query
stringlengths
7
9.5k
document
stringlengths
10
1.07M
negatives
sequencelengths
19
19
metadata
dict
Adds errors if ptainstructor_is_valid? returns false
def ptainstructor_is_valid errors.add(:ptainstructor,'No PTA instructor was selected.') unless ptainstructor_is_valid? end
[ "def ptainstructor_is_valid?\n return self.ptainstructor_id != nil\n end", "def teacher_is_valid\n errors.add(:teacher,'No classroom location was selected.') unless teacher_is_valid?\n end", "def active_instructor\n return if self.instructor.nil?\n errors.add(:instructor, \"is not active\") unless self.instructor.active\n\n end", "def unassigned_instructor\n return true if self.camp.nil? || self.instructor.nil?\n unless CampInstructor.where(camp_id: self.camp_id, instructor_id: self.instructor_id).to_a.empty?\n errors.add(:base, \"Instructor assigned to this camp already\")\n end\n end", "def grade_is_valid\n errors.add(:grade, 'Invalid grade entered.') unless grade_is_valid?\n end", "def set_errors\n @errors = []\n if self.college_name == \"\" || self.college_name == nil\n @errors << \"Must include valid College name\"\n end\n\n if self.conference_id == 0 || self.conference_id == nil\n @errors << \"Must choose Conference\"\n end\n end", "def validate_parade\n if(!parade_valid?)\n @parade.errors.each_full { |msg| errors.add('parade', msg) }\n end\n parade_valid?\n end", "def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?\n end", "def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def enrolled_is_valid\n errors.add(:enrolled, \"An invalid enrollment value was selected.\") unless enrollment_is_valid?\n end", "def course_id_is_valid\n errors.add(:course_id, \"No valid class was selected.\") unless course_id_is_valid?\n end", "def validate\n \tif self.resource_type == RESOURCE_TYPE[:tutor]\n\t\t\tcurrent_user\n\t\t\t@owner = current_user.resource\n\t\t\t@tutors = Tutor.find(:all, :conditions => [\"owner_id = ?\",@owner.id])\n\t\t\t#@Tutor_users should not remain nil while using with << method.\n\t\t\t@tutor_users = []\n\t\t\tif @tutors\n\t\t\t\t@tutors.each do |tutor|\n\t\t\t\t\t@tutor_users << tutor.user\n\t\t\t\tend\n\t\t\tend\n\t\t\t#Finds all Users who are not Tutor.\t\t\t\n\t\t\t@non_tutors = User.find(:all, :conditions => [\"resource_type != ?\",'Tutor'])\n\t\t\t#Combines two arrays (@tutor_users and @non_tutors) into one array and checks if login available.\n\t\t\tfor user in @tutor_users.concat(@non_tutors)\t\t\n\t\t\t\terrors.add(:login, \"has already been taken.\") if self.login == user.login\n\t\t\t\terrors.add(:email, \"has already been taken.\") if self.email == user.email\n\t\t\tend\t\t\t\n \tend\n end", "def duplicate_ptainstructor(oldptainstructor)\n newptainstructor = oldptainstructor.dup\n newptainstructor.semester_id = self.id\n return false unless newptainstructor.save\n return true\n end", "def create\n @instructor = Instructor.new(instructor_params)\n if @instructor.save\n render json: @instructor, status: :created, location: @instructor\n else\n render json: @instructor.errors, status: :unprocessable_entity\n \n end\n end", "def create?; user.instructor?; end", "def validate_tutorial\n if self.tutorial\n return true\n end\n if self.rut.nil? || birth_date.nil? || city_id.nil? || phone.nil? || preuniversity.nil? || level_id.nil? || nem.nil?\n return false\n else\n self.tutorial = true\n self.save\n end\n end", "def create\n @section_instructor = SectionInstructor.new(section_instructor_params)\n\n respond_to do |format|\n if @section_instructor.save\n format.html { redirect_to @section_instructor, notice: 'Section instructor was successfully created.' }\n format.json { render :show, status: :created, location: @section_instructor }\n else\n format.html { render :new }\n format.json { render json: @section_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def should_valid_age\n if not athlete\n errors.add(:performance, 'Es wurde kein(e) Sportler(in) gefunden.')\n else\n athlete_age = Date.today.year - athlete.birthday.year\n age_range = AgeRange.find_by_age(athlete_age)[0]\n if not DisciplineAge.exists?(['discipline_id = ? AND age_range_id = ?', discipline.id, age_range.id])\n errors.add(:performance, 'Das Alter ist nicher erlaubt.') \n end \n end\n end", "def can_create_course?\n ptainstructors = Ptainstructor.find_by_semester_id(self.id)\n teachers = Teacher.find_by_semester_id(self.id)\n if ((ptainstructors == nil) or (teachers == nil))\n return false\n end\n return true\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests that the course's ptainstructor_id is not nil and returns true or false.
def ptainstructor_is_valid? return self.ptainstructor_id != nil end
[ "def can_create_course?\n ptainstructors = Ptainstructor.find_by_semester_id(self.id)\n teachers = Teacher.find_by_semester_id(self.id)\n if ((ptainstructors == nil) or (teachers == nil))\n return false\n end\n return true\n end", "def ptainstructor_is_valid\n errors.add(:ptainstructor,'No PTA instructor was selected.') unless ptainstructor_is_valid?\n end", "def course_tutor?(current_user, course)\n !course.tutors.where(user_id: current_user.id, course_id: course.id).empty?\n end", "def can_create_course?\n instructors = Instructor.find_by_semester_id(self.id)\n classrooms = Classroom.find_by_semester_id(self.id)\n if ((instructors == nil) or (classrooms == nil))\n return false\n end\n return true\n end", "def unassigned_instructor\n return true if self.camp.nil? || self.instructor.nil?\n unless CampInstructor.where(camp_id: self.camp_id, instructor_id: self.instructor_id).to_a.empty?\n errors.add(:base, \"Instructor assigned to this camp already\")\n end\n end", "def teaching_course?(course)\n return false unless course\n Employment.exists?(['course_id = ? AND user_id = ?', course.id, id])\n end", "def returning_instructor?\n courses.any? { |course| instructor?(course) && course.approved? }\n end", "def course_exists?( a_course )\n a_class = instance_for_course_in_path( a_course )\n return false if a_class.nil?\n true\n end", "def enrolled_in_course?(course)\n !!course && course.is_student?(self)\n end", "def instructor_for_course?(node)\n available?(session[:user], node.get_instructor_id)\n end", "def is_user_instructor?(instructor_id)\n # ta created the course, current user is the instructor of this ta.\n instructor_ids = []\n TaMapping.where(ta_id: instructor_id).each {|mapping| instructor_ids << Course.find(mapping.course_id).instructor_id }\n session[:user].role_id == 2 and instructor_ids.include? session[:user].id\n end", "def is_user_instructor?(instructor_id)\n # ta created the course, current user is the instructor of this ta.\n instructor_ids = []\n TaMapping.where(ta_id: instructor_id).each { |mapping| instructor_ids << Course.find(mapping.course_id).instructor_id }\n (session[:user].role_id == 2) && instructor_ids.include?(session[:user].id)\n end", "def free?\n self.instructor.nil?\n end", "def context_instructor?\n has_exact_role?('instructor') || has_exact_role?('urn:lti:role:ims/lis/Instructor')\n end", "def course_owner?(course)\n tutor? && current_user?(course.tutor)\n end", "def instructor_of?(user)\n cuds = course_user_data\n\n cuds.each do |cud|\n next unless cud.instructor?\n return true unless cud.course.course_user_data.where(user: user).empty?\n end\n\n false\n end", "def current_user_has_instructor_privileges?\n current_user_has_privileges_of?('Instructor')\n end", "def course_is_available?(node)\n instructor_for_course?(node) || ta_for_course?(node)\n end", "def instructor?\n has_role?('instructor') || has_role?('faculty') || has_role?('staff')\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds errors if teacher_is_valid? returns false
def teacher_is_valid errors.add(:teacher,'No classroom location was selected.') unless teacher_is_valid? end
[ "def teacher_is_valid?\n return self.teacher_id != nil\n end", "def teacher_required\n unless current_user.is_teacher == true\n redirect_to education_path\n end\n end", "def validateTeacher\n user = getActiveUser(cookies)\n if user.user_account_type == 'teacher'\n return true\n else\n redirect_to login_path\n return false\n end\n end", "def same_teacher_required\n unless @current_user == User.find(:first, :conditions => [\"specified_type = 'Teacher' AND specified_id = (?)\", params[:id]])\n flash[:error] = \"Non puoi modificare un utente diverso dal tuo\"\n redirect_to timetables_url\n end\n end", "def ptainstructor_is_valid\n errors.add(:ptainstructor,'No PTA instructor was selected.') unless ptainstructor_is_valid?\n end", "def validate\n \tif self.resource_type == RESOURCE_TYPE[:tutor]\n\t\t\tcurrent_user\n\t\t\t@owner = current_user.resource\n\t\t\t@tutors = Tutor.find(:all, :conditions => [\"owner_id = ?\",@owner.id])\n\t\t\t#@Tutor_users should not remain nil while using with << method.\n\t\t\t@tutor_users = []\n\t\t\tif @tutors\n\t\t\t\t@tutors.each do |tutor|\n\t\t\t\t\t@tutor_users << tutor.user\n\t\t\t\tend\n\t\t\tend\n\t\t\t#Finds all Users who are not Tutor.\t\t\t\n\t\t\t@non_tutors = User.find(:all, :conditions => [\"resource_type != ?\",'Tutor'])\n\t\t\t#Combines two arrays (@tutor_users and @non_tutors) into one array and checks if login available.\n\t\t\tfor user in @tutor_users.concat(@non_tutors)\t\t\n\t\t\t\terrors.add(:login, \"has already been taken.\") if self.login == user.login\n\t\t\t\terrors.add(:email, \"has already been taken.\") if self.email == user.email\n\t\t\tend\t\t\t\n \tend\n end", "def run\n return teacher unless teacher.save\n\n authenticate_teacher\n\n teacher\n end", "def teacher_does_not_exist_yet(teacher_id)\n needs_to_be_created = true\n if !@teachers.nil? and @teachers.size > 0\n @teachers.each do |school, current_teachers|\n if current_teachers.include?(teacher_id)\n needs_to_be_created = false\n break\n end\n end\n end\n needs_to_be_created\n end", "def validate_tutorial\n if self.tutorial\n return true\n end\n if self.rut.nil? || birth_date.nil? || city_id.nil? || phone.nil? || preuniversity.nil? || level_id.nil? || nem.nil?\n return false\n else\n self.tutorial = true\n self.save\n end\n end", "def teacher=(value)\n @teacher = value\n end", "def run\n return invalid_course unless teacher_valid? && course_params\n\n TeacherCourse.create(teacher: teacher, course: course) if course.valid?\n\n course\n end", "def set_errors\n @errors = []\n if self.college_name == \"\" || self.college_name == nil\n @errors << \"Must include valid College name\"\n end\n\n if self.conference_id == 0 || self.conference_id == nil\n @errors << \"Must choose Conference\"\n end\n end", "def trip_errors\n trip.valid?\n trip.errors\n end", "def should_valid_gender\n if not athlete\n errors.add(:performance, 'Es wurde kein(e) Sportler(in) gefunden.')\n elsif not discipline\n errors.add(:performance, 'Es wurde keine Disziplin gefunden.')\n elsif not Discipline.exists?([\"name = ? AND gender_id = ?\", discipline.name, athlete.gender_id])\n errors.add(:performance, 'Das Geschlecht der Sportlerin/des Sportlers ist fuer diese Disziplin nicht zugelassen.')\n end\n end", "def create\n user = User.find_by_mail(params[:mail])\n respond_to do |format|\n if user == nil\n @teacher = User.new()\n @teacher.mail = params[:mail]\n @teacher.random = rand(120)\n t = Teacher.new()\n a = Address.new()\n t.save\n a.save false\n @teacher.specified = t\n @teacher.address = a\n if params[:graduate_course_id]\n @teacher.graduate_courses << GraduateCourse.find(params[:graduate_course_id])\n end\n if @teacher.save\n flash[:notice] = \"Docente invitato con successo\"\n TeacherMailer.deliver_activate_teacher(@current_user, @teacher)\n format.html{redirect_to new_teacher_url}\n format.js{render(:update) {|page| page.redirect_to new_teacher_url}}\n else\n @graduate_courses = @current_user.graduate_courses\n format.html{render :action => :new}\n format.js{}\n end\n else\n if user.own_by_teacher?\n if params[:graduate_course_id]\n user.graduate_courses << GraduateCourse.find(params[:graduate_course_id])\n end\n flash[:notice] = \"Docente invitato con successo\"\n format.html{redirect_to new_teacher_url}\n format.js{render(:update) {|page| page.redirect_to new_teacher_url}}\n else\n flash[:error] = \"La mail inserita è già presente e non corrisponde ad un docente\"\n format.html{redirect_to new_teacher_url}\n format.js{render(:update) {|page| page.redirect_to new_teacher_url}}\n end\n end\n end\n end", "def collect_all_errors( usr )\n user_errors = collect_user_errors( usr, :user_login, :password )\n teacher_errors = usr.teacher.errors.full_messages\n\n\n all_errors = ( user_errors + teacher_errors )\n end", "def teacher_assigned?\n teacher_id?\n end", "def create_teacher\n\t\t@teacher = Teacher.new\n\t\t@teacher.user = self\n\t\t@teacher.save!\n\tend", "def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n flash[:notice] = 'Teacher was successfully created.'\n format.html { redirect_to(teachers_path) }\n format.xml { render :xml => @teacher, :status => :created, :location => @teacher }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests that the course's teacher_id is not nil and returns true or false.
def teacher_is_valid? return self.teacher_id != nil end
[ "def course_tutor?(current_user, course)\n !course.tutors.where(user_id: current_user.id, course_id: course.id).empty?\n end", "def teacher_does_not_exist_yet(teacher_id)\n needs_to_be_created = true\n if !@teachers.nil? and @teachers.size > 0\n @teachers.each do |school, current_teachers|\n if current_teachers.include?(teacher_id)\n needs_to_be_created = false\n break\n end\n end\n end\n needs_to_be_created\n end", "def teacher_assigned?\n teacher_id?\n end", "def can_create_course?\n ptainstructors = Ptainstructor.find_by_semester_id(self.id)\n teachers = Teacher.find_by_semester_id(self.id)\n if ((ptainstructors == nil) or (teachers == nil))\n return false\n end\n return true\n end", "def teaching_course?(course)\n return false unless course\n Employment.exists?(['course_id = ? AND user_id = ?', course.id, id])\n end", "def teacher_logged_in?\n\t\t!current_teacher.nil?\n\tend", "def validateTeacher\n user = getActiveUser(cookies)\n if user.user_account_type == 'teacher'\n return true\n else\n redirect_to login_path\n return false\n end\n end", "def student?\n !teacher?\n end", "def teacher_required\n unless current_user.is_teacher == true\n redirect_to education_path\n end\n end", "def tutored_student?(student)\n self.courses.any? { |course| course.student == student}\n end", "def is_teacher\n \"teacher\".include? current_user.role\n end", "def teacher_is_valid\n errors.add(:teacher,'No classroom location was selected.') unless teacher_is_valid?\n end", "def course_registered?\n course_id = params[:teacher_course][:course_id].to_i\n teacher_course_exist = TeacherCourse.where(:course_id => course_id , :teacher_id => teacher_id).first\n end", "def ptainstructor_is_valid?\n return self.ptainstructor_id != nil\n end", "def is_teacher\n unless current_user\n return false\n end\n current_user.priv == ADMIN || current_user.priv == TEACHER\n end", "def signed_in?\n !current_teacher.nil?\n end", "def attended_exam_in? course\n exams.for_course(course).attended.present?\n end", "def valid_prize_teacher\n return self.teachers.first if self.prize_teacher_id.blank? || self.teachers.first.try(:id) == self.prize_teacher_id\n nil\n end", "def needs_password?(teacher, params)\n teacher.email != params[:teacher][:email] ||\n params[:teacher][:password].present?\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array with number of students in course and class_max.
def class_how_full? return [self.students.count, self.class_max] end
[ "def expected_grades\n assignment.course.students.count\n end", "def num_grades(student)\n @grades[student].length\n end", "def num_grades (student)\n @grades[student].length\n end", "def find_largest_smaller_ten(courses_array)\n num = -1\n target = nil # If no course with less than 10 students exists function will return nil\n courses_array.each do |course|\n if course.num_students < 10 && course.num_students > num\n num = course.num_students\n target = course\n end\n end\n\n return target\nend", "def expected_submissions\n assignment.course.students.count\n end", "def total_students\n registrations.\n inject(0) {|total, registration| total + registration.number_of_students }\n end", "def most_popular_student\n arr = self.my_students\n most_popular = arr.uniq.max_by {|i| arr.count(i)}\n end", "def created_classrooms_collaborations_count\n created_classrooms.map(&:collaborations_count).reduce(:+).to_i\n end", "def courses_per_prim_section(semester_courses)\n courses = []\n semester_courses.each do |course|\n primary_sections(course).each { courses.push(course) }\n end\n courses\n end", "def count_students\n students.size\n end", "def available_courses\n MAX_COURSES - self.course_selections_count\n end", "def count_all_courses\n count = courses.size()\n subgroups.each do |subgroup|\n count += subgroup.count_all_courses\n end\n count\n end", "def subjects_by_count\n retarray = []\n courseHash = {}\n for course in self.courses\n subject = course.subject\n if courseHash.has_key? subject\n courseHash[subject] = courseHash[subject]+1\n else\n courseHash[subject] = 1\n end\n end\n \n courseHash.sort_by {|k,v| v}\n courseHash.each_key {|key| retarray << key}\n return retarray\n end", "def active_student_count\n if self.students.present?\n self.students.select { |s| s.sign_in_count > 0 }.size\n else\n 0\n end\n end", "def student_count\n student_ids = bookings.confirmed.map { |booking| booking.student_id }\n student_ids.uniq.count\n end", "def courses_per_transcript(semester_courses)\n courses = []\n semester_courses.each do |course|\n if course_transcript(course).nil?\n primary_sections(course).each { courses.push(course) }\n else\n course_transcript(course).each { courses.push(course) }\n end\n end\n courses\n end", "def findClassAverage(studentsArray)\r\n \r\n classSum = 0.0\r\n \r\n studentsArray.each { |student| classSum += student.numGrade }\r\n \r\n if studentsArray.size > 0\r\n \r\n return classSum / studentsArray.size\r\n \r\n end\r\n \r\n \r\n \r\n return 0\r\n \r\n end", "def counts_students\n x = students.length\n \"There are #{x} students in our class\"\nend", "def active_course_count\n count = 0\n\n active_training_plans.each do |tp| \n count += tp.course_for_user(self).count\n end\n \n count\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Characterizes the file at 'filepath' if available, otherwise, pulls a copy from the repository and runs characterization on that file.
def perform(file_set, file_id, filepath = nil, user = nil) @event_start = DateTime.current @relation = file_set.class.characterization_proxy file = file_set.characterization_proxy raise "#{@relation} was not found for FileSet #{file_set.id}" unless file_set.characterization_proxy? filepath = Hyrax::WorkingDirectory.find_or_retrieve(file_id, file_set.id) unless filepath && File.exist?(filepath) characterize( file: file, filepath: filepath, user: user, file_set: file_set ) end
[ "def perform(file_set, file_id, filepath = nil)\n raise \"#{file_set.class.characterization_proxy} was not found for FileSet #{file_set.id}\" unless file_set.characterization_proxy?\n # Ensure a fresh copy of the repo file's latest version is being worked on, if no filepath is directly provided\n filepath = Hyrax::WorkingDirectory.copy_repository_resource_to_working_directory(Hydra::PCDM::File.find(file_id), file_set.id) unless filepath && File.exist?(filepath)\n characterize(file_set, file_id, filepath)\n\n Hyrax.publisher.publish('file.characterized',\n file_set: file_set,\n file_id: file_id,\n path_hint: filepath)\n end", "def characterize(save: true)\n @file_set = TikaFileCharacterizationService.new(file_set: file_set, persister: persister).characterize\n @file_set = scanned_map_characterization_service.characterize if scanned_map_characterization_service.valid?\n @file_set = vector_characterization_service.characterize if vector_characterization_service.valid?\n @file_set = raster_characterization_service.characterize if raster_characterization_service.valid?\n @file_set = external_metadata_service.characterize if external_metadata_service.valid?\n @file_set\n end", "def perform(file_set, file_id, filepath = nil)\n raise \"#{file_set.class.characterization_proxy} was not found for FileSet #{file_set.id}\" unless file_set.characterization_proxy?\n\n filepath = Hyrax::WorkingDirectory.find_or_retrieve(file_id, file_set.id) unless filepath && File.exist?(filepath)\n characterize(file_set, file_id, filepath)\n CreateDerivativesJob.perform_later(file_set, file_id, filepath)\n end", "def characterize(save: true)\n TikaFileCharacterizationService.new(file_set: file_set, persister: persister).characterize\n end", "def file_text(input_filepath, output_filepath)\n\t\t\traise(ArgumentError, 'String input filepath is expected') unless input_filepath.is_a?(String)\n\t\t\traise(ArgumentError, 'String output filepath is expected') unless output_filepath.is_a?(String)\n\t\t\tbegin\n\t\t\t\ti = File.new(input_filepath)\n\t\t\t\to = File.new(output_filepath, 'w')\n\t\t\t\twhile !i.eof?\n\t\t\t\t\to.write(obfuscate(to_morse(i.readline)) + \"\\n\")\n\t\t\t\tend\n\t\t\t\ti.close\n\t\t\t\to.close \n\t\t\trescue IOError => e\n\t\t\t\tputs \"#{e.message}\"\n\t\t\tend\n\t\tend", "def characterize\n validate_arguments!\n\n unless options[:param_file]\n error(\"Usage: mortar local:characterize -f PARAMFILE.\\nMust specify parameter file. For detailed help run:\\n\\n mortar local:characterize -h\")\n end\n\n #cd into the project root\n project_root = options[:project_root] ||= Dir.getwd\n unless File.directory?(project_root)\n error(\"No such directory #{project_root}\")\n end\n\n Dir.chdir(project_root)\n\n gen = Mortar::Generators::CharacterizeGenerator.new\n gen.generate_characterize\n\n controlscript_name = \"controlscripts/lib/characterize_control.py\"\n gen = Mortar::Generators::CharacterizeGenerator.new\n gen.generate_characterize\n script = validate_script!(controlscript_name)\n params = config_parameters.concat(pig_parameters)\n\n ctrl = Mortar::Local::Controller.new\n ctrl.run(script, pig_version, params)\n gen.cleanup_characterize(project_root)\n end", "def open_in_file(filepath)\n File.open(filepath, 'rb')\n end", "def customize_file(user_id, filename)\n\t handle = File.open(filename, 'r')\n\t content = handle.read\n\t \n\tend", "def ocr_file(file_path)\n if !File.exist?(text_path(file_path))\n begin\n Docsplit.extract_text(file_path, :output => '../text')\n rescue\n end\n end\n\n text = \"\"\n text = File.read(text_path(file_path)) if File.exist?(text_path(file_path))\n return text\n end", "def get_blob_plain_by_filepath(user, repository, base, filepath)\n hash = get_hash_by_path(user , repository, base, filepath)\n get_blob_plain_by_hash(user, repository, hash)\n end", "def maybe_file(str)\n path = canonical(str)\n if File.exists?(path)\n Util::IO.read(path)\n else\n str\n end\n end", "def pull_file(path)\n @bridge.pull_file(path)\n end", "def detect_charset(path)\n Process.run_command 'uchardet', path\n rescue Errno::ENOENT\n # :nocov:\n Process.run_command('encguess', path).sub(/^.*\\s+/, '')\n # :nocov:\n end", "def read\n return nil unless name\n path = Format.cwd == '' ? name : File.join(Format.cwd, name)\n return nil unless File.exists? path\n io = File.open(path)\n io = Iconv.conv('utf-8', @encoding, io.read) if @encoding\n io\n end", "def cb_patched_load_file(filename, *args)\n Thread.current[:cb_locale_file_name] = filename\n cb_original_load_file(filename, *args)\n end", "def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n @target_file = @file_set.try(type)\n next unless @target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: @target_file.file_identifiers[0])\n @dataset_path = filename\n unzip_original_file if zip_file?\n new_file = @target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n clean_up_zip_directory if zip_file?\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end", "def diacritize_file(path)\n texts = File.open(path).map do |line|\n line.chomp.strip\n end\n\n # process batches\n out_texts = []\n idx = 0\n while idx + @batch_size <= texts.length\n originals = texts[idx..idx+@batch_size-1]\n src = originals.map.each{|t| preprocess_text(t)}\n lengths = src.map.each{|seq| seq.length}\n ort_inputs = {\n 'src' => src,\n 'lengths' => lengths\n }\n preds = predict_batch(ort_inputs)\n\n out_texts += (0..@batch_size-1).map do |i|\n reconcile_strings(\n originals[i],\n combine_text_and_haraqat(src[i], preds[i])\n )\n end\n idx += @batch_size\n end\n\n # process rest of data\n while idx < texts.length\n out_texts += [diacritize_text(texts[idx])]\n idx += 1\n end\n\n out_texts\n end", "def eval_wgit(filepath = nil)\n puts 'Searching for .wgit.rb file in local and home directories...'\n\n [filepath, Dir.pwd, Dir.home].each do |dir|\n path = \"#{dir}/.wgit.rb\"\n next unless File.exist?(path)\n\n puts \"Eval'ing #{path}\"\n puts 'Call `eval_wgit` after changes to re-eval the file'\n eval(File.read(path))\n\n break\n end\n\n nil\nend", "def load_page_from_file(filepath) \n begin \n @filepath = filepath\n @biblionet_id = filepath[/\\d+(?!.*\\d+)/] unless filepath.nil?\n @page = open(filepath).read \n rescue StandardError => e\n puts e\n end \n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array of tokens that cover the value that the parameter token has as its default Search forward to find value assigned to this parameter We want to find the thing after `=` and before `,`
def extract_default_value_tokens(ptok) value_tokens = [] token = ptok.next_code_token nesting = 0 while token case token.type when :LPAREN, :LBRACK nesting += 1 when :RBRACK nesting -= 1 when :RPAREN nesting -= 1 if nesting.negative? # This is the RPAREN at the end of the parameters. There wasn't a COMMA last_token = token.prev_code_token break end when :EQUALS first_token = token.next_code_token when :COMMA unless nesting.positive? last_token = token.prev_code_token break end end token = token.next_token end value_tokens = tokens[tokens.find_index(first_token)..tokens.find_index(last_token)] if first_token && last_token value_tokens end
[ "def scan_for_commas(token); end", "def get_hash_tokens_for_parameter(tokens,parameter)\n get_tokens_between(tokens,:BRACE,parameter)\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 74 )\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal356 = nil\n parameter355 = nil\n parameter357 = nil\n\n tree_for_char_literal356 = nil\n stream_COMMA = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token COMMA\" )\n stream_parameter = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule parameter\" )\n begin\n # at line 742:5: parameter ( ',' parameter )*\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5248 )\n parameter355 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter355.tree )\n end\n # at line 742:15: ( ',' parameter )*\n while true # decision 91\n alt_91 = 2\n look_91_0 = @input.peek( 1 )\n\n if ( look_91_0 == COMMA )\n alt_91 = 1\n\n end\n case alt_91\n when 1\n # at line 742:18: ',' parameter\n char_literal356 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_parameters_5253 )\n if @state.backtracking == 0\n stream_COMMA.add( char_literal356 )\n end\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5256 )\n parameter357 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter357.tree )\n end\n\n else\n break # out of loop for decision 91\n end\n end # loop for decision 91\n # AST Rewrite\n # elements: parameter\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 742:36: -> ( parameter )+\n # at line 742:39: ( parameter )+\n stream_parameter.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_parameter.has_next?\n @adaptor.add_child( root_0, stream_parameter.next_tree )\n\n end\n stream_parameter.reset\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 74 )\n\n end\n \n return return_value\n end", "def comma\n match(Token.new(:symbol, ','))\n end", "def paramRest\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n return_value = ParamRestReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __COMMA99__ = nil\n params100 = nil\n\n tree_for_COMMA99 = nil\n\n begin\n # at line 174:2: ( COMMA params | )\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == COMMA )\n alt_23 = 1\n elsif ( look_23_0 == RB )\n alt_23 = 2\n else\n raise NoViableAlternative( \"\", 23, 0 )\n end\n case alt_23\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 174:4: COMMA params\n __COMMA99__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_paramRest_843 )\n @state.following.push( TOKENS_FOLLOWING_params_IN_paramRest_846 )\n params100 = params\n @state.following.pop\n @adaptor.add_child( root_0, params100.tree )\n # --> action\n return_value.list = ( params100.nil? ? nil : params100.list )\n # <-- action\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 176:4: \n # --> action\n return_value.list = []\n # <-- action\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n\n end\n \n return return_value\n end", "def parameter_tokens\n PuppetLint::Data.param_tokens(@tokens)\n end", "def paramRest\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n return_value = ParamRestReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __COMMA84__ = nil\n params85 = nil\n\n tree_for_COMMA84 = nil\n\n begin\n # at line 154:2: ( COMMA params | )\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == COMMA )\n alt_17 = 1\n elsif ( look_17_0 == LCB )\n alt_17 = 2\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 154:4: COMMA params\n __COMMA84__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_paramRest_788 )\n @state.following.push( TOKENS_FOLLOWING_params_IN_paramRest_791 )\n params85 = params\n @state.following.pop\n @adaptor.add_child( root_0, params85.tree )\n # --> action\n return_value.list = ( params85.nil? ? nil : params85.list )\n # <-- action\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 156:4: \n # --> action\n return_value.list = []\n # <-- action\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n\n end\n \n return return_value\n end", "def parameter\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n return_value = ParameterReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n __SPLAT261__ = nil\n __ID262__ = nil\n char_literal263 = nil\n __ID264__ = nil\n __ID266__ = nil\n expression265 = nil\n\n tree_for_SPLAT261 = nil\n tree_for_ID262 = nil\n tree_for_char_literal263 = nil\n tree_for_ID264 = nil\n tree_for_ID266 = nil\n\n begin\n # at line 219:3: ( ^( SPLAT ID ) | ^( '=' ID expression ) | ID )\n alt_36 = 3\n case look_36 = @input.peek( 1 )\n when SPLAT then alt_36 = 1\n when ASGN then alt_36 = 2\n when ID then alt_36 = 3\n else\n raise NoViableAlternative( \"\", 36, 0 )\n end\n case alt_36\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 219:5: ^( SPLAT ID )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __SPLAT261__ = match( SPLAT, TOKENS_FOLLOWING_SPLAT_IN_parameter_1602 )\n\n tree_for_SPLAT261 = @adaptor.copy_node( __SPLAT261__ )\n\n root_1 = @adaptor.become_root( tree_for_SPLAT261, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n __ID262__ = match( ID, TOKENS_FOLLOWING_ID_IN_parameter_1604 )\n\n tree_for_ID262 = @adaptor.copy_node( __ID262__ )\n\n @adaptor.add_child( root_1, tree_for_ID262 )\n\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 220:5: ^( '=' ID expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal263 = match( ASGN, TOKENS_FOLLOWING_ASGN_IN_parameter_1614 )\n\n tree_for_char_literal263 = @adaptor.copy_node( char_literal263 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal263, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n __ID264__ = match( ID, TOKENS_FOLLOWING_ID_IN_parameter_1616 )\n\n tree_for_ID264 = @adaptor.copy_node( __ID264__ )\n\n @adaptor.add_child( root_1, tree_for_ID264 )\n\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_parameter_1618 )\n expression265 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression265.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 221:5: ID\n _last = @input.look\n __ID266__ = match( ID, TOKENS_FOLLOWING_ID_IN_parameter_1626 )\n\n tree_for_ID266 = @adaptor.copy_node( __ID266__ )\n\n @adaptor.add_child( root_0, tree_for_ID266 )\n\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n end\n \n return return_value\n end", "def parameter_list\n recursive_expression(:expression, :comma)\n end", "def param_tokens(these_tokens)\n depth = 0\n lparen_idx = nil\n rparen_idx = nil\n\n these_tokens.each_with_index do |token, i|\n if token.type == :LPAREN\n depth += 1\n lparen_idx = i if depth == 1\n elsif token.type == :RPAREN\n depth -= 1\n if depth.zero?\n rparen_idx = i\n break\n end\n elsif token.type == :LBRACE && depth.zero?\n # no parameters\n break\n end\n end\n\n if lparen_idx.nil? || rparen_idx.nil?\n nil\n else\n these_tokens[(lparen_idx + 1)..(rparen_idx - 1)]\n end\n end", "def get_tokens_between(tokens,type,parameter)\n brace_open=tokens.find do |token|\n token.type == left(type) and\n # Vorher kommt ein Pfeil, somit ist es der Wert eines Parmeters\n token.prev_code_token.type == :FARROW and\n # Vor dem Pfeil kommt der gesuchte Parameter\n token.prev_code_token.prev_code_token.value == parameter\n end\n\n if brace_open.nil?\n return []\n else\n return get_block_between(type,brace_open)\n end\n end", "def params\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n return_value = ParamsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __ID82__ = nil\n paramRest83 = nil\n\n tree_for_ID82 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 149:4: ID paramRest\n __ID82__ = match( ID, TOKENS_FOLLOWING_ID_IN_params_767 )\n\n tree_for_ID82 = @adaptor.create_with_payload( __ID82__ )\n @adaptor.add_child( root_0, tree_for_ID82 )\n\n @state.following.push( TOKENS_FOLLOWING_paramRest_IN_params_769 )\n paramRest83 = paramRest\n @state.following.pop\n @adaptor.add_child( root_0, paramRest83.tree )\n # --> action\n return_value.list = [__ID82__.text] + ( paramRest83.nil? ? nil : paramRest83.list )\n # <-- action\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n end\n \n return return_value\n end", "def delimiter_regexp\n /\\A.*=.*((([^\\w\\s\\+\\)\\(])|([_]))\\s?)\\w+=.*\\z/\n end", "def tag_parameters\n index = 0\n loop do\n tok = @tokens[index -= 1]\n next if tok[0] == ','\n return if tok[0] != :IDENTIFIER\n tok[0] = :PARAM\n end\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n __PARAMS259__ = nil\n parameter260 = nil\n\n tree_for_PARAMS259 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 215:5: ^( PARAMS ( parameter )* )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __PARAMS259__ = match( PARAMS, TOKENS_FOLLOWING_PARAMS_IN_parameters_1582 )\n\n tree_for_PARAMS259 = @adaptor.copy_node( __PARAMS259__ )\n\n root_1 = @adaptor.become_root( tree_for_PARAMS259, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 215:15: ( parameter )*\n while true # decision 35\n alt_35 = 2\n look_35_0 = @input.peek( 1 )\n\n if ( look_35_0 == ASGN || look_35_0 == SPLAT || look_35_0 == ID )\n alt_35 = 1\n\n end\n case alt_35\n when 1\n # at line 215:15: parameter\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_1584 )\n parameter260 = parameter\n @state.following.pop\n\n @adaptor.add_child( root_1, parameter260.tree )\n\n\n else\n break # out of loop for decision 35\n end\n end # loop for decision 35\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 31 )\n\n end\n \n return return_value\n end", "def call_parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 225 )\n return_value = CallParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n call_parameters_start_index = @input.index\n\n root_0 = nil\n __COMMA1243__ = nil\n call_parameter1242 = nil\n call_parameter1244 = nil\n\n tree_for_COMMA1243 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 1139:4: call_parameter ( COMMA call_parameter )*\n @state.following.push( TOKENS_FOLLOWING_call_parameter_IN_call_parameters_7383 )\n call_parameter1242 = call_parameter\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, call_parameter1242.tree )\n end\n # at line 1139:19: ( COMMA call_parameter )*\n while true # decision 322\n alt_322 = 2\n look_322_0 = @input.peek( 1 )\n\n if ( look_322_0 == COMMA )\n alt_322 = 1\n\n end\n case alt_322\n when 1\n # at line 1139:21: COMMA call_parameter\n __COMMA1243__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_call_parameters_7387 )\n if @state.backtracking == 0\n\n tree_for_COMMA1243 = @adaptor.create_with_payload( __COMMA1243__ )\n @adaptor.add_child( root_0, tree_for_COMMA1243 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_call_parameter_IN_call_parameters_7389 )\n call_parameter1244 = call_parameter\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, call_parameter1244.tree )\n end\n\n else\n break # out of loop for decision 322\n end\n end # loop for decision 322\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 225 )\n memoize( __method__, call_parameters_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "def matchToken(s)\n Tokens.each do |t, v|\n if s.match(v)\n return [t,s]\n end\n end\n nil\nend", "def tokenize_config_value(str); end", "def tag_parameters\n index = 0\n loop do\n tok = @tokens[index -= 1]\n return if !tok\n next if tok[0] == ','\n return if tok[0] != :IDENTIFIER\n tok[0] = :PARAM\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of tokens that cover the data type of the parameter ptok Search backwards until we either bump into a comma (whilst not nested), or reach the opening LPAREN
def extract_type_tokens(ptok) type_tokens = [] token = ptok.prev_code_token nesting = 0 while token case token.type when :LBRACK nesting += 1 when :LPAREN nesting += 1 if nesting.positive? # This is the LPAREN at the start of the parameter list first_token = token.next_code_token last_token = ptok.prev_code_token break end when :RBRACK, :RPAREN nesting -= 1 when :COMMA if nesting.zero? first_token = token.next_code_token last_token = ptok.prev_code_token break end end token = token.prev_code_token end type_tokens = tokens[tokens.find_index(first_token)..tokens.find_index(last_token)] if first_token && last_token type_tokens end
[ "def extract_default_value_tokens(ptok)\n value_tokens = []\n token = ptok.next_code_token\n nesting = 0\n while token\n case token.type\n when :LPAREN, :LBRACK\n nesting += 1\n when :RBRACK\n nesting -= 1\n when :RPAREN\n nesting -= 1\n if nesting.negative?\n # This is the RPAREN at the end of the parameters. There wasn't a COMMA\n last_token = token.prev_code_token\n break\n end\n when :EQUALS\n first_token = token.next_code_token\n when :COMMA\n unless nesting.positive?\n last_token = token.prev_code_token\n break\n end\n end\n token = token.next_token\n end\n value_tokens = tokens[tokens.find_index(first_token)..tokens.find_index(last_token)] if first_token && last_token\n value_tokens\n end", "def parameter_type_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 26)\n parameter_type_list_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 233:5: parameter_list ( ',' '...' )?\n @state.following.push(TOKENS_FOLLOWING_parameter_list_IN_parameter_type_list_914)\n parameter_list\n @state.following.pop\n # at line 233:20: ( ',' '...' )?\n alt_31 = 2\n look_31_0 = @input.peek(1)\n\n if (look_31_0 == T__25) \n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 233:21: ',' '...'\n match(T__25, TOKENS_FOLLOWING_T__25_IN_parameter_type_list_917)\n match(T__53, TOKENS_FOLLOWING_T__53_IN_parameter_type_list_919)\n\n end\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 26)\n memoize(__method__, parameter_type_list_start_index, success) if @state.backtracking > 0\n\n end\n \n return \n end", "def parameter_list\n recursive_expression(:expression, :comma)\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n begin\n # at line 98:13: LPAREN ( type ID ( COMMA type ID )* )? RPAREN\n match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_parameters_876 )\n # at line 98:20: ( type ID ( COMMA type ID )* )?\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == BOOLEAN || look_15_0 == FLOAT || look_15_0 == ID || look_15_0 == INTEGER || look_15_0 == STRING || look_15_0 == VOID )\n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 98:22: type ID ( COMMA type ID )*\n @state.following.push( TOKENS_FOLLOWING_type_IN_parameters_880 )\n type\n @state.following.pop\n match( ID, TOKENS_FOLLOWING_ID_IN_parameters_882 )\n # at line 98:30: ( COMMA type ID )*\n while true # decision 14\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == COMMA )\n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 98:32: COMMA type ID\n match( COMMA, TOKENS_FOLLOWING_COMMA_IN_parameters_886 )\n @state.following.push( TOKENS_FOLLOWING_type_IN_parameters_888 )\n type\n @state.following.pop\n match( ID, TOKENS_FOLLOWING_ID_IN_parameters_890 )\n\n else\n break # out of loop for decision 14\n end\n end # loop for decision 14\n\n\n end\n match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_parameters_898 )\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n\n end\n\n return return_value\n end", "def param_tokens(these_tokens)\n depth = 0\n lparen_idx = nil\n rparen_idx = nil\n\n these_tokens.each_with_index do |token, i|\n if token.type == :LPAREN\n depth += 1\n lparen_idx = i if depth == 1\n elsif token.type == :RPAREN\n depth -= 1\n if depth.zero?\n rparen_idx = i\n break\n end\n elsif token.type == :LBRACE && depth.zero?\n # no parameters\n break\n end\n end\n\n if lparen_idx.nil? || rparen_idx.nil?\n nil\n else\n these_tokens[(lparen_idx + 1)..(rparen_idx - 1)]\n end\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n begin\n # at line 149:5: LPAR ( type ID ( COMMA type ID )* )? RPAR\n match( LPAR, TOKENS_FOLLOWING_LPAR_IN_parameters_1386 )\n # at line 149:10: ( type ID ( COMMA type ID )* )?\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0 == ID || look_13_0 == R_BOOL || look_13_0.between?( R_FLOAT, R_STRING ) || look_13_0 == VOID )\n alt_13 = 1\n end\n case alt_13\n when 1\n # at line 149:12: type ID ( COMMA type ID )*\n @state.following.push( TOKENS_FOLLOWING_type_IN_parameters_1390 )\n type\n @state.following.pop\n match( ID, TOKENS_FOLLOWING_ID_IN_parameters_1392 )\n # at line 149:20: ( COMMA type ID )*\n while true # decision 12\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == COMMA )\n alt_12 = 1\n\n end\n case alt_12\n when 1\n # at line 149:22: COMMA type ID\n match( COMMA, TOKENS_FOLLOWING_COMMA_IN_parameters_1396 )\n @state.following.push( TOKENS_FOLLOWING_type_IN_parameters_1398 )\n type\n @state.following.pop\n match( ID, TOKENS_FOLLOWING_ID_IN_parameters_1400 )\n\n else\n break # out of loop for decision 12\n end\n end # loop for decision 12\n\n\n end\n match( RPAR, TOKENS_FOLLOWING_RPAR_IN_parameters_1408 )\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n\n end\n\n return return_value\n end", "def parse_arg_names\n arg_names = []\n consume(:oparen)\n if peek(:identifier)\n arg_names << consume(:identifier).value\n while peek(:comma)\n consume(:comma)\n arg_names << consume(:identifier).value\n end\n end\n consume(:cparen)\n arg_names\n end", "def tokenize (p_token, type, lineno, pos)\n\t\n\tif type == \"op\"\n\t\treturn op_tokenize(p_token, lineno, pos)\n\t\n\telsif type == \"character\"\n\t\treturn char_tokenize(p_token, lineno, pos)\n\t\n\telsif type == \"string\"\n\t\treturn string_tokenize(p_token, lineno, pos)\n\t\n\telsif type == \"digit\"\n\t\treturn digit_tokenize(p_token, lineno, pos)\n\t\n\telse\n\t\t# should create an error here, just for thoroughness\n\tend\nend", "def accept_many(type)\n tokens = []\n while !end? && here.type == type\n tokens << here\n advance\n end\n tokens\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 74 )\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal356 = nil\n parameter355 = nil\n parameter357 = nil\n\n tree_for_char_literal356 = nil\n stream_COMMA = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token COMMA\" )\n stream_parameter = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule parameter\" )\n begin\n # at line 742:5: parameter ( ',' parameter )*\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5248 )\n parameter355 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter355.tree )\n end\n # at line 742:15: ( ',' parameter )*\n while true # decision 91\n alt_91 = 2\n look_91_0 = @input.peek( 1 )\n\n if ( look_91_0 == COMMA )\n alt_91 = 1\n\n end\n case alt_91\n when 1\n # at line 742:18: ',' parameter\n char_literal356 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_parameters_5253 )\n if @state.backtracking == 0\n stream_COMMA.add( char_literal356 )\n end\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5256 )\n parameter357 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter357.tree )\n end\n\n else\n break # out of loop for decision 91\n end\n end # loop for decision 91\n # AST Rewrite\n # elements: parameter\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 742:36: -> ( parameter )+\n # at line 742:39: ( parameter )+\n stream_parameter.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_parameter.has_next?\n @adaptor.add_child( root_0, stream_parameter.next_tree )\n\n end\n stream_parameter.reset\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 74 )\n\n end\n \n return return_value\n end", "def get_tokens_between(tokens,type,parameter)\n brace_open=tokens.find do |token|\n token.type == left(type) and\n # Vorher kommt ein Pfeil, somit ist es der Wert eines Parmeters\n token.prev_code_token.type == :FARROW and\n # Vor dem Pfeil kommt der gesuchte Parameter\n token.prev_code_token.prev_code_token.value == parameter\n end\n\n if brace_open.nil?\n return []\n else\n return get_block_between(type,brace_open)\n end\n end", "def _parse_list\n _eat :space\n args = []\n return args if _peek(:punct, ')')\n\n loop do\n args << _parse_expr1\n\n _eat :space\n if _eat(:punct, \",\")\n _eat :space\n else\n break\n end\n end\n\n args\n end", "def tokenize\n ret = []\n\n @value.gsub(/\\(/, \" ( \").gsub(/\\)/, \" ) \").split.each do |token|\n case token\n when \"(\", \")\"\n ret << token\n else\n ret << Atom.new(token)\n end\n end\n\n Sequence.new ret\n end", "def compile_parameterlist\n write_tag '<parameterList>'\n until check?(')')\n compile_type\n consume(TokenType::IDENTIFIER) # varName\n break unless check?(',')\n consume(',')\n end\n write_tag '</parameterList>'\n end", "def call_parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 225 )\n return_value = CallParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n call_parameters_start_index = @input.index\n\n root_0 = nil\n __COMMA1243__ = nil\n call_parameter1242 = nil\n call_parameter1244 = nil\n\n tree_for_COMMA1243 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 1139:4: call_parameter ( COMMA call_parameter )*\n @state.following.push( TOKENS_FOLLOWING_call_parameter_IN_call_parameters_7383 )\n call_parameter1242 = call_parameter\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, call_parameter1242.tree )\n end\n # at line 1139:19: ( COMMA call_parameter )*\n while true # decision 322\n alt_322 = 2\n look_322_0 = @input.peek( 1 )\n\n if ( look_322_0 == COMMA )\n alt_322 = 1\n\n end\n case alt_322\n when 1\n # at line 1139:21: COMMA call_parameter\n __COMMA1243__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_call_parameters_7387 )\n if @state.backtracking == 0\n\n tree_for_COMMA1243 = @adaptor.create_with_payload( __COMMA1243__ )\n @adaptor.add_child( root_0, tree_for_COMMA1243 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_call_parameter_IN_call_parameters_7389 )\n call_parameter1244 = call_parameter\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, call_parameter1244.tree )\n end\n\n else\n break # out of loop for decision 322\n end\n end # loop for decision 322\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 225 )\n memoize( __method__, call_parameters_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "def paramRest\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n return_value = ParamRestReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __COMMA84__ = nil\n params85 = nil\n\n tree_for_COMMA84 = nil\n\n begin\n # at line 154:2: ( COMMA params | )\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == COMMA )\n alt_17 = 1\n elsif ( look_17_0 == LCB )\n alt_17 = 2\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 154:4: COMMA params\n __COMMA84__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_paramRest_788 )\n @state.following.push( TOKENS_FOLLOWING_params_IN_paramRest_791 )\n params85 = params\n @state.following.pop\n @adaptor.add_child( root_0, params85.tree )\n # --> action\n return_value.list = ( params85.nil? ? nil : params85.list )\n # <-- action\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 156:4: \n # --> action\n return_value.list = []\n # <-- action\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n\n end\n \n return return_value\n end", "def paramRest\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n return_value = ParamRestReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __COMMA99__ = nil\n params100 = nil\n\n tree_for_COMMA99 = nil\n\n begin\n # at line 174:2: ( COMMA params | )\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == COMMA )\n alt_23 = 1\n elsif ( look_23_0 == RB )\n alt_23 = 2\n else\n raise NoViableAlternative( \"\", 23, 0 )\n end\n case alt_23\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 174:4: COMMA params\n __COMMA99__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_paramRest_843 )\n @state.following.push( TOKENS_FOLLOWING_params_IN_paramRest_846 )\n params100 = params\n @state.following.pop\n @adaptor.add_child( root_0, params100.tree )\n # --> action\n return_value.list = ( params100.nil? ? nil : params100.list )\n # <-- action\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 176:4: \n # --> action\n return_value.list = []\n # <-- action\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n\n end\n \n return return_value\n end", "def visit_comma(node); end", "def parameters_2\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n\n __ID23__ = nil\n type_s24 = nil\n\n\n begin\n # at line 217:6: COMMA type_s ID\n match( COMMA, TOKENS_FOLLOWING_COMMA_IN_parameters_2_1090 )\n @state.following.push( TOKENS_FOLLOWING_type_s_IN_parameters_2_1092 )\n type_s24 = type_s\n @state.following.pop\n __ID23__ = match( ID, TOKENS_FOLLOWING_ID_IN_parameters_2_1094 )\n\n # --> action\n $program.add_var(__ID23__.text, ( type_s24 && @input.to_s( type_s24.start, type_s24.stop ) ), $scope, 1, 0, 0)\n # <-- action\n\n\n # --> action\n $program.add_param_mem(__ID23__.text)\n # <-- action\n\n\n # --> action\n $params += 1\n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n\n end\n\n return \n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if this location has no more offerings
def isEmpty? return self.offerings.count == 0 end
[ "def has_onsite_holdings?\n return false unless self[:location_facet].present?\n\n # consider each location for this record....\n self[:location_facet].each do |location_facet|\n # skip over anything that's offsite...\n next if location_facet =~ /^Offsite/\n next if location_facet =~ /ReCAP/i\n\n # skip over Online locations (e.g., just links)\n next if location_facet =~ /Online/i\n\n # If we got here, we found somthing that's onsite!\n return true\n end\n\n # If we dropped down to here, we only found offsite locations.\n false\n end", "def sold_out?\n l = location_object\n l.num_seats == num_tickets_sold\n end", "def has_shopped?\n self.points_entries.purchases.count > 0\n end", "def complete?\n remaining_meetings.empty?\n end", "def custom_destroy\n\t self.destroy \n # destroy location if no more offerings in this location\n location = Location.find(self.location_id)\n\t if location.isEmpty?\n location.destroy\n return true\n else\n return false\n end\n\tend", "def has_available_time_slot?\n self.location_times.length < num_time_slots\n end", "def free?( wear_location )\r\n wear_location = wear_location.to_wear_location\r\n return self.equip_slots.any?{ |equip_slot| equip_slot.item.nil? && equip_slot.wear_locations.include?(wear_location) }\r\n end", "def spot_available?\n spot_availability = self.spot.get_availability\n ((self.start_date..self.end_date).to_a - spot_availability).empty?\n end", "def free_seats?\n # yes if not booked_up\n !booked_up?\n end", "def has_shipment?\n shipments_count > 0\n end", "def empty?\n @smart_listing.count == 0\n end", "def has_slots_available\n (6 - products.count) > 0\n end", "def destinations_exceeded?\n !max_destinations.valid?\n end", "def no_more?\n more_results == :NO_MORE_RESULTS\n end", "def no_more?\n more_results == :NO_MORE_RESULTS\n end", "def available?\n !(past? || available_seat_nums.empty?)\n end", "def maximum_no_of_people_reached?(ride_offer)\n signed_up_counts = RideOfferInterest.signed_up_counts(@ride_offer.id)\n true if signed_up_counts == ride_offer.no_of_people\n end", "def sold_out?(num_sold)\n total_available.nil? ? false : (num_sold >= total_available)\n end", "def ships_remaining\n\t\tif @ships_left > 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format share descriptions a bit nicer by converting and to spaces.
def share_description(value) raw(value).gsub("<br>", " ").gsub("<br />", " ") end
[ "def share_description(value) \n raw(value).gsub(\"<br>\", \" \").gsub(\"<br />\", \" \")\n end", "def format_description description\n \"#{description}\".ljust(30)\n end", "def format_description(title, text=nil, indent=0, bullet=true)\n string = ' '*indent\n string << '- ' if bullet\n string << title\n if text and !text.empty?\n string << \": \"\n if text.split(\"\\n\").length > 1\n string << \"\\n\"\n text.split(\"\\n\").each do |line|\n string << ' '*(indent+2) + line.strip + \"\\n\"\n end\n else\n string << text.strip + \"\\n\"\n end\n else\n string << \"\\n\"\n end\n return string\n end", "def descr_separator\n ' - '\n end", "def format descriptions\n formatted = format_rows descriptions\n\n aligned = formatted.transpose.map do |column|\n width = column.map { |entry| entry.length }.max\n\n column.map { |entry| entry.rjust width }\n end\n\n aligned.transpose.map do |row|\n row.join ' '\n end\n end", "def formatted_description(vegetable)\n vegetable.description.scan(/\\b.*\\b/).each do |sentence|\n print sentence + \". \" if sentence.length > 15\n if sentence.length < 15 && sentence != \"\"\n puts \"\"\n puts \"**#{sentence}**\"\n end\n end\n end", "def format_description!\n output << md_p(endpoint.description) unless endpoint.description.empty?\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif reader?(desc)\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif desc.is_reader?(@user) || in_admin_mode?\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def share_text_long\n # For now, just make it the same as short version\n \"\" + self.share_text_short\n end", "def auditershelp_to_descriptive_s( model, field, str )\n str = str.to_s\n\n return '&mdash;' if ( str.blank? ) # Note this will also catch non-empty, but all whitespace strings\n\n if ( model == Poll )\n if ( field == 'description' )\n return RedCloth.new( str ).to_html\n elsif ( field == 'currency_id' )\n return auditershelp_link_to( Currency, str, :name )\n elsif ( field == 'user_id' )\n return auditershelp_link_to( User, str, :name )\n end\n elsif ( model == Donation )\n if ( field == 'currency_id' )\n return auditershelp_link_to( Currency, str, :name )\n elsif ( field == 'poll_id' )\n return auditershelp_link_to( Poll, str, :title )\n elsif ( field == 'user_id' )\n return auditershelp_link_to( User, str, :name )\n elsif ( field == 'workflow_state' )\n return apphelp_state( str, DonationsController )\n end\n end\n\n return h( str )\n end", "def itemize entry, header = [\"role\", \"who\", \"address\"]\n<<EOS\n- #{clean header.map { |x| entry[x] }.join(\", \")}\n #{period entry}\n#{reflow_to_string entry[\"summary\"], 72, \" \"}\nEOS\nend", "def description_title(desc)\n result = desc.partial_format_name.t\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif desc.is_reader?(@user)\n :restricted.l\n else\n :private.l\n end\n unless result.match(/(^| )#{permit}( |$)/i)\n result += \" (#{permit})\"\n end\n\n return result\n end", "def format_description(text)\n # Look for signs of structure, otherwise just treat as unstructured.\n case text\n when /\"\";/ then double_quotes_to_sections(text)\n when /\\.--v\\. */ then double_dash_to_sections(text)\n when /; *PART */i then # Seen in some IA records.\n when /:;/ then # Observed in one unusual case.\n when /[[:punct:]] *--.* +-- +/ then # Blurbs/quotes with attribution.\n when / +-- +.* +-- +/ then # Table-of-contents title list.\n when /(;[^;]+){4,}/ then # Many sections indicated.\n else return format_multiline(text)\n end\n q_section = nil\n text.split(/ *; */).flat_map { |part|\n next if (part = part.strip).blank?\n case part\n when /^\"\"(.*)\"\"$/\n # === Rare type of table-of-contents listing entry\n line = $1.to_s\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless q_section)\n q_section = $1.to_s\n [gap, \"#{q_section} #{$2}\", \"\\n\"].compact\n else\n q_section = nil\n line.match?(/^\\d+ +/) ? line : \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n\n when / +-- +.* +-- +/\n # === Table-of-contents listing\n section = nil\n part.split(/ +-- +/).flat_map { |line|\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless section)\n section = $1.to_s.delete_suffix('.')\n [gap, \"#{section}. #{$2}\", \"\\n\"].compact\n else\n section = nil\n \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n }.tap { |toc| toc << \"\\n\" unless toc.last == \"\\n\" }\n\n when /[[:punct:]] *--/\n # === Blurbs/quotes with attribution\n part.scan(BLURB_RE).flat_map do |paragraph, attribution|\n attribution.remove!(/[.\\s]+$/)\n [\"#{paragraph} #{EM_DASH}#{attribution}.\", \"\\n\"]\n end\n\n when /^v[^.]*\\. *\\d/\n # === Apparent table-of-contents volume title\n [part]\n\n else\n # === Plain text section\n part = \"#{part}.\" unless part.match?(/[[:punct:]]$/)\n [part, \"\\n\"]\n end\n }.compact.map { |line|\n line.gsub(/---/, EM_DASH).gsub(/--/, EN_DASH)\n }\n end", "def share_text_long_html\n # For now, just make it the same as short version\n \"<b>#{self.share_text_long}</b>\"\n end", "def extra_description\n [for_description, discard_description].compact.join(\" \")\n end", "def fq_space_title(s)\n s.creator.nickname + '/' + '<strong>' + s.title + '</strong>'\n end", "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end", "def reformat_twofaced_names(card)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Link helper takes a URL and outputs a link with a custom label with http and www stripped out
def link_helper(url) # set up another variable for the link link = url # add http if missing from url if !url.include?("http://") && !url.include?("https://") url = "http://" + url end # strip out http/https from link if link.include?("http://") || link.include?("https://") link = link.split("://")[1] end # strip out the www from the link link = link.split("www.")[1] if link.include?("www.") # remove trailing slash link = link[0..(link.length - 2)] if link[link.length - 1].eql?("/") # return a link_to with the final link and url link_to(link, url) end
[ "def format_link_or_text(url)\n return url\n end", "def external_link(label, path, **opt, &block)\n opt[:target] = '_blank' unless opt.key?(:target)\n make_link(label, path, **opt, &block)\n end", "def link_to(text, url)\n \"<a href='#{url}' title='#{text}'>#{text}</a>\"\n end", "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "def process_href(href)\n \"https://en.wikipedia.org\" + href\n end", "def link_to(text, url)\n '<a href=\"%s\">%s</a>' % [url(url), text]\n end", "def website_link(display, website, no_website_display=\"\", options=\"\")\n return no_website_display if website.empty?\n \n if website.include? \"http://\" or website.include? \"https://\"\n return \"<a href=\\\"\" + website + \"\\\" target=\\\"_blank\\\" \" + options + \">\" + display + \"</a>\"\n else\n return \"<a href=\\\"http://\" + website + \"\\\" target=\\\"_blank\\\" \" + options + \">\" + display + \"</a>\"\n end\n end", "def link_to_url(url)\n link_to truncate(sanitize(url).sub(%r{^https?://}, ''), :length => 30), sanitize(url) unless url.blank?\n end", "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "def to_link(text)\n URI::encode(@base_url + text.strip.gsub(/\\s+/, @space_replacement))\n end", "def internal_link url, title = nil\n wrap(\"#{url}#{title ? \"|#{title}\" : \"\"}\", \"[[\", \"]]\")\n end", "def slack_link_to(url, text)\n return text unless url.present?\n \"<#{url}|#{text}>\"\n end", "def link aUrl, aName = nil, aTitle = nil\n aName ||= aUrl\n %{<a href=\"#{aUrl}\"#{%{ title=\"#{aTitle}\"} if aTitle}>#{aName}</a>}\n end", "def make_direct_link(url) #:doc:\n url\n end", "def link_to_page_with_label(label)\n return (\"<a href='/chefs/\" + self.id.to_s + \"'>\" + label + \"</a>\").html_safe\n end", "def inline_titled_link url\n stripped = url.\n strip.\n sub(%r{\\Ahttps?://}, \"\").\n sub(%r{/\\z}, \"\")\n %Q{<link href=\"#{url}\"><color rgb='#{LINK_COL}'>#{stripped}</color></link>}\n end", "def mk_link(url, css, title)\n abbrev_title = title.nil? ? OY::Markup.markup_abbrevs[File.extname(url)[1..-1].to_sym] : title\n %Q(<a href='#{url.downcase}' class='oy-link #{css}'>#{abbrev_title}</a>)\n rescue\n mk_link(url, css, \"NIL\")\n end", "def link(opts)\n \"#{opts[:name]} !LINK_OPEN_TAG!#{opts[:href]}!LINK_CLOSE_TAG!\"\n end", "def link_to(title, path, opts={}, base=true)\n unless is_uri?(path) || base == false\n path = url(path)\n end\n \n return \"<a href=\\\"#{path}\\\"#{parse_options(opts)}>#{title}</a>\"\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SVG Image Helper Converts a dragonflystored SVG image to inline SVG with a missing asset fallback.
def svg_image(image) raw image.data rescue Dragonfly::Job::Fetch::NotFound "Image missing" end
[ "def svg!\n attr = ->(node) { ['src', 'data'].find {|k| node[k]} }\n @doc.css('img,iframe,embed,object[type=\"image/svg+xml\"]').select do |node|\n src = attr.call node\n Transformer.local_img?(node, ['src', 'data']) && MiniMime.lookup_by_filename(node[src])&.content_type == 'image/svg+xml'\n end.each do |node|\n src = attr.call node\n node[src] = \"data:image/svg+xml;base64,#{Base64.strict_encode64(File.read node[src])}\"\n end\n end", "def svg_image_tag filename, options = {}\n filename.gsub! /\\.svg$/i, \"\"\n options[\"data-svg-fallback\"] ||= asset_path(\"#{filename}.png\")\n image_tag \"#{filename}.svg\", options\n end", "def svg_image_tag(source, fallback=nil, options={})\n if options.blank? && fallback.is_a?(Hash)\n options = fallback\n fallback = nil\n end\n options = options.symbolize_keys\n options[:src] = path_to_image(source)\n options[:fallback] = fallback unless fallback.blank?\n fallback_path=path_to_fallback_image(source, options[:fallback])\n options[:onerror]=\"this.src='#{fallback_path}'\" if fallback_path.present?\n options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size]\n tag \"img\", options.except(:fallback)\n end", "def svg(s)\n convert(s, mime: 'image/svg+xml')\n end", "def show_svg(path)\n File.open(\"app/assets/images/svg_img/#{path}\", \"rb\") do |file|\n raw file.read\n end\n end", "def rasterize(svg, options={})\n File.open(@temp_folder + '/temp_svg.svg', 'w') { |file|\n file.write(svg)\n }\n \n `#{@command} -d #{@temp_folder} -m image/#{options[:as].downcase} #{@temp_folder}/temp_svg.svg`\n \n image = \"\"\n File.open(@temp_folder + '/temp_svg.' + options[:as].downcase, 'r') { |file|\n image = file.read\n }\n \n image\n end", "def optimize_svg_for_uri_escaping!(svg); end", "def embedded_svg(filename, options = {})\n # assets = Rails.application.assets\n # file = assets.find_asset(filename).source.force_encoding(\"UTF-8\")\n File.open(\"app/assets/images/#{filename}\", 'rb') do |file|\n doc = Nokogiri::HTML::DocumentFragment.parse file\n svg = doc.at_css \"svg\"\n if options[:class].present?\n svg[\"class\"] = options[:class]\n end\n raw doc\n end\n end", "def embed_svg(filename, additional_class = nil)\n\n svg = File.open(Rails.root.to_s + '/app/assets/images/' + filename) { |f| Nokogiri::XML f }\n\n unless additional_class.nil?\n svg.root['class'] = additional_class\n end\n\n svg.to_html.html_safe\n\n end", "def process_note_svg(svg, image_id)\n root = svg.root\n raise \"#{image_id} is not an SVG image\" unless root.name == 'svg'\n \n # Strip all attributes except for viewBox.\n raise \"#{image_id} does not have a viewBox\" unless root['viewBox']\n sizes = root['viewBox'].strip.split.map(&:to_f)\n raise \"#{image_id} has a poorly formatted viewBox\" unless sizes.length == 4\n unless sizes[0] == 0 && sizes[1] == 0\n raise \"#{image_id} has a viewBox that doesn't start at 0 0\"\n end\n\n {\n :width => sizes[2], :height => sizes[3],\n :svg => root.inner_html.strip\n }\n end", "def embedded_svg(filename, options = {})\n doc = Nokogiri::HTML::DocumentFragment.parse(File.read(Rails.root.join('app', 'assets', 'images', filename)))\n if options[:class].present?\n doc.at_css('svg')['class'] = \"svg svg--#{File.basename(filename, '.*').parameterize} #{options[:class]}\"\n else\n doc.at_css('svg')['class'] = \"svg svg--#{File.basename(filename, '.*').parameterize}\"\n end\n raw doc\n end", "def svg_object_tag(source, fallback=nil, options={})\n if options.blank? && fallback.is_a?(Hash)\n options = fallback\n fallback = nil\n end\n options = options.symbolize_keys\n options[:data] = path_to_image(source)\n options[:type] = options.fetch(:type){ \"image/svg+xml\" }\n options[:fallback] = fallback unless fallback.blank?\n options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size]\n\n content_tag(\"object\", options.except(:fallback)) do\n fallback_path=path_to_fallback_image(source, options[:fallback])\n concat tag(\"param\", name: \"src\", value: options[:data])\n concat image_tag(fallback_path, options.except(:data, :fallback, :type)) if fallback_path.present?\n end\n\n end", "def absolute_image_source(image)\n image ? data.site.url + \"/images/\" + image : \"/images/NoImage.svg\"\n end", "def maskicon_svg\n serve_image :maskicon_svg\n end", "def get_svg\n\t expires_in(1.hours, :private => false, :public => true)\n\t source_fedora_object = Multiresimage.find(params[:id])\n\t authorize! :show, source_fedora_object\n\t @svg = source_fedora_object.DELIV_OPS.content()\n gon.url = DIL_CONFIG['dil_js_url']\n respond_to do |wants|\n wants.xml { render :xml => @svg }\n end\n end", "def responsive_image(image) \n return \"/images/NoImage.svg\" unless image != nil\n\n # Get the image name without the extension. The filename should NOT contain any '.' before the extension\n name = image.match(/(.+)\\.(jpg|jpeg|png|gif)/)[1]\n extension = image.match(/(.+)\\.(jpg|jpeg|png|gif)/)[2]\n\n return <<-EOL\n <img src=\"/images/#{name}.#{extension}\" alt=\"/images/#{name}.#{extension}\"\n srcset=\"/images/#{name}-400px.#{extension} 400w, /images/#{name}-800px.#{extension} 800w, /images/#{name}-1200px.#{extension} 1200w\">\n EOL\n end", "def resolve_image_path node, image_path, image_format, relative_to = true\n doc = node.document\n if relative_to == true\n imagesdir = nil if (imagesdir = doc.attr 'imagesdir').nil_or_empty? || imagesdir == '.' || imagesdir == './'\n else\n imagesdir = relative_to\n end\n # NOTE: base64 logic currently used for inline images\n if ::Base64 === image_path\n return @tmp_files[image_path] if @tmp_files.key? image_path\n tmp_image = ::Tempfile.create %W(image- .#{image_format})\n tmp_image.binmode unless image_format == 'svg'\n tmp_image.write ::Base64.decode64 image_path\n tmp_image.close\n @tmp_files[image_path] = tmp_image.path\n # NOTE: this will catch a classloader resource path on JRuby (e.g., uri:classloader:/path/to/image)\n elsif ::File.absolute_path? image_path\n ::File.absolute_path image_path\n elsif !(is_url = url? image_path) && imagesdir && (::File.absolute_path? imagesdir)\n ::File.absolute_path image_path, imagesdir\n # handle case when image is a URI\n elsif is_url || (imagesdir && (url? imagesdir) && (image_path = node.normalize_web_path image_path, imagesdir, false))\n if !allow_uri_read\n log :warn, %(cannot embed remote image: #{image_path} (allow-uri-read attribute not enabled))\n return\n elsif @tmp_files.key? image_path\n return @tmp_files[image_path]\n end\n tmp_image = ::Tempfile.create ['image-', image_format && %(.#{image_format})]\n tmp_image.binmode if (binary = image_format != 'svg')\n begin\n load_open_uri.open_uri(image_path, (binary ? 'rb' : 'r')) {|fd| tmp_image.write fd.read }\n tmp_image.close\n @tmp_files[image_path] = tmp_image.path\n rescue\n @tmp_files[image_path] = nil\n log :warn, %(could not retrieve remote image: #{image_path}; #{$!.message})\n tmp_image.close\n unlink_tmp_file tmp_image.path\n nil\n end\n # handle case when image is a local file\n else\n node.normalize_system_path image_path, imagesdir, nil, target_name: 'image'\n end\n end", "def external_icon(path, options = {})\n classes = _icon_classes(options) + [\"external-icon\"]\n\n if path.split(\".\").last == \"svg\"\n icon_path = application_path(path)\n return unless icon_path\n\n attributes = { class: classes.join(\" \") }.merge(options)\n asset = File.read(icon_path)\n asset.gsub(\"<svg \", \"<svg#{tag_builder.tag_options(attributes)} \").html_safe\n else\n image_pack_tag(path, class: classes.join(\" \"), style: \"display: none\")\n end\n end", "def svg\n # Only recompile the SVG if it doesn't already exist\n unless File.exist? self.svg_name\n File.open(\"#{@name}.tex\", 'w') { |f| f.write document }\n # TODO Catch pdflatex errors\n system \"lib/latex2svg #{@name}\"\n end\n # Unless latex2svg was successful, use a placeholder SVG\n copy_placeholder unless File.exist? self.svg_name\n return File.read self.svg_name\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /feelings/1 GET /feelings/1.json
def show @feeling = Feeling.find(params[:id]) @sake = Sake.find(params[:sake_id]) respond_to do |format| format.html # show.html.erb format.json { render json: @feeling } end end
[ "def update\n feeling = Feeling.find(params[:id])\n feeling.update(feeling_params)\n render json: feeling\n end", "def index\n @feelings = Feeling.where(user: current_user).all\n end", "def show\n @featuring = Featuring.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @featuring }\n end\n end", "def new\n @sake= Sake.find(params[:sake_id])\n @feeling = Feeling.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feeling }\n end\n end", "def index\n @given_time_feelings = GivenTimeFeeling.all\n end", "def index\n @feel_swatches = FeelSwatch.all\n end", "def show\n @dayfeeling = Dayfeeling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dayfeeling }\n end\n end", "def create\n @feel = Feel.new(feel_params)\n\n respond_to do |format|\n if @feel.save\n format.html { redirect_to feels_path, notice: 'Feel was successfully created.' }\n format.json { render :show, status: :created, location: @feel }\n else\n format.html { render :new }\n format.json { render json: @feel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feel.update(feel_params)\n format.html { redirect_to @feel, notice: 'Feel was successfully updated.' }\n format.json { render :show, status: :ok, location: @feel }\n else\n format.html { render :edit }\n format.json { render json: @feel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @feeling = Feeling.find(params[:id])\n\n respond_to do |format|\n if @feeling.update_attributes(params[:feeling])\n format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @feeling_graphic = FeelingGraphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feeling_graphic }\n end\n end", "def show\n @fatigue = Fatigue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fatigue }\n end\n end", "def show\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fortune }\n end\n end", "def show\n @feast = Feast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feast }\n end\n end", "def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end", "def show\n @foodhamper = Foodhamper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foodhamper }\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 @feat = @person.feats.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def index\n @feeling_cards = FeelingCard.all\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /feelings/new GET /feelings/new.json
def new @sake= Sake.find(params[:sake_id]) @feeling = Feeling.new respond_to do |format| format.html # new.html.erb format.json { render json: @feeling } end end
[ "def new\n @featuring = Featuring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @featuring }\n end\n end", "def new\n @fatigue = Fatigue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fatigue }\n end\n end", "def create\n @feeling = Feeling.new(feeling_params)\n\n respond_to do |format|\n if @feeling.save\n format.html { redirect_to new_feeling_path }\n #format.js\n format.json { render :show, status: :created, location: @feeling }\n else\n format.html { render :new }\n #format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def new\n @fish = Fish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish }\n end\n end", "def create\n @feel = Feel.new(feel_params)\n\n respond_to do |format|\n if @feel.save\n format.html { redirect_to feels_path, notice: 'Feel was successfully created.' }\n format.json { render :show, status: :created, location: @feel }\n else\n format.html { render :new }\n format.json { render json: @feel.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @fortune = Fortune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune }\n end\n end", "def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end", "def new\n @fetznedition = Fetznedition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fetznedition }\n end\n end", "def new\n @foodhamper = Foodhamper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foodhamper }\n end\n end", "def new\n @look = Look.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @look }\n end\n end", "def new\n @fishing_method = FishingMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fishing_method }\n end\n end", "def new\n @founder = Founder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @founder }\n end\n end", "def new\n @flaw = Flaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flaw }\n end\n end", "def new\n @lending = Lending.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lending }\n end\n end", "def new\n @funding = Funding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @funding }\n end\n end", "def new\n @dayfeeling = Dayfeeling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dayfeeling }\n end\n end", "def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end", "def new\n @happening = Happening.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @happening }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /feelings/1 PUT /feelings/1.json
def update @feeling = Feeling.find(params[:id]) respond_to do |format| if @feeling.update_attributes(params[:feeling]) format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @feeling.errors, status: :unprocessable_entity } end end end
[ "def update\n feeling = Feeling.find(params[:id])\n feeling.update(feeling_params)\n render json: feeling\n end", "def update\n respond_to do |format|\n if @feel.update(feel_params)\n format.html { redirect_to @feel, notice: 'Feel was successfully updated.' }\n format.json { render :show, status: :ok, location: @feel }\n else\n format.html { render :edit }\n format.json { render json: @feel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update #{@feeling.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @feeling.update(updated_params)\n puts \"brucep update success\"\n #format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.html { redirect_to new_feeling_path }\n format.json { render :show, status: :ok, location: @feeling }\n #format.js\n else\n format.html { render :edit }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @given_time_feeling.update(given_time_feeling_params)\n format.html { redirect_to @given_time_feeling, notice: 'Given time feeling was successfully updated.' }\n format.json { render :show, status: :ok, location: @given_time_feeling }\n else\n format.html { render :edit }\n format.json { render json: @given_time_feeling.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feel_swatch.update(feel_swatch_params)\n format.html { redirect_to @feel_swatch, notice: 'Feel swatch was successfully updated.' }\n format.json { render :show, status: :ok, location: @feel_swatch }\n else\n format.html { render :edit }\n format.json { render json: @feel_swatch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dayfeeling = Dayfeeling.find(params[:id])\n\n respond_to do |format|\n if @dayfeeling.update_attributes(params[:dayfeeling])\n format.html { redirect_to(@dayfeeling, :notice => 'Dayfeeling was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dayfeeling.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @fatigue = Fatigue.find(params[:id])\n\n respond_to do |format|\n if @fatigue.update_attributes(params[:fatigue])\n format.html { redirect_to @fatigue, notice: 'Fatigue was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fatigue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @feel = Feel.new(feel_params)\n\n respond_to do |format|\n if @feel.save\n format.html { redirect_to feels_path, notice: 'Feel was successfully created.' }\n format.json { render :show, status: :created, location: @feel }\n else\n format.html { render :new }\n format.json { render json: @feel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @featuring.update(featuring_params)\n format.html { redirect_to @featuring, notice: 'Featuring was successfully updated.' }\n format.json { render :show, status: :ok, location: @featuring }\n else\n format.html { render :edit }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @action_definition = ActionDefinition.find(params[:id])\n @feeling_definitions = FeelingDefinition.all\n\n respond_to do |format|\n if @action_definition.update_attributes(params[:action_definition])\n format.html { redirect_to(@action_definition, :notice => 'Action definition was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_definition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fife.update(fife_params)\n format.html { redirect_to @fife, notice: 'Five was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fife.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n if @belief.update_attributes(params[:belief])\n format.html { redirect_to @belief, :notice => 'Belief was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @belief.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feeling_card.update(feeling_card_params)\n format.html { redirect_to @feeling_card, notice: 'Feeling card was successfully updated.' }\n format.json { render :show, status: :ok, location: @feeling_card }\n else\n format.html { render :edit }\n format.json { render json: @feeling_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @feeling_graphic = FeelingGraphic.find(params[:id])\n\n respond_to do |format|\n if @feeling_graphic.update_attributes(params[:feeling_graphic])\n format.html { redirect_to(@feeling_graphic, :notice => 'Feeling graphic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feeling_graphic.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feetback.update(feetback_params)\n format.html { redirect_to @feetback, notice: 'Feetback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feetback }\n else\n format.html { render :edit }\n format.json { render json: @feetback.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@feat = Feat.find(params[:id])\n @feat = @character.feats.find(params[:id])\n\n respond_to do |format|\n if @feat.update_attributes(params[:feat])\n flash[:notice] = 'Feat was successfully updated.'\n format.html { redirect_to(edit_character_path(@character)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feat.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 create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages\n render json: {message: @errors}, status: :unprocessable_entity\n end\n\n if !@survey\n render json: {message: [\"Survey is Required!\"] }, status: :unprocessable_entity\n end\n end", "def update\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n if @fortune.update_attributes(params[:fortune])\n format.html { redirect_to @fortune, notice: 'Fortune was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fortune.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /feelings/1 DELETE /feelings/1.json
def destroy @feeling = Feeling.find(params[:id]) @feeling.destroy respond_to do |format| format.html { redirect_to feelings_url } format.json { head :ok } end end
[ "def destroy\n @featuring = Featuring.find(params[:id])\n @featuring.destroy\n\n respond_to do |format|\n format.html { redirect_to featurings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feel_swatch.destroy\n respond_to do |format|\n format.html { redirect_to feel_swatches_url, notice: 'Feel swatch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dayfeeling = Dayfeeling.find(params[:id])\n @dayfeeling.destroy\n\n respond_to do |format|\n format.html { redirect_to(dayfeelings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @given_time_feeling.destroy\n respond_to do |format|\n format.html { redirect_to given_time_feelings_url, notice: 'Given time feeling was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @feeling_graphic = FeelingGraphic.find(params[:id])\n @feeling_graphic.destroy\n\n respond_to do |format|\n format.html { redirect_to(feeling_graphics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feat.destroy\n respond_to do |format|\n format.html { redirect_to feats_url, notice: 'Feat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fatigue = Fatigue.find(params[:id])\n @fatigue.destroy\n\n respond_to do |format|\n format.html { redirect_to fatigues_url }\n format.json { head :ok }\n end\n end", "def destroy\n @feetback.destroy\n respond_to do |format|\n format.html { redirect_to feetbacks_url, notice: 'Feetback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @feat = @person.feats.find(params[:id])\n @feat.destroy\n\n respond_to do |format|\n format.html { redirect_to(person_feats_url(@person)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @fly = Fly.find(params[:id])\n @fly.destroy\n\n respond_to do |format|\n format.html { redirect_to flies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @belief = Belief.find(params[:id])\n @belief.destroy\n\n respond_to do |format|\n format.html { redirect_to beliefs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @available_foodstuff.destroy\n respond_to do |format|\n format.html { redirect_to available_foodstuff_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @featuring.destroy\n respond_to do |format|\n format.html { redirect_to featuring_index_url, notice: 'Featuring was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fifteen.destroy\n respond_to do |format|\n format.html { redirect_to fifteens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @behat = Behat.find(params[:id])\n @behat.destroy\n\n respond_to do |format|\n format.html { redirect_to behats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fetznedition = Fetznedition.find(params[:id])\n @fetznedition.destroy\n\n respond_to do |format|\n format.html { redirect_to fetzneditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_definition = ActionDefinition.find(params[:id])\n @action_definition.destroy\n @feeling_definitions = FeelingDefinition.all\n\n respond_to do |format|\n format.html { redirect_to(action_definitions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @firefly.destroy\n respond_to do |format|\n format.html { redirect_to fireflies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the notice unless it is one of the default ignored exceptions
def notify_or_ignore(exception, opts = {}) notice = build_notice_for(exception, opts) send_notice(notice) unless notice.ignore? end
[ "def notify_or_ignore(exception, context = {})\n send_notification(exception, context = {}) unless ignored?(exception)\n end", "def notice_error(exception)\n return unless enabled? && agent\n\n agent.notice_error(exception)\n end", "def notice!\n self.severity = :NOTICE\n end", "def notice?\n severity == :NOTICE\n end", "def notice?\n severity == \"NOTICE\"\n end", "def _notice(msg, type = :notice)\n if type == :error\n add_error(msg)\n else\n add_msg(\"* #{msg}\", type)\n end\nend", "def ignore_exception?(ex)\n @ignore.include?(ex.to_s) \n end", "def ignore_errors\n risky_a\nrescue Exception => e\n puts \"Error running code: #{e}\"\nelse\n risky_b\nend", "def send_403(message)\n I3.server.send_error(\n :status => \"403 Forbidden\",\n :title => \"Permission Denied\",\n :message => message,\n :help => \"Please contact the Help Desk if you believe you have \" +\n \"received this message in error.\")\n end", "def unknown(message = nil, ex = nil, data = nil, &block)\n _log(UNKNOWN, message, ex, data, &block)\n end", "def unknown(title, message, options={}, &block)\n self.log(title, message, options.merge(:level => Logger::UNKNOWN), &block)\n end", "def notice_error(e, options={})\n state = TingYun::Agent::TransactionState.tl_get\n txn = state.current_transaction\n if txn\n txn.exceptions.notice_error(e, options)\n state.transaction_sample_builder.trace.add_errors_to_current_node(state,e) rescue nil\n elsif TingYun::Agent.instance\n TingYun::Agent.instance.error_collector.notice_error(e, options)\n end\n end", "def ignore!\n\t\t\t\tSignal.trap(@name, \"IGNORE\")\n\t\t\tend", "def notice(nick, msg)\n write \"NOTICE \"+nick+\" :\"+msg\n end", "def handle_unknown_error\n do_nothing\n end", "def notify_non_example_exception(exception, context_description); end", "def test_notice_only\n d = create_driver(CONFIG_NOTICE_ONLY)\n time = event_time\n ts = Time.at(time.to_r).strftime(d.instance.time_format)\n d.run(default_tag: 'test') do\n d.feed(time, {'msg' => \"notice message from fluentd out_ikachan: testing now\"})\n d.feed(time, {'msg' => \"notice message from fluentd out_ikachan: testing second line\"})\n end\n\n assert_equal 2, @posted.length\n\n assert_equal 'notice', @posted[0][:method]\n assert_equal '#morischan', @posted[0][:channel]\n assert_equal \"out_ikachan: test [#{ts}] notice message from fluentd out_ikachan: testing now\", @posted[0][:message]\n\n assert_equal 'notice', @posted[1][:method]\n assert_equal '#morischan', @posted[1][:channel]\n assert_equal \"out_ikachan: test [#{ts}] notice message from fluentd out_ikachan: testing second line\", @posted[1][:message]\n end", "def skip_this_when(enabled:, expected_exception:)\n yield\n rescue expected_exception => e\n e.tap do\n skip e.message if enabled && e.is_a?(expected_exception)\n end\n end", "def throwing?\n !exceptions.include? 'x_none'\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If there is a file saved on the server for the record, this method sets its permissions using the nix +chmod+ command. +permissions+ should be an octalformat integer. The default setting when saving files is 0644.
def chmod(permissions = nil) permissions ||= self.class.upload_options[:chmod] File.chmod(permissions, full_path) if file_exists? end
[ "def update_permissions_on_storage\n if @options[:perms]\n response = system(\"chmod -R o+w #{File.join(@path, 'storage')}\")\n if response\n say_success \"Updated permissions on storage/ directory.\"\n else\n say_failed \"Could not update permissions on storage/ directory.\"\n end\n end\n end", "def chmod(path, mode, options={})\n check_options(options, OPT_TABLE['SETPERMISSION'])\n res = operate_requests('PUT', path, 'SETPERMISSION', options.merge({'permission' => mode}))\n res.code == '200'\n end", "def update_file_permissions!(permissions, category)\n permissions.each_pair do |datasetID, dataset|\n dataset.each_pair do |fileID, permission|\n p = self.permissions(category).find_or_initialize_by_datasetID_and_fileID(datasetID, fileID)\n\n if permission == '1'\n p.permissionvalue = (category == :a ? 1 : 2)\n p.save!\n else\n p.destroy unless p.new_record?\n end\n end\n end\n end", "def mode=(value)\n File.chmod(Integer(\"0\" + value), @resource[:name])\n end", "def permissions\n Sufia::GenericFile::Permissions.parse_permissions(params)\n @generic_file.update_attributes(params[:generic_file].reject { |k,v| %w{ Filedata Filename revision}.include? k})\n @generic_file.save\n Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.user_key)\n redirect_to sufia.edit_generic_file_path, :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })\n end", "def permissions\n ScholarSphere::GenericFile::Permissions.parse_permissions(params)\n @generic_file.update_attributes(params[:generic_file].reject { |k,v| %w{ Filedata Filename revision}.include? k})\n @generic_file.save\n Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.login)\n redirect_to edit_generic_file_path, :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })\n end", "def mode=(value)\n File.chmod(Integer(\"0#{value}\"), @resource[:name])\n end", "def mode=(value)\n File.chmod(Integer(\"0\" + value), @resource[:name])\n end", "def chmod(p0) end", "def permissions=(value)\n @permissions = value\n end", "def chmod(mode, *files)\n verbose = if files[-1].is_a? String then false else files.pop end\n $stderr.printf \"chmod %04o %s\\n\", mode, files.join(\" \") if verbose\n o_chmod mode, *files\n end", "def set_mode\n FileUtils.chmod options[:mode], options[:file] if options[:mode] && File.exist?(options[:file])\n\n return true if !backup_file\n FileUtils.chmod options[:mode], backup_file if File.exist? backup_file\n return true\n end", "def chmod(mode) File.chmod(mode, path) end", "def lchmod(permission, *files)\n nfp = 0\n files.each do |f|\n nfp += VirtFS.fs_lookup_call(f) { |p| file_lchmod(permission, p) }\n end\n nfp\n end", "def set_mode\n # Why are we trying to set_mode when we don't even have a file?\n return false if !@file\n File.chmod @mode, @file if File.exist? @file\n\n # the backup file may not exist for whatever reason, lets not shit if it doesn't.\n return true if !backup_file\n File.chmod @mode, backup_file if File.exist? backup_file\n true\n end", "def FileModesOwnership\n\tarquivo = File.new(\"arquivo_novo.txt\", \"w\")\n\tarquivo.chmod(0755)\n\tarquivo.close()\nend", "def chmod(file, mode)\n if File.stat(file).mode != mode\n FileUtils.chmod(mode, file, :verbose => verbose?) \n end\n end", "def set_permissions(*args)\n self.permissions = {}\n args.each do | permission |\n raise InvalidPermissionError.new(\"Permission #{permission} is invalid.\") unless ALLOWED_PERMISSIONS.include?(permission)\n self.permissions[permission] = true\n end\n end", "def set_file_priv()\n FileUtils.chmod 0644, @setting_file_path\n FileUtils.chmod 0644, @root_cert_kc_path\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the full system path (including +RAILS_ROOT+) to the uploaded file, as specified by the record's current attributes. Used by +full_path+ in the event that no file exists.
def full_path_from_current_attributes path = self.class.upload_options[:directory]. gsub(Regexp.new("^(#{RAILS_ROOT})?/?"), RAILS_ROOT + '/') + '/' + instance_directory + '/' + send(self.class.upload_options[:filename]) path.gsub(/\/+/, '/') end
[ "def file_full_path\n Rails.root.to_s + file_path.to_s\n end", "def full_path\n if app_root.nil? || app_root.empty?\n path\n else\n File.join app_root, path\n end\n end", "def path\n return self.saved? ? @realfile.path : nil\n end", "def full_path\n path\n end", "def file_path\n @local_path\n end", "def current_path\n file.try(:path)\n end", "def path_to_current_file\n @path\n end", "def current_file_path\n clurl = AssetSettings[:local_assets][@file_id].last\n clurl.sub(/\\A#{AssetSettings[:local_assets].assets_url_prefix}/,\n '') if clurl\n end", "def path\n return if @file.blank?\n if is_path?\n File.expand_path(@file)\n elsif @file.respond_to?(:path) && !@file.path.blank?\n File.expand_path(@file.path)\n end\n end", "def absolute_path\n STORE.join(filename.to_s)\n end", "def file_path\n file.current_path\n end", "def file_path\n return @file_path\n end", "def path\n if defined?(Storage::FileSystem) && file.storage.is_a?(Storage::FileSystem)\n file.storage.path(file.id)\n end\n end", "def selected_absolute_path\n selected_file_name = @files[@selected].first\n # This may not be the absolute path (e.g. file_name may be '.')\n selected_full_path = File.join(@current_path, selected_file_name)\n File.absolute_path(selected_full_path)\n end", "def relative_path\n must_be File\n Pathname.new(self.full_path).relative_path_from(Pathname.new(Dir.pwd)).to_s\n end", "def fullpath\n File.join(@path, @source)\n end", "def get_real_file_path(filename)\n case @type\n when HASHED_BACKUP_TYPE\n @hashed_backup_manifest_database.execute(\"SELECT fileID FROM Files WHERE relativePath=?\", filename) do |row|\n tmp_filename = row[\"fileID\"]\n tmp_filefolder = tmp_filename[0,2]\n return @root_folder + tmp_filefolder + tmp_filename\n end\n when PHYSICAL_BACKUP_TYPE\n return @physical_backup_app_folder + filename\n end\n return nil\n end", "def getFullPath()\n fullpath = \"\"\n fullpath += @resource[:disk_path]\n fullpath += @resource[:partition_number]\n return fullpath\n end", "def file_path\n base_image ? base_image.base_filename : nil\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renames the uploaded file stored in the filesystem if the record's attribute changes have caused the file's path to change. Only works if the path is a function only of the record's own properties, not of the properties of any associations. Called using the +before_update+ callback in ActiveRecord::Base.
def rename_uploaded_file return unless @uploaded_file.nil? if file_exists? and full_path != full_path_from_current_attributes ensure_directory_exists File.rename(full_path, full_path_from_current_attributes) remove_empty_directory @saved_full_path = full_path_from_current_attributes end end
[ "def rename_file\n return unless filename_changed?\n\n old_full_filename = [base_path, filename_was].join(\"/\")\n\n object = self.class.bucket.objects.find(old_full_filename)\n new_object = object.copy(:key => full_filename, :acl => attachment_options[:acl])\n object.destroy\n true\n end", "def has_interpolated_attached_file name, options = {}\n\n # Get old pathes to all files from file and save in instance variable\n before_update do |record|\n @interpolated_names = {} unless @interpolated_names\n @interpolated_names[name] = {} unless @interpolated_names[name]\n old_record = self.class.find(record.id)\n (record.send(name).styles.keys+[:original]).each do |style|\n @interpolated_names[name][style] = old_record.send(name).path(style)\n end\n end\n\n # If validation has been passed - move files to a new location\n after_update do |record|\n (record.send(name).styles.keys+[:original]).each do |style|\n orig_path = @interpolated_names[name][style]\n dest_path = record.send(name).path(style)\n if orig_path && dest_path && File.exist?(orig_path) && orig_path != dest_path\n FileUtils.move(orig_path, dest_path)\n end\n end\n end\n\n # If renaming (or other callbacks) went wrong - restore old names to files\n after_rollback do |record|\n return unless @interpolated_names\n (record.send(name).styles.keys+[:original]).each do |style|\n dest_path = @interpolated_names[name][style]\n orig_path = record.send(name).path(style)\n if orig_path && dest_path && File.exist?(orig_path) && orig_path != dest_path\n FileUtils.move(orig_path, dest_path)\n end\n end\n end\n\n has_attached_file name, options\n end", "def rename_file\n return unless asset.queued_for_write.present?\n\n path = asset.queued_for_write[:original].path\n ext = File.extname path\n basename = File.basename path, ext\n file_name = \"#{Digest::MD5.hexdigest(basename + Time.now.to_i.to_s)}#{ext}\"\n\n asset.instance_write :file_name, file_name\n end", "def file_update\n File.rename(file_path,\n File.join(File.dirname(file_path),\n File.basename(file_path).gsub(/_\\d+\\.txt/, \"_#{Time.now.to_i}.txt\")))\n end", "def write_path\n if renamed?\n sanitized_path request_payload[\"path\"]\n else\n path\n end\n end", "def rename_existing_file\n return unless file_file_name_changed?\n\n (file.styles.keys + [:original]).each do |style|\n dirname = File.dirname(file.path(style).sub(/\\A\\//, ''))\n old_path = \"#{dirname}/#{file_file_name_was}\"\n new_path = \"#{dirname}/#{file_file_name}\"\n begin\n file.s3_bucket.objects[old_path].move_to(new_path, acl: :public_read)\n rescue AWS::S3::Errors::NoSuchKey\n end\n end\n end", "def detect_rename(commit, parent, path)\n diff = parent.diff(commit, paths: [path], disable_pathspec_match: true)\n\n # If +path+ is a filename, not a directory, then we should only have\n # one delta. We don't need to follow renames for directories.\n return nil if diff.each_delta.count > 1\n\n delta = diff.each_delta.first\n if delta.added?\n full_diff = parent.diff(commit)\n full_diff.find_similar!\n\n full_diff.each_delta do |full_delta|\n if full_delta.renamed? && path == full_delta.new_file[:path]\n # Look for the old path in ancestors\n path.replace(full_delta.old_file[:path])\n end\n end\n end\n end", "def rename_file(file_id, old_filename, new_filename)\n path = \"./public/uploads/#{file_id}\"\n if old_filename != new_filename\n FileUtils.mv(\"#{path}/#{old_filename}\", \"#{path}/#{new_filename}\")\n end\nend", "def rename_mp4_to_mp3\n\n file_path = attachment.path\n\n if (current_format = File.extname(self.attachment.path)) =~ /mp4/\n new_attachment_file_name = File.basename(self.attachment_file_name, File.extname(self.attachment_file_name)) + EXTNAME_FOR_RENAME\n file_path = File.join(File.dirname(self.attachment.path), File.basename(self.attachment.path, current_format)+EXTNAME_FOR_RENAME)\n\n FileUtils.mv(self.attachment.path, file_path)\n update_column(:attachment_file_name, new_attachment_file_name)\n end\n\n file_path\n end", "def rename(to) File.rename(path, to) end", "def file_path=(value)\n @file_path = value\n end", "def action_rename\n if @tpath == nil\n Chef::Log.Fatal \"Target path is empty and need to be set for rename action\"\n elsif (!dir_exists?(@path))\n Chef::Log::Error(\"Source directory #{ @path } doesn't exist; rename action not taken\")\n else\n converge_by(\"rename #{ @new_resource }\") do\n @client.rename(@path, @tpath)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def rename_via_move(new_file_name)\n if human_filenames\n dir = File.dirname(path)\n\n moves = []\n versions.values.unshift(self).each do |v|\n from_path = File.join(dir, v.full_filename)\n to_path = File.join(dir, v.full_filename(new_file_name))\n next if from_path == to_path || !File.exists?(from_path)\n moves << [from_path, to_path]\n end\n moves.each { |move| FileUtils.mv(*move) }\n end\n\n write_internal_identifier new_file_name\n model.send(\"write_#{mounted_as}_identifier\")\n retrieve_from_store!(new_file_name) if human_filenames\n\n new_file_name\n end", "def set_file_mtime\n write_attribute(:file_mtime, File.mtime(file_name)) if (file_mtime.blank? and !file_name.blank?)\n end", "def with_file_path_for(attribute, &block) # :yields: full_file_path\n attachment = attachment_for(attribute)\n\n if attachment.respond_to?(:s3)\n yield attachment.url\n elsif File.exists?(attachment.path)\n yield attachment.path\n else # file hasn't been saved, use a tempfile\n temp_rename = File.join(Dir.tmpdir, attachment.original_filename)\n File.copy(attachment.to_file.path, temp_rename)\n\n yield temp_rename\n end\n ensure\n temp_rename && File.unlink(temp_rename) # always delete this\n end", "def rename_picture\n previous_picture_path = DownloadCategory.find(self.id).picture_path\n if previous_picture_path && picture_exists?(previous_picture_path) && previous_picture_path != picture_path\n begin\n File.rename(previous_picture_path, picture_path)\n rescue\n # Do Nothing.\n end\n end\n end", "def rename_storage_object\n if self.permanent_key_was.present? && self.permanent_key.present?\n target_key = nil\n if self.permanent_key != self.permanent_key_was\n target_key = self.permanent_key\n elsif self.filename != self.filename_was\n target_key = self.class.permanent_key(institution_key: self.institution.key,\n item_id: self.item_id,\n filename: self.filename)\n end\n if target_key\n PersistentStore.instance.move_object(source_key: self.permanent_key_was,\n target_key: target_key)\n self.update_column(:permanent_key, target_key) # skip callbacks\n end\n elsif self.staging_key_was.present? && self.staging_key.present?\n target_key = nil\n if self.staging_key != self.staging_key_was\n target_key = self.staging_key\n elsif self.filename != self.filename_was\n target_key = self.class.staging_key(institution_key: self.institution.key,\n item_id: self.item_id,\n filename: self.filename)\n end\n if target_key\n PersistentStore.instance.move_object(source_key: self.staging_key_was,\n target_key: target_key)\n self.update_column(:staging_key, target_key) # skip callbacks\n end\n end\n end", "def file_has_changed?\n original_filename_changed? or original_filesize_changed?\n end", "def sync_filename\n save_s3_filename(preserve_filename? ? original_name : nil)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes sure that the appropriate directory exists so the file can be saved into it.
def ensure_directory_exists dir = File.dirname(full_path_from_current_attributes) FileUtils.mkdir_p(dir) unless File.exists?(dir) end
[ "def ensure_tmpfile_dir_exists!\n FileUtils.mkdir_p(tmpfile_dir_pathname)\n end", "def verify_directory\n FileUtils.makedirs @new_location\n end", "def ensure_meta_info_dir_exists!\n FileUtils.mkdir_p(RubyFileReader::Reader.meta_info_dir_pathname)\n end", "def ensure_directory(dir, filename)\n file_dir = File.expand_path(File.join(dir, File.dirname(filename)))\n FileUtils.mkdir_p(file_dir)\n end", "def ensure_dir(f)\n d = Pathname.new(f).dirname\n FileUtils.mkdir_p(d) if not Pathname.new(d).exist?\nend", "def make_sure_exists dir\n FileUtils.mkdir_p(dir) unless Dir.respond_to?(:exists?) && Dir.exists?(dir)\n end", "def ensure_directory(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end", "def ensure_exists\n create unless Dir.exist? path\n end", "def make_save_directory\n directory = File.dirname(Save.save_filename)\n Dir.mkdir!(directory)\n end", "def check_dest_dir\n dir = File.dirname absolute_filename\n FileUtils.mkdir_p(dir) unless Dir.exist?(dir)\n end", "def ensure_store_directory\n FileUtils.mkpath( store ) unless File.directory?( store )\n end", "def file_exists?\n\tdirectory_name = \"db/seed_files\"\n\tunless File.exist?(directory_name)\n\t\tputs \"Created folder 'db/seed_files'\"\n\t\tDir.mkdir(directory_name)\n\tend\nend", "def check_dest_dir\n dir = File.dirname absolute_filename\n FileUtils.mkdir_p(dir) unless Dir.exist?(dir)\n end", "def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end", "def setup_directory(path, logging_tag)\n\t\tif File.exist?(path)\n\t\t\tif @collision_policy == :destroy\n\t\t\t\tputs \"#{logging_tag} :: Deleting directory #{path}\"\n\t\t\t\tFileUtils.rm_rf(path)\n\t\t\t\tFileUtils.mkdir_p(path)\n\t\t\telsif @collision_policy == :overwrite\n\t\t\t\tputs \"#{logging_tag} :: Overwriting inside directory #{path}\"\n\t\t\telse\n\t\t\t\traise(IOError, \"Directory already exists, exiting: #{path}\")\n\t\t\tend\n\t\telse\n\t\t\tputs \"#{logging_tag} :: Creating new directory #{path}\"\n\t\t\tFileUtils.mkdir_p(path)\n\t\tend\n\tend", "def check_and_create_directory(dir)\n dir.tap do\n dir.exist? || dir.mkpath\n end\n end", "def save!\n valid!\n\n begin\n Dir.mkdir(@path)\n rescue Errno::EEXIST\n raise ArgumentError, 'base path exists!'\n end\n\n self\n end", "def assert_directory_exists!(path)\n dir = File.dirname(path)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n end", "def make_dir up_to_path = nil\n up_to_path ||= path\n `if [ ! -d \"#{up_to_path}\" ];then mkdir -p \"#{up_to_path}\";fi`\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the file's directory if it is empty. Recusively deletes directories going up the tree until it reaches a nonempty directory. Thumbs.db and .DS_Store files are removed if they are the only contents of a directory.
def remove_empty_directory(path = nil) dir = path || File.dirname(full_path) dir.gsub!(/(\/+\.\.?\/*)*$/, '') system_files = %w(Thumbs.db .DS_Store) if File.directory?(dir) and !File.symlink?(dir) and (Dir.entries(dir) - %w(. ..) - system_files).empty? system_files.each { |sys| File.delete("#{dir}/#{sys}") if File.exists?("#{dir}/#{sys}") } Dir.rmdir(dir) remove_empty_directory(dir.gsub(/\/+[^\/]*\/*$/, '')) end end
[ "def rm_empty_tree(path)\n raise ArgumentError, \"path cannot be a non-directory file\" if path.file?\n begin\n FileUtils.rmdir path, parents: true\n rescue Errno::ENOTEMPTY, Errno::EEXIST, Errno::ENOENT\n end\n end", "def remove_empty_fs_dirs(path)\n return if (! File.exist? path)\n Dir.entries(path).each do |f|\n next if (f == '.' or f == '..')\n child_path = File.join(path, f)\n next if (! File.directory? child_path)\n remove_empty_fs_dirs(child_path)\n end\n if (! Dir.entries(path).count == 2)\n raise Node::NodeDeleteError, \"Dir #{path} @ #{path} not empty\"\n end\n Dir.rmdir(path)\n end", "def empty_non_root_directory path\n check_path_for_danger_to_remove path\n\n logger.debug \"Removing content of '#{File.join path, '*'}'\"\n FileUtils.rm_rf Dir.glob(File.join(path, '*'))\n FileUtils.rm_rf Dir.glob(File.join(path, '.*')).select {|f| f !~ /\\/..?$/}\n end", "def clean(path)\n return if !File.exists?(path)\n\n if File.directory?(path)\n log.info \"Deleting directory #{path}...\"\n FileUtils.rm_r(path)\n else\n log.info \"Deleting file #{path}...\"\n File.delete(path)\n end\nend", "def delete_files_and_empty_parent_directories\n style_names = reflection.styles.map{|style| style.name} << :original\n # If the attachment was set to nil, we need the original value\n # to work out what to delete.\n if column_name = reflection.column_name_for_stored_attribute(:file_name)\n interpolation_params = {:basename => record.send(\"#{column_name}_was\")}\n else\n interpolation_params = {}\n end\n style_names.each do |style_name|\n path = interpolate_path(style_name, interpolation_params) or\n next\n FileUtils.rm_f(path)\n begin\n loop do\n path = File.dirname(path)\n FileUtils.rmdir(path)\n end\n rescue Errno::EEXIST, Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR\n # Can't delete any further.\n end\n end\n end", "def prune_empty_directories(path)\n all_files = all_files(path)\n\n directories = all_files.select { |x| File.directory?(x) }\n directories.sort! { |a, b| b.size <=> a.size }\n\n directories.each do |directory|\n entries = all_files(directory)\n FileUtils.rmdir(directory) if entries.empty?\n end\n end", "def clear_empty_parents\n current = self\n loop do\n current = current.parent\n break unless current.exist?\n break if current.children.any?\n\n current.delete\n end\n rescue SystemCallError\n #done if we try to delete a populated directory\n end", "def clean_dir\n\n path = self.get_dir\n _clean_dir(path)\n end", "def cleanup_empty_dirs!(path)\n if File.directory?(path) && path.index(Merb.root) == 0\n system(\"find #{path} -depth -empty -type d -exec rmdir {} \\\\;\")\n end\n end", "def remove_empty_dirs(path)\n remove_empty_fs_dirs fs_path(path)\n end", "def delete_empty_directories(dir)\n return if File.realpath(dir) == File.realpath(cache_path)\n if Dir.children(dir).empty?\n Dir.delete(dir) rescue nil\n delete_empty_directories(File.dirname(dir))\n end\n end", "def delete_file_and_folder!( file_path )\n FileUtils.rm_f file_path\n boundary = adapter_path + '/'\n loop do\n file_path = File.dirname file_path\n break unless file_path.index boundary\n FileUtils.rmdir file_path\n end\n end", "def rmdir_if_empty_ie path\n rmdir path if File.exist?(path) && dir_empty?(path)\n end", "def remove_empty_parent(path)\n p_path = File.dirname(path)\n # do not attempt to delete non-existent directories\n return if (! File.exist? p_path) or (! File.directory? p_path)\n # do not delete root, even if empty!\n return if p_path == File.join(base_path, root)\n # is directory even empty?\n return if Dir.entries(p_path).count > 2\n\n begin \n Dir.rmdir(p_path)\n rescue Exception => e\n # directory is not empty; just return\n return\n end\n end", "def delete_dir!(path); end", "def clean_directories!\n all_build_files = File.join(@app.config[:build_dir], '**', '*')\n\n empty_directories = Dir[all_build_files].select do |d|\n File.directory?(d)\n end\n\n empty_directories.each do |d|\n remove_file d, force: true if Pathname(d).children.empty?\n end\n end", "def rmdir() Dir.rmdir(path) end", "def delete_dir_contents(target_dir)\n Find.find(target_dir) do |x|\n if File.file?(x)\n FileUtils.rm(x)\n elsif File.directory?(x) && x != target_dir\n FileUtils.remove_dir(x)\n end\n end\n end", "def rollback_file(file, contents)\n if contents.present?\n File.open(file, \"w\") { |f| f << contents }\n else\n File.delete(file)\n begin\n dir = File.dirname(file)\n until dir == Rails.root\n Dir.rmdir(dir) # delete current folder\n dir = dir.split(\"/\")[0..-2].join(\"/\") # select parent folder\n end\n rescue Errno::ENOTEMPTY # Directory not empty\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /exhibitior_categories/new GET /exhibitior_categories/new.json
def new @exhibitior_category = ExhibitiorCategory.new respond_to do |format| format.html # new.html.erb format.json { render json: @exhibitior_category } end end
[ "def new\n @new_category = NewCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_category }\n end\n end", "def new\n @categorize = Categorize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorize }\n end\n end", "def new\n puts @category.inspect\n @internal = @category.internals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internal }\n end\n end", "def new\n @newscategory = Newscategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newscategory }\n end\n end", "def new\n @category = Category.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @categorization = Categorization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorization }\n end\n end", "def create\n @exhibitior_category = ExhibitiorCategory.new(params[:exhibitior_category])\n\n respond_to do |format|\n if @exhibitior_category.save\n format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully created.' }\n format.json { render json: @exhibitior_category, status: :created, location: @exhibitior_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @exercise_categories = ExerciseCategory.all\n @exercise_category = ExerciseCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def new\n @categoria = Categoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categoria }\n end\n end", "def new\n @category = current_mall.categories.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @exhibitorcategory = Exhibitorcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exhibitorcategory }\n end\n end", "def new\n @exhibitor_category = ExhibitorCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exhibitor_category }\n end\n end", "def new\n @categories_d = CategoriesD.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categories_d }\n end\n end", "def new\n @create_category = CreateCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_category }\n end\n end", "def new\n @exibitor_category = ExibitorCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exibitor_category }\n end\n end", "def create\n @new_category = NewCategory.new(params[:new_category])\n\n respond_to do |format|\n if @new_category.save\n format.html { redirect_to @new_category, notice: 'NewCategory was successfully created.' }\n format.json { render json: @new_category, status: :created, location: @new_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @new_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nonfictionliteraturecategory = Nonfictionliteraturecategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @nonfictionliteraturecategory }\n end\n end", "def new\n @categorias_tipo = CatTipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorias_tipo }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /exhibitior_categories POST /exhibitior_categories.json
def create @exhibitior_category = ExhibitiorCategory.new(params[:exhibitior_category]) respond_to do |format| if @exhibitior_category.save format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully created.' } format.json { render json: @exhibitior_category, status: :created, location: @exhibitior_category } else format.html { render action: "new" } format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity } end end end
[ "def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def add_categorization_on_form(kapp_slug, body, headers=default_headers)\n raise StandardError.new \"Category properties is not valid, must be a Hash.\" unless body.is_a? Hash\n @logger.info(\"Adding Categorization for \\\"#{kapp_slug}\\\" kapp\")\n post(\"#{@api_url}/kapps/#{kapp_slug}/categorizations\", body, headers)\n end", "def create\n if params[:categoria_producto]\n p = Producto.find(params[:producto_id])\n c = Categoria.find(params[:categoria_id])\n\n if p.categorias << c\n render json: c, status: :created\n else\n render json: {:errors => {categoria: [\"No se ha podido agregar categoria\"]}}, status: :unprocessable_entity\n end\n\n else\n @categoria = Categoria.new(parametros_categoria)\n\n if @categoria.save\n render json: @categoria, status: :created\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end\n end", "def create_categories\n categories = PublicApinception::API.all.map { |api| api.category }.uniq\n PublicApinception::Category.new_from_array(categories)\n end", "def create\n @parsed = JSON.parse params[:entity].delete :categories\n\t\t@entity = Entity.new params[:entity]\n begin\n validates_categories @parsed\n if @entity.add_categories @parsed\n respond_with do |format|\n format.html{ redirect_to entity_coupons_path(@entity), notice: 'You are Awesome for join us' }\n end\n else\n render_new_with_errors\n end\n rescue Exception => e\n @entity.errors << e.message\n render_new_with_errors\n end\n end", "def create\n @categories = Categories.new(categories_params)\n\n respond_to do |format|\n if @categories.save\n format.html { redirect_to @categories, notice: 'Categories was successfully created.' }\n format.json { render :show, status: :created, location: @categories }\n else\n format.html { render :new }\n format.json { render json: @categories.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end", "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to @categoria, notice: 'Categoria was successfully created.' }\n format.json { render json: @categoria, status: :created, location: @categoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorialivro = Categorialivro.new(params[:categorialivro])\n\n respond_to do |format|\n if @categorialivro.save\n format.html { redirect_to @categorialivro, :notice => 'Categorialivro was successfully created.' }\n format.json { render :json => @categorialivro, :status => :created, :location => @categorialivro }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @categorialivro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @categorium = @torneo.categoria.build(categorium_params)\n\n respond_to do |format|\n if @categorium.save\n format.html { redirect_to torneo_categoria_path(@torneo), notice: 'Categoría fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @categorium }\n else\n format.html { render :new }\n format.json { render json: @categorium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exibitor_category = ExibitorCategory.new(params[:exibitor_category])\n\n respond_to do |format|\n if @exibitor_category.save\n format.html { redirect_to @exibitor_category, notice: 'Exibitor category was successfully created.' }\n format.json { render json: @exibitor_category, status: :created, location: @exibitor_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exibitor_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories_for_decision\n @decision = Decision.find params[:id]\n @categories = @decision.categories\n end", "def create\n @categoty = Categoty.new(categoty_params)\n\n respond_to do |format|\n if @categoty.save\n format.html { redirect_to @categoty, notice: 'Categoty was successfully created.' }\n format.json { render :show, status: :created, location: @categoty }\n else\n format.html { render :new }\n format.json { render json: @categoty.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorization = Categorization.new(params[:categorization])\n\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to @categorization, notice: 'Categorization was successfully created.' }\n format.json { render json: @categorization, status: :created, location: @categorization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categorization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorization = Categorization.new(params[:categorization])\n @categories = category_list\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully created.') }\n format.xml { render :xml => @categorization, :status => :created, :location => @categorization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend", "def create\n @exercise_category = ExerciseCategory.new(params[:exercise_category].permit(:name, :organization_id))\n\n respond_to do |format|\n if @exercise_category.save\n format.html { redirect_to exercise_categories_path }\n format.json { render json: exercise_categories_path, status: :created, location: @exercise_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categary = Categary.new(categary_params)\n\n respond_to do |format|\n if @categary.save\n format.html { redirect_to @categary, notice: 'Categary was successfully created.' }\n format.json { render :show, status: :created, location: @categary }\n else\n format.html { render :new }\n format.json { render json: @categary.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /exhibitior_categories/1 PUT /exhibitior_categories/1.json
def update @exhibitior_category = ExhibitiorCategory.find(params[:id]) respond_to do |format| if @exhibitior_category.update_attributes(params[:exhibitior_category]) format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity } end end end
[ "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end", "def update\n @exhibitor_category = ExhibitorCategory.find(params[:id])\n\n respond_to do |format|\n if @exhibitor_category.update_attributes(params[:exhibitor_category])\n format.html { redirect_to @exhibitor_category, notice: 'Exhibitor category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exhibitor_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exibitor_category = ExibitorCategory.find(params[:id])\n\n respond_to do |format|\n if @exibitor_category.update_attributes(params[:exibitor_category])\n format.html { redirect_to @exibitor_category, notice: 'Exibitor category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exibitor_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exhibitorcategory = Exhibitorcategory.find(params[:id])\n\n respond_to do |format|\n if @exhibitorcategory.update_attributes(params[:exhibitorcategory])\n format.html { redirect_to @exhibitorcategory, notice: 'Exhibitorcategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exhibitorcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_category = ExerciseCategory.find(params[:id])\n \n respond_to do |format|\n if @exercise_category.update_attributes(params[:exercise_category])\n format.html { redirect_to exercise_categories_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n authorize @category\n if @category.update(category_params)\n render 'api/v1/categories/show'\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @acticle_category.update(acticle_category_params)\n format.html { redirect_to @acticle_category, notice: 'Acticle category was successfully updated.' }\n format.json { render :show, status: :ok, location: @acticle_category }\n else\n format.html { render :edit }\n format.json { render json: @acticle_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categorialivro = Categorialivro.find(params[:id])\n\n respond_to do |format|\n if @categorialivro.update_attributes(params[:categorialivro])\n format.html { redirect_to @categorialivro, :notice => 'Categorialivro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @categorialivro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to @categoria, notice: 'Categoria se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categorize = Categorize.find(params[:id])\n\n respond_to do |format|\n if @categorize.update_attributes(params[:categorize])\n format.html { redirect_to @categorize, notice: 'Categorize was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorize.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @accessory_category = AccessoryCategory.find(params[:id])\n\n if @accessory_category.update(accessory_category_params)\n audit(@accessory_category, current_user)\n head :no_content\n else\n render json: @accessory_category.errors, status: :unprocessable_entity\n end\n end", "def update_many\n if @categories.update_all(category_params)\n render json: @categories, status: :ok, location: categories_url\n else\n render json: @categories.map{ |category| category.errors }, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n @exhibitior_category = ExhibitiorCategory.new(params[:exhibitior_category])\n\n respond_to do |format|\n if @exhibitior_category.save\n format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully created.' }\n format.json { render json: @exhibitior_category, status: :created, location: @exhibitior_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def quickupdatecategories\n begin\n curriculum_id = BSON::ObjectId.from_string(params[:curriculum][:id])\n curriculum = Curriculum.find_by(:id => curriculum_id)\n if curriculum.nil?\n flash[:error] = t('curriculum.msg_error_not_permission')\n redirect_to home_error_path\n else\n user_id = BSON::ObjectId.from_string(session[:user_id])\n if !curriculum.mentor_id.eql?(user_id)\n flash[:error] = t('curriculum.msg_error_not_permission')\n redirect_to home_error_path\n else\n categories = get_categories_from_params\n\n if !categories.nil? && !categories.empty?\n curriculum.curriculum_categories = categories\n respond_to do |format|\n if !curriculum.errors\n flash.now[:error] = curriculum.errors.full_messages.to_sentence(:last_word_connector => ', ')\n format.js { render partial: 'mentor/error' }\n # format.html\n else\n flash.now[:notice] = t('category.msg_update_success')\n format.js { render partial: 'mentor/success'}\n end\n end\n else\n respond_to do |format|\n flash.now[:error] = t('category.msg_atleast_category')\n format.js { render partial: 'mentor/error' }\n # format.html\n end\n end\n end\n end\n rescue Exception => e\n logger.error(\"Curriculum update error: #{e.message}\")\n respond_to do |format|\n flash.now[:error] = t('material.msg_update_failed')\n format.js { render action: 'mentor/error' }\n # format.html\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_expense_category.update(api_v1_expense_category_params)\n format.html { redirect_to @api_v1_expense_category, notice: 'Expense category was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense_category }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_category(project_id, category_id, opts = {})\n put \"projects/#{project_id}/categories/#{category_id}\", opts\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /exhibitior_categories/1 DELETE /exhibitior_categories/1.json
def destroy @exhibitior_category = ExhibitiorCategory.find(params[:id]) @exhibitior_category.destroy respond_to do |format| format.html { redirect_to exhibitior_categories_url } format.json { head :no_content } end end
[ "def destroy\n @exhibitor_category = ExhibitorCategory.find(params[:id])\n @exhibitor_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitor_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n EconomicCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to economic_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @exhibitorcategory = Exhibitorcategory.find(params[:id])\n @exhibitorcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitorcategories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @exibitor_category = ExibitorCategory.find(params[:id])\n @exibitor_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exibitor_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alien_category.destroy\n respond_to do |format|\n format.html { redirect_to alien_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @checklist_category.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @categoty.destroy\n respond_to do |format|\n format.html { redirect_to categoties_url, notice: 'Categoty was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_category = ExamCategory.find(params[:id])\n @exam_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cafeteria_category.destroy\n respond_to do |format|\n format.html { redirect_to cafeteria_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @categary.destroy\n respond_to do |format|\n format.html { redirect_to categaries_url, notice: 'Categary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_expense_category.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expense_categories_url, notice: 'Expense category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categoria_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @catogary = Catogary.find(params[:id])\n @catogary.destroy\n\n respond_to do |format|\n format.html { redirect_to catogaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorialivro = Categorialivro.find(params[:id])\n @categorialivro.destroy\n\n respond_to do |format|\n format.html { redirect_to categorialivros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_categorization = ItemCategorization.find(params[:id])\n @item_categorization.destroy\n\n respond_to do |format|\n format.html { redirect_to item_categorizations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_category = ExerciseCategory.find(params[:id])\n @exercise_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @acticle_category.destroy\n respond_to do |format|\n format.html { redirect_to acticle_categories_url, notice: 'Acticle category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Payments history for calendar month +month_period+ +month_period+ A string like 'yyyyMM' that represent month of year
def get_payments_history(month_period) request('getPaymentsHistory', base_api_parameters.merge({ monthPeriod: month_period })) end
[ "def month() end", "def period\n case self.recurring_month\n when 12\n 1.year # 1.year != 12.months\n else\n self.recurring_month.months\n end\n end", "def month(input) = (day_of_year(input) - 1) / 30 + 1", "def months; end", "def months() 30 * days end", "def expiration_month\n @months = [\"01\",\"02\",\"03\",\"04\",\"05\",\"06\",\"07\",\"08\",\"09\",\"10\",\"11\",\"12\"]\n end", "def months\n find_period :months\n end", "def monthly\n if (params[:date] != nil && params[:date][:year] != nil)\n year = params[:date][:year].to_i\n else\n year = Date.today.year\n end\n\n month = 1\n @months = []\n @date = Date.civil(year, 1, 1)\n\n (0...12).each do |i|\n startDay = Date.civil(year, month, 1)\n endDay = Date.civil(year, month, -1)\n\n totals = {}\n\n Entry.where(:date => startDay..endDay).each do |entry|\n if (!entry.final_name.category.ignore)\n if (totals[entry.final_name.category.name] == nil)\n totals[entry.final_name.category.name] = {:debits => 0, :credits => 0}\n end\n \n if (entry.amount > 0)\n totals[entry.final_name.category.name][:debits] += entry.amount\n else\n totals[entry.final_name.category.name][:credits] += entry.amount\n end\n end\n end\n\n @months.push(totals)\n month += 1\n end\n end", "def month_num_paying_acc\n month_num_paying\n end", "def report_monthly_customers\n @company = Company.find(params[:company_id])\n @customers = @company.get_customers()\n \n if(params[:year] and params[:year].numeric?)\n @year = params[:year].to_i\n else\n @year = Time.now.year\n end\n \n if(params[:month] and params[:month].numeric?)\n @month = params[:month].to_i\n else\n @month = Time.now.month\n end\n \n curr_year = Time.now.year\n c_year = curr_year\n c_month = 1\n \n @years = []\n @months = monthsArr\n @month_name = @months[@month - 1][0]\n \n @pagetitle = \"Monthly customers report - #{@month_name} #{@year} - #{@company.name}\"\n \n while(c_year > Time.now.year - 5)\n @years.push(c_year)\n c_year -= 1\n end\n \n @dates = []\n end", "def create_monthly_payments(\n total_price, enrollment_length, enrollment_discount, enrollment_date, \n _period_discount, period_length, period_start_date, prepayment, _payment_plan, _student_id\n )\n payments = []\n period_length.times do |i|\n\n date_at_begining_of_month = period_start_date >> i\n _payment_date = date_at_begining_of_month + DATE_SPACER\n _price = (total_price - total_price * enrollment_discount) / enrollment_length\n _price -= _price * _period_discount\n \n if (date_at_begining_of_month == enrollment_date and enrollment_date.month == 9) or (_payment_date.month == 5)\n _price -= prepayment\n end\n \n _description = create_description(\n total_price, enrollment_discount, enrollment_length, enrollment_date, \n _period_discount, period_start_date, _payment_date, prepayment, _price)\n \n payments << self.new(_price.truncate(2), _description, _payment_date, _period_discount, _payment_plan, _student_id)\n end\n payments\n end", "def fixed_monthly_payment(amount, months, ir )\n amount*( ir * ( 1 + ir ) **months )/(( 1 + ir )**months - 1 )\nend", "def month\n set_function_and_argument(:month, nil)\n end", "def month_add(month, interval)\n d = to_date_obj(\"#{month}-01\")\n d = d >> interval\n return d.strftime('%Y-%m')\n end", "def month\n @interval = 'month'\n self\n end", "def monthly_payment(salary_per_annum)\n return salary_per_annum / 12\nend", "def report_monthly_products\n @company = Company.find(params[:company_id])\n @products = @company.get_products()\n \n if(params[:year] and params[:year].numeric?)\n @year = params[:year].to_i\n else\n @year = Time.now.year\n end\n \n if(params[:month] and params[:month].numeric?)\n @month = params[:month].to_i\n else\n @month = Time.now.month\n end\n \n curr_year = Time.now.year\n c_year = curr_year\n c_month = 1\n \n @years = []\n @months = monthsArr\n @month_name = @months[@month - 1][0]\n \n @pagetitle = \"Monthly products report - #{@month_name} #{@year} - #{@company.name}\"\n \n while(c_year > Time.now.year - 5)\n @years.push(c_year)\n c_year -= 1\n end\n \n @dates = []\n end", "def months\r\n ((@period % A_YEAR.to_r)/A_MONTH.to_r).to_i\r\n end", "def create_monthly_data\n number = @slide_number.to_i + 1\n monthly_data = Nokogiri::HTML(\n open(\n \"#{ENV['API_DOMAIN_2']}#{ENV['API_DOMAIN_2_MONTHLY']}\"\n )\n ).css(\"div.shareable-section-wrapper\").last\n\n data = {\n sign: @sign_name.to_s,\n duration: \"monthly\",\n horoscope_text: monthly_data.css(\"div[#{number}]\").text.split(' ')[1..-1].join(' ')\n } if monthly_data\n Horoscope.create(data) if monthly_data and data\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Summary expenses report for calendar month +month_period+ +month_period+ A string like 'yyyyMM' that represent month of year
def get_expenses_summary(month_period) request('getExpensesSummary', base_api_parameters.merge({ monthPeriod: month_period })) end
[ "def total_month_expenses\n sum_expenses(expenses_this_month)\n end", "def month() end", "def expenses_this_month \n self.get_specific_expenses(30)\n end", "def monthly_expenses\n expenses.group(:expended_at).sum(:amount).to_a.map{ |k,v| [ k.strftime('%v'), v ] }\n end", "def ExtractMonth(expense)\n expense.expense_date.month\n end", "def months; end", "def idsr_monthly_summary\n @report_name = 'IDSR Monthly Summary'\n @logo = CoreService.get_global_property_value('logo').to_s\n @current_location_name =Location.current_health_center.name\n @obs_start_year = Observation.first.obs_datetime.year\n\n render :layout => 'report'\n end", "def capital_expenditure_month_year\n capital_expenditure_sub_method('month_year')\n end", "def month(input) = (day_of_year(input) - 1) / 30 + 1", "def monthly\n if (params[:date] != nil && params[:date][:year] != nil)\n year = params[:date][:year].to_i\n else\n year = Date.today.year\n end\n\n month = 1\n @months = []\n @date = Date.civil(year, 1, 1)\n\n (0...12).each do |i|\n startDay = Date.civil(year, month, 1)\n endDay = Date.civil(year, month, -1)\n\n totals = {}\n\n Entry.where(:date => startDay..endDay).each do |entry|\n if (!entry.final_name.category.ignore)\n if (totals[entry.final_name.category.name] == nil)\n totals[entry.final_name.category.name] = {:debits => 0, :credits => 0}\n end\n \n if (entry.amount > 0)\n totals[entry.final_name.category.name][:debits] += entry.amount\n else\n totals[entry.final_name.category.name][:credits] += entry.amount\n end\n end\n end\n\n @months.push(totals)\n month += 1\n end\n end", "def month_name(number); end", "def change_type_list_expenses( expenses_month, year )\n HelperController.int_to_month( expenses_month )\n temporary_expense = { year => expenses_month }\n\n return temporary_expense\n end", "def generate_month_expenses\n Expense.all.each do |expense|\n MonthExpense.create(month_id: self.id, expense_id: expense.id)\n end\n end", "def period_in_words\n case recurring_month\n when 12\n 'yearly'\n when 1\n 'monthly'\n when 0\n \"once\"\n else\n \"every #{recurring_month} months\"\n end\n end", "def report_monthly_sellers\n @company = Company.find(params[:company_id])\n @users = @company.get_users()\n \n if(params[:year] and params[:year].numeric?)\n @year = params[:year].to_i\n else\n @year = Time.now.year\n end\n \n if(params[:month] and params[:month].numeric?)\n @month = params[:month].to_i\n else\n @month = Time.now.month\n end\n \n curr_year = Time.now.year\n c_year = curr_year\n c_month = 1\n \n @years = []\n @months = monthsArr\n @month_name = @months[@month - 1][0]\n \n @pagetitle = \"Monthly sellers report - #{@month_name} #{@year} - #{@company.name}\"\n \n while(c_year > Time.now.year - 5)\n @years.push(c_year)\n c_year -= 1\n end\n \n @dates = []\n end", "def report_monthly_products\n @company = Company.find(params[:company_id])\n @products = @company.get_products()\n \n if(params[:year] and params[:year].numeric?)\n @year = params[:year].to_i\n else\n @year = Time.now.year\n end\n \n if(params[:month] and params[:month].numeric?)\n @month = params[:month].to_i\n else\n @month = Time.now.month\n end\n \n curr_year = Time.now.year\n c_year = curr_year\n c_month = 1\n \n @years = []\n @months = monthsArr\n @month_name = @months[@month - 1][0]\n \n @pagetitle = \"Monthly products report - #{@month_name} #{@year} - #{@company.name}\"\n \n while(c_year > Time.now.year - 5)\n @years.push(c_year)\n c_year -= 1\n end\n \n @dates = []\n end", "def create_monthly_data\n number = @slide_number.to_i + 1\n monthly_data = Nokogiri::HTML(\n open(\n \"#{ENV['API_DOMAIN_2']}#{ENV['API_DOMAIN_2_MONTHLY']}\"\n )\n ).css(\"div.shareable-section-wrapper\").last\n\n data = {\n sign: @sign_name.to_s,\n duration: \"monthly\",\n horoscope_text: monthly_data.css(\"div[#{number}]\").text.split(' ')[1..-1].join(' ')\n } if monthly_data\n Horoscope.create(data) if monthly_data and data\n end", "def total_invoices_current_year_by_month\n self.invoices\n .select(\"strftime('%m', issue_date) as month, COUNT(*) as total\")\n .where(\"strftime('%Y', issue_date) = ?\", Time.now.year.to_s)\n .group(\"strftime('%m', issue_date)\")\n .order(\"strftime('%m', issue_date)\")\n end", "def months\n find_period :months\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an Array of dependencies on the target
def dependency_list @target.dependencies.map(&:display_name) end
[ "def dependencies\n return @dependencies ||= []\n end", "def dependencies\n @target_dependencies + (@parent ? @parent.dependencies : [])\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def dependencies\n []\n end", "def dependencies\n @dependencies.values\n end", "def target_definition_list\n @dependencies_by_target_definition.keys\n end", "def dependencies_for(specification)\n []\n end", "def all_dependencies(targets)\n targets.to_h do |target|\n deps = target[:dependencies] || []\n deps = deps.delete_if { |dep| dep.include? '/' } # Remove subspecs\n [target[:name], deps]\n end\n end", "def dependent_gems\n out = []\n Gem.source_index.each do |name,gem|\n gem.dependencies.each do |dep|\n if self.satisfies_requirement?(dep) then\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [gem, dep, sats]\n end\n end\n end\n out\n end", "def remaining_dependencies\n dependencies = []\n @current_packages.each do |_, package|\n package.spec.dependencies.each do |dep|\n next if satisfy? dep\n dependencies << dep\n end\n end\n dependencies\n end", "def dependencies_for goal\n found, preconditions, next_action = dependencies.assoc(goal)\n preconditions = [preconditions].flatten.compact\n warn \"No origin for #{goal} goal\" unless found\n [found, preconditions, next_action]\n end", "def depends_on()\n if @value.nil?\n return []\n end\n unless @depends_on\n @depends_on = @value.variables.collect do |var|\n\ttmp = @parent.variable_by_name(var)\n\ttmp or raise \"Can't locate variable dependency '#{var}'!\"\n end\n end\n @depends_on\n end", "def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def dependency_paths\n @dependency_paths ||= []\n end", "def all_deps(specs)\n result = Set[]\n\n specs.each do |spec|\n spec.dependencies.each do |dep|\n name = dep.name.sub(/\\/.*/, '')\n result.add(name)\n end\n end\n\n result = result.to_a\n trace(' deps', *result)\n return result\nend", "def dependencies\n @dependencies ||= {}\n end", "def dependencies\n EMPTY_SET\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns names of files with duplicates imports.
def files_with_duplicate_imports files.select(&:has_duplicate_import?) end
[ "def remove_duplicate_imports\n files.each(&:remove_duplicate_imports)\n end", "def duplicate_imports_info\n import_frequency_mapping = {}\n all_imports.uniq.each do |item|\n item_occurrence = all_imports.count(item)\n if item_occurrence > 1\n import_frequency_mapping[item.chomp] = item_occurrence\n end\n end\n import_frequency_mapping\n end", "def warn_if_filenames_repeated\n all_files = @items.inject([]){|a,item| a += item.filenames}\n dup_files = all_files.find_all{|f| all_files.count(f) > 1}.uniq\n\n if dup_files.length > 0\n STDERR.puts \"\\nWARNING: A reference to one or more 'dspace.files' has been repeated.\"\n dup_files.sort.each{|f| STDERR.puts \"- 'dspace.files' filename: #{f}\"}\n end\n end", "def remove_duplicate_imports\n duplicate_imports_mapping = duplicate_imports_info\n duplicate_imports = duplicate_imports_mapping.keys\n file_lines = IO.readlines(@path, chomp: true).select do |line|\n if duplicate_imports.include? line\n if duplicate_imports_mapping[line] <= 1\n line\n else\n duplicate_imports_mapping[line] = duplicate_imports_mapping[line] - 1\n nil\n end\n else\n line\n end\n end\n File.open(@path, 'w') do |file|\n file.puts file_lines\n end\n end", "def has_duplicate_import?\n duplicate_imports_info.length > 0\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def uniq_name_files\n new_files = []\n @files.each do |f|\n n = f\n n[:name] += ' ' if new_files.count{|e| e[:name] == n[:name]} > 0\n new_files << n\n end\n new_files\n end", "def unique_modules\n @unique_modules\n end", "def duplicate_filenames\n sql = <<-SQL\n SELECT *\n FROM stash_engine_file_uploads AS a\n JOIN (SELECT upload_file_name\n FROM stash_engine_file_uploads\n WHERE resource_id = ? AND (file_state IS NULL OR file_state = 'created')\n GROUP BY upload_file_name HAVING count(*) >= 2) AS b\n ON a.upload_file_name = b.upload_file_name\n WHERE a.resource_id = ?\n SQL\n FileUpload.find_by_sql([sql, id, id])\n end", "def package_files\n (rdoc_files + lib_files + tests + doc_files + \n programs + extra_files + extension_files).uniq\n end", "def find_unique_files(first, exclude)\n file_list = []\n Find.find(first) do |file|\n relative_file_path = file.gsub(/#{first}/, '')\n next if $ignored_files.include? relative_file_path\n next if file == first\n relative_dir = file.gsub(/#{first}/, '')\n Find.prune if $ignored_dirs.include? relative_dir\n next if FileTest.directory?(file)\n # Make sure this file isn't in a path in the 'exclude' array\n exclude_file = false\n exclude.each do |dir|\n if relative_file_path =~ /^#{dir}/\n exclude_file = true\n break\n end\n end\n unless exclude_file\n file_list << relative_file_path\n end\n end\n\n file_list\nend", "def get_imports (path)\n imports = []\n puts \"path: #{path}\"\n for line in `otool -L '#{path}'`.split(\"\\n\")\n if line =~ /^\\t(.*)\\s*\\(.*\\)$/\n import = Pathname.new($1.rstrip)\n if import.basename != path.basename\n imports << import\n end\n end\n end\n return imports\nend", "def importer_names\n importers.map{|e| e.const_name }\n end", "def resolve_conflict(files)\n filename = files\n .map {|f| f['path']}\n .sort\n .first\n puts %[rm \"#{filename}\"]\nend", "def duplicate_paths\n @check_target_paths.select do |file|\n is_duplicate?(file.basename)\n end\n end", "def all_file_names\n @all_file_names ||= (local_files.keys | remote_files.keys).sort\n end", "def files_unique? files, case_sensitive: false\n bases = files.map { |f| File.basename f }\n bases.map! &:downcase unless case_sensitive\n\n return true if bases.size == bases.uniq.size\n\n dupes = bases.select { |base| # find repeated basenames\n bases.count(base) > 1\n }.uniq.map { |base| # get the full paths for the repeats\n regex = case_sensitive ? /\\/#{base}$/ : /\\/#{base}$/i\n files.grep regex\n }\n LOGGER.error(COMMAND) {\n \"Refusing to process files with identical base names (case_sensitive=#{case_sensitive}): #{dupes}\"\n }\n false\nend", "def source_files\n instance_methods.map(&:file).compact.uniq\n end", "def mtime_including_imports(file)\n mtimes = [mtime(file)]\n File.readlines(file).each do |line|\n next unless line =~ /^\\s*@import ['\"]([^'\"]+)/\n\n imported = File.join(File.dirname(file), Regexp.last_match[1])\n\n # complete path given ?\n mod_time = if imported =~ /\\.le?ss$/\n mtime(imported)\n else\n # we need to add .less or .lss\n [mtime(\"#{imported}.less\"), mtime(\"#{imported}.lss\")].max\n end\n mtimes << mod_time\n end\n mtimes.max\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the unused dependencies on the target
def unused_dependencies_list imports = all_unique_imports.map { |import| import.split.last } dependency_list - imports end
[ "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def remaining_dependencies\n dependencies = []\n @current_packages.each do |_, package|\n package.spec.dependencies.each do |dep|\n next if satisfy? dep\n dependencies << dep\n end\n end\n dependencies\n end", "def dependencies\n cached_dependencies.reject { |d| ignored?(d) }\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def unresolved\n dependencies.inject([]){ |list,dep| \n (!dep.met && !dep.resolved) ? (list << dep) : (list)\n }\n end", "def dependency_list\n @target.dependencies.map(&:display_name)\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def missing_dependencies\n dependencies.keys.select{|m| !method_defined?(m) && !private_method_defined?(m)}\n end", "def target_definition_list\n @dependencies_by_target_definition.keys\n end", "def dependencies\n []\n end", "def dependencies\n EMPTY_SET\n end", "def dependencies\n @target_dependencies + (@parent ? @parent.dependencies : [])\n end", "def dependencies\n @dependencies.values\n end", "def dependencies\n return @dependencies ||= []\n end", "def list_build_dependencies\n @project.components.map(&:build_requires).flatten.uniq - @project.components.map(&:name)\n end", "def discover_deps\n log = Build.logger\n\n # list of targets that may need building, separated by type (found by following\n # dependencies of top-level targets)\n #\n @t_groups = {\n :src => [], :as => [], :cc => [], :cxx => [], :lib => [], :exe => [],\n }\n log.debug \"Discovering header file dependencies ...\"\n\n # @redundant -- holds top-level targets that are redundant due to being dependencies\n # of other top-level targets\n #\n @redundant = Set[]\n @targets.each { |tgt|\n next if @redundant.include? tgt\n raise \"Top-level target %s already visited but not in @redundant\" % tgt.path if\n tgt.visit\n\n # this allows us, when we discover a redundant top-level target T, to print the\n # name of the top-level target of which T is a dependency\n #\n @top = tgt\n\n target_deps tgt\n }\n if !@redundant.empty? # remove redundant targets\n before = @targets.size\n @targets -= @redundant\n msg = (\"Removed %d redundant targets from top-level list, @targets.size: \" +\n \"%d --> %d\") % [@redundant.size, before, @targets.size]\n log.info msg\n end\n\n # wait for dependency discovery tasks to complete\n @lock.synchronize {\n # enqueued task count is negative, so negate it\n @deps_enq_cnt = -@deps_enq_cnt\n\n # in the unlikely but possible case that all enqueued tasks are done, no need to\n # wait\n #\n if @deps_enq_cnt == @deps_done_cnt\n log.info \"All dependency discovery tasks already done, no need to wait\"\n else\n # wait on condition variable until it is signalled by a thread indicating that\n # dependency tasks have completed\n # might need to add \"... until @needs.empty?\" here if we get spurious signals\n #\n @done.wait @lock\n raise \"Spurious signal: enqueued count (%d) != completed count (%d)\" %\n [@deps_enq_cnt, @deps_done_cnt] if @deps_enq_cnt != @deps_done_cnt\n log.info \"Got signal: dependency dicovery tasks completed.\"\n end\n } # synchronize\n\n # Convert list of header file names into objects and add to @deps;\n # this needs to be single threaded since it reads/modifies global target list\n # Add \"@t_groups[ :as ] + \" if necessary; currently, we assume assembler files do\n # not have included header files.\n #\n list = @t_groups[ :cc ] + @t_groups[ :cxx ]\n list.map( &:hdrs_to_deps )\n\n # remove the transient field @visit in each target; we'll get an exception if the\n # field does not exist\n #\n # This may be useful later so we no longer remove it\n # @t_groups.each_value{ |list| list.map( &:remove_visit ) }\n\n log.debug \"... done discovering header file dependencies\"\n end", "def degraded_dependencies\n str_report = Rails.cache.read(:dependencies_report)\n return [] if !str_report\n\n report = JSON.parse str_report\n report.values.each_with_object([]) do |element, result|\n result << element[\"name\"] if element[\"up_rate_5\"].to_i < 50\n end\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removed the unused target dependencies on the target.
def remove_unused_dependencies # puts 'removing unused dependencies list.' dependencies = @target.dependencies dependencies.each do |dependency| dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name end end
[ "def remove_all_dependencies\n super\n end", "def delete_dependencies\n raise 'Not implemented'\n end", "def prune_dependencies\n class_names = @classes.map {|klass| klass.name}\n @classes.each do |klass|\n klass.dependencies = klass.dependencies.uniq.keep_if {|dep| class_names.include?(dep)}\n end\n end", "def remove_from_dependencies\n dependencies.each do |dependency|\n dependency.dependents.delete(self)\n end\n dependencies.clear\n end", "def remove\n changed!\n @dependencies = nil\n end", "def clean()\n\t\tSystem::clean target()\n\tend", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def delete_all_targets\n\t\tTarget.delete_all\n\tend", "def RemoveObsoleteResolvables\n Builtins.y2milestone(\"--------- removing obsolete selections ---------\")\n\n # this removes only information about selections and applied patches\n # it doesn't remove any package\n Builtins.y2milestone(\n \"Removing all information about selections and patches in %1\",\n Installation.destdir\n )\n Pkg.TargetStoreRemove(Installation.destdir, :selection)\n\n # disabled by FATE #301990, bugzilla #238488\n # Pkg::TargetStoreRemove (Installation::destdir, `patch);\n\n Builtins.y2milestone(\"--------- removing obsolete selections ---------\")\n\n nil\n end", "def destroy_dependencies\n question_dependencies.each { |dep| dep.destroy }\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def remove_all_dependencies(opts)\n opts = check_params(opts,[:members])\n super(opts)\n end", "def clean!\n dedupe!\n remove_unreflected_preloads!\n end", "def clean()\n rels = releases()\n rels.pop()\n\n unless rels.empty?\n rm = ['rm', '-rf'].concat(rels.map {|r| release_dir(r)})\n rm << release_dir('skip-*')\n cmd.ssh(rm)\n end\n end", "def remove_unfulfilled_dependencies(leaf, raise_on_missing = true, processed = {})\n tree.dependencies.each do |package, dependency|\n dependency.versions.select! do |version, leaf|\n if processed[version]\n true\n else\n processed[version] = true\n\n # Remove unfulfilled transitive dependencies\n remove_unfulfilled_dependencies(leaf, false, processed)\n valid = true\n leaf.dependencies.each do |k, v|\n valid = false if v.versions.empty?\n end\n valid\n end\n end\n if dependency.versions.empty? && raise_on_missing\n error(\"No valid version found for package #{package}\")\n end\n end\n end", "def remove_from_dependents\n dependents.each do |dependent|\n dependent.dependencies.delete(self)\n end\n former_dependents = dependents.dup\n dependents.clear\n propagate_remove(former_dependents)\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def prune_dependencies\n class_names = @classes.map {|klass| klass.name}\n @classes.each do |klass|\n klass.dependencies = klass.dependencies.map do |dep|\n dep_split = dep.split('::')\n if class_names.include?(dep)\n next dep\n end\n klass_split = klass.name.split('::')\n if klass_split.size != dep_split.size\n klass_split.pop(dep_split.size)\n else\n klass_split.pop(dep_split.size - 1)\n end\n (klass_split + dep_split).join('::')\n end\n klass.dependencies = klass.dependencies.uniq.keep_if {|dep| dep != klass.name && class_names.include?(dep)}\n end\n end", "def clear_prerequisites; end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all the duplicate import statements from all the files linked to the target
def remove_duplicate_imports files.each(&:remove_duplicate_imports) end
[ "def remove_duplicate_imports\n duplicate_imports_mapping = duplicate_imports_info\n duplicate_imports = duplicate_imports_mapping.keys\n file_lines = IO.readlines(@path, chomp: true).select do |line|\n if duplicate_imports.include? line\n if duplicate_imports_mapping[line] <= 1\n line\n else\n duplicate_imports_mapping[line] = duplicate_imports_mapping[line] - 1\n nil\n end\n else\n line\n end\n end\n File.open(@path, 'w') do |file|\n file.puts file_lines\n end\n end", "def files_with_duplicate_imports\n files.select(&:has_duplicate_import?)\n end", "def fix_imports\n @config.refresh\n eslint_result = run_eslint_command\n undefined_variables = eslint_result.map do |line|\n /([\"'])([^\"']+)\\1 is not defined/.match(line) do |match_data|\n match_data[2]\n end\n end.compact.uniq\n\n unused_variables = eslint_result.map do |line|\n /\"([^\"]+)\" is defined but never used/.match(line) do |match_data|\n match_data[1]\n end\n end.compact.uniq\n\n old_imports = find_current_imports\n new_imports = old_imports[:imports].reject do |import_statement|\n unused_variables.each do |unused_variable|\n import_statement.delete_variable(unused_variable)\n end\n import_statement.variables.empty?\n end\n\n undefined_variables.each do |variable|\n if js_module = find_one_js_module(variable)\n inject_js_module(variable, js_module, new_imports)\n end\n end\n\n replace_imports(old_imports[:newline_count],\n new_imports,\n old_imports[:imports_start_at])\n end", "def remove_python_compiled_files path\n Find.find(path) do |path|\n if path.end_with?'.pyc' or path.end_with?'.pyo'\n FileUtils.rm path\n end\n end\n end", "def clean!\n dedupe!\n remove_unreflected_preloads!\n end", "def clean_up\n FileUtils.rm(\n Dir.glob('build/{src,lib}.{rb,c,js}') +\n Dir.glob('build/ruby2d-opal.{rb,js}') +\n Dir.glob('build/app.c')\n )\nend", "def clean_genFiles\n module_names = Dir[\"**/*.fun\"].map{|mn| mn.chomp(\".fun\")}\n tbCancelled = module_names.map{|mn| mn+\"_fun.\"} + [\"TestRunner.\"]\n tbCancelled = tbCancelled.map{|tbc| [tbc+\"f90\",tbc+\"o\",tbc+\"MOD\"]}.flatten\n tbCancelled += Dir[\"**/TestRunner\"]\n tbCancelled += Dir[\"**/makeTestRunner\"]\n tbCancelled = (tbCancelled+tbCancelled.map{|tbc| tbc.downcase}).uniq\n FileUtils.rm_f(tbCancelled)\n end", "def remove_replaced_files!\n sources.reject! do |sf|\n !sf.provides.empty? && sf.provides.any? { |tag| replacements_tree[tag] && replacements_tree[tag] != sf }\n end\n end", "def fix_imports\n reload_config\n eslint_result = run_eslint_command\n\n return if eslint_result.empty?\n\n unused_variables = {}\n undefined_variables = Set.new\n\n eslint_result.each do |line|\n match = REGEX_ESLINT_RESULT.match(line)\n next unless match\n if match[:type] == 'is defined but never used'\n unused_variables[match[:variable_name]] ||= Set.new\n unused_variables[match[:variable_name]].add match[:line].to_i\n else\n undefined_variables.add match[:variable_name]\n end\n end\n\n return if unused_variables.empty? && undefined_variables.empty?\n\n old_imports = find_current_imports\n\n # Filter out unused variables that do not appear within the imports block.\n unused_variables.select! do |_, line_numbers|\n any_numbers_within_range?(line_numbers, old_imports[:range])\n end\n\n new_imports = old_imports[:imports].clone\n new_imports.delete_variables!(unused_variables.keys)\n\n undefined_variables.each do |variable|\n js_module = find_one_js_module(variable)\n next unless js_module\n new_imports << js_module.to_import_statement(variable, @config)\n end\n\n replace_imports(old_imports[:range], new_imports)\n end", "def remove_unnecessary_require\n service_files = grpc_out_ruby_files.select do |v|\n name = File.basename(v)\n name.end_with?(\"_pb.rb\") && name.include?(\"_services_\")\n end\n service_files.each do |path|\n source = open(path)\n .read\n .split(\"\\n\")\n .reject { |line| line =~ /^require / && !line.include?(\"grpc\") }.join(\"\\n\")\n open(path, \"w\") do |f|\n f.write source\n end\n end\n\n without_service_files = grpc_out_ruby_files.select do |v|\n name = File.basename(v)\n name.end_with?(\"_pb.rb\") && !name.include?(\"_services_\")\n end\n without_service_files.each do |path|\n source = open(path)\n .read\n .split(\"\\n\")\n .reject { |line| line =~ /^require / && !line.include?(\"google/protobuf\") }.join(\"\\n\")\n open(path, \"w\") do |f|\n f.write source\n end\n end\n end", "def update_includes\n includes.reject! do |include|\n mod = include.module\n !(String === mod) && @store.modules_hash[mod.full_name].nil?\n end\n\n includes.uniq!\n end", "def delete_all\n @loaded_constants.each do |const_name|\n if Object.const_defined?(const_name)\n Object.send(:remove_const, const_name)\n end\n end\n Ichiban::HTMLCompiler::Context.clear_user_defined_helpers\n end", "def remove_moved_files\n scan_for_merges.each do |file|\n if File.amp_lexist?(@repo.working_join(file))\n UI.debug(\"removing #{file}\")\n File.unlink(@repo.working_join(file))\n end\n end\n end", "def merge(file)\n content = super.gsub(/^\\s*@import(?:\\surl\\(|\\s)(['\"]?)([^\\?'\"\\)\\s]+)(\\?(?:[^'\"\\)]*))?\\1\\)?(?:[^?;]*);?/i, \"\")\n dir = File.expand_path(File.dirname(file))\n\n content.scan(/url\\([\\s\"']*([^\\)\"'\\s]*)[\\s\"']*\\)/m).uniq.collect do |url|\n url = url.first\n path = resolve_path(url, dir)\n content.gsub!(/\\([\\s\"']*#{Regexp.escape(url)}[\\s\"']*\\)/m, \"(#{path})\") unless path == url\n end\n\n content\n end", "def clean_includes\n FileUtils.rm_r @project.build_path.join('includes')\n end", "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def disable_imports_from(name)\n Autoproj.workspace.manifest.disable_imports_from(name)\nend", "def clear_import_errors!\n update!(import_errors: nil)\n end", "def delete_unused_associations_files\n _delete_unused_associations_file(@unused_associations_coverage_file)\n _delete_unused_associations_file(@unused_associations_file)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /businessbooks GET /businessbooks.json
def index @businessbooks = Businessbook.search(params[:search]).paginate(:per_page => 18, :page => params[:page]) respond_to do |format| format.html # index.html.erb format.json { render :json => @businessbooks } end end
[ "def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def index\n @biblebooks = Biblebook.all\n\n respond_to do |format|\n format.html\n format.json{ render json: @biblebooks, root: false}\n end\n end", "def index\n @books = get_books()\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def index\n @books = Book.all\n render json: @books\n end", "def index\n @businesses = Business.all\n render json: @businesses\n end", "def index\n render json: user_shelf.books\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @businesses = Business.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @businesses }\n end\n end", "def get_books_by_category(categories)\n rest_output = RestClient.get get_category_books_api(categories), @header\n JSON.parse(rest_output)\n end", "def show\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def show\n @bank_book = BankBook.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank_book }\n end\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def new\n @businessbook = Businessbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def index\n @lendbooks = Lendbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lendbooks }\n end\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /businessbooks/1 GET /businessbooks/1.json
def show @businessbook = Businessbook.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @businessbook } end end
[ "def index\n @businessbooks = Businessbook.search(params[:search]).paginate(:per_page => 18, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @businessbooks }\n end\n end", "def index\n @biblebooks = Biblebook.all\n\n respond_to do |format|\n format.html\n format.json{ render json: @biblebooks, root: false}\n end\n end", "def index\n @books = get_books()\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def index\n @books = Book.all\n render json: @books\n end", "def show\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end", "def show\n @bank_book = BankBook.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank_book }\n end\n end", "def show\n \n @bank_book = BankBook.first(:id => params[:id].to_i)\n # @bank_book = BankBook.get(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank_book }\n end\n end", "def index\n @businesses = Business.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @businesses }\n end\n end", "def index\n @businesses = Business.all\n render json: @businesses\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n render json: user_shelf.books\n end", "def new\n @businessbook = Businessbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def show\n @business = Business.find_by(id: business_params[:id])\n if @business\n render json: @business, status: 200\n else\n render json: { errors: t(\"api.errors.business.does_not_exist\") }, status: 404\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def show\n @booksale = Booksale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @booksale }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def search_specifc_book(id_book,book_title,book_id,book_publishDate)\n @response = self.class.get(\"/Books/#{id_book}\",\n :headers => {\"Content-Type\": 'application/json; charset=utf-8; v=1.0', \"path\": \"#{$id_book}\"}) \n $book_title = @response[\"title\"]\n $book_id = @response[\"id\"]\n end", "def show\n @business_item = BusinessItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business_item }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /businessbooks/new GET /businessbooks/new.json
def new @businessbook = Businessbook.new respond_to do |format| format.html # new.html.erb format.json { render :json => @businessbook } end end
[ "def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end", "def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end", "def new\n @business = Business.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business }\n end\n end", "def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end", "def new\n @books_on_loan = BooksOnLoan.new\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end", "def new\n @bank_book = BankBook.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank_book }\n end\n end", "def new\n @business = Business.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business }\n end\n end", "def new\n @bank_book = BankBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank_book }\n end\n end", "def new\n @booksalecategory = Booksalecategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @booksalecategory }\n end\n end", "def new\n @bb = Bb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bb }\n end\n end", "def new\n @businesscategory = Businesscategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @businesscategory }\n end\n end", "def new\n @books_category = BooksCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @books_category }\n end\n end", "def new\n @book_category = BookCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_category }\n end\n end", "def new\n @book_collection = BookCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_collection }\n end\n end", "def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end", "def new\n @book_url = BookUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_url }\n end\n end", "def new\n @business_document_type = BusinessDocumentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business_document_type }\n end\n end", "def new\n @business_type = BusinessType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business_type }\n end\n end", "def new\n @business_info = BusinessInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business_info }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /businessbooks POST /businessbooks.json
def create @businessbook = Businessbook.new(params[:businessbook]) respond_to do |format| if @businessbook.save format.html { redirect_to @businessbook, :notice => 'Businessbook was successfully created.' } format.json { render :json => @businessbook, :status => :created, :location => @businessbook } else format.html { render :action => "new" } format.json { render :json => @businessbook.errors, :status => :unprocessable_entity } end end end
[ "def create\n @books_on_loan = BooksOnLoan.new(params[:books_on_loan])\n respond_to do |format|\n if @books_on_loan.save\n format.json { render json: @books_on_loan, status: :created, \n location: @books_on_loan }\n else\n format.json { render json: @books_on_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def create_booking(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/bookings',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def create\n @bank_book = BankBook.new(params[:bank_book])\n\n respond_to do |format|\n if @bank_book.save\n format.html { redirect_to @bank_book, notice: 'Bank book was successfully created.' }\n format.json { render json: @bank_book, status: :created, location: @bank_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bank_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @businessbook = Businessbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def create\n @booking = Booking.new(booking_params)\n if @booking.save\n render json: @booking\n else\n render json: @booking.errors\n end\n end", "def create\n @booksale = Booksale.new(params[:booksale])\n\n respond_to do |format|\n if @booksale.save\n format.html { redirect_to @booksale, :notice => 'Booksale was successfully created.' }\n format.json { render :json => @booksale, :status => :created, :location => @booksale }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @booksale.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @business = @user.businesses.build(business_params)\n\n respond_to do |format|\n if @business.save\n format.html { redirect_to root_path(@user), notice: 'Business was successfully created.' }\n format.json { render :show, status: :created, location: @business }\n else\n format.html { render :new }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booksalecategory = Booksalecategory.new(params[:booksalecategory])\n\n respond_to do |format|\n if @booksalecategory.save\n format.html { redirect_to @booksalecategory, :notice => 'Booksalecategory was successfully created.' }\n format.json { render :json => @booksalecategory, :status => :created, :location => @booksalecategory }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @booksalecategory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @add_book = AddBook.new(add_book_params)\n\n respond_to do |format|\n if @add_book.save\n format.html { redirect_to @add_book, notice: 'Add book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @add_book }\n else\n format.html { render action: 'new' }\n format.json { render json: @add_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def create\n @boc = Boc.new(boc_params)\n\n respond_to do |format|\n if @boc.save\n format.html { redirect_to new_boc_path, notice: 'Boc was successfully created.' }\n format.json { render :show, status: :created, location: @boc }\n else\n format.html { render :new }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_book = Api::Book.new(api_book_params)\n respond_to do |format|\n if @api_book.save\n format.html { redirect_to @api_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @api_book }\n else\n format.html { render :new }\n format.json { render json: @api_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n @boat.save!\n render :json => @boat.as_json\n end", "def create\n @books_on_loan = BooksOnLoan.new(books_on_loan_params)\n\n respond_to do |format|\n if @books_on_loan.save\n format.html { redirect_to @books_on_loan, notice: 'Books on loan was successfully created.' }\n format.json { render :show, status: :created, location: @books_on_loan }\n else\n format.html { render :new }\n format.json { render json: @books_on_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bookmark = Bookmark.new(params[:bookmark])\n# req = ActiveSupport::JSON.decode(request.body)\n# @bookmark = Bookmark.new(req)\n\n respond_to do |format|\n if @bookmark.save\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully created.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @businesscategory = Businesscategory.new(params[:businesscategory])\n\n respond_to do |format|\n if @businesscategory.save\n format.html { redirect_to @businesscategory, :notice => 'Businesscategory was successfully created.' }\n format.json { render :json => @businesscategory, :status => :created, :location => @businesscategory }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @businesscategory.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /businessbooks/1 PUT /businessbooks/1.json
def update @businessbook = Businessbook.find(params[:id]) respond_to do |format| if @businessbook.update_attributes(params[:businessbook]) format.html { redirect_to @businessbook, :notice => 'Businessbook was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @businessbook.errors, :status => :unprocessable_entity } end end end
[ "def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Biblebook.update(params[:id], params[:biblebook])\n end", "def update\n update_object(@business, \"#{businesses_url}?scheme_id=#{@business.scheme_id}\", business_params)\n end", "def update\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n if @books_on_loan.update_attributes(params[:books_on_loan])\n format.json { head :no_content }\n else\n format.json { render json: @books_on_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find_by_id(params[:id])\n\n if @book.present?\n if @book.update(book_params)\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end", "def update\n @booking.update_attributes(params[:booking])\n respond_with(@booking, location: bnb_bookings_url(@booking.bnb))\n end", "def update_booking(booking_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/bookings/{booking_id}',\n 'default')\n .template_param(new_parameter(booking_id, key: 'booking_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to_update({thing: @book})\n end", "def update\n respond_to do |format|\n data = api_book_params\n logger.info data\n if @api_book.update(data)\n format.html { redirect_to @api_book, notice: 'Book was successfully updated.' }\n format.json { render :show }\n else\n format.html { render :edit }\n format.json { render json: @api_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business_object = BusinessObject.find(params[:id])\n\n respond_to do |format|\n if @business_object.update_attributes(params[:business_object])\n format.html { redirect_to @business_object, :notice => 'Business object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @business_object.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @business_document_type = BusinessDocumentType.find(params[:id])\n\n respond_to do |format|\n if @business_document_type.update_attributes(params[:business_document_type])\n format.html { redirect_to @business_document_type, notice: 'Business document type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business_document_type.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 respond_to do |format|\n if @bookshelf.update(bookshelf_params)\n format.html { redirect_to @bookshelf, notice: 'Bookshelf was successfully updated.' }\n format.json { render :show, status: :ok, location: @bookshelf }\n else\n format.html { render :edit }\n format.json { render json: @bookshelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to backstage_books_url, notice: 'book was successfully updated.' }\n # format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n # format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bank_book = BankBook.get(params[:id])\n \n respond_to do |format|\n if @bank_book.update(params[:bank_book])\n format.html { redirect_to @bank_book, notice: 'Bank book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bank_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @add_book.update(add_book_params)\n format.html { redirect_to @add_book, notice: 'Add book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @add_book.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /businessbooks/1 DELETE /businessbooks/1.json
def destroy @businessbook = Businessbook.find(params[:id]) @businessbook.destroy respond_to do |format| format.html { redirect_to businessbooks_url } format.json { head :no_content } end end
[ "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def destroy\n @business = Business.find(params[:id])\n @business.destroy\n\n respond_to do |format|\n format.html { redirect_to businesses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @books_on_loan = BooksOnLoan.find(params[:id])\n @books_on_loan.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to deleted_books_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @boc.destroy\n respond_to do |format|\n format.html { redirect_to bocs_url, notice: 'Boc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank_book = BankBook.get(params[:id])\n @bank_book.destroy\n \n respond_to do |format|\n format.html { redirect_to bank_books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_whole.destroy\n respond_to do |format|\n format.html { redirect_to book_wholes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank_book = BankBook.get(params[:id])\n @bank_book.destroy\n\n respond_to do |format|\n format.html { redirect_to bank_books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @biblebook.destroy\n respond_to do |format|\n format.html { redirect_to biblebooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @business_item = BusinessItem.find(params[:id])\n @business_item.destroy\n\n respond_to do |format|\n format.html { redirect_to business_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @primary_business = PrimaryBusiness.find(params[:id])\n @primary_business.destroy\n\n respond_to do |format|\n format.html { redirect_to primary_businesses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.book_identifier.delete rescue nil\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booksale = Booksale.find(params[:id])\n @booksale.destroy\n\n respond_to do |format|\n format.html { redirect_to booksales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bookshelf = Bookshelf.find(params[:id])\n @bookshelf.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookshelves_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @business = Business.find(params[:id])\n @business.destroy\n\n respond_to do |format|\n format.html { redirect_to(businesses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booksalecategory = Booksalecategory.find(params[:id])\n @booksalecategory.destroy\n\n respond_to do |format|\n format.html { redirect_to booksalecategories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @businesscategory = Businesscategory.find(params[:id])\n @businesscategory.destroy\n\n respond_to do |format|\n format.html { redirect_to businesscategories_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /admin/digersayfas GET /admin/digersayfas.json
def index @admin_digersayfas = Admin::Digersayfa.all end
[ "def index\n @admin_pricing_kalafs = [Admin::Pricing::Kalaf.last] - [nil]\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_kalafs.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end", "def index\n @almanac_days = AlmanacDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @almanac_days }\n end\n end", "def index\n return if !current_user.admin?\n @disfrazs = Disfraz.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disfrazs }\n end\n end", "def update\n respond_to do |format|\n if @admin_digersayfa.update(admin_digersayfa_params)\n format.html { redirect_to @admin_digersayfa, notice: 'Digersayfa was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_digersayfa }\n else\n format.html { render :edit }\n format.json { render json: @admin_digersayfa.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @frais_deplacements = FraisDeplacement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_deplacements }\n end\n end", "def destroy\n @admin_digersayfa.destroy\n respond_to do |format|\n format.html { redirect_to admin_digersayfas_url, notice: 'Digersayfa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @admin_pricing_foams = Admin::Pricing::Foam.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_foams.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end", "def index\n @karyalay_samagris = KaryalaySamagri.all\n render json: @karyalay_samagris\n end", "def index\n @admin_pricing_fabrics = Admin::Pricing::Fabric.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_fabrics.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end", "def index\n @frais_annexes = FraisAnnex.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_annexes }\n end\n end", "def index\n @appraisal_fees = AppraisalFee.all\n end", "def index\n @discharges = Discharge.all\n render json: @discharges\n end", "def index\n @api_dishes = Dish.all\n end", "def show\n @ngay = Ngay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ngay }\n end\n end", "def index\n @trial_days = TrialDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trial_days }\n end\n end", "def index\n @daw_asignaturas = DawAsignatura.all\n end", "def daily_food_goal\n get(\"/user/#{@user_id}/foods/log/goal.json\")\n end", "def index\n @admin_grampanchyats = Admin::Grampanchyat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_grampanchyats }\n end\n end", "def index\n @freelaws = Freelaw.ordered_roots\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @freelaws }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /admin/digersayfas POST /admin/digersayfas.json
def create @admin_digersayfa = Admin::Digersayfa.new(admin_digersayfa_params) @turad = { 0 => "Bilim İnsanları", 1 => "Resmi Evraklar", 2 => "İlginç Bilgiler", 3 => "Motivasyon", 4 => "Sınav Sistemi"} @tur = { 0 => "biliminsanlari", 1 => "resmievraklar", 2 => "ilgincbilgiler", 3 => "motivasyon", 4 => "sinavsistemi"} respond_to do |format| if @admin_digersayfa.save Admin::Duyuru.create(aciklama: @admin_digersayfa.created_at.to_s.split(" ")[0] + " " + @turad[@admin_digersayfa.tur] + " " + @admin_digersayfa.baslik + " yazısı eklenmiştir.<a href=/" + @tur[@admin_digersayfa.tur] + "> Yazıya ulaşmak için tıklayınız. </a>", tur: 0) format.html { redirect_to @admin_digersayfa, notice: 'Yazı başarılı bir şekilde oluşturuldu.' } format.json { render :show, status: :created, location: @admin_digersayfa } else format.html { render :new } format.json { render json: @admin_digersayfa.errors, status: :unprocessable_entity } end end end
[ "def update\n respond_to do |format|\n if @admin_digersayfa.update(admin_digersayfa_params)\n format.html { redirect_to @admin_digersayfa, notice: 'Digersayfa was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_digersayfa }\n else\n format.html { render :edit }\n format.json { render json: @admin_digersayfa.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @free_day = FreeDay.new(free_day_params)\n respond_to do |format|\n if @free_day.save\n format.html { redirect_to free_days_path, notice: 'Free day was successfully created.' }\n format.json { render :show, status: :created, location: @free_day }\n else\n @free_days = FreeDay.all\n format.html { render :index }\n format.json { render json: json_errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gaz_assay = GazAssay.new(params[:gaz_assay])\n @authorized_user = User.find(session[:user_id])\n respond_to do |format|\n if @gaz_assay.save\n format.html { redirect_to gaz_assays_url, notice: 'Данные нового анализа газа успешно записаны.' }\n format.json { render json: @gaz_assay, status: :created, location: @gaz_assay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gaz_assay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ngay = Ngay.new(params[:ngay])\n\n respond_to do |format|\n if @ngay.save\n format.html { redirect_to @ngay, notice: 'Ngay was successfully created.' }\n format.json { render json: @ngay, status: :created, location: @ngay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ngay.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @admin_digersayfas = Admin::Digersayfa.all\n end", "def create\n @sanchaypatra = current_user.sanchaypatras.new(sanchaypatra_params)\n @sanchaypatra.generate_tokens\n\n respond_to do |format|\n if @sanchaypatra.save\n format.html { redirect_to sanchaypatras_url, notice: 'Sanchaypatra was successfully created.' }\n format.json { render :show, status: :created, location: @sanchaypatra }\n else\n format.html { render :new }\n format.json { render json: @sanchaypatra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_despesa = TipoDespesa.new(tipo_despesa_params)\n\n respond_to do |format|\n if @tipo_despesa.save\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_despesa }\n else\n format.html { render :new }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shipping_fee = ShippingFee.new(shipping_fee_params)\n\n respond_to do |format|\n if @shipping_fee.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @admin_digersayfa.destroy\n respond_to do |format|\n format.html { redirect_to admin_digersayfas_url, notice: 'Digersayfa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @sgda_seller_goal_day = SgdaSellerGoalDay.new(sgda_seller_goal_day_params)\n\n respond_to do |format|\n if @sgda_seller_goal_day.save\n format.html { redirect_to @sgda_seller_goal_day, notice: 'Sgda seller goal day was successfully created.' }\n format.json { render :show, status: :created, location: @sgda_seller_goal_day }\n else\n format.html { render :new }\n format.json { render json: @sgda_seller_goal_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @arc_barangay = ArcBarangay.new(arc_barangay_params)\n\n respond_to do |format|\n if @arc_barangay.save\n format.html { redirect_to @arc_barangay, notice: 'Arc barangay was successfully created.' }\n format.json { render action: 'show', status: :created, location: @arc_barangay }\n else\n format.html { render action: 'new' }\n format.json { render json: @arc_barangay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pendaftaran = Pendaftaran.new(pendaftaran_params)\n no_pendaftaran = generate_no_pendaftaran\n npwpd = @pendaftaran.npwpd\n @pendaftaran.no_pendaftaran = no_pendaftaran\n @pendaftaran.no_reg_pendaftaran = no_pendaftaran + '/' + Date.today.year.to_s\n @pendaftaran.npwpd = npwpd[0..3] + no_pendaftaran + '.' + Kecamatan.find(@pendaftaran.kecamatan_id).kode + '.' + Kelurahan.find(@pendaftaran.kelurahan_id).kode\n respond_to do |format|\n if @pendaftaran.save\n format.html { redirect_to @pendaftaran, notice: 'Pendaftaran berhasil tersimpan' }\n format.json { render :show, status: :created, location: @pendaftaran }\n else\n format.html { render :new }\n format.json { render json: @pendaftaran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_pricing_kalaf = Admin::Pricing::Kalaf.new(admin_pricing_kalaf_params)\n\n respond_to do |format|\n if @admin_pricing_kalaf.save\n format.html { redirect_to admin_pricing_kalafs_path, notice: mk_notice(@admin_pricing_kalaf, :id, 'Kalaf', :create) }\n format.json { render json: @admin_pricing_kalaf, status: :created, location: admin_pricing_kalafs_path }\n else\n format.html { render :new }\n format.json { render json: @admin_pricing_kalaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n response = send_fax(params)\n render json: response\n\n end", "def create\n @barangay = Barangay.new(barangay_params)\n\n respond_to do |format|\n if @barangay.save\n format.html { redirect_to @barangay, notice: 'Barangay was successfully created.' }\n format.json { render :show, status: :created, location: @barangay }\n else\n format.html { render :new }\n format.json { render json: @barangay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daw_asignatura = DawAsignatura.new(daw_asignatura_params)\n\n respond_to do |format|\n if @daw_asignatura.save\n format.html { redirect_to @daw_asignatura, notice: 'Daw asignatura was successfully created.' }\n format.json { render :show, status: :created, location: @daw_asignatura }\n else\n format.html { render :new }\n format.json { render json: @daw_asignatura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @masut_assay = MasutAssay.new(params[:masut_assay])\n\n respond_to do |format|\n if @masut_assay.save\n format.html { redirect_to masut_assays_url, notice: 'Данные нового анализа мазута успешно записаны.' }\n format.json { render json: @masut_assay, status: :created, location: @masut_assay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @masut_assay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pendaftaran_kela = PendaftaranKela.new(pendaftaran_kela_params)\n\n respond_to do |format|\n if @pendaftaran_kela.save\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully created.' }\n format.json { render :show, status: :created, location: @pendaftaran_kela }\n else\n format.html { render :new }\n format.json { render json: @pendaftaran_kela.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /admin/digersayfas/1 PATCH/PUT /admin/digersayfas/1.json
def update respond_to do |format| if @admin_digersayfa.update(admin_digersayfa_params) format.html { redirect_to @admin_digersayfa, notice: 'Digersayfa was successfully updated.' } format.json { render :show, status: :ok, location: @admin_digersayfa } else format.html { render :edit } format.json { render json: @admin_digersayfa.errors, status: :unprocessable_entity } end end end
[ "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_pricing_kalaf.update(admin_pricing_kalaf_params)\n format.html { redirect_to admin_pricing_kalafs_path, notice: mk_notice(@admin_pricing_kalaf, :id, 'Kalaf', :update) }\n format.json { render json: @admin_pricing_kalaf, status: :ok, location: admin_pricing_kalafs_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_pricing_kalaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_admin.update(api_v1_admin_params)\n format.html { redirect_to @api_v1_admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_v1_post_flag = PostFlag.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_flag.update_attributes(params[:api_v1_post_flag])\n format.html { redirect_to @api_v1_post_flag, notice: 'Post flag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_flag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end", "def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @superadmin = Superadmin.find(params[:id])\n\n respond_to do |format|\n if @superadmin.update_attributes(params[:superadmin])\n format.html { redirect_to @superadmin, notice: 'Superadmin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @superadmin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_fee.update(client_fee_params)\n format.html { redirect_to client_fees_path, notice: 'Client fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @client_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant(tenant_id, request)\n start.uri('/api/tenant')\n .url_segment(tenant_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "def update\n respond_to do |format|\n if @super_admin.update(super_admin_params)\n format.html { redirect_to @super_admin, notice: 'Super admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @super_admin }\n else\n format.html { render :edit }\n format.json { render json: @super_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @farmako.update(farmako_params)\n format.html { redirect_to @farmako, notice: 'Farmako was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @farmako.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "def update\n respond_to do |format|\n if @opt10059_one_one.update(opt10059_one_one_params)\n format.html { redirect_to @opt10059_one_one, notice: 'Opt10059 one one was successfully updated.' }\n format.json { render :show, status: :ok, location: @opt10059_one_one }\n else\n format.html { render :edit }\n format.json { render json: @opt10059_one_one.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch *args\n make_request :patch, *args\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /admin/digersayfas/1 DELETE /admin/digersayfas/1.json
def destroy @admin_digersayfa.destroy respond_to do |format| format.html { redirect_to admin_digersayfas_url, notice: 'Digersayfa was successfully destroyed.' } format.json { head :no_content } end end
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete_guest_access_portal(args = {}) \n delete(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend", "def delete\n request_method('DELETE')\n end", "def destroy\n @gaz_assay = GazAssay.find(params[:id])\n @gaz_assay.destroy\n\n respond_to do |format|\n format.html { redirect_to gaz_assays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ngay = Ngay.find(params[:id])\n @ngay.destroy\n\n respond_to do |format|\n format.html { redirect_to ngays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n request = RestClient.delete File.join(API_SERVER,\"rest-api/departments\",params['id'])\n redirect_to :action => :index\t\n end", "def delete_aos_version_box(args = {}) \n delete(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @json.destroy\n\n head :no_content\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 @digom.destroy\n respond_to do |format|\n format.html { redirect_to digoms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def delete\n self.class.headers 'Authorization' => \"OAuth #{ENV['sfdc_token']}\"\n self.class.headers 'Content-Type' => \"application/json\"\n response = self.class.delete(SObject.root_url+\"/sobjects/#{@object_name}/#{@Id}\")\n raise response.parsed_response[0]['message'] if response.code.to_i > 299\n nil\n end", "def destroy\n @aliexpress = Aliexpress.find(params[:id])\n @aliexpress.destroy\n\n respond_to do |format|\n format.html { redirect_to aliexpresses_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params={}); make_request(:delete, host, port, path, params); end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /instituicoes GET /instituicoes.json
def index @instituicoes = Instituicao.all respond_to do |format| format.html # index.html.erb format.json { render json: @instituicoes } end end
[ "def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instituicao }\n end\n end", "def index\n @instituicos = Instituico.all\n end", "def index\n @instituicaos = Instituicao.all\n end", "def show\n @instalacion = Instalacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instalacion }\n end\n end", "def index\n @instituciones = Institucion.all\n end", "def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end", "def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end", "def index\n @ice_ores = IceOre.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ice_ores }\n end\n end", "def index\n @institutos = Instituto.all\n end", "def index\n @instalacoes = Instalacao.all\n end", "def new\n @instituicao = Instituicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instituicao }\n end\n end", "def show\n @admin_instituicao = AdminInstituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_instituicao }\n end\n end", "def index\n @institutos = Instituto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @institutos }\n end\n end", "def show\n @inventario = Inventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventario }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end", "def index\n @ivas = Iva.all\n\n render json: @ivas\n end", "def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instituicao }\n end\n end", "def index\n @tecnicas = Tecnica.all\n render json: @tecnicas\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /instituicoes/1 GET /instituicoes/1.json
def show @instituicao = Instituicao.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @instituicao } end end
[ "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def show\n @instalacion = Instalacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instalacion }\n end\n end", "def index\n @instituicos = Instituico.all\n end", "def index\n @instituicaos = Instituicao.all\n end", "def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end", "def show\n @admin_instituicao = AdminInstituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_instituicao }\n end\n end", "def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end", "def new\n @instituicao = Instituicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instituicao }\n end\n end", "def show\n @inventario = Inventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventario }\n end\n end", "def index\n @instituciones = Institucion.all\n end", "def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instituicao }\n end\n end", "def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end", "def index\n @institucion = Institucion.where(:id => params[:institucion_id]).first\n @institucioncatalogos = Institucioncatalogo.where(:institucion_id => params[:institucion_id])\n end", "def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end", "def show\n @interveniente = Interveniente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interveniente }\n end\n end", "def index\n @institutos = Instituto.all\n end", "def index\n @institutos = Instituto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @institutos }\n end\n end", "def new\n @instalacion = Instalacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instalacion }\n end\n end", "def show\n @itinerario = Itinerario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itinerario }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /instituicoes/new GET /instituicoes/new.json
def new @instituicao = Instituicao.new respond_to do |format| format.html # new.html.erb format.json { render json: @instituicao } end end
[ "def new\n @instalacion = Instalacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instalacion }\n end\n end", "def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end", "def new\n @inventario = Inventario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventario }\n end\n end", "def new\n @identificacion = Identificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identificacion }\n end\n end", "def new\n @sitio_entrega = SitioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def new\n @noticia = Noticia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @noticia }\n end\n end", "def new\n @niche = Niche.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @niche }\n end\n end", "def new\n @admin_instituicao = AdminInstituicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_instituicao }\n end\n end", "def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end", "def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end", "def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end", "def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end", "def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def new\n @servico = Servico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @servico }\n end\n end", "def new\n @estetica = Estetica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estetica }\n end\n end", "def new\n @azione = Azione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @azione }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aplicacion }\n end\n end", "def new\n @newse = Newse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newse }\n end\n end", "def new\n @instituicao = Instituicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituicao }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /instituicoes POST /instituicoes.json
def create @instituicao = Instituicao.new(params[:instituicao]) respond_to do |format| if @instituicao.save format.html { redirect_to @instituicao, notice: 'Instituicao was successfully created.' } format.json { render json: @instituicao, status: :created, location: @instituicao } else format.html { render action: "new" } format.json { render json: @instituicao.errors, status: :unprocessable_entity } end end end
[ "def create\n @instituico = Instituico.new(instituico_params)\n\n respond_to do |format|\n if @instituico.save\n format.html { redirect_to @instituico, notice: 'Instituição criada com sucesso.' }\n format.json { render :show, status: :created, location: @instituico }\n else\n format.html { render :new }\n format.json { render json: @instituico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instituicao = Instituicao.new(instituicao_params)\n\n respond_to do |format|\n if @instituicao.save\n format.html { redirect_to @instituicao, notice: 'Instituição cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @instituicao }\n else\n format.html { render :new }\n format.json { render json: @instituicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instituto = Instituto.new(instituto_params)\n\n respond_to do |format|\n if @instituto.save\n format.html { redirect_to @instituto, notice: 'O instituto foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @instituto }\n else\n format.html { render :new }\n format.json { render json: @instituto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instituto = Instituto.new(params[:instituto])\n\n respond_to do |format|\n if @instituto.save\n flash[:notice] = ''\n format.html { redirect_to :action => \"new\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instituto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @institucion = Institucion.new(institucion_params)\n\n respond_to do |format|\n if @institucion.save\n format.html { redirect_to instituciones_path, notice: 'Institucion almacenada con exito' }\n format.json { render :index, status: :created}\n else\n format.html { render :new }\n format.json { render json: @institucion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instituicao = Instituicao.new(params[:instituicao])\n\n respond_to do |format|\n if @instituicao.save\n format.html { redirect_to(@instituicao, :notice => 'Instituicao was successfully created.') }\n format.xml { render :xml => @instituicao, :status => :created, :location => @instituicao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instituicao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @instituicao_responsavel = InstituicaoResponsavel.new(instituicao_responsavel_params)\n\n respond_to do |format|\n if @instituicao_responsavel.save\n format.html { redirect_to @instituicao_responsavel, notice: 'Instituicao responsavel was successfully created.' }\n format.json { render :show, status: :created, location: @instituicao_responsavel }\n else\n format.html { render :new }\n format.json { render json: @instituicao_responsavel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instaa = Instaa.new(instaa_params)\n\n respond_to do |format|\n if @instaa.save\n format.html { redirect_to @instaa, notice: 'Instaa was successfully created.' }\n format.json { render :show, status: :created, location: @instaa }\n else\n format.html { render :new }\n format.json { render json: @instaa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institucional = Institucional.new(params[:institucional])\n\n respond_to do |format|\n if @institucional.save\n format.html { redirect_to @institucional, notice: 'Institucional was successfully created.' }\n format.json { render json: @institucional, status: :created, location: @institucional }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inscripcione = Inscripcione.new(inscripcione_params)\n\n respond_to do |format|\n if @inscripcione.save\n format.html { redirect_to @inscripcione, notice: 'Inscripcione was successfully created.' }\n format.json { render :show, status: :created, location: @inscripcione }\n else\n format.html { render :new }\n format.json { render json: @inscripcione.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instancia = Instancia.new(params[:instancia])\n\n respond_to do |format|\n if @instancia.save\n format.html { redirect_to(@instancia, :notice => 'Instancia was successfully created.') }\n format.xml { render :xml => @instancia, :status => :created, :location => @instancia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instancia.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @instituation = Instituation.new(instituation_params)\n\n respond_to do |format|\n if @instituation.save\n format.html { redirect_to @instituation, notice: 'Instituation was successfully created.' }\n format.json { render :show, status: :created, location: @instituation }\n else\n format.html { render :new }\n format.json { render json: @instituation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @instituicao = Instituicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instituicao }\n end\n end", "def create\n @inscripcion = Inscripcion.new(inscripcion_params)\n\n respond_to do |format|\n if @inscripcion.save\n format.html { redirect_to @inscripcion, notice: 'Inscripcion was successfully created.' }\n format.json { render :show, status: :created, location: @inscripcion }\n else\n format.html { render :new }\n format.json { render json: @inscripcion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incucai = Incucai.new(params[:incucai])\n\n respond_to do |format|\n if @incucai.save\n format.html { redirect_to @incucai, notice: 'Incucai was successfully created.' }\n format.json { render json: @incucai, status: :created, location: @incucai }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incucai.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inventario = Inventario.new(inventario_params)\n\n respond_to do |format|\n if @inventario.save\n format.html { redirect_to @inventario, notice: 'Inventario was successfully created.' }\n format.json { render :show, status: :created, location: @inventario }\n else\n format.html { render :new }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institucion = Institucion.new(params[:institucion])\n\n respond_to do |format|\n if @institucion.save\n flash[:notice] = 'Institucion se ha creado con exito.'\n format.html { redirect_to(admin_institucions_url) }\n format.xml { render :xml => @institucion, :status => :created, :location => @institucion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @institucion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @opcion = Opcion.new(params[:opcion])\n\n if @opcion.save\n render json: @opcion, status: :created, location: @opcion\n else\n render json: @opcion.errors, status: :unprocessable_entity\n end\n end", "def create\n @instituicao_curso = InstituicaoCurso.new(instituicao_curso_params)\n\n @instituicao_curso.instituicao = Instituicao.find(@instituicao_curso.instituicao_id)\n @instituicao_curso.curso = Curso.find(@instituicao_curso.curso_id)\n\n respond_to do |format|\n if @instituicao_curso.save\n format.html { redirect_to @instituicao_curso, notice: 'Instituicao curso was successfully created.' }\n format.json { render :show, status: :created, location: @instituicao_curso }\n else\n format.html { render :new }\n format.json { render json: @instituicao_curso.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /instituicoes/1 PUT /instituicoes/1.json
def update @instituicao = Instituicao.find(params[:id]) respond_to do |format| if @instituicao.update_attributes(params[:instituicao]) format.html { redirect_to @instituicao, notice: 'Instituicao was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @instituicao.errors, status: :unprocessable_entity } end end end
[ "def update\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n if @instituicao.update_attributes(params[:instituicao])\n format.html { redirect_to(@instituicao, :notice => 'Instituicao was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instituicao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instituto.update(instituto_params)\n format.html { redirect_to @instituto, notice: 'O instituto foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @instituto }\n else\n format.html { render :edit }\n format.json { render json: @instituto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instituto = Instituto.find(params[:id])\n\n respond_to do |format|\n if @instituto.update_attributes(params[:instituto])\n flash[:notice] = ''\n format.html { redirect_to(institutos_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instituto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @inventario = Inventario.find(params[:id])\n\n respond_to do |format|\n if @inventario.update_attributes(params[:inventario])\n format.html { redirect_to @inventario, notice: 'Inventario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instancia = Instancia.find(params[:id])\n\n respond_to do |format|\n if @instancia.update_attributes(params[:instancia])\n format.html { redirect_to(@instancia, :notice => 'Instancia was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instancia.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @opcion = Opcion.find(params[:id])\n\n if @opcion.update(params[:opcion])\n head :no_content\n else\n render json: @opcion.errors, status: :unprocessable_entity\n end\n end", "def update\n @admin_instituicao = AdminInstituicao.find(params[:id])\n\n respond_to do |format|\n if @admin_instituicao.update_attributes(params[:admin_instituicao])\n format.html { redirect_success_show(\"Administrador alterado com sucesso!\",:admin_instituicaos, @admin_instituicao.id)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_instituicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventario.update(inventario_params)\n format.html { redirect_to @inventario, notice: 'Inventario was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario }\n else\n format.html { render :edit }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n if @institucional.update_attributes(params[:institucional])\n format.html { redirect_to @institucional, notice: 'Institucional was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @institucion = Institucion.find(params[:id])\n\n respond_to do |format|\n if @institucion.update_attributes(params[:institucion])\n flash[:notice] = 'Institucion was successfully updated.'\n format.html { redirect_to(@institucion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institucion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instituicao_curso.update(instituicao_curso_params)\n format.html { redirect_to @instituicao_curso, notice: 'Instituicao curso was successfully updated.' }\n format.json { render :show, status: :ok, location: @instituicao_curso }\n else\n format.html { render :edit }\n format.json { render json: @instituicao_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sitio.update(sitio_params)\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { render :show, status: :ok, location: @sitio }\n else\n format.html { render :edit }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instituto.update_attributes(params[:instituto])\n format.html { redirect_to(@instituto, :notice => 'Instituto fue modificado exitosamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instituto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n if @incucai.update_attributes(params[:incucai])\n format.html { redirect_to @incucai, notice: 'Incucai was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incucai.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @institucion = Institucion.find(params[:id])\n\n respond_to do |format|\n if @institucion.update_attributes(params[:institucion])\n flash[:notice] = 'Institucion se ha actualizado con exito.'\n format.html { redirect_to(admin_institucions_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institucion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n if @sitio_entrega.update_attributes(params[:sitio_entrega])\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /instituicoes/1 DELETE /instituicoes/1.json
def destroy @instituicao = Instituicao.find(params[:id]) @instituicao.destroy respond_to do |format| format.html { redirect_to instituicoes_url } format.json { head :no_content } end end
[ "def destroy\n @instituicao.destroy\n respond_to do |format|\n format.html { redirect_to instituicaos_url, notice: 'Instituição deletada com sucesso..' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instalacion = Instalacion.find(params[:id])\n @instalacion.destroy\n\n respond_to do |format|\n format.html { redirect_to instalacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institucion.destroy\n respond_to do |format|\n format.html { redirect_to instituciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_instituicao = AdminInstituicao.find(params[:id])\n @admin_instituicao.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_instituicaos }\n format.json { head :no_content }\n end\n end", "def destroy\n @instituto.destroy\n respond_to do |format|\n format.html { redirect_to institutos_url, notice: 'O instituto foi deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instituicao = Instituicao.find(params[:id])\n @instituicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(instituicoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inventario = Inventario.find(params[:id])\n @inventario.destroy\n\n respond_to do |format|\n format.html { redirect_to inventarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instancia = Instancia.find(params[:id])\n @instancia.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instituto = Instituto.find(params[:id])\n @instituto.destroy\n\n respond_to do |format|\n format.html { redirect_to(institutos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_situacoesrelatorio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_situacoesrelatorios_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @institucion = Institucion.find(params[:id])\n @institucion.destroy\n\n respond_to do |format|\n format.html { redirect_to(instituciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @oficio = Oficio.find(params[:id])\n @oficio.destroy\n\n respond_to do |format|\n format.html { redirect_to oficios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ejercicio1 = Ejercicio1.find(params[:id])\n @ejercicio1.destroy\n\n respond_to do |format|\n format.html { redirect_to ejercicio1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @indicador.destroy\n respond_to do |format|\n format.html { redirect_to indicadores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /data_items POST /data_items.json
def create @data_item = DataItem.new(data_item_params) respond_to do |format| if @data_item.save format.html { redirect_to @data_item, notice: 'Data item was successfully created.' } format.json { render :show, status: :created, location: @data_item } else format.html { render :new } format.json { render json: @data_item.errors, status: :unprocessable_entity } end end end
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n @item_data = ItemData.new(item_data_params)\n\n respond_to do |format|\n if @item_data.save\n format.html { redirect_to @item_data, notice: 'Item datum was successfully created.' }\n format.json { render :show, status: :created, location: @item_data }\n else\n format.html { render :new }\n format.json { render json: @item_data.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "def create_item\n props = {\n bibIds: [create_bib],\n itemType: 50,\n location: 'os',\n barcodes: [@data[:item_barcode]],\n }\n props[:callNumbers] = [@data[:call_number]] unless (@data[:call_number] || '').empty?\n\n # Add an internal note identifying the partner item:\n unless @data[:item_nypl_source].nil? or @data[:item_id].nil?\n item_uri = \"#{ENV['PLATFORM_API_BASE_URL']}/items/#{@data[:item_nypl_source]}/#{@data[:item_id]}\"\n props[:internalNotes] = [\"Original item: #{item_uri}\"]\n end\n\n $logger.debug \"Sierra API POST: items #{props.to_json}\"\n response = self.class.sierra_client.post 'items', props\n\n raise SierraVirtualRecordError, 'Could not create temporary item' unless response.success? && response.body.is_a?(Hash) && response.body['link']\n\n @item_id = response.body['link'].split('/').last.to_i\n @item_id\n end", "def item_data(data)\r\n BnetApi.make_request(\"/d3/data/item/#{data}\")\r\n end", "def create_item(params = nil, headers = nil)\n post(\"/api/v1/items\", params, headers)\n end", "def create_item(params = nil, headers = nil)\n post(\"/api/v2/items\", params, headers)\n end", "def item_data\n @idata ||= MultiJson.decode(params[:menu_items])\n end", "def create\n @input_data_item = InputDataItem.new(input_data_item_params)\n\n respond_to do |format|\n if @input_data_item.save\n format.html { redirect_to @input_data_item, notice: 'Input data item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @input_data_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @input_data_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item(data, question_ids)\n xml = xml_root(\"items\")\n\n questions = question_ids.inject(XML::Node.new(\"questions\")) do |doc, id|\n question = XML::Node.new(\"question\")\n question[\"id\"] = id.to_s\n doc << question\n end\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"item\") << (XML::Node.new(\"data\") << name) << questions.copy(true))\n end\n\n send_and_process('items/add', 'items/item', xml)\n end", "def create(params)\n @client.make_request(:post, 'customs_items', MODEL_CLASS, params)\n end", "def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "def add_new_item(api, cookie, number, subject, newreq)\n item = nil\n option_hash = { content_type: :json, accept: :json, cookies: cookie }\n newitem = { number: number, clause: newreq['clauseno'], date: newreq['date'], standard: newreq['standard'],\n subject: subject }\n res = api[\"items\"].post newitem.to_json, option_hash unless $dryrun\n if res&.code == 201\n item = JSON.parse(res.body)\n reqres = add_request_to_item(api, cookie, item, newreq)\n end\n item\nend", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end", "def add_item_to_project\n @project = Project.find(params[:id])\n @item = Item.find(params[:item_id])\n\n @project.items << @item\n\n render json: @project, include: :items\n end", "def add_request_to_item(item, new_request)\n itemid = item[\"id\"]\n option_hash = {content_type: :json, accept: :json, cookies: @maint_cookie}\n begin\n res = @api[\"items/#{itemid}/requests\"].post new_request.to_json, option_hash\n rescue => e\n @logger&.error \"add_request_to_item => exception #{e.class.name} : #{e.message}\"\n if (ej = JSON.parse(e.response)) && (eje = ej[\"errors\"])\n eje.each do |k, v|\n @logger&.error \"#{k}: #{v.first}\"\n end\n end\n return nil\n end\n res\n end", "def create\n @item = Item.create(items_params)\n redirect_to root_url\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the underlying type size in bits
def type_size @type.size end
[ "def bit_size_of(type)\n C.size_of_type_in_bits(self, type)\n end", "def bitsize\n @length\n end", "def sizeof(type)\n size_ptr = Pointer.new(:ulong_long)\n align_ptr = Pointer.new(:ulong_long)\n NSGetSizeAndAlignment(type, size_ptr, align_ptr)\n size_ptr[0]\n end", "def bit_len\r\n return @length\r\n end", "def width\n return self.bit_length\n end", "def abi_size_of(type)\n C.abi_size_of_type(self, type)\n end", "def length; @bits.length; end", "def size_in_byte\n return @size_in_byte\n end", "def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end", "def bit_length\n @bit_length ||= ECDSA.bit_length(field.prime)\n end", "def bit_length\n bitstream_length * 8\n end", "def count_bits(typ=true)\n if typ\n @bitarray.nitems\n else\n @bitarray.clone.delete_if {|b| b==1}.length\n end\n end", "def size64_high\n @ole.Size64High\n end", "def num_bits(*) end", "def header_size\n TYPE_SIZE\n end", "def storage_size_of(type)\n C.store_size_of_type(self, type)\n end", "def pixel_bitsize(color_mode, depth = T.unsafe(nil)); end", "def get_size_t(name)\n ptr = FFI::MemoryPointer.new :size_t\n mallctl name, ptr, size_pointer(ptr), nil, 0\n\n read_size_t(ptr)\n end", "def set_type_size(sz, signed = false)\n tname = \"#{signed ? \"\" : \"U\"}Int#{sz}\"\n t = eval tname\n raise \"unsupported bitfield type #{tname}\" unless t\n @type = t\n @signed = signed\n return sz\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the size and signedness of the underlying type
def set_type_size(sz, signed = false) tname = "#{signed ? "" : "U"}Int#{sz}" t = eval tname raise "unsupported bitfield type #{tname}" unless t @type = t @signed = signed return sz end
[ "def size=(s)\n self.width = self.height = @size = s\n end", "def set_size(size = BlockSize)\n if size > MaxSize\n return @size_allowed = false\n end\n\n @biff_size = size\n @book_size = [size, BlockSize].max\n @size_allowed = true\n end", "def set_integer!(value)\n @objects = nil\n @memory = nil\n\n if value < 0\n self[:type] = :negative_integer\n self[:values][:i64] = value\n else\n self[:type] = :positive_integer\n self[:values][:u64] = value\n end\n end", "def size=(value)\n @size = value\n end", "def attr_set_ub8(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def set_size *args\n new_size = parse_size(*args)\n @size[:width] = new_size[:width] if (new_size.key? :width)\n @size[:height] = new_size[:height] if (new_size.key? :height)\n end", "def size=(size)\n self.width = self.height = @size = size\n end", "def set_ctypes(types)\n @ctypes = types\n @offset = []\n offset = 0\n\n max_align = types.map { |type, count = 1|\n orig_offset = offset\n align = ALIGN_MAP[type]\n offset = PackInfo.align(orig_offset, align)\n\n @offset << offset\n\n offset += (SIZE_MAP[type] * count)\n\n align\n }.max\n\n @size = PackInfo.align(offset, max_align)\n end", "def size=(size)\n @size = size if size > @size\n end", "def security_size=(size)\n @image[security_size_offset, DWORD_SIZE] = raw_bytes(size)\n end", "def size=(value)\n @size = value\n end", "def set_short\n @length.set_short\n self\n end", "def complexType=(value)\n @_index = 0\n @_value = value\n end", "def attr_set_integer(attr_type, number)\n #This is a stub, used for indexing\n end", "def attr_set_binary(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def complexType=(value)\n @_index = 4\n @_value = value\n end", "def attr_set_sb8(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def st_type=(type)\n header.st_info = (header.st_info & (~0xf)) | (type.to_i & 0xf)\n end", "def record_size(s)\n @size = s\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When people refer to a mountain they can use Mount Name, Name Mountain, Mt. Name, Name mtn ...etc
def aliases myAliases = "" if ['Mount ',' Mountain',' Peak'].any? {|word| self.name.include?(word)} short = shortname myAliases = "#{short} Mountain, Mount #{short}, Mt. #{short}, Mt #{short}, #{shortname} mt, #{shortname} mtn, #{short} mtn., #{short} Peak" end myAliases end
[ "def pony_full_name(abbrev)\n \n name = \"\"\n if abbrev == \"rainbow\"\n name = \"Rainbow Dash\"\n elsif abbrev == \"fluttershy\"\n name = \"Fluttershy\"\n elsif abbrev == \"twilight\"\n name = \"Twilight Sparkle\"\n elsif abbrev == \"rarity\"\n name = \"Rarity\"\n elsif abbrev == \"pinkie\"\n name = \"Pinkie Pie\"\n elsif abbrev == \"applejack\"\n name = \"Applejack\"\n end\n \n name\n end", "def cup_name\n if is_married?\n pref_name + \" & \" + spouse.pref_name\n else\n pref_name\n end\n end", "def name; termid;end", "def three_word_name; end", "def full_name(patient)\n return unless patient\n\n if patient.family_name.blank? && patient.animal_type.present?\n return [patient.given_name,\n patient.middle_name,\n \"(#{animal_species_name(patient.animal_type)})\"].join(' ').squish\n end\n\n [patient.given_name,\n patient.middle_name,\n patient.family_name,\n patient.family_name2,\n patient.partner_name].join(' ').squish\n end", "def full_name(patient)\n [patient.given_name,\n patient.middle_name,\n patient.family_name,\n patient.family_name2,\n patient.partner_name].join(' ').squish\n end", "def abbrev_and_name\n abbreviation_name\n end", "def full_name\n full_name = \"#{first} #{middle} #{last}\"\n if maiden != last\n full_name += \" nee #{maiden}\"\n end\n return full_name\n end", "def print_mountain_info\n puts \"\\n#{self.name}\".upcase.colorize(:blue).bold\n puts \"Located in #{self.region}\".upcase if self.region\n puts \"5 Day Snowfall: \" + \"#{self.five_day_snowfall}\".colorize(:red) if self.five_day_snowfall\n puts \"Tomorrow's Snow Fall: \" + \"#{self.tomorrows_snowfall}\".colorize(:red) if self.tomorrows_snowfall\n puts \"Conditions: \" + \"#{self.conditions}\".colorize(:red) if self.conditions\n puts \"Base Depth: \" + \"#{self.base_depth}\".colorize(:red) if self.base_depth\n puts \"Trails Open: \" + \"#{self.trails_open}\".colorize(:red) if self.trails_open\n puts \"Lifts Open: \" + \"#{self.lifts_open}\".colorize(:red) if self.lifts_open\n puts \"\"\n end", "def full_name\n major.title.gsub(/\\s{2,}/, ' ') rescue major_abbr\n end", "def two_word_name; end", "def match_to_preflabel(name)\n name = name.downcase\n case name\n when /reconstruction/\n standard_name = 'University of York. Post-war Reconstruction and'\\\n ' Development Unit'\n when /applied human rights/\n standard_name = 'University of York. Centre for Applied Human Rights'\n when /health economics/\n standard_name = 'University of York. Centre for Health Economics'\n when /health sciences/\n standard_name = 'University of York. Department of Health Sciences'\n when /lifelong learning/\n standard_name = 'University of York. Centre for Lifelong Learning'\n when /medieval studies/\n standard_name = 'University of York. Centre for Medieval Studies'\n when /renaissance/\n standard_name = 'University of York. Centre for Renaissance and Early'\\\n ' Modern Studies'\n when /reviews/\n standard_name = 'University of York. Centre for Reviews and'\\\n ' Disseminations'\n when /women/\n standard_name = \"University of York. Centre for Women's Studies\"\n when /school of social and political science/\n standard_name = 'University of York. School of Social and Political'\\\n ' Science'\n when /social policy/\n standard_name = 'University of York. Department of Social Policy and'\\\n ' Social Work'\n when /school of politics economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /politics/\n standard_name = 'University of York. Department of Politics'\n when /economics and related/\n standard_name = 'University of York. Department of Economics and Related'\\\n ' Studies'\n when /economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /history of art/\n standard_name = 'University of York. Department of History of Art'\n when /history/\n standard_name = 'University of York. Department of History'\n when /electronic/\n standard_name = 'University of York. Department of Electronic Engineering'\n when /theatre/\n standard_name = 'University of York. Department of Theatre, Film and'\\\n ' Television'\n when /physics/\n standard_name = 'University of York. Department of Physics'\n when /computer/\n standard_name = 'University of York. Department of Computer Science'\n when /psychology/\n standard_name = 'University of York. Department of Psychology'\n when /law/\n standard_name = 'University of York. York Law School'\n when /mathematics/\n standard_name = 'University of York. Department of Mathematics'\n when /advanced architectural/\n standard_name = 'University of York. Institute of Advanced Architectural'\\\n ' Studies'\n when /conservation/\n standard_name = 'University of York. Centre for Conservation Studies'\n when /eighteenth century/\n standard_name = 'University of York. Centre for Eighteenth Century\n Studies'\n when /chemistry/\n standard_name = 'University of York. Department of Chemistry'\n when /sociology/\n standard_name = 'University of York. Department of Sociology'\n when /education/\n standard_name = 'University of York. Department of Education'\n when /music/\n standard_name = 'University of York. Department of Music'\n when /archaeology/\n standard_name = 'University of York. Department of Archaeology'\n when /biology/\n standard_name = 'University of York. Department of Biology'\n when /biochemistry/ # confirmed with metadata team - recheck?\n standard_name = 'University of York. Department of Biology'\n when /english and related/ # confirmed directly with English department\n standard_name = 'University of York. Department of English and Related'\\\n ' Literature'\n when /philosophy/\n standard_name = 'University of York. Department of Philosophy'\n when /management studies/\n standard_name = 'University of York. Department of Management Studies'\n when /management school/\n # older versionof department name which should be retained if match found\n standard_name = 'University of York. The York Management School'\n when /language and linguistic science/\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /language and lingusitic science/ # deal with common typo\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /for all/ # this is 'languages for all' but in some records 'language'\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science. Languages for All'\n when /hull/\n standard_name = 'Hull York Medical School'\n when /international pathway/\n standard_name = 'University of York. International Pathway College'\n when /school of criminology/\n standard_name = 'University of York. School of Criminology'\n when /natural sciences/\n standard_name = 'University of York. School of Natural Sciences'\n when /environment and geography/ # order important, more precise must be first\n standard_name = 'University of York. Department of Environment and Geography'\n when /environment/\n standard_name = 'University of York. Environment Department'\n else\n standard_name = 'COULD NOT MATCH ' + name\n end\n standard_name\n end", "def full_name\n name\n end", "def district_name(name)\n if name.to_s[/\\A[\\dA-Z]+\\z/]\n \"District #{name}\"\n else\n name\n end\n end", "def create_multi_name\n base_name = String.new(Faker::Games::ElderScrolls.creature)\n if base_name.split.size == 1\n adjective = Spicy::Proton.adjective.capitalize\n new_name = base_name.split.unshift(adjective)\n new_name.join(' ')\n else\n return base_name\n end\n end", "def veteran_name_object\n FullName.new(veteran_first_name, veteran_middle_initial, veteran_last_name)\n end", "def human_name; end", "def street_name; end", "def half_wind_abbreviation; end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Searches for the nearest higher mountain in a given radius and sets that as the parent mountain Sets distance to parent mountain as well
def set_parent_mountain_by_radius radius Place.find_by_radius(centerLatitude, centerLongitude, radius, (height||0)+1).where("type = 'Mountain'").each do |mountain| distance = dist(mountain.centerLatitude, mountain.centerLongitude) if distance < dist_to_parent && self != mountain self.dist_to_parent = distance self.parent_mountain_id = mountain.id self.parent_mountain = mountain self.set_height_and_isolation end end end
[ "def refresh_nearby_mountains\n return unless self.height_changed? || self.latitude_changed? || self.longitude_changed?\n Mountain.find_by_radius(self.latitude,self.longitude,self.dist_to_parent + 20).where(\"type = 'Mountain'\").each do |mountain|\n next if mountain.height.nil? || mountain.dist_to_parent.nil?\n if mountain.height < self.height && self != mountain && dist(mountain.latitude, mountain.longitude) < mountain.dist_to_parent\n mountain.parent_mountain_id = self.id\n\tmountain.dist_to_parent = dist(mountain.latitude, mountain.longitude)\n\tmountain.set_height_and_isolation\n mountain.save\n end\n end\n end", "def nearest_child\n c = nil\n children.each do |n|\n c=n if not c or distance(n)<distance(c)\n end\n c\n end", "def grab_nearest_by_location(distance, loc)\n\n end", "def adjust_distances_if_needed\n self.distance_from_town_centre_m = closest_distance(distance_from_town_centre_m)\n end", "def nearest\n @tree.leaves(parent) - [self]\n end", "def nearest_object(radius = 10000)\n return nearest_object_by_geog(self.geog_point, radius) if self.has_attribute?(:geog_point)\n return nearest_object_by_coords(self.lat, self.lng, radius) if self.has_attribute?(:lat) && self.has_attribute?(:lng)\n end", "def pop_closest_from_fringe\n next_city = nil\n @fringe.each do |city|\n if next_city.nil? ||\n @cache[city][:distance] < @cache[next_city][:distance]\n next_city = city\n end\n end\n @fringe.delete(next_city) unless next_city.nil?\n next_city\n end", "def getSurroundingLowestElevations(parent)\n\t\tx = parent.x\n\t\ty = parent.y\n\t\tcost = 0\n\t\tmin = nil\n\t\twaterFound = false\n\t\twater = nil\n\t\tmin_list = Array.new\n\t\t\n\t\t#search nodes around parent node\n\t\tfor i in (x-1..x+1)\n\t\t\tfor j in (y-1..y+1)\n\t\t\t\t#if its not the parent node\n\t\t\t\tif (i != x or j != y)\n\t\t\t\t\ttemp = @map[check_xy(i)][check_xy(j)]\n\t\t\t\t\t\n\t\t\t\t\t#if we've managed to find the ocean or some other water\n\t\t\t\t\tif temp.type != \"Land\"\n\t\t\t\t\t\twaterFound = true\n\t\t\t\t\t\twater = @river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1\n\t\t\t\t\telsif (temp.elevation != -1 and temp.type == \"Land\")\n\t\t\t\t\t\tif min == nil or temp.elevation < @map[min.x][min.y].elevation\n\t\t\t\t\t\t\tmin_list.clear\n\t\t\t\t\t\t\tmin = @river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1\n\t\t\t\t\t\t\tmin_list.push(min)\n\t\t\t\t\t\telsif temp.elevation == @map[min.x][min.y].elevation\n\t\t\t\t\t\t\tmin_list.push(@river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#if water has been found clear other options and use that node\n\t\tif waterFound\n\t\t\tmin_list.clear\n\t\t\tmin_list.push(water)\n\t\tend\n\t\t\n\t\treturn min_list\n\t\t\n\tend", "def spatially_locate_deposit (deposit, distance)\n puts \"Testing #{deposit[:name]} ... With distance #{distance} km\"\n if !deposit[:parent].nil?\n count = Deposit.distance(deposit[:longitude],deposit[:latitude],distance,'km').count\n\t case \n\t when count < 1 \n\t\tozmin_deposit = spatially_locate_deposit(deposit,distance*1.5)\n\t when count > 1\n\t ozmin_deposit = spatially_locate_deposit(deposit,distance*0.5)\n\t when count == 1\n\t ozmin_deposit = Deposit.distance(deposit[:longitude],deposit[:latitude],distance,'km').all\n\t end\n\tend\n\tozmin_deposit\n end", "def map_reach\n if Town === self\n supporting_radius\n else\n 0\n end\n end", "def select_within_radius km\n self.location_hash = location_hash.select {|h1| distance(h1) <= km }\n end", "def find_closest(options={})\n find(:nearest, options)\n end", "def nearest_city\n Traveler.cities.min_by { |city| self.distance_to city }\n end", "def closest(num = 8)\n opts = {\n order: {\n _geo_distance: {\n 'location' => \"#{latitude},#{longitude}\",\n 'order' => 'asc',\n 'unit' => 'mi'\n }\n },\n limit: num,\n where: {\n id: { not: id }\n }\n }\n Location.search('*', opts).results\n end", "def nearest_driver\r\n\t\tcandidate_driver = nil\r\n\t\tminimum_distance = 2*@maps.mapsize\r\n\t\t@array_of_driver.each do |driver|\r\n\t\t\tdistance = distance(@user.location, driver.location)\r\n\t\t\tif distance < minimum_distance\r\n\t\t\t\tcandidate_driver = driver\r\n\t\t\t\tminimum_distance = distance\r\n\t\t\tend \r\n\t\tend\r\n\t\tcandidate_driver\r\n\tend", "def labelPlaces\n return unless waypoints_changed?\n Place.find_by_radius(averageLatitude, averageLongitude, 50, 0).each do |place|\n minDistance = 400#km\n closestPoint = waypoints.first\n waypoints_minus_removed.each do |waypoint|\n\tdistance = place.dist waypoint.latitude, waypoint.longitude\n\tif minDistance > distance\n\t minDistance = distance\n\t closestPoint = waypoint\n\tend\n end\n # Someone entered a point on the place. If a mountain then replace the height\n # with the correct value and adjust the height change to reflect the new value.\n # If the waypoint isn't labelled then give it the places title and icon.\n if minDistance < 0.3 && !closestPoint.height.nil?\n\tparent = waypoints_minus_removed[closestPoint.parent_index]\n if place.class == Mountain && parent.present?\n heightChange = closestPoint.height - parent.height\n self.height_gain -= heightChange > 0 ? heightChange : 0 unless self.height_gain.nil?\n self.height_loss -= heightChange < 0 ? -heightChange : 0 unless self.height_loss.nil?\n end\n\tclosestPoint.height = place.height if place.class == Mountain\n\tclosestPoint.icon = place.class::MARKER_ICON[0..-5] if closestPoint.icon.nil?\n\tclosestPoint.title = place.name if closestPoint.title.nil?\n if place.class == Mountain && parent.present?\n heightChange = closestPoint.height - parent.height\n self.height_gain += heightChange > 0 ? heightChange : 0 unless self.height_gain.nil?\n self.height_loss += heightChange < 0 ? -heightChange : 0 unless self.height_loss.nil?\n end\n end\n end\n end", "def create_within radius\n random_circle = random_within\n diff_distance = Geo::Distance.new(self.center, random_circle.center)\n max_dist_within_circle = self.distance - diff_distance\n Geo::Radius::Circle.new random_circle.center, max_dist_within_circle.random_within\n end", "def ancestor(distance)\n environment = self\n 0.upto(distance - 1).each { environment = environment.enclosing }\n environment\n end", "def closest_point_to(target, min_distance=3)\n angle_rad = target.calculate_rad_angle_between(self)\n radius = target.radius + min_distance\n x = target.x + radius * Math.cos(angle_rad)\n y = target.y + radius * Math.sin(angle_rad)\n\n Position.new(x, y)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Look for mountains within radius to parent or 30km whichever is higher. If this mountain is higher than a mountain in this radius and closer than its parent then change that mountains parent to be this mountain and update its dist_to_parent
def refresh_nearby_mountains return unless self.height_changed? || self.latitude_changed? || self.longitude_changed? Mountain.find_by_radius(self.latitude,self.longitude,self.dist_to_parent + 20).where("type = 'Mountain'").each do |mountain| next if mountain.height.nil? || mountain.dist_to_parent.nil? if mountain.height < self.height && self != mountain && dist(mountain.latitude, mountain.longitude) < mountain.dist_to_parent mountain.parent_mountain_id = self.id mountain.dist_to_parent = dist(mountain.latitude, mountain.longitude) mountain.set_height_and_isolation mountain.save end end end
[ "def set_parent_mountain_by_radius radius\n Place.find_by_radius(centerLatitude, centerLongitude, radius, (height||0)+1).where(\"type = 'Mountain'\").each do |mountain|\n distance = dist(mountain.centerLatitude, mountain.centerLongitude) \n if distance < dist_to_parent && self != mountain\n self.dist_to_parent = distance\n\t self.parent_mountain_id = mountain.id\n\t self.parent_mountain = mountain\n\t self.set_height_and_isolation\n\tend\n end \n end", "def nearest_child\n c = nil\n children.each do |n|\n c=n if not c or distance(n)<distance(c)\n end\n c\n end", "def nearest\n @tree.leaves(parent) - [self]\n end", "def getSurroundingLowestElevations(parent)\n\t\tx = parent.x\n\t\ty = parent.y\n\t\tcost = 0\n\t\tmin = nil\n\t\twaterFound = false\n\t\twater = nil\n\t\tmin_list = Array.new\n\t\t\n\t\t#search nodes around parent node\n\t\tfor i in (x-1..x+1)\n\t\t\tfor j in (y-1..y+1)\n\t\t\t\t#if its not the parent node\n\t\t\t\tif (i != x or j != y)\n\t\t\t\t\ttemp = @map[check_xy(i)][check_xy(j)]\n\t\t\t\t\t\n\t\t\t\t\t#if we've managed to find the ocean or some other water\n\t\t\t\t\tif temp.type != \"Land\"\n\t\t\t\t\t\twaterFound = true\n\t\t\t\t\t\twater = @river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1\n\t\t\t\t\telsif (temp.elevation != -1 and temp.type == \"Land\")\n\t\t\t\t\t\tif min == nil or temp.elevation < @map[min.x][min.y].elevation\n\t\t\t\t\t\t\tmin_list.clear\n\t\t\t\t\t\t\tmin = @river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1\n\t\t\t\t\t\t\tmin_list.push(min)\n\t\t\t\t\t\telsif temp.elevation == @map[min.x][min.y].elevation\n\t\t\t\t\t\t\tmin_list.push(@river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#if water has been found clear other options and use that node\n\t\tif waterFound\n\t\t\tmin_list.clear\n\t\t\tmin_list.push(water)\n\t\tend\n\t\t\n\t\treturn min_list\n\t\t\n\tend", "def adjust_distances_if_needed\n self.distance_from_town_centre_m = closest_distance(distance_from_town_centre_m)\n end", "def calculate_distance_from_root( node, by_maximum_distance )\n unless @distances.member?(@by_reference ? node.object_id : node)\n if @roots.member?(@by_reference ? node.object_id : node) then\n @distances[@by_reference ? node.object_id : node] = 0\n else\n distance = by_maximum_distance ? 0 : 1000000000\n\n @to[@by_reference ? node.object_id : node].each do |path|\n steps = calculate_distance_from_root( path, by_maximum_distance ) + 1\n distance = by_maximum_distance ? max(distance, steps) : min(distance, steps)\n end\n\n @distances[@by_reference ? node.object_id : node] = distance\n end\n end\n\n return @distances[@by_reference ? node.object_id : node]\n end", "def spatially_locate_deposit (deposit, distance)\n puts \"Testing #{deposit[:name]} ... With distance #{distance} km\"\n if !deposit[:parent].nil?\n count = Deposit.distance(deposit[:longitude],deposit[:latitude],distance,'km').count\n\t case \n\t when count < 1 \n\t\tozmin_deposit = spatially_locate_deposit(deposit,distance*1.5)\n\t when count > 1\n\t ozmin_deposit = spatially_locate_deposit(deposit,distance*0.5)\n\t when count == 1\n\t ozmin_deposit = Deposit.distance(deposit[:longitude],deposit[:latitude],distance,'km').all\n\t end\n\tend\n\tozmin_deposit\n end", "def labelPlaces\n return unless waypoints_changed?\n Place.find_by_radius(averageLatitude, averageLongitude, 50, 0).each do |place|\n minDistance = 400#km\n closestPoint = waypoints.first\n waypoints_minus_removed.each do |waypoint|\n\tdistance = place.dist waypoint.latitude, waypoint.longitude\n\tif minDistance > distance\n\t minDistance = distance\n\t closestPoint = waypoint\n\tend\n end\n # Someone entered a point on the place. If a mountain then replace the height\n # with the correct value and adjust the height change to reflect the new value.\n # If the waypoint isn't labelled then give it the places title and icon.\n if minDistance < 0.3 && !closestPoint.height.nil?\n\tparent = waypoints_minus_removed[closestPoint.parent_index]\n if place.class == Mountain && parent.present?\n heightChange = closestPoint.height - parent.height\n self.height_gain -= heightChange > 0 ? heightChange : 0 unless self.height_gain.nil?\n self.height_loss -= heightChange < 0 ? -heightChange : 0 unless self.height_loss.nil?\n end\n\tclosestPoint.height = place.height if place.class == Mountain\n\tclosestPoint.icon = place.class::MARKER_ICON[0..-5] if closestPoint.icon.nil?\n\tclosestPoint.title = place.name if closestPoint.title.nil?\n if place.class == Mountain && parent.present?\n heightChange = closestPoint.height - parent.height\n self.height_gain += heightChange > 0 ? heightChange : 0 unless self.height_gain.nil?\n self.height_loss += heightChange < 0 ? -heightChange : 0 unless self.height_loss.nil?\n end\n end\n end\n end", "def pop_closest_from_fringe\n next_city = nil\n @fringe.each do |city|\n if next_city.nil? ||\n @cache[city][:distance] < @cache[next_city][:distance]\n next_city = city\n end\n end\n @fringe.delete(next_city) unless next_city.nil?\n next_city\n end", "def cluster\n closest_distance = 0\n while closest_distance < @max_distance\n closest_distance, c1, c2 = find_closest_distance\n\n if closest_distance < @max_distance\n merge(c1, c2)\n end\n end\n end", "def map_reach\n if Town === self\n supporting_radius\n else\n 0\n end\n end", "def nearest_children\n min_distance = distance(nearest_child)\n cs = []\n children.each do |n|\n cs << n if distance(n) == min_distance\n end\n cs\n end", "def ancestor(distance)\n environment = self\n 0.upto(distance - 1).each { environment = environment.enclosing }\n environment\n end", "def _find_common_parent entry_points, total_travel_time, conveyors, original_entry_point, entry_point, target\n conveyor = conveyors.select {|cs| cs.node2 == target}.first\n if conveyor\n if conveyor.node1 == entry_point\n puts \"!!found common parent: #{entry_point}\"\n entry_points << target\n entry_points << conveyor.node1\n total_travel_time += conveyor.travel_time.to_i\n return entry_points, total_travel_time\n elsif conveyor.node1 == original_entry_point\n puts \"!!matched source: #{original_entry_point}\"\n conveyor = conveyors.select {|cs| cs.node1 == original_entry_point && cs.node2 == target}.first\n total_travel_time += conveyor.travel_time.to_i\n return entry_points, total_travel_time\n else\n puts \"..keep looking: #{conveyor.node1}, #{target}\"\n entry_points << target\n entry_points << conveyor.node1\n total_travel_time += conveyor.travel_time.to_i\n _find_common_parent entry_points, total_travel_time, conveyors, original_entry_point, target, conveyor.node1\n end\n end\n end", "def close_to_room(room)\n if self.latitude == nil && self.longitude == nil\n d = 0\n else\n d=50000\n if self.latitude && self.longitude\n r = 6371\n rad = Math::PI/180\n dLat = (self.latitude - room.latitude)*rad\n dLong = (self.longitude - room.longitude)*rad\n lat1 = self.latitude*rad\n lat2 = room.latitude*rad\n a = Math.sin(dLat/2)*Math.sin(dLat/2)+ Math.cos(lat1)*Math.cos(lat2)*Math.sin(dLong/2)*Math.sin(dLong/2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n d = r * c \n end\n end\n return d\n end", "def add_to_parent(new_entry, parent) \n index = 0\n parent.children.each do\n if(new_entry.cidr.packed_network < parent.children[index].cidr.packed_network)\n break\n end\n index += 1\n end\n\n parent.children.insert(index, new_entry)\n\n return()\n end", "def parent_share\n if get(:parent_share)\n get(:parent_share)\n elsif from.slots.out(label).edges.one?\n set(:parent_share, 1.0)\n elsif demand && demand.zero?\n set(:parent_share, 0.0)\n elsif demand && from.demand &&\n from.slots.out(label).share &&\n ! from.output_of(label).zero?\n set(:parent_share, demand / from.output_of(label))\n end\n end", "def grab_nearest_by_location(distance, loc)\n\n end", "def find_closest_child(node)\r\n # if node has no children yet\r\n return nil if @children.length == 0\r\n \r\n # calculate distance between each children and given node\r\n distances = @children.map do |child|\r\n Distances.send(@config.distance_metric, child, node)\r\n end\r\n \r\n # find the index of a child, whose distance to node is lowest\r\n distances.each_with_index.min_by { |with_index| with_index[0] } [1]\r\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of Licensee::License instances
def licenses(options = {}) Licensee::License.all(options) end
[ "def licenses\n @licenses ||= self.details['licenses'].collect{|l| License.new(self, l)}\n end", "def licenses\n licenses = []\n uris = metadata[dataset_uri][dct.license.to_s]\n if uris.nil?\n []\n else\n uris.each do |uri|\n l = metadata[uri]\n licenses << License.new(:uri => uri, :name => l[dct.title.to_s])\n end\n return licenses\n end\n rescue\n []\n end", "def licenses\n licenses = []\n uris = metadata[dataset_uri][RDF::DC.license.to_s]\n if uris.nil?\n []\n else\n uris.each do |license_uri|\n licenses << License.new(:uri => license_uri, :name => first_value( license_uri, RDF::DC.title ))\n end\n return licenses\n end\n rescue => e\n []\n end", "def return_selectable_licenses()\n LICENSES\n end", "def licenses\n data[:licenses]\n end", "def licenses\n @licenses ||= {}\n end", "def license_items\n license_id = unsafe_params[\"license_id\"]\n fail \"License license_id needs to be an Integer\" unless license_id.is_a?(Numeric) && (license_id.to_i == license_id)\n\n # Check if the license exists and is editable by the user. Throw 404 if otherwise.\n License.editable_by(@context).find(license_id)\n\n items_to_license = unsafe_params[\"items_to_license\"]\n fail \"License items_o_license needs to be an Array of Strings\" unless items_to_license.is_a?(Array) && items_to_license.all? do |item|\n item.is_a?(String)\n end\n\n items_licensed = []\n LicensedItems.transaction do\n items_to_license.each do |item_uid|\n item = item_from_uid(item_uid)\n if item.editable_by(@context) && %w(asset file).include?(item.klass)\n items_licensed << LicensedItems.find_or_create_by(license_id: license_id, licenseable: item).uid\n end\n end\n end\n\n render json: { license_id: license_id, items_licensed: items_licensed }\n end", "def licenses\n if @licenses.nil?\n @licenses = self.links.select do |link|\n link.rel == \"license\"\n end\n end\n return @licenses\n end", "def license_items\n license_id = unsafe_params[\"license_id\"]\n unless license_id.is_a?(Numeric) && (license_id.to_i == license_id) ||\n license_id.is_a?(String) && license_id.to_i.positive?\n raise \"License license_id needs to be an Integer\"\n end\n\n # Check if the license exists and is editable by the user. Throw 404 if otherwise.\n License.editable_by(@context).find(license_id)\n\n items_to_license = unsafe_params[\"items_to_license\"]\n if items_to_license.is_a?(String)\n items_to_license = [items_to_license]\n elsif items_to_license.is_a?(Array) && items_to_license.any? { |item| item.is_a?(String) }\n raise \"License items_o_license needs to be an Array of Strings\"\n end\n\n items_licensed = []\n LicensedItem.transaction do\n items_to_license.each do |item_uid|\n item = item_from_uid(item_uid)\n if item.editable_by?(@context) && %w(asset file).include?(item.klass)\n items_licensed << LicensedItem.find_or_create_by(license_id: license_id,\n licenseable: item).id\n end\n end\n end\n\n render json: { license_id: license_id, items_licensed: items_licensed }\n end", "def licenses\n @licenses ||= matched_files.map(&:license).uniq\n end", "def available_licenses(&block)\n License.find_available.each do |license|\n block.call(license)\n end\n end", "def index\n @licensees = Licensee.all\n end", "def index\n @licenses = License.all\n end", "def customized_licenses\n @research_output.plan.template.licenses.map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end", "def load_licenses(object)\n @licenses = []\n @license = {}\n\n @license = LicenseSerializer.new(object.license) if object.license\n return unless object.editable_by?(@context)\n\n @licenses = License.editable_by(@context).map do |license|\n {\n id: license.id,\n uid: license.uid,\n title: license.title,\n created_at_date_time: ApplicationSerializer.new(license).created_at_date_time,\n }\n end\n end", "def list_licenses\n check_scope!\n licenses = License.\n editable_by(@context).\n eager_load(user: :org).\n includes(:taggings).\n order(:title)\n\n licenses = licenses.where(scope: params[:scopes]) if params[:scopes].present?\n\n render json: licenses, root: \"licenses\", adapter: :json\n end", "def licenses\r\n LicensesController.instance\r\n end", "def find_licenses_in_source\n license_files = []\n\n @find_class.find(@gem_source) do |path|\n license_files << path if path.include?(\"LICENSE\")\n end\n\n license_files\n end", "def licenses=(licenses)\n @licenses = [licenses].flatten\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the license for a given path
def license(path) Licensee.project(path).license end
[ "def license\n File.read file_path('LICENSE') if license?\n end", "def license_file_path(path = NULL)\n if null?(path)\n @license_file_path || File.join(install_dir, \"LICENSE\")\n else\n @license_file_path = File.join(install_dir, path)\n end\n end", "def license_file\n license_files.first if license_files.count == 1 || lgpl?\n end", "def license_url\n get_url(:license)\n end", "def license\n licenses.first\n end", "def license\n return text_node('package/license')\n end", "def license_url\n case self.license\n when \"cc-by-sa-3.0\"\n \"http://creativecommons.org/licenses/by-sa/3.0/\"\n when \"cc-by-nc-sa-2.0-uk\"\n \"http://creativecommons.org/licenses/by-nc-sa/2.0/uk\"\n end\n end", "def license\n return @license\n end", "def retrieve_license(url)\n (@licenses ||= {})[url] ||= Net::HTTP.get(URI(url))\n end", "def get_license(node)\n get_nexus_data_bag(node)[:license]\n end", "def configured_license_path(package_name)\n license_path = config.dig(\"manifest\", \"licenses\", package_name)\n return unless license_path\n\n license_path = config.root.join(license_path)\n return unless license_path.exist?\n license_path\n end", "def find_license_text(terms)\n #load yml file\n licenses = YAML.load_file(File.join(options.config_folder,Licenses))\n # hash out from the terms supplied\n begin\n CGI.escapeHTML licenses[terms]['license_link']\n rescue\n raise \"No such license as #{terms}. Available licenses: #{licenses.keys.inject(){|x,y| x+', '+y}}\"\n end\n end", "def license\n @license || 'Unknown'\n end", "def project_license_content\n project.license_file.nil? ? \"\" : IO.read(File.join(Config.project_root,project.license_file))\n end", "def third_party_licenses\n @license_file = File.read(Rails.root.join('public/VENDOR-LICENSES'))\n end", "def license\n read_property 'License'\n end", "def project_license_content\n project.license_file.nil? ? \"\" : IO.read(File.join(Config.project_root, project.license_file))\n end", "def package_license_location(package)\n dist_info = File.join(package[\"Location\"], package[\"Name\"].gsub(\"-\", \"_\") + \"-\" + package[\"Version\"] + \".dist-info\")\n\n license_path = [\"license_files\", \"licenses\"]\n .map { |directory| File.join(dist_info, directory) }\n .find { |path| File.exist?(path) }\n\n license_path || dist_info\n end", "def license_text\n content_file = project.license_file || remote_license_file || project.readme_file\n content_file.content if content_file\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inverse of the confidence threshold, represented as a float By default this will be 0.1
def inverse_confidence_threshold @inverse ||= (1 - Licensee.confidence_threshold / 100.0).round(2) end
[ "def inverse_confidence_threshold\n @inverse_confidence_threshold ||=\n (1 - (Licensee.confidence_threshold / 100.0)).round(2)\n end", "def inverse_probability(p)\n case\n when p <= 0\n -1 / 0.0\n when p >= 1\n 1 / 0.0\n when (p - 0.5).abs <= Float::EPSILON\n @mu\n else\n begin\n NewtonBisection.new { |x| probability(x) - p }.solve(nil, 1_000_000)\n rescue\n 0 / 0.0\n end\n end\n end", "def negative_likelihood\n (1.0 - sensitivity) / specificity\n end", "def inverse_rate\n 1.0 / rate\n end", "def inverse()\n map_hash{|k,v|[k,1/v] if v > 0}.to_p\n end", "def z_critical(confidence_level)\n -Distribution::Z.p_value((1-confidence_level) / 2.0)\n end", "def invert(center)\n delta = (2*(center.to_f - value)).round\n self + delta\n end", "def inverse\n Unit(\"1\") / self\n end", "def cond_est_inf\n begin\n 1.0/rcond_private(:row)\n rescue SingularMatrix\n 1.0/0.0\n end\n end", "def epsilon(sign=+1)\n super.normalize\n end", "def positive_likelihood\n sensitivity / (1.0 - specificity)\n end", "def t_critical(confidence_level, df)\n -Distribution::T.p_value((1-confidence_level) / 2.0, df)\n end", "def improve_inverse(other)\n old_inverse = other.inverse\n old_precision = other.inverse_precision\n other.inverse = ((old_inverse + old_inverse) << old_precision) - \n (other * old_inverse * old_inverse)\n other.inverse.normalize\n other.inverse_precision *= 2\n \n # Trim zero digits at the end; they don't help.\n zero_digits = 0\n zero_digits += 1 while other.inverse.d[zero_digits] == Byte.zero\n \n if zero_digits > 0\n other.inverse = other.inverse >> zero_digits\n other.inverse_precision -= zero_digits\n end\n end", "def threshold\n @threshold || 95\n end", "def confidenceLo\n end", "def vig\n 1 - total_probability**-1\n end", "def innovativeness_gain(v)\n innovativeness(v * 0.10)\n end", "def calculate_confidence(_vuln)\n 100\n end", "def threshold\n @threshold ||= 0\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the list of linked workitems ['role1:wid1', ..., 'roleN:widN']
def links tmp = [] @doc.xpath('//field[@id="linkedWorkItems"]/list/struct').each do |struct| linked_wid = struct.xpath('item[@id="workItem"]').text role = struct.xpath('item[@id="role"]').text tmp << "#{role}:#{linked_wid}" end return tmp end
[ "def workitems (store_name=nil)\n\n return load_user_workitems if store_name == 'users'\n return (@workitems[store_name] || []) if store_name\n\n # then return all the workitems the user has access to\n\n wis = load_user_workitems\n\n @store_names.inject(wis) do |r, sname|\n r += (@workitems[sname] || [])\n end\n end", "def list_names\n list.map { |item| item['name'] } - ['Workspace']\n # A self reference is present even in an empty workspace.\n end", "def peoplelinks\n \tlinks = Array.new\n \tpresenters.each do |p|\n \t\tif p[:handle].length > 1 then\n \t\t\tname = \"#{p[:name].split(\" \")[0]} \\\"#{p[:handle]}\\\" #{p[:name].split(\" \")[1]}\"\n \t\telse\n \t\t\tname = p[:name]\n \t\tend\n\n \t\tlinks.push(:name => name, :link => \"presenters/#{p[:id]}\")\n \tend\n \treturn links\n end", "def related_programmes\n programmes | programmes_for_role(:programme_administrator)\n end", "def workspaces\n @workspace_control_items\n end", "def originator_list \n @board_design_entries = BoardDesignEntry.get_user_entries(@logged_in_user)\n @other_entries = BoardDesignEntry.get_other_pending_entries(@logged_in_user)\n end", "def workitems\n @engine.storage_participant.map do |wi|\n ScriptoriaCore::Workitem.from_ruote_workitem(wi)\n end\n end", "def items_list\n return self.donor_items.map{|it| \" #{it.item.andand.item_code} (#{it.number_donated}) \"}.join(\"/\")\n end", "def roles_working_with\n find_related_frbr_objects( :works_with, :which_roles?) \n end", "def list(refname, mailbox); end", "def related_work_ids\n @related_work_ids ||= begin\n Array(related_url).find_all do |url|\n url =~ RELATED_WORK_PREFIX_RE\n end.collect do |url|\n url.sub(RELATED_WORK_PREFIX_RE, '')\n end\n end\n end", "def index\n @linked_accounts = current_user.linked_accounts\n end", "def personal_weblinks\n [*get_weblinks_by_predicate(:personHasPersonalWebLink)]\n end", "def next_and_previous_links_listitems(work, chapter)\n links = next_and_previous_links(work, chapter)\n links.collect {|link| \"<li>\" + link + \"</li>\\n\"}\n end", "def linked_resources\n return @linked_resources\n end", "def managers_list\n managers = self.has_managers\n case managers.length\n when 0\n return nil\n when 1\n return \"#{managers.first.name} <#{managers.first.email}>\"\n when 2\n return \"#{managers.first.name} <#{managers.first.email}>\" + \" and \" + \"#{managers.second.login} <#{managers.second.email}>\"\n else\n list = String.new\n (0..(managers.length - 3)).each{ |i| list += \"#{managers[i].name} <#{managers[i].email}>, \" }\n list += \"#{managers[managers.length-2].name} <#{managers[managers.length-2].email}>\" + \" and \" + \"#{managers[managers.length-1].name} <#{managers[managers.length-1].email}>\" # last two managers get special formatting\n return list\n end \n end", "def links_in(role=nil)\n\tif role.nil?\n\t Link.find(:to_wid => self.wid)\n\telse\n\t Link.find(:to_wid => self.wid, :role => role.to_s)\n\tend\n end", "def get_relation_list(args)\n JSON.parse(\n \tget_the_json(\"#{args[:collection_A]}-#{args[:key_A]}-#{args[:collection_B]}-#{args[:jmc]}-relation\")\n )[args[:list]]\nend", "def run_list\n self.roles.collect { |role| \"role[#{role}]\" } +\n self.recipes.collect { |recipe| \"recipe[#{recipe}]\" }\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a link to another workitem with specified role
def add_link(lh) lnk_wid = lh[:wid] lnk_role = lh[:role] # find or create the attach node if @doc.xpath('//field[@id="linkedWorkItems"]/list').last.nil? Nokogiri::XML::Builder.with(@doc.xpath('//work-item').last) do field(:id => 'linkedWorkItems') { list {} } end end # build and attach the link struct Nokogiri::XML::Builder.with(@doc.xpath('//field[@id="linkedWorkItems"]/list').last) do struct { item(:id => 'revision') item(:id => 'workItem') { text lnk_wid } item(:id => 'role') { text lnk_role } } end end
[ "def add_link_to_work(source, work, work_item)\n node = MarcNode.new(\"work\", \"856\", \"\", \"##\")\n node.add_at(MarcNode.new(\"work\", \"u\", \"/admin/sources/#{work_item['id']}\", nil), 0)\n node.add_at(MarcNode.new(\"work\", \"z\", \"#{work_item['cmp']}: #{work_item['std_title']}\", nil), 0)\n node.sort_alphabetically\n work.marc.root.children.insert(work.marc.get_insert_position(\"856\"), node)\nend", "def admin_link\n if model.role == :admin || model.role == :owner\n h.content_tag :li do\n h.link_to h.admin_index_path do\n h.content_tag(:i, '', :class => 'icon-wrench') + \" Site Administration\"\n end\n end\n end\n end", "def links_in(role=nil)\n\tif role.nil?\n\t Link.find(:to_wid => self.wid)\n\telse\n\t Link.find(:to_wid => self.wid, :role => role.to_s)\n\tend\n end", "def admin_link_to_user(user)\n case user.role\n when 'influencer'\n link_to(user.full_name, admin_influencer_path(user.influencer))\n when 'affiliate'\n link_to(user.full_name, admin_affiliate_path(user.affiliate))\n when 'advertiser'\n link_to(user.full_name, admin_advertiser_path(user.advertiser))\n end\n end", "def invite_workplace_share_link\n flash[:notice] = \"Channel invite link successfully copied. This link can now be shared for others to join.\"\n redirect_to new_workplace_invite_path(@institute, @workplace)\n end", "def job_attachitem(job, item, role=:Hauled, filter_idx=-1)\n if role != :TargetContainer\n item.flags.in_job = true\n end\n\n itemlink = SpecificRef.cpp_new\n itemlink.type = :JOB\n itemlink.job = job\n item.specific_refs << itemlink\n\n joblink = JobItemRef.cpp_new\n joblink.item = item\n joblink.role = role\n joblink.job_item_idx = filter_idx\n job.items << joblink\n end", "def edit_link(attr_name)\n if h.own_profile?\n link_text = contractor_missing_attr?(attr_name) ? \"Add\" : \"Edit\"\n\n h.link_to(\"javascript:void(0)\", id: attr_name, class: \"edit-link #{link_text} pull-right\") do\n #h.haml_concat h.content_tag(:i, class: \"e-icon-pencil\", style: \"height: 20px; line-height: 16px;\")\n h.haml_concat link_text\n end\n end\n end", "def extend_chain_relinkrole\n @block_roles.each_with_index do |o, i|\n @block_roles[i].lesson_id = @block_lessons[i].id\n end\n return \"\"\n end", "def click_add_salesperson_link\n add_salesperson_link.click\n end", "def add_role(role)\n roles << role\n end", "def admin_link\n if model.is_admin?\n h.content_tag :li do\n h.link_to h.admin_index_path do\n h.content_tag(:i, '', :class => 'icon-wrench') + \" Site Administration\"\n end\n end\n end\n end", "def role_links(generate_links=false)\n \n roles = [ { :message => :designer_role, :name => 'Designer' },\n { :message => :fir_role, :name => 'FIR Reviewer' },\n { :message => :reviewer_role, :name => 'Reviewer' },\n { :message => :pcb_management_role, :name => 'PCB Management' },\n { :message => :pcb_admin_role, :name => 'PCB Admin'},\n { :message => :tracker_admin_role, :name => 'Tracker Admin' } ]\n \n links = []\n return links if !generate_links\n \n roles.each do |role|\n \n # Go through the roles list and determine if the user is registered\n # for the role. If yes, then create the link to change to that role.\n new_role = @logged_in_user.send(role[:message])\n if (new_role && @logged_in_user && (@logged_in_user.active_role.id != new_role.id))\n links << '<td width=\"110\" align=\"center\">' + \n link_to(role[:name], { :controller => :user,\n :action => :set_role,\n :id => new_role.id }) + \n '</td>'\n end\n \n # Nil out the entries that do not have a link.\n #links = roles.collect { |role| role[:link_to] }\n #links.compact!\n \n end\n \n links\n \n end", "def create\n @role_specific_link = RoleSpecificLink.new(role_specific_link_params)\n @role_specific_link.role_id = @user.role\n #@role_specific_link = @user.role_specific_links.build(role_specific_link_params)\n respond_to do |format|\n if @role_specific_link.save\n format.html { redirect_to @role_specific_link, notice: 'Role specific link was successfully created.' }\n format.json { render :show, status: :created, location: @role_specific_link }\n else\n format.html { render :new }\n format.json { render json: @role_specific_link.errors, status: :unprocessable_entity }\n end\n end\n end", "def link_user_google_apps_account(google_apps_linking_item)\n # POST /d2l/api/gae/(version)/linkuser\nend", "def add_link\n @bib.link.each do |l|\n case l.type&.downcase\n when \"doi\" then @item.doi = l.content\n when \"file\" then @item.file2 = l.content\n when \"src\" then @item.url = l.content\n end\n end\n end", "def new_item_link klass \n unless klass.responds_to?('admin_disabled_actions') and klass.admin_disabled_actions.include?('new')\n x = \"<div style='float:left;margin-right:15px;padding-top:5px'>\"\n x += link_to image_tag(\"wilderness/buttons/add-new.png\"), new_polymorphic_path([:admin,klass]) \n x += \"</div>\"\n end\n end", "def add_role(host, role)\n host[:roles] = host[:roles] | [role]\n end", "def assign_workflow_role(user, study, role)\n self.add_new.click\n select_user.click\n select_from_dropdown(:user, user)\n select_study.click\n select_from_dropdown(:study, study)\n select_role.click\n select_from_dropdown(:role, role)\n page.first('.dxgvCommandColumnItem_Main_Theme').click\n sleep 3\n end", "def add_link(cta_1, cta_2)\n interaction_id = cta_1.interactions.all.first.id\n InteractionCallToAction.create(:interaction_id => interaction_id, :call_to_action_id => cta_2.id)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete an organization's routing settings
def delete_routing_settings(opts = {}) delete_routing_settings_with_http_info(opts) return nil end
[ "def destroy\n @org_setting.destroy\n\n head :no_content\n end", "def destroy\n @canonical_route.destroy\n end", "def destroy\n @settings_path = SettingsPath.find(params[:id])\n @settings_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(settings_paths_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to settings_organizations_url, notice: 'Organization was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @global_account_setting = GlobalAccountSetting.find(params[:id])\n @global_account_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to(global_account_settings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @global_page_setting = GlobalPageSetting.find(params[:id])\n @global_page_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to global_page_settings_url }\n format.json { head :no_content }\n end\n end", "def delete_settings_and_regions_by_organization_id_and_region(organization_id, region)\n HttpClient::Preconditions.assert_class('organization_id', organization_id, String)\n HttpClient::Preconditions.assert_class('region', region, String)\n r = @client.request(\"/organizations/#{CGI.escape(organization_id)}/settings/regions/#{CGI.escape(region)}\").delete\n nil\n end", "def delete_route_domain\n super\n end", "def destroy\n @organization = Organization.find(params[:id])\n @organization.delete\n end", "def destroy\n @tournament_config.destroy\n respond_to do |format|\n format.html { redirect_to tournament_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'dashboard'\n end", "def destroy\n @distributor_setting.destroy\n respond_to do |format|\n format.html { redirect_to distributor_settings_url, notice: 'Distributor setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n standard_destroy(OrganizationType, params[:id])\n end", "def destroy\n @site_setting = ::SiteSettings.find(params[:id])\n @site_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to admincp_site_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_global_setting\n @global_setting.destroy\n respond_to do |format|\n format.html { redirect_to admin_global_settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @oa_config.destroy\n respond_to do |format|\n format.html { redirect_to oa_configs_url, notice: 'Oa config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to(orgadmin_organizations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_site_setting = Admin::SiteSetting.find(params[:id])\n @admin_site_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_site_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @network_setting = NetworkSetting.find(params[:id])\n @network_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to(network_settings_url) }\n format.xml { head :ok }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the wrapup codes for a queue
def get_routing_queue_wrapupcodes(queue_id, opts = {}) data, _status_code, _headers = get_routing_queue_wrapupcodes_with_http_info(queue_id, opts) return data end
[ "def commands_for_key_queue\n (0).upto(self.key_queue.size - 1) do |i|\n key_sequence = self.key_queue[i..-1].map(&:to_s).join\n number_prefix = key_sequence.scan(/^[1-9][0-9]*/)[0] # 0 can be used in normal mappings.\n key_sequence = key_sequence[number_prefix.size..-1] if number_prefix\n commands = Array(KeyMap.user_keymap[self.current_mode][key_sequence])\n return [(number_prefix || 1).to_i, commands] unless commands.empty?\n end\n [0, []]\n end", "def get_queued_calls\n @queue.dup\n end", "def compute_next_queue_private\n return [\"normal\", \"No way to determine if Next Queue is set properly\", true ]\n\n # queue = @cached.queue\n\n # # Lets deal with backups and secondarys. As far as I know, they\n # # are not editable for any reason.\n # p_s_b = @cached.p_s_b\n # if p_s_b == 'S' || p_s_b == 'B'\n # return [\"normal\", \"Next Queue for secondary/backup not editable or judged\", true ]\n # end\n \n # pmr = @cached.pmr\n # # World Trade, next queue is always o.k.\n # # TODO Actually, this isn't true. It resolver or next queue get\n # # clobbered they are not o.k. We might could add code to detect that.\n # if pmr.country != \"000\"\n # return [\"normal\", \"Next Queue for WT not editable or judged\", true ]\n # end\n\n # if pmr.next_center.nil?\n # return [ \"wag-wag\", \"Next Queue center is invalid\", true ]\n # end\n\n # next_queue = pmr.next_queue\n # if next_queue.nil?\n # return [ \"wag-wag\", \"Next Queue queue name is invalid\", true ]\n # end\n\n # # We are going to assume that if we have no queue info records\n # # on this queue, then it is a team queue.\n # if (infos = queue.queue_infos).empty?\n # return [ \"good\", \"Team queues are not editable or judged\", true ]\n # end\n\n # # Personal queue set to next queue... bad dog.\n # if next_queue.id == queue.id\n # return [ \"wag-wag\", \"Next queue set to personal queue\", true ]\n # end\n\n # # Queues outside of center can't be good -- can they?\n # if pmr.next_center.center != queue.center.center\n # return [ \"warn\", \"Next queue outside of center is probably wrong\", true ]\n # end\n \n # unless next_queue.queue_infos.empty?\n # return [ \"warn\", \"Next queue is a personal queue\", true ]\n # end\n\n # return [ \"good\", \"I can not find anything to complain about\", true ]\n end", "def next_command\n # try each queue, if necessary (all queues may be empty)\n @queues.keys.size.times do\n # pop a command (may be nil)\n type = @queues.keys[@queue_index]\n command = @queues[type].pop\n # increment queue index\n @queue_index = (@queue_index < (@queues.keys.size - 1)) ? (@queue_index + 1) : 0\n # return converted command or continue\n unless command.nil?\n command = convert_command(command, type)\n return [command, type]\n end\n end\n # all queues are empty\n return [nil, nil]\n end", "def fetch_queued_calls(phone_number, queue_name)\n\t\tcalls_json = {username: username, phoneNumbers: phone_number, queueName: queue_name}\n\t\tresponse = post(%{#{VOICE_URL}/queueStatus}, calls_json)\n\t\tresponse_object = JSON.parse(response, quirky_mode: true)\n\n\t\treturn response_object['NumQueued'] if response_object['Status'].eql?(\"Success\")\n\t\traise AfricasTalkingGatewayException, response_object['ErrorMessage']\n\tend", "def queue_key\n result = queue_name\n result = try(:arguments).presence && result.call if result.is_a?(Proc)\n result&.to_sym\n end", "def queue\n @queue ||= :low\n end", "def restriction_queue(tracking_key, queue)\n restriction_queue_raw(tracking_key, queue).collect {|s| decode(s) }\n end", "def adoptable_queue; adoptable_fund_queues.future.first; end", "def backlog\n @queues.map{|k,v| [k,v.size]} \n end", "def queue_stats\n broker_stats[\"queues\"]\n end", "def entry_queues\n qs = Bluth.priority.collect { |qname| self.send qname }\n if defined?(Bluth::TimingBelt)\n notch_queues = Bluth::TimingBelt.priority.collect { |notch| notch.queue }\n qs.insert 1, *notch_queues\n end\n qs\n end", "def calculate_swaps(queues)\n\tresult = []\n\tqueues.each do |queue|\n\t\tswap = 0\n\t\ttotal_swaps = 0\n\t\tqueue.each_with_index do |actual_pos, i|\n\t\t\tcurrent_pos = i + 1\n\t\t\tswap = actual_pos - current_pos\n\t\t\tbreak if swap > 2\n\t\t\t([(actual_pos-3), 0].max...(current_pos-1)).each do |g|\n\t\t\t\ttotal_swaps += 1 if queue[g] > actual_pos\n\t\t\tend\n\n\t\tend\n\t\tif swap > 2\n\t\t\tresult << \"Too chaotic\" \n\t\telse\n\t\t\tresult << total_swaps\n\t\tend\n\tend\n\tresult\nend", "def waiting_by_queue\n Hash[@resque_data_store.queue_names.map { |queue_name|\n [queue_name,@resque_data_store.queue_size(queue_name)]\n }]\n end", "def queue_info\n \"pid=#{Process.pid} queue=#{queue_name}\"\n end", "def queues_names\n ans = {}\n queues.map { |name, queue| ans.merge!(name => queue.description) }\n group_queues.map { |name, queues| ans.merge!(name => queues) }\n ans\n end", "def units_worked(queue)\n queue_group = get_queue_group(queue)\n queue_group && redis.hget(\"queue-work:#{queue_group}\", queue)\n end", "def queues\n []\n end", "def determine_queue\n daacs = %w(nsidc lpdaac)\n\n daacs.each do |daac|\n collections.each do |collection|\n return daac if collection['id'].include?(daac)\n end\n end\n\n 'default'\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an organization's routing settings
def get_routing_settings(opts = {}) data, _status_code, _headers = get_routing_settings_with_http_info(opts) return data end
[ "def account_organization\n get('account/organization')\n end", "def show\n @org_settings = current_user.organization.settings\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @settings }\n end\n end", "def routing_mode\n return @routing_mode\n end", "def get_route\n self.route\n end", "def autonomous_system_organization\n get('autonomous_system_organization')\n end", "def get_webhook_and_settings_by_organization(organization)\n HttpClient::Preconditions.assert_class('organization', organization, String)\n r = @client.request(\"/#{CGI.escape(organization)}/webhook/settings\").get\n ::Io::Flow::V0::Models::WebhookSettings.new(r)\n end", "def routing_type\n return @routing_type\n end", "def get_routes\n Route.fetch(filter: { type: SUBWAY_TYPES })\n end", "def organization()\n @conf.key?(\"organization\") ? @conf[\"organization\"] : Environment::ORGANIZATION\n end", "def get_settings(organization)\n HttpClient::Preconditions.assert_class('organization', organization, String)\n r = @client.request(\"/#{CGI.escape(organization)}/webhooks/settings\").get\n ::Io::Flow::V0::Models::WebhookSettings.new(r)\n end", "def get_settings\n settings = {}\n settings['sharing_scope'] = self.sharing_scope\n settings['access_type'] = self.access_type\n settings['use_custom_sharing'] = self.use_custom_sharing\n settings['use_whitelist'] = self.use_whitelist\n settings['use_blacklist'] = self.use_blacklist\n return settings\n end", "def get(organization, incoming={})\n HttpClient::Preconditions.assert_class('organization', organization, String)\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),\n :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),\n :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),\n :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? \"-created_at\" : x), String)\n }.delete_if { |k, v| v.nil? }\n r = @client.request(\"/#{CGI.escape(organization)}/tax/settings\").with_query(query).get\n r.map { |x| ::Io::Flow::V0::Models::TaxSetting.from_json(x) }\n end", "def get_settings_and_regions_by_organization_id(organization_id)\n HttpClient::Preconditions.assert_class('organization_id', organization_id, String)\n r = @client.request(\"/organizations/#{CGI.escape(organization_id)}/settings/regions\").get\n r.map { |x| ::Io::Flow::V0::Models::RegionSetting.new(x) }\n end", "def settings\n Buildr.application.settings\n end", "def configured_routes\n\t\thandlers = self.configured_handlers\n\t\treturn Mongrel2::Config::Route.where( target_id: handlers.select(:id) )\n\tend", "def routes\n app_obj.routes\n end", "def app_routes\n res = get(\"apps\", app[\"id\"])\n res[\"data\"][\"routes\"]\n end", "def requestor_settings\n return @requestor_settings\n end", "def get_general_config\n if options[:next_config]\n roadmap.next_general_config(:save => true, :tone => options[:new_tone])\n else\n roadmap.config_generale\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Contact Center Settings
def get_routing_settings_contactcenter(opts = {}) data, _status_code, _headers = get_routing_settings_contactcenter_with_http_info(opts) return data end
[ "def get_account_settings\n acc_settings = self.quote.project.account.account_setting\n end", "def get_settings\n settings = {}\n settings['sharing_scope'] = self.sharing_scope\n settings['access_type'] = self.access_type\n settings['use_custom_sharing'] = self.use_custom_sharing\n settings['use_whitelist'] = self.use_whitelist\n settings['use_blacklist'] = self.use_blacklist\n return settings\n end", "def settings\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/account/settings').settings\n end", "def settings\n @settings ||= Goldberg::SystemSettings.find(:first)\n end", "def get\n is_valid_key = valid_number?(@account_id) || valid_string?(@account_id)\n\n unless is_valid_key && valid_string?(@sdk_key)\n STDERR.warn 'account_id and sdk_key are required for fetching account settings. Aborting!'\n return '{}'\n end\n\n dacdn_url = \"#{PROTOCOL}://#{HOSTNAME}#{PATH}\"\n\n settings_file_response = VWO::Common::Requests.get(dacdn_url, params)\n\n if settings_file_response.code != '200'\n STDERR.warn <<-DOC\n Request failed for fetching account settings.\n Got Status Code: #{settings_file_response.code}\n and message: #{settings_file_response.body}.\n DOC\n end\n settings_file_response.body\n rescue StandardError => e\n STDERR.warn \"Error fetching Settings File #{e}\"\n end", "def settings\n return @settings\n end", "def mailbox_settings\n return @mailbox_settings\n end", "def query_settings(options={})\n path = \"/api/v2/settings\"\n get(path, options)\n end", "def get_contact_cis_settings_with_http_info(xero_tenant_id, contact_id, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountingApi.get_contact_cis_settings ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_contact_cis_settings\"\n end\n # verify the required parameter 'contact_id' is set\n if @api_client.config.client_side_validation && contact_id.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_id' when calling AccountingApi.get_contact_cis_settings\"\n end\n # resource path\n local_var_path = '/Contacts/{ContactID}/CISSettings'.sub('{' + 'ContactID' + '}', contact_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].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'])\n header_params[:'xero-tenant-id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'CISSettings' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\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, \"AccountingApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountingApi#get_contact_cis_settings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def settings\n Buildr.application.settings\n end", "def get_preferred_contactinfo\n rci = get_preferred_role_contactinfo\n result = nil\n result = rci.contactinfo if !rci.blank?\n result\n end", "def getSettingsForDash\n\t\tif(!self.customCode)\n\t\t\treturn {}\n\t\telse\n\t\t\tsettings = Hash.new\n\t\t\tcustomSettings.each do |k,v|\n\t\t\t\tsettings[k] = v[:val]\n\t\t\tend\n\n\t\t\treturn settings\n\t\tend\n\tend", "def query_options\n options = JSON.parse(connection.get(\"/Contact/QueryOptions\").body )\n end", "def get()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('notificationspartnersettings', 'get', 'KalturaNotificationsPartnerSettings', 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 settings\n @settings_manager\n end", "def settings\n @settings ||= {}\n end", "def settings\n _settings.map(&:name)\n end", "def client_settings\n @client_settings ||= ConfigurationSetting.current_client_settings\n end", "def email_settings\n return @email_settings\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the list of routing skills.
def get_routing_skills(opts = {}) data, _status_code, _headers = get_routing_skills_with_http_info(opts) return data end
[ "def skills\n\t\t[]\n\tend", "def get_skills\r\n Skill.where(\"opportunity_id = ?\", opportunity_id).all\r\n end", "def skills\n return @skills\n end", "def get_profile_skills\n profile_skills = find_elements PROFILE_SKILLS_LOCATOR\n get_skills profile_skills\n end", "def skills\r\n return (@race.skills | @mobile_class.skills)\r\n end", "def list_skills\n\t\trender json: Skill.where(language_id: params[:language_id]).to_json\n\tend", "def index\n @tools_skills = ToolsSkill.all\n end", "def skillsNeeded\n\t\t[]\n\tend", "def skills\n result = []\n for i in @skills\n result.push($data_skills[i])\n end\n return result\n end", "def index\n @specialization_skills = SpecializationSkill.all\n end", "def index\n @goal_skills = GoalSkill.all\n end", "def index\n @needed_skills = NeededSkill.all\n end", "def index\n @skill_levels = SkillLevel.all\n end", "def index\n @skill_lists = SkillList.all\n end", "def skills\n # Check if the logged-in student is authorized before rendering the view\n check_authroization\n\n # Find a student's selected skills\n @selected_skills = @student.skills\n # Find all skills that aren't selected by the student\n @unselected_skills = Skill.all.select { |skill| !@student.skills.include?(skill) }\n end", "def index\n @current_skills = CurrentSkill.all\n end", "def index\n @required_skills = RequiredSkill.all\n end", "def index\n @areas_skills = AreasSkill.all\n end", "def index\n @user_to_skills = UserToSkill.all\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add bulk routing language to user. Max limit 50 languages
def patch_user_routinglanguages_bulk(user_id, body, opts = {}) data, _status_code, _headers = patch_user_routinglanguages_bulk_with_http_info(user_id, body, opts) return data end
[ "def process_language_redirect\n # Add languages\n record.parts.each do |part|\n # Get language redirect configuration\n if part.name == 'config'\n # Loop all languages\n languages = []\n part.content.each_line do |language|\n # Get language name and base url\n config = language.split(':')\n # Check if configuration is correct\n if (config.length == 2)\n # Get language props\n lang = config[0]\n url = config[1]\n # Set name as default if '*'\n lang = \"default\" if lang == '*'\n # Add language if not already done\n if not languages.include?(url)\n # Get the language page\n p = Page.find_by_url(config[1])\n if p\n @children << Radiant::RadiantPageResource.new(\"#{path}/#{lang}\", p)\n languages << url\n end\n end\n end\n end\n end\n end\n end", "def language_add\n load_content_language(params, Language.add(params))\n end", "def add_route_to_locale(locale, route)\n for i in 1..6\n existing = locale.send(\"route_#{i}\")\n \n # If there is no route at the given index, create a route and add it at the given index\n if existing.nil?\n locale.send(\"route_#{i}=\", route)\n locale.save\n break\n end\n end \n end", "def add_language(lang)\n @fields['languages'] = [] if @fields['languages'].empty?\n lang = LanguageList::LanguageInfo.find(lang)\n return if lang.nil?\n lang = lang.iso_639_3\n @fields['languages'] << lang unless @fields['languages'].include? lang\n end", "def add_language(lang)\n require 'language_list'\n @fields['languages'] = [] if @fields['languages'].nil? || @fields['languages'].empty?\n lang = LanguageList::LanguageInfo.find(lang)\n return if lang.nil?\n\n lang = lang.iso_639_3\n @fields['languages'] << lang unless @fields['languages'].include?(lang)\n end", "def add_language_skill\n @profile = Profile.find(params[:id])\n user = @profile.user\n LanguageSkill.destroy_all([\"user_id = ?\", user.id])\n params[:language].keys.each do |language_id|\n if params[:language][\"#{language_id}\"][:check]=='1'\n language = Language.find(language_id).name\n skill = LanguageSkill.new\n skill.language = language\n skill.user_id = user.id\n skill.degree = params[:language][\"#{language_id}\"][:efficiency]\n skill.save\n flash[:success] = 'Language Skills Updated'\n end\n end\n end", "def addl_languages_names\n self.dig_for_array(\"addlLanguageNames\")\n end", "def add_route_to_locale(locale, source, points)\n for i in 1..6\n route = locale.send(\"route_#{i}\")\n \n # If there is no route at the given index, create a route and add it at the given index\n if route.nil?\n route = Route.create(name: \"Route #{DateTime.now}\", points_on_route: points)\n route.sources.push(Source.create(link: source))\n route.save\n locale.send(\"route_#{i}=\", route)\n locale.save\n break\n elsif route.points_on_route == points\n route.sources.push(Source.create(link: source))\n route.save\n break\n end\n end \n end", "def upgrade_to_language\n desc \"Creating languages for pages\"\n Alchemy::Page.all.each do |page|\n if !page.language_code.blank? && page.language.nil?\n root = page.get_language_root\n lang = Alchemy::Language.find_or_create_by_code(\n :name => page.language_code.capitalize,\n :code => page.language_code,\n :frontpage_name => root.name,\n :page_layout => root.page_layout,\n :public => true\n )\n page.language = lang\n if page.save(:validate => false)\n log \"Set language for page #{page.name} to #{lang.name}.\"\n end\n else\n log(\"Language for page #{page.name} already set.\", :skip)\n end\n end\n end", "def update_langauges(language_ids)\r\n transaction do\r\n language_ids[:known_language_ids].each do |known_lang|\r\n if language_ids[:learning_language_ids].include?(known_lang)\r\n raise \"Users cannot both know and be learning a language.\"\r\n end\r\n end\r\n self.learning_language_ids = language_ids[:known_language_ids]\r\n self.learning_language_ids = language_ids[:learning_language_ids]\r\n end\r\n end", "def translations_new\n\t\tif params[:res][:section] && params[:res][:subsection] && params[:res][:key]\n\t\t\tLANGUAGES.each do |l|\n\t\t\t\t@yaml = YAML.load_file(\"#{RAILS_ROOT}/config/locales/#{l}.yml\")\n\t\t\t\tif @yaml[l][params[:res][:section]][params[:res][:subsection]]\n\t\t\t\t\ttmp = { params[:res][:key] => params[:translations][l] }\n\t\t\t\t\t@yaml[l][params[:res][:section]][params[:res][:subsection]].merge!(tmp)\n\t\t\t\telse\n\t\t\t\t\ttmp = { params[:res][:subsection] => { params[:res][:key] => params[:translations][l] } }\n\t\t\t\t\t@yaml[l][params[:res][:section]].merge!(tmp)\n\t\t\t\tend\n\t\t\t\t@new=File.new(\"#{RAILS_ROOT}/config/locales/#{l}.yml\", \"w+\")\n\t\t\t\t@new.syswrite(@yaml.to_yaml)\n\t\t\tend\n\t\tend\n\t\tredirect_to '/superadmin/translations'\n\tend", "def addl_language_names\n self.dig_for_array(\"addlLanguageNames\")\n end", "def add_translation_bundle bundle_name, *language\r\n \r\n if bundle_name.is_a?(String)\r\n \r\n language << @language if language.empty?\r\n \r\n language.each do |lang|\r\n \r\n bundle = TranslationBundle.new(bundle_name, lang).load\r\n \r\n self.add_translation_bundle bundle\r\n \r\n end\r\n \r\n elsif bundle_name.is_a?(TranslationBundle)\r\n \r\n raise \"cannot set language parameter when using a TranslationBundle\" unless language.empty?\r\n \r\n tb = bundle_name\r\n \r\n language_bundles = @bundles[tb.language]\r\n \r\n unless language_bundles\r\n language_bundles = []\r\n @bundles[tb.language] = language_bundles\r\n end\r\n \r\n already_registered = language_bundles.any? {|bundle| bundle.name == tb.name}\r\n \r\n unless already_registered\r\n \r\n language_bundles << tb\r\n \r\n @no_translate_patterns.concat(tb.no_translate_patterns) if tb.no_translate_patterns\r\n \r\n end\r\n \r\n else\r\n raise \"Expected a String or a TranslationBundle but got a #{bundle_name.class} - #{bundle_name}\"\r\n end\r\n \r\n @translations_enabled = true\r\n \r\n end", "def assign_languages\n return unless full_name_changed?\n\n # Extract languages from full_name string\n match_data = full_name.match %r{\\((?<languages>.*)\\)}\n return unless match_data.present?\n\n langs = match_data[:languages].downcase.split('/').map(&:strip)\n return unless langs.present?\n\n # Reset languages\n self.languages = []\n\n # Set provided languages if they are known\n langs.each { |lang| assign_single_language(lang) }\n\n # Assign sublanguages if appropriate\n assign_web_languages if langs.include?('web')\n assign_mobile_languages if langs.include?('mobile')\n end", "def create_default_language_entries\n self.all.each {|entry| entry.save_default_translation}\n end", "def index\n #@user = User.find(params[:id])\n @languages = @user.languages.all unless @user.nil?\n end", "def save_lang(resource, resource_language)\n a = ['en','fr','zh']\n if a.include?(resource_language)\n\n language = Language.find_by_code(resource_language)\n resource.language_id = language.id\n if resource.save\n puts \"I saved?\"\n end\n\n else\n resource.language_id = 0\n resource.save\n end\n end", "def index\n @learning_resources = @language.learning_resources\n end", "def update_languages\n # Get existing repo languages from GitHub\n remote_languages = fetch_languages\n\n # Check Language table, add new ones if necessary\n remote_languages.each do |name, bytes|\n language = Language.find_or_create_by(name: name)\n\n # Create relation if needed\n language_relations.create(language: language, bytes: bytes)\n end\n\n # If a language was removed from remote repo, destroy the relation\n removed_languages = languages.pluck(:name) - remote_languages.keys\n removed_languages.each do |language_name|\n language = Language.where(name: language_name).first\n relation = language_relations.where(language_id: language.id).first\n relation.destroy\n end\n\n languages\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Just calling model_cls.new(attrs) fails to account for embedded associations that are inherited with _type. We check for embedded associations and ensure that embeds_many and embeds_one are handled properly.
def _reify model_cls, attrs disc_key = model_cls.discriminator_key model_cls = attrs[disc_key].constantize if attrs[disc_key] instance = model_cls.new attrs.each do |k, v| if (rel = model_cls.relations[k]) && rel.embedded? # Reify the subrel if rel.is_a?(Mongoid::Association::Embedded::EmbedsMany) instance[k] = v.map { |v_curr| _reify(rel.relation_class_name.constantize, v_curr) } else instance[k] = _reify(rel.relation_class_name.constantize, v) end else # Reify the attribute directly instance[k] = v end end instance end
[ "def nested_attributes_create(reflection, attributes)\n obj = reflection.associated_class.new\n nested_attributes_set_attributes(reflection, obj, attributes)\n after_validation_hook{validate_associated_object(reflection, obj)}\n if reflection.returns_array?\n send(reflection[:name]) << obj\n after_save_hook{send(reflection.add_method, obj)}\n else\n associations[reflection[:name]] = obj\n # Don't need to validate the object twice if :validate association option is not false\n # and don't want to validate it at all if it is false.\n send(reflection[:type] == :many_to_one ? :before_save_hook : :after_save_hook){send(reflection.setter_method, obj.save(:validate=>false))}\n end\n obj\n end", "def create_model_based_on_attrs model, attrs, preset_options\n case attrs\n when Hash\n name = attrs.delete \"content\"\n model.new(name, preset_options.merge(attrs))\n when String\n model.new(attrs)\n else\n raise \"Unknown format of element #{model}\"\n end\n end", "def initialize(attrs = {})\n @nested_model_instances = {}\n \n self._nested_models.each do |model|\n model_class = model.to_s.classify.constantize\n \n if attrs.include?(model)\n @nested_model_instances[model] = initialize_nested_model(model_class, attrs[model])\n else\n @nested_model_instances[model] = initialize_nested_model(model_class)\n end\n end\n \n self._dependencies.each do |from, tos|\n tos.each do |to|\n @nested_model_instances[from].public_send(\"#{to.to_s}=\", @nested_model_instances[to])\n end\n end\n end", "def build_attachable(attr_params={})\n @attachable_type = attr_params[:attachable_type] || self.attachable_type.to_s\n self.attachable = @attachable_type.constantize.new(attr_params) unless @attachable_type.nil?\n end", "def init_model(attrs, options, version)\n klass = version_reification_class(version, attrs)\n\n # The `dup` option and destroyed version always returns a new object,\n # otherwise we should attempt to load item or to look for the item\n # outside of default scope(s).\n model = if options[:dup] == true || version.event == \"destroy\"\n klass.new\n else\n version.item || init_model_by_finding_item_id(klass, version) || klass.new\n end\n\n if options[:unversioned_attributes] == :nil && !model.new_record?\n init_unversioned_attrs(attrs, model)\n end\n\n model\n end", "def create_nested_document!(parent, child_assoc, child_model)\n child = child_model.new(params)\n if child_model.embeddable?\n parent.send(child_assoc) << child\n unless parent.valid?\n error 400, convert(body_for(:invalid_document, child))\n end\n unless parent.save\n error 400, convert(body_for(:internal_server_error))\n end\n else\n unless child.valid?\n error 400, convert(body_for(:invalid_document, child))\n end\n unless child.save\n error 400, convert(body_for(:internal_server_error))\n end\n end\n child\n end", "def creatable_model_not_embeddable?(cmrs, item)\n return true if item.class.class_parent_name == 'ActivityLog'\n\n cmrs.first.last.first.last[:ref_config][:view_as][:new].in?(NotEmbeddedOptions)\n rescue StandardError\n nil\n end", "def build_model_object(model_params)\n @model_class.new(model_params)\n end", "def create_model\n return if options[:existing_model]\n args = [name]\n args << \"platforms_#{concern_type}_id:integer\"\n\n # Recreate arguments\n attributes.each do |a|\n args << \"#{a.name}:#{a.type}#{a.has_index? ? \":index\" : \"\" }\"\n end\n\n # Recreate options\n options.each do |k, v|\n unless k == \"existing_model\"\n args << \"--#{k}=#{v}\"\n end\n end\n\n # Use the standard model generator\n generate \"model\", args.join(\" \")\n end", "def create_model\n # binding.pry # if model_values.nil?\n self.model = klass.create(model_values)\n rescue ActiveModel::UnknownAttributeError => e\n puts \"Err: #{e.message}\"\n end", "def build_model(table)\n model = Mongify::Mongoid::Model.new(class_name: table.name.classify, table_name: table.name)\n model.polymorphic_as = table.polymorphic_as if table.polymorphic?\n #TODO: Might need to check that model doesn't already exist in @models\n @models[table.name.downcase.to_sym] = model\n model\n end", "def unsafe_build(attrs)\n record = new\n record.unsafe_attributes = attrs\n record\n end", "def unsafe_build(attrs)\n record = new\n record.unsafe_attributes = attrs\n record\n end", "def initialize(attrs = {})\n if attrs.has_key?(:attachable)\n begin\n attrs[:attachable] = self.class.convert_attachable(attrs, :attachable)\n rescue => exc\n self.errors[:attachable] << exc.message\n attrs.delete(:attachable)\n end\n end\n\n # why do we save the attachable? Because the :attachable association actually uses a different object\n # instance to store the attachable, and therefore the one that was passed is not the one returned\n # by a call to self.attachable. As a consequence, calls like self.attachable.association_proxy_cache.clear\n # do not have the desired effect, since they are made to the association object rather than the\n # one that was passed in. So we remember what was passed in and make the calls on it as needed.\n\n @_attachable = attrs[:attachable]\n\n super(attrs)\n end", "def instantiate(attributes)\n model.new(attributes)\n end", "def build_object(write_attrs = nil)\n @object = end_of_association_chain.send parent? ? :build : :new, object_params(write_attrs)\n end", "def build_for_class(klass, fields)\n new_klass = Class.new(klass) do\n self.table_name = klass.table_name\n self.inheritance_column = nil\n\n extend LightRecord::RecordAttributes\n\n define_fields(fields)\n\n def initialize(data)\n @attributes = data\n @readonly = true\n @association_cache = {}\n @primary_key = self.class::LIGHT_RECORD_PRIMARY_KEY_CACHE\n #init_internals\n end\n\n def self.model_name\n self.superclass.model_name\n end\n\n def read_attribute_before_type_cast(attr_name)\n @attributes[attr_name.to_sym]\n end\n\n def self.subclass_from_attributes?(attrs)\n false\n end\n\n def has_attribute?(attr_name)\n @attributes.has_key?(attr_name.to_sym)\n end\n\n def read_attribute(attr_name)\n @attributes[attr_name.to_sym]\n end\n\n def _read_attribute(attr_name)\n @attributes.fetch(attr_name.to_sym) { |n| yield n if block_given? }\n end\n\n def [](attr_name)\n @attributes[attr_name.to_sym]\n end\n\n def attributes\n @attributes\n end\n\n # to avoid errors when try saving data\n def remember_transaction_record_state\n @new_record ||= false\n @destroyed ||= false\n @_start_transaction_state ||= {level: 0}\n super\n end\n\n def sync_with_transaction_state\n nil\n end\n\n def new_record?\n false\n end\n\n # For Rails < 5.1\n # Assign without type casting, no support for alias, sorry\n def write_attribute_with_type_cast(attr_name, value, should_type_cast)\n @attributes[attr_name.to_sym] = value\n end\n\n # For Rails >= 5.1\n # Assign without type casting, no support for alias, sorry\n if ActiveRecord.version >= Gem::Version.new(\"5.1.0\")\n def write_attribute(attr_name, value)\n attr_name = attr_name.to_sym\n attr_name = self.class.primary_key if attr_name == :id && self.class.primary_key\n @attributes[attr_name] = value\n value\n end\n\n def raw_write_attribute(attr_name, value) # :nodoc:\n @attributes[attr_name.to_sym] = value\n value\n end\n end\n\n ## For Rails 5.2\n def id_in_database\n attributes[self.class.primary_key.to_sym]\n end\n\n # For Rails >= 6.0\n if ActiveRecord.version >= Gem::Version.new(\"6.0.0\")\n def restore_transaction_record_state(force_restore_state = false)\n # nothing\n end\n\n def _has_attribute?(attr_name)\n has_attribute?(attr_name)\n end\n end\n\n # For Rails >= 7.0\n if ActiveRecord.version >= Gem::Version.new(\"7.0.0\")\n def update_columns(attributes)\n unless @attributes.respond_to?(:write_cast_value)\n @attributes.define_singleton_method(:write_cast_value) do |k, v|\n self[k.to_sym] = v\n end\n end\n super\n end\n\n def clear_attribute_change(k)\n # nothing\n end\n end\n\n def reload\n super\n @attributes = @attributes.to_h.symbolize_keys\n\n self\n end\n\n private\n def write_attribute_without_type_cast(attr_name, value)\n @attributes[attr_name.to_sym] = value\n end\n\n def clear_aggregation_cache\n if defined?(@aggregation_cache) && @aggregation_cache\n super\n end\n end\n end\n\n # for rails 6\n new_klass.const_set(:LIGHT_RECORD_PRIMARY_KEY_CACHE, klass.primary_key)\n\n if klass.const_defined?(:LightRecord, false)\n new_klass.send(:prepend, klass::LightRecord)\n if klass::LightRecord.respond_to?(:included)\n klass::LightRecord.included(new_klass)\n end\n elsif klass.superclass.const_defined?(:LightRecord, false)\n new_klass.send(:prepend, klass.superclass::LightRecord)\n if klass.superclass::LightRecord.respond_to?(:included)\n klass.superclass::LightRecord.included(new_klass)\n end\n end\n\n new_klass\n end", "def build(attrs = {})\n attrs = default_attrs.merge(attrs)\n\n # Setting up vacols data must come prior to creating appeal so\n # appeal code picks up the persisted data.\n vacols_case = setup_vacols_data(attrs)\n\n setup_vbms_documents(attrs)\n setup_bgs_data(attrs)\n\n LegacyAppeal.find_or_initialize_by(vacols_id: vacols_case[:bfkey])\n end", "def initialize(record = default_new_record, **attrs)\n @record = record\n\n assignable_attrs = directly_assignable_attributes.map do |attr_name|\n [attr_name, record.public_send(attr_name)]\n end.to_h\n\n mappable_attrs = directly_mappable_attributes.map do |form_attr_name, record_attr_name|\n [form_attr_name, record.send(record_attr_name)]\n end.to_h\n\n super(**assignable_attrs.merge(mappable_attrs).merge(attrs))\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array of nonuniform length arrays, rightpad all arrays with zeros so they're the same size, then transpose the array. This is a destructive operation: the zeropadding modifies the arrayofarrays
def jagged_transpose(arrays) max_length = arrays.map{ |a| a.length }.max arrays.map{ |a| a.fill(0, a.length, max_length - a.length) }.transpose end
[ "def pad_and_transpose(rounds_arr)\n rounds_arr.collect do |games_arr|\n case games_arr.size\n when 16 then [ 4, 9,14,19].each{|idx| games_arr.insert(idx, [nil]*4)}\n when 8 then [ 2, 5, 8,11].each{|idx| games_arr.insert(idx, [nil]*6)}\n when 4 then [ 1, 3, 5, 7].each{|idx| games_arr.insert(idx, [nil]*7)}\n else games_arr.fill(nil, (games_arr.size)..(rounds_arr.first.size-1)) unless games_arr.size == rounds_arr.first.size\n end\n games_arr.flatten\n end.transpose\n end", "def transpose\n return [] if empty?\n\n out = []\n max = nil\n\n each do |ary|\n ary = Rubinius::Type.coerce_to ary, Array, :to_ary\n max ||= ary.size\n\n # Catches too-large as well as too-small (for which #fetch would suffice)\n raise IndexError, \"All arrays must be same length\" if ary.size != max\n\n ary.size.times do |i|\n entry = (out[i] ||= [])\n entry << ary.at(i)\n end\n end\n\n out\n end", "def transpose(array)\r\n result = []\r\n\r\n 0.upto(array.size - 1) do |idx|\r\n new_row = []\r\n array.each do |inner_array|\r\n new_row << inner_array[idx]\r\n end\r\n result << new_row\r\n end\r\n \r\n p result\r\nend", "def sumar_arrays(arrays)\n arrays.transpose.map {|x| x.reduce(:+)}\nend", "def pad_two_dimensionnal_array(array)\n column_count = array[0].length\n longests = Array.new(column_count, 0)\n array.each do |line|\n line.each_with_index do |cell, column|\n cell = '' if cell.nil?\n length = cell.size\n longest = longests[column]\n longests[column] = length if length > longest\n end\n end\n\n padded_array = array.map do |line|\n line.map.with_index do |cell, index|\n cell = '' if cell.nil?\n cell.ljust(longests[index])\n end\n end\n padded_array\n end", "def normalized_transpose(pad='')\n sizes = row_sizes\n min_size = sizes.min\n max_size = sizes.max\n source = if min_size != max_size # Multiple row sizes\n map{|row| row + [pad]*(max_size - row.size)}\n else\n source = self\n end\n source.transpose\n end", "def vstack(arrays)\n arys = arrays.map do |a|\n _atleast_2d(cast(a))\n end\n concatenate(arys,axis:0)\n end", "def column_stack(arrays)\n arys = arrays.map do |a|\n a = cast(a)\n case a.ndim\n when 0; a[:new,:new]\n when 1; a[true,:new]\n else; a\n end\n end\n concatenate(arys,axis:1)\n end", "def interleave(*arrays)\n return [] if arrays.empty?\n inter_array = []\n\n arrays.max_by(&:length).size.times do |index|\n arrays.each { |array| inter_array << array[index] }\n end\n\n inter_array\nend", "def rotate_array(array)\n result = []\n 1.upto(array.size - 1) {|index| result << array[index]}\n result << array[0]\n result\nend", "def shiftArray(arr); arr.push(0).shift end", "def pad!(input_array, output_length, pad = nil)\n new_length = output_length - input_array.length\n\n if new_length > 0\n padded_array = Array.new(new_length, pad)\n input_array.concat(padded_array)\n end\n input_array\n\nend", "def rotate_array(array_of_numbers)\n rotated_array = array_of_numbers.clone\n rotated_array << rotated_array.shift\n\n rotated_array\nend", "def rotate_array(arr)\n outcome = []\n arr.each_with_index { |el, idx| outcome << el unless idx == 0 }\n outcome << arr[0]\n outcome\nend", "def transpose(input_mat)\n row_count = 0\n column_count = 0\n result = Array.new(input_mat[0].size){Array.new(input_mat.size)}\n loop do\n loop do\n result[column_count][row_count] = input_mat[row_count][column_count]\n column_count += 1\n break if column_count > input_mat[0].size - 1\n end\n row_count += 1\n column_count = 0\n break if row_count > input_mat.size - 1\n end\n result\nend", "def transpose() end", "def sort(array)\n temp = array.dup\n\n return [] if temp.empty?\n\n temp.shift + sort(temp.transpose.reverse)\nend", "def transpose!(matrix)\n copy_matrix = []\n matrix.each_with_index { |row, ind| copy_matrix[ind] = row }\n matrix[0].length.times { matrix.unshift([]) }\n copy_matrix.length.times { matrix.pop }\n matrix.each_with_index do |_, n_ind|\n copy_matrix.each_with_index do |_, ind|\n matrix[ind] << copy_matrix[n_ind][ind]\n end\n end\nend", "def rotate_array(unrotated)\n unrotated[1..] + [unrotated.first]\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /stock_gabarras/1 GET /stock_gabarras/1.xml
def show @stock_gabarra = StockGabarra.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @stock_gabarra } end end
[ "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock }\n end\n end", "def new\n @stock_gabarra = StockGabarra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_gabarra }\n end\n end", "def index\n @stockretakes = Stockretake.find_detailed\n Rails.logger.debug{@stockretakes.inspect}\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stockretakes }\n end\n end", "def index_old\n @stocks = Stock.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stocks }\n end\n end", "def show\n @producto_stock = ProductoStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @producto_stock }\n end\n end", "def lookup_stock(stock)\n address, port = lookup_service('stock-price')\n uri = URI.parse(URI.encode(\"http://#{address}:#{port}/stock/#{stock}\"))\n res = Net::HTTP.get_response(uri)\n res.body if res.is_a?(Net::HTTPSuccess)\nend", "def index\r\n @stock_transfers = StockTransfer.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @stock_transfers }\r\n end\r\n end", "def index\n @grandprixes = Grandprix.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @grandprixes }\n end\n end", "def show\n @stock_set = StockSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_set }\n end\n end", "def index\n @stock_counts = StockCount.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stock_counts }\n end\n end", "def show\n @resource_stock = ResourceStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource_stock }\n end\n end", "def index\n @stock_lives = StockLive.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stock_lives }\n end\n end", "def index\n @out_of_stocks = OutOfStock.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @out_of_stocks }\n end\n end", "def show\n @stockist = Stockist.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @stockist }\n end\n end", "def show\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_transfer }\n end\n end", "def show\n @stock_disposal = StockDisposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_disposal }\n end\n end", "def show\n @out_of_stock = OutOfStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @out_of_stock }\n end\n end", "def index\n @gigs = Gig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @gigs }\n end\n end", "def show\n @stock_signal = StockSignal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_signal }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /stock_gabarras/new GET /stock_gabarras/new.xml
def new @stock_gabarra = StockGabarra.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @stock_gabarra } end end
[ "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock }\n end\n end", "def new\n @stock_set = StockSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_set }\n end\n end", "def new\r\n @stock_transfer = StockTransfer.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @stock_transfer }\r\n end\r\n end", "def new\n @producto_stock = ProductoStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @producto_stock }\n end\n end", "def create\n @stock_gabarra = StockGabarra.new(params[:stock_gabarra])\n\n respond_to do |format|\n if @stock_gabarra.save\n flash[:notice] = 'StockGabarra was successfully created.'\n format.html { redirect_to(@stock_gabarra) }\n format.xml { render :xml => @stock_gabarra, :status => :created, :location => @stock_gabarra }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock_gabarra.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @stock_symbol = StockSymbol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_symbol }\n end\n end", "def new\n @stockist = Stockist.new\n assign_lovs\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @stockist }\n end\n end", "def new\n @stock_count = StockCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_count }\n end\n end", "def new\n @stock_use = StockUse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_use }\n end\n end", "def new\n @stock_signal = StockSignal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_signal }\n end\n end", "def new\n @out_of_stock = OutOfStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @out_of_stock }\n end\n end", "def new\n @stock_item = StockItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_item }\n end\n end", "def new\n @stock_location = StockLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_location }\n end\n end", "def new\n @stock = Stock.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @scrap_xml = ScrapXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrap_xml }\n end\n end", "def new\n @stock_category = StockCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_category }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stockpointmaster = Stockpointmaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stockpointmaster }\n end\n end", "def new\n @finance = Finance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @finance }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /stock_gabarras POST /stock_gabarras.xml
def create @stock_gabarra = StockGabarra.new(params[:stock_gabarra]) respond_to do |format| if @stock_gabarra.save flash[:notice] = 'StockGabarra was successfully created.' format.html { redirect_to(@stock_gabarra) } format.xml { render :xml => @stock_gabarra, :status => :created, :location => @stock_gabarra } else format.html { render :action => "new" } format.xml { render :xml => @stock_gabarra.errors, :status => :unprocessable_entity } end end end
[ "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to(@stock, :notice => 'Stock was successfully created.') }\n format.xml { render :xml => @stock, :status => :created, :location => @stock }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n flash[:notice] = 'Stock was successfully created.'\n format.html { redirect_to(@stock) }\n format.xml { render :xml => @stock, :status => :created, :location => @stock }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @stock_gabarra = StockGabarra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_gabarra }\n end\n end", "def create\n @stock = Stock.create!(stock_params)\n json_response(@stock, :created)\n\n end", "def create\n \n @producto_stock = ProductoStock.new(params[:producto_stock])\n \n respond_to do |format|\n if @producto_stock.save\n format.html { redirect_to(@producto_stock, :notice => 'ProductoStock was successfully created.') }\n format.xml { render :xml => @producto_stock, :status => :created, :location => @producto_stock }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @producto_stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\n\n if @stock.save\n render json: @stock, status: :created, location: @stock\n else\n render json: @stock.errors, status: :unprocessable_entity\n end\n end", "def create\n @sp500_stock = Sp500Stock.new(params[:sp500_stock])\n\n respond_to do |format|\n if @sp500_stock.save\n format.html { redirect_to @sp500_stock, notice: 'Sp500 stock was successfully created.' }\n format.json { render json: @sp500_stock, status: :created, location: @sp500_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sp500_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingreso_manual_a_stock = IngresoManualAStock.new(ingreso_manual_a_stock_params)\n\n respond_to do |format|\n if @ingreso_manual_a_stock.save\n format.html { redirect_to @ingreso_manual_a_stock, notice: 'Ingreso manual a stock was successfully created.' }\n format.json { render :show, status: :created, location: @ingreso_manual_a_stock }\n else\n format.html { render :new }\n format.json { render json: @ingreso_manual_a_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource_stock = ResourceStock.new(params[:resource_stock])\n\n respond_to do |format|\n if @resource_stock.save\n format.html { redirect_to(@resource_stock, :notice => 'Resource stock was successfully created.') }\n format.xml { render :xml => @resource_stock, :status => :created, :location => @resource_stock }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource_stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @stock_symbol = StockSymbol.new(params[:stock_symbol])\n\n respond_to do |format|\n if @stock_symbol.save\n format.html { redirect_to(@stock_symbol, :notice => 'StockSymbol was successfully created.') }\n format.xml { render :xml => @stock_symbol, :status => :created, :location => @stock_symbol }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock_symbol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @stock_set = StockSet.new(params[:stock_set])\n\n respond_to do |format|\n if @stock_set.save\n format.html { redirect_to(@stock_set, :notice => 'Stock set was successfully created.') }\n format.xml { render :xml => @stock_set, :status => :created, :location => @stock_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @stock_transaction = StockTransaction.new(params[:stock_transaction])\n\n respond_to do |format|\n if @stock_transaction.save\n flash[:notice] = 'StockTransaction was successfully created.'\n format.html { redirect_to(@stock_transaction) }\n format.xml { render :xml => @stock_transaction, :status => :created, :location => @stock_transaction }\n else\n format.html { render :action => 'new' }\n format.xml { render :xml => @stock_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to stocks_url, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @available_stock = AvailableStock.new(available_stock_params)\n\n respond_to do |format|\n if @available_stock.save\n format.html { redirect_to @available_stock, notice: 'Available stock was successfully created.' }\n format.json { render :show, status: :created, location: @available_stock }\n else\n format.html { render :new }\n format.json { render json: @available_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @various_stock = VariousStock.new(various_stock_params)\n\n respond_to do |format|\n if @various_stock.save\n format.html { redirect_to @various_stock, notice: 'Various stock was successfully created.' }\n format.json { render :show, status: :created, location: @various_stock }\n else\n format.html { render :new }\n format.json { render json: @various_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @addstock = Addstock.new(addstock_params)\n\n respond_to do |format|\n if @addstock.save\n format.html { redirect_to @addstock, notice: 'Addstock was successfully created.' }\n format.json { render :show, status: :created, location: @addstock }\n else\n format.html { render :new }\n format.json { render json: @addstock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @atp_stock = AtpStock.new(atp_stock_params)\n\n respond_to do |format|\n if @atp_stock.save\n format.html { redirect_to @atp_stock, notice: 'Atp stock was successfully created.' }\n format.json { render :show, status: :created, location: @atp_stock }\n else\n format.html { render :new }\n format.json { render json: @atp_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @model_stock = ModelStock.new(model_stock_params)\n\n respond_to do |format|\n if @model_stock.save\n format.html { redirect_to @model_stock, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @model_stock }\n else\n format.html { render :new }\n format.json { render json: @model_stock.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /stock_gabarras/1 PUT /stock_gabarras/1.xml
def update @stock_gabarra = StockGabarra.find(params[:id]) respond_to do |format| if @stock_gabarra.update_attributes(params[:stock_gabarra]) flash[:notice] = 'StockGabarra was successfully updated.' format.html { redirect_to(@stock_gabarra) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @stock_gabarra.errors, :status => :unprocessable_entity } end end end
[ "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n flash[:notice] = 'Stock was successfully updated.'\n format.html { redirect_to(@stock) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to(@stock, :notice => 'Stock was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @stock = Stock.find(params[:id])\n\n if @stock.update(stock_params)\n head :no_content\n else\n render json: @stock.errors, status: :unprocessable_entity\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @producto_stock = ProductoStock.find(params[:id])\n\n respond_to do |format|\n if @producto_stock.update_attributes(params[:producto_stock])\n format.html { redirect_to(@producto_stock, :notice => 'ProductoStock was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @producto_stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @stock_set = StockSet.find(params[:id])\n\n respond_to do |format|\n if @stock_set.update_attributes(params[:stock_set])\n format.html { redirect_to(@stock_set, :notice => 'Stock set was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "def update\n @stock_live = StockLive.where(:s_index => params[:id]).first\n\n respond_to do |format|\n if @stock_live.update_attributes(params[:stock_live])\n format.html { redirect_to(@stock_live, :notice => 'Stock live was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock_live.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource_stock = ResourceStock.find(params[:id])\n\n respond_to do |format|\n if @resource_stock.update_attributes(params[:resource_stock])\n format.html { redirect_to(@resource_stock, :notice => 'Resource stock was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource_stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ingreso_manual_a_stock.update(ingreso_manual_a_stock_params)\n format.html { redirect_to @ingreso_manual_a_stock, notice: 'Ingreso manual a stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingreso_manual_a_stock }\n else\n format.html { render :edit }\n format.json { render json: @ingreso_manual_a_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @movimiento_stock = MovimientoStock.find(params[:id])\n respond_to do |format|\n if @movimiento_stock.update_attributes(params[:movimiento_stock])\n format.html { redirect_to @movimiento_stock, notice: 'Movimiento stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movimiento_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n if @sp500_stock.update_attributes(params[:sp500_stock])\n format.html { redirect_to @sp500_stock, notice: 'Sp500 stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp500_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @various_stock.update(various_stock_params)\n format.html { redirect_to @various_stock, notice: 'Various stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @various_stock }\n else\n format.html { render :edit }\n format.json { render json: @various_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @model_stock.update(model_stock_params)\n format.html { redirect_to @model_stock, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @model_stock }\n else\n format.html { render :edit }\n format.json { render json: @model_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invoice_stock.update(invoice_stock_params)\n format.html { redirect_to invoice_stocks_path, notice: 'Invoice stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_stock }\n else\n format.html { render :edit }\n format.json { render json: @invoice_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stock_index = StockIndex.find(params[:id])\n\n if @stock_index.update(stock_index_params)\n head :no_content\n else\n render json: @stock_index.errors, status: :unprocessable_entity\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /stock_gabarras/1 DELETE /stock_gabarras/1.xml
def destroy @stock_gabarra = StockGabarra.find(params[:id]) @stock_gabarra.destroy respond_to do |format| format.html { redirect_to(stock_gabarras_url) } format.xml { head :ok } end end
[ "def destroy\n @scrap_xml = ScrapXml.find(params[:id])\n @scrap_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(scrap_xmls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(stocks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @producto_stock = ProductoStock.find(params[:id])\n @producto_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(producto_stocks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stock_set = StockSet.find(params[:id])\n @stock_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @resource_stock = ResourceStock.find(params[:id])\n @resource_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(resource_stocks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_xml = Transaction::Xml.find(params[:id])\n @transaction_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_xmls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stock_signal = StockSignal.find(params[:id])\n @stock_signal.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_signals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stockretake = Stockretake.find(params[:id])\n @stockretake.destroy\n\n respond_to do |format|\n format.html { redirect_to(stockretakes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stockist = Stockist.find(params[:id])\n @stockist.destroy\n\n respond_to do |format|\n format.html { redirect_to(stockists_url) }\n format.xml { head :ok }\n end\n end", "def destroy \n @qx.destroy\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stock_item = StockItem.find(params[:id])\n @stock_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stock_category = StockCategory.find(params[:id])\n @stock_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @historique = Historique.find(params[:id])\n @historique.destroy\n\n respond_to do |format|\n format.html { redirect_to(historiques_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @grandprix = Grandprix.find(params[:id])\n @grandprix.destroy\n\n respond_to do |format|\n format.html { redirect_to(grandprixes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bacterial_stock.destroy\n respond_to do |format|\n format.html { redirect_to @sequence, notice: 'Bacterial stock was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stock_index.destroy\n\n head :no_content\n end", "def del\n @status1 = Status1.find(params[:id])\n @status1.destroy\n\n respond_to do |format|\n format.html { redirect_to(status1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stockpointmaster = Stockpointmaster.find(params[:id])\n @stockpointmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(stockpointmasters_url) }\n format.xml { head :ok }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an optional workout sumary If defaults are set returns standard summary. Otherwaise returns the start_workout partial
def workout_program(user) return workout_summary(user) if user.started? start_workout(user) end
[ "def summary_default\n @summarizer.default if @summarizer.respond_to?(:default)\n end", "def summary\n #render unless @output\n @summary\n end", "def apply_summary; nil; end", "def workout\n WorkoutPlan.new(plan)\n end", "def total_workouts\n set_sport_by_user.count || 0\n end", "def summary_with_any_as_default\n summary_without_any_as_default || self.class.localized_facets_without_base(:summary).map {|m| send(m)}.compact.first\n end", "def correct_workout_nil\n if @user.workouts == nil\n @user.workouts = 0\n end\n end", "def edit_summary\n return summary unless diff_stats # If diff_stats is nil, then summary is the edit summary\n nil # Otherwise, it's diff_stats and returns nil\n end", "def summary *bases\r\n\t\t\t\t# define variants of summary parts, in decreasing length\r\n\t\t\t\tsumm = [\r\n\t\t\t\t\t[\"robot pracowicie\", \"robot\"],\r\n\t\t\t\t\tbases.sort_by{|a| -a.bytes.to_a.length },\r\n\t\t\t\t\t[(task.desc && !task.desc.strip.empty?) ? \"(#{task.desc})\" : nil],\r\n\t\t\t\t\t[\"[operator: [[User:#{task.user}|#{task.user}]]]\", \"[operator: #{task.user}]\", \"[#{task.user}]\"]\r\n\t\t\t\t]\r\n\t\t\t\t\r\n\t\t\t\t# how important it is to keep parts at given indices intact\r\n\t\t\t\tpriorities = [1, 5, 10, 3]\r\n\t\t\t\tinv = priorities.max + 1\r\n\t\t\t\t\r\n\t\t\t\t# compute all possible summaries and rank them by sum of length of parts, weighted by priorities\r\n\t\t\t\tpossib = summ[0].product(*summ[1..-1])\r\n\t\t\t\tpossib = possib.sort_by{|summ|\r\n\t\t\t\t\t- summ.zip(priorities).map{|part, prio| part ? part.bytes.to_a.length * (inv - prio) : 0 }.inject(:+)\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t# take the first one that fits within 255 bytes, or last\r\n\t\t\t\tsumm = possib.find{|summ| summ.compact.join(\" \").bytes.to_a.length <= 255 } || possib.last\r\n\t\t\t\treturn summ.compact.join(\" \")\r\n\t\t\tend", "def job_summary\n summary = \"#{self.title} - \"\n\n if self.avg_bid\n summary += \"#{self.avg_bid}\"\n elsif self.budget\n summary += \"#{self.budget}\"\n elsif self.budget_range\n summary += \"#{self.budget_range.join(\" - \")}\"\n end\n summary\n end", "def default_value_for_summary\n positional_match_or_nil(@chunked_source.readme, SUMMARY_MATCH, 0) do |str|\n warn(\"Using summary from README: #{str}\")\n end\n end", "def default_values\n \tself.total_worth ||= 0\n \tend", "def total_workout_calories\n set_sport_by_user.sum(:burned_calories) || 0\n end", "def display_total_calories_per_workout\n puts \"This workout will burn an average of #{self.total_calories} calories.\"\n end", "def last_workout_with_km_calories\n set_sport_by_user.last.try(:distance) || 0\n end", "def default_summaries\n Summaries.new(summarizers)\n end", "def attendance_wise_ranking_report2\n @students ||= @batch.students\n @weekdays ||= @batch.weekdays\n @general_setting = GeneralSetting.first\n render 'attendance_wise_ranking_report', layout: false\n end", "def summary\n definition \"Summary\"\n end", "def first_summary\n # there is only one subset, and there is only one summary per subset, since this is the single case\n @collection.subsets[0].summaries[0]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
>> quiz = [0,0,0,1,0,0,1,1,0,1] >> count_quiz_completions(quiz) => "The number of participants who did not attempt Quiz 1 is 6 out of 10 total participants."
def count_quiz_completions(quiz_results) no_quiz = quiz_results.count(0) total = quiz_results.count "The number of participants who did not attempt Quiz 1"\ " is #{no_quiz} out of #{total} total participants." end
[ "def question_count\n return people.first.answered.size if people.length == 1\n\n people_answering = people.length\n questions = Hash.new 0\n people.each do |person|\n person.answered.each do |char|\n questions[char] += 1\n end\n end\n\n count = 0\n questions.each do |_, value|\n count += 1 if value == people_answering\n end\n count\n end", "def number_corrects\r\n corrects = 0\r\n\r\n (0..@question_answer.length() - 1).each do |idx|\r\n corrects += @question_answer[idx] == @user_answer[idx] ? 1 : 0\r\n end\r\n\r\n corrects\r\n end", "def question_number(battle)\n if is_player_1?(battle)\n answers = battle.player_1_answers\n else\n answers = battle_player_2_answers\n end\n\n answers = answers - ['.']\n count_questions = answers.count\n\n return count_questions\n end", "def answered_count\n people.collect(&:answered).flatten.uniq.size\n end", "def answers_completed\n answers_completed = 0\n answers_completed = answers_completed + 1 if self.answer and !self.answer.empty?\n answers_completed = answers_completed + 1 if self.answer2 and !self.answer2.empty?\n answers_completed = answers_completed + 1 if self.answer3 and !self.answer3.empty?\n answers_completed = answers_completed + 1 if self.answer4 and !self.answer4.empty?\n answers_completed = answers_completed + 1 if self.answer5 and !self.answer5.empty?\n answers_completed = answers_completed + 1 if self.answer6 and !self.answer6.empty?\n answers_completed = answers_completed + 1 if self.answer7 and !self.answer7.empty?\n \n answers_completed\n end", "def quizzes_failed_count\n #Attempt.where(user_id: self.id, passed: false).count\n count = 0\n Section.where(course_id: self.id).each do |section|\n count = count + section.attempts.where(passed: false).count\n end\n count\n end", "def completed_quest_number; completed_quests.size; end", "def number_of_zeros quiz_array\n quiz_array.count(0)\nend", "def alsquiz_count\n self.titles.available.inject(0) {|sum, title| sum + title.alsquiz_count}\n end", "def number_correct\n @correct_answers = []\n\n @turns.each do |turn|\n @correct_answers << turn.correct?\n end\n @correct_answers.count(true)\n end", "def answer_total\n count = 0\n self.list_answers.each {|a| count +=a.to_i }\n count\n end", "def valid_question_count\n valid_questions.count\n end", "def number_of_questions\n questions.count\n end", "def quest_count\r\n each.to_a.size\r\n end", "def num_answered_questions(plan)\n answered_questions(plan).count(&:answered?)\n end", "def completion_count\n count = 0\n\n students.each do |student|\n if student.complete?(self)\n count += 1\n end\n end\n\n return count\n end", "def count_results(answer)\n answer.split(\" \")[1].to_i\n end", "def answer_count\n if is_standard?\n respond_to?(:copy_answer_count_col) ? copy_answer_count_col || 0 : copies.inject?(0){|sum, c| sum += c.answer_count}\n else\n respond_to?(:answer_count_col) ? answer_count_col || 0 : questionings.inject(0){|sum, q| sum += q.answers.count}\n end\n end", "def answers_with_count\n count=Hash.new(0)\n self.list_answers.each {|a| count[a]+=1 }\n count\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enables or disables the generation of events in the Page domain.
def page_events=(new_page_events) new_page_events = !!new_page_events if new_page_events != page_events @rpc.call(new_page_events ? 'Page.enable' : 'Page.disable') @page_events = new_page_events end new_page_events end
[ "def enable\n @page.enabled = !@page.enabled\n @page.save\n redirect_to_pages\n end", "def disable\n {\n method: \"Page.disable\"\n }\n end", "def enable!\n @events_tracker = EventsTracker.new(events)\n end", "def is_site_pages_creation_enabled=(value)\n @is_site_pages_creation_enabled = value\n end", "def edge_disable_first_run_page=(value)\n @edge_disable_first_run_page = value\n end", "def events_visit\n track_event('Events Page Visited')\n end", "def edge_allow_start_pages_modification=(value)\n @edge_allow_start_pages_modification = value\n end", "def disabled_events\n @disabled_events ||= Set.new\n end", "def enable_event(event)\n disabled_events.delete(event)\n self\n end", "def enable\n @enabled = true\n end", "def enable\n {\n method: \"DOM.enable\"\n }\n end", "def edge_disable_first_run_page\n return @edge_disable_first_run_page\n end", "def enable!\n set_enabled!(true)\n end", "def wire_up_on_every_page(anemone)\n anemone.on_every_page do |page|\n @delegate.on_every_page(page)\n end if @delegate.respond_to?(:on_every_page)\n end", "def enable\n\t\t@page = Page.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @page.update_attribute(:enabled, true)\n\t\t\t\tformat.html { redirect_to pages_url, notice: \"Page Enabled\" }\n\t\t\t\tformat.json\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html { redirect_to pages_url, notice: \"There was an error enabling this Page\" }\n\t\t\t\tformat.json\t{ render json: @page.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\t\t\n\tend", "def enable\n {\n method: \"DOMSnapshot.enable\"\n }\n end", "def edge_allow_start_pages_modification\n return @edge_allow_start_pages_modification\n end", "def live_enable\n authorize @event\n @event.update(available_live: true)\n redirect_to stage_event_path(@event)\n end", "def perform_discretely\n if (saved_callback = state.on_page_create_callback)\n # equivalent to calling `on_page_create`\n state.on_page_create_callback = nil\n yield\n # equivalent to calling `on_page_create &saved_callback`\n state.on_page_create_callback = saved_callback\n else\n yield\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns string containing respondent's first and last name
def respondent_full_name [respondent_first_name, respondent_last_name].compact.join(' ') end
[ "def full_name\n return \"#{first_name} #{last_name}\"\n end", "def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n return (self.last_name + \", \" + self.first_name)\n end", "def full_client_name\n \"#{last_name}, #{first_name}\"\n end", "def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end", "def fullname\n full = [self.firstname, self.lastname].join(' ').strip\n unless full.blank?\n return full\n else\n return self.username\n end\n end", "def fullname\n return person.fullname if !person.nil? && verified?\n \"#{firstname} #{lastname}\"\n end", "def full_name\n [first_name, surname].join(' ')\n end", "def name_and_email\r\n if email\r\n return \"#{self.entire_full_name} <#{self.email}>\"\r\n else\r\n return nil\r\n end\r\n end", "def informal_name\n given = given_name.presence || \"\"\n chinese, english = given.split(/,\\s*/)\n given = english.presence || chinese # nb. if no comma then chinese will hold the whole name and we'll show that.\n [given, family_name].join(' ')\n end", "def name\n if first_name && last_name\n name = \"#{first_name} #{last_name}\"\n elsif first_name\n name = first_name\n else\n name = email\n end\n end", "def full_name(patient)\n [patient.given_name,\n patient.middle_name,\n patient.family_name,\n patient.family_name2,\n patient.partner_name].join(' ').squish\n end", "def fullname(opt = {})\n options = { :middlename => true, :skip_update => false, :override_with_local => true, :ignore_nickname => false }.merge(opt)\n if person_resource? && !options[:skip_update]\n update_resource_cache! rescue nil\n return display_name unless options[:override_with_local]\n end\n return display_name if firstname.blank? && lastname.blank?\n parts = []\n parts << (options[:ignore_nickname] ? read_attribute(:firstname) : firstname)\n parts << \"(#{nickname})\" if !Customer.display_nicknames_by_default? && !options[:ignore_nickname] && !nickname.blank?\n parts << (middlename.length == 1 ? \"#{middlename.to_s}.\" : middlename.to_s) if options[:middlename] && !middlename.blank?\n parts << lastname\n parts.join(\" \")\n end", "def get_full_name (contact)\n \"#{contact[\"name\"]} #{contact[\"last_name\"]}\"\n end", "def complete_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def last_name\n person_name['FamilyName']\n end", "def full_name\n\t return \"#{@real_profile.firstname} \"\n\tend", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def get_full_name(hash)\n\treturn hash[\"first\"] + \" \" + hash[\"last\"] + \", the \" + hash[\"title\"]\nend", "def full_name\n first_name.present? && last_name.present? ? \"#{first_name} #{last_name}\" : uid\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fixes birth number badly transfered from candidates
def fix_bad_birth_numbers(students = nil) ActiveRecord::Base.connection.execute('SET NAMES UTF8') notfound = [] students ||= Student.find(:all) @@mylog.info "There are %i students" % students.size students.each do |student| if c = Candidate.find(:all, :conditions => ["birth_number like ?", "%s_" % student.birth_number]) if c.size > 0 if c.size > 1 @@mylog.info "More than one candidate for student %i. Getting first." % student.id end c = c.first @@mylog.info "Found one candidate for student %i" % student.id if c.birth_number =~ /\d{6}\// bn = c.birth_number.gsub(/\//, '') @@mylog.info "Got slash in birth number. Fixin student %i with %s" % [student.id, bn] student.update_attribute(:birth_number, bn) else @@mylog.info "No slash in birth number for %i" % student.id end else @@mylog.info "Candidate has't been found" notfound << student.id end end end return notfound end
[ "def celebrate_birthday(age)\n\t\t@age = age + 1\n\t\treturn @age\n\tend", "def fix_leader!(leader)\n\n if leader.length < 24\n # pad it to 24 bytes, leader is supposed to be 24 bytes\n leader.replace( leader.ljust(24, ' ') )\n elsif leader.length > 24\n # Also a problem, slice it\n leader.replace( leader.byteslice(0, 24))\n end\n # http://www.loc.gov/marc/bibliographic/ecbdldrd.html\n leader[10..11] = '22'\n leader[20..23] = '4500'\n\n if settings['horizon.destination_encoding'] == \"UTF8\"\n leader[9] = 'a'\n end\n\n # leader should only have ascii chars in it; invalid non-ascii\n # chars can cause ruby encoding problems down the line.\n # additionally, a force_encoding may be neccesary to\n # deal with apparent weird hard to isolate jruby bug prob same one\n # as at https://github.com/jruby/jruby/issues/886\n leader.force_encoding('ascii')\n\n unless leader.valid_encoding?\n # replace any non-ascii chars with a space.\n\n # Can't access leader.chars when it's not a valid encoding\n # without a weird index out of bounds exception, think it's\n # https://github.com/jruby/jruby/issues/886\n # Grr.\n\n #leader.replace( leader.chars.collect { |c| c.valid_encoding? ? c : ' ' }.join('') )\n leader.replace(leader.split('').collect { |c| c.valid_encoding? ? c : ' ' }.join(''))\n end\n\n\n\n end", "def strip_birth_number\n self.birth_number.strip!\n end", "def get_birth_number_2(birthdate)\nbirth_number = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\n\n\n\n\n\n\n\n=begin\n\t\nNow you need to start reducing that number down to a single digit. First you’re going to convert the number back to a string so that you can use array syntax again – array syntax does not work on integers!\n\nConvert the number back to a string, then follow step 3 again; get each number individually, using array syntax, and convert it to a number. Then add those two numbers together. \n\t\n=end\n\n\nbirth_number_2=birth_number.to_s\nbirth_number_2 = birth_number_2[0].to_i + birth_number_2[1].to_i\n\n=begin\n\t\n Now it’s time for an if statement! Your current number could be 1-9, or it could be greater than 9.\n\nYour if statement needs to check if your number is greater than 9, and if it is, reduce again by following step 4. Otherwise, you are all set for the next step. \n\t\n=end\n\nif birth_number_2 > 9\n\tthen \tbirth_number_2 = birth_number_2.to_s\n\t\t\tbirth_number_2 = birth_number_2[0].to_i + birth_number_2[1].to_i\nend\n\n\n=begin\t\nNow you have your single-digit birth path number! All that’s left is to display the number to the user and also the number’s meaning. For this you’ll use a case statement.\n\nYour case statement should check the birth path number and then display the correct message. To make your life a LITTLE easier, you can get the text for each number below.\n\nYour message should look something like this:\n\nYour numerology number is 1.\n\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\n\t\n=end\n\nreturn birth_number_2\nend", "def clean_001_or_019(value)\n value = value.downcase.strip\n value = value.sub(/^o(n|c[mn])/, '')\n value = value.sub(/^(\\d+)\\D\\w+$/, '\\1')\n end", "def invalid_south_african_id_number\n invalid_date_of_birth = [\n Faker::Number.number(digits: 2),\n Faker::Number.between(from: 13, to: 99),\n Faker::Number.between(from: 32, to: 99)\n ].map(&:to_s).join\n\n id_number = [\n invalid_date_of_birth,\n Faker::Number.number(digits: 4),\n ZA_CITIZENSHIP_DIGITS.sample(random: Faker::Config.random),\n ZA_RACE_DIGIT\n ].join\n\n [id_number, south_african_id_checksum_digit(id_number)].join\n end", "def get_number(birthdate)\nnumber = (birthdate[0].to_i) + (birthdate[1].to_i) + (birthdate[2].to_i) + (birthdate[3].to_i) + (birthdate[4].to_i) + (birthdate[5].to_i) + (birthdate[6].to_i) + (birthdate[7].to_i)\nnew_number = number.to_s\nnew_number = (new_number[0].to_i) + (new_number[1].to_i)\n\nif new_number > 9\n\tnew_number = (new_number[0].to_i) + (new_number[1].to_i)\nend\t\n\treturn new_number\n\nend", "def convert_yy_2_yyyy( birth_year )\n return nil if birth_year.nil?\n # Already a 4-digit year?\n if birth_year.to_i > 1900\n birth_year\n\n # 2-digit year?\n elsif birth_year.to_i < 100\n # We keep track upto M105:\n if DateTime.now.year - 1900 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1900 + birth_year.to_i\n end\n\n # 3-digit year?\n elsif birth_year.to_i < 1000\n # We keep track upto M105:\n if DateTime.now.year - 1000 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1000 + birth_year.to_i\n end\n end\n end", "def clean_an\n if aleph_record?\n an_numeric_component.prepend('MIT01')\n elsif aleph_cr_record?\n an_numeric_component.prepend('MIT30')\n end\n end", "def non_target_elderly_driver_birth_date\n Chronic.parse(\"#{rand(94..100)} years ago\").strftime('%m/%d/%Y')\n end", "def birth_date_presorter (birth_date)\n year = birth_date.match(/\\d{4}$/)[0]\n month = birth_date.match(/^\\d\\d?/)[0]\n day = birth_date.match(/\\/(\\d\\d?)\\//).captures[0]\n month = \"0\" + month if month.length == 1\n day = \"0\" + day if day.length == 1\n year + month + day\n end", "def birth_path_number(date)\n no1 = date[0].to_i\n no2 = date[1].to_i\n no3 = date[2].to_i\n no4 = date[3].to_i\n no5 = date[4].to_i\n no6 = date[5].to_i\n no7 = date[6].to_i\n no8 = date[7].to_i\n\n # Adds all the digits of the birthdate\n number = no1 + no2 + no3 + no4 + no5 + no6 + no7 + no8\n\n # Reverts the number into a string\n number = number.to_s\nend", "def year_of_birth(current_year, age)\n\tcurrent_year - age\n\tend", "def change_dob\n dob = parse_date_of_birth\n if current_user.update_date_of_birth!(dob)\n redirect_to settings_path, notice: \"Date of birth updated successfully.\"\n else\n @date_error = dob.blank? ? \"Please enter a valid date.\" : \"You must be at least 18 years old to join the study.\"\n render :dob\n end\n end", "def find_birth_and_death(text) \n return nil, nil, text if text.blank?\n\n b,d = nil,nil\n\n birth_death_regex = /\n \\s*? # leading whitespace\n [\\(|\\[] # Date bracketing — open paren or bracket\n (?!b.)\n (?!d.)\n \\s*? # any char\n (\\d{3,4})? # three to four numbers\n (\\?)? # find certainty\n \\s?\\D\\s? # single char splitter, maybe surrounded by spaces\n (\\d{2,4})? # two to four numbers\n (\\?)? # find certainty\n [\\)|\\]] # close paren or brackets\n \\s*? # trailing whitespace\n /ix\n\n death_regex = /\n \\s*? # leading whitespace\n [\\(|\\[] # Date bracketing — open paren or bracket\n \\s*? # any number of whitespaces\n d\\.\\s\n (\\d{3,4})\n (\\?)? # find certainty\n \\s*? # any number of whitespaces\n [\\)|\\]] # Date bracketing — close paren or bracket\n \\s*? # trailing whitespace\n /ix\n\n birth_regex = /\n \\s*? # leading whitespace\n [\\(|\\[] # Date bracketing — open paren or bracket\n \\s*? # any number of whitespaces\n b\\.\\s\n (\\d{3,4})\n (\\?)? # find certainty\n \\s*? # any number of whitespaces\n [\\)|\\]] # Date bracketing — close paren or bracket\n \\s*? # trailing whitespace\n /ix\n\n if (range = text.scan(birth_death_regex).flatten) != []\n b, bcert, d, dcert = range\n unless b.nil?\n if !d.nil? && b.length == 4 && d.length == 2\n d = (b[0..1] + d)\n end\n b = DateExtractor.find_dates_in_string(b).first \n b.certainty = bcert.nil?\n end\n unless d.nil?\n d = DateExtractor.find_dates_in_string(d).first \n d.certainty = dcert.nil?\n end\n else\n if (range = text.scan(death_regex)) != []\n death, dcert = range.flatten\n d = DateExtractor.find_dates_in_string(death).first\n d.certainty = dcert.nil?\n end\n if (range = text.scan(birth_regex)) != []\n birth, bcert = range.flatten\n b = DateExtractor.find_dates_in_string(birth).first\n b.certainty = bcert.nil?\n end\n end\n text = text.gsub(birth_death_regex,\"\")\n text = text.gsub(birth_regex,\"\")\n text = text.gsub(death_regex, \"\")\n return [b,d,text]\n end", "def birth_path_number (birthdate)\n\tnumber = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\n\tnumber_str = number.to_s\n\tbirth_number = number_str[0].to_i + number_str[1].to_i\n\n\tif birth_number > 9\n\t\tnumber2_str = birth_number.to_s\n\t\tbirth_number = number2_str[0].to_i + number2_str[1].to_i\n\tend\n\n\treturn birth_number\nend", "def update_person_number\n discipline = Discipline[event.discipline]\n default_number_issuer = NumberIssuer.find_by_name(RacingAssociation.current.short_name)\n if person && event.number_issuer && event.number_issuer != default_number_issuer && number.present? && !RaceNumber.rental?(number, discipline)\n person.updater = updater\n person.add_number(number, discipline, event.number_issuer, event.date.year)\n end\n end", "def hebrew_birthday(birthdate, h_year = self.year)\n birth_day = birthdate.day\n birth_month = birthdate.month\n birth_year = birthdate.year\n if birth_month == last_month_of_year(birth_year)\n date(h_year, last_month_of_year(h_year), birth_day).fixed\n else\n date(h_year, birth_month, 1).fixed + birth_day - 1\n end\n end", "def age_needs_correction?(today = Date.today)\n birthdate_estimated && date_created.year == today.year && today.month < 7 && birthdate.month == 7 && birthdate.day == 1\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reads sident from webservice and change it for students
def repair_sident(indices) @@mylog.info "There are %i students" % indices.size @client = SOAP::NetHttpClient.new service = SERVICE_URL + SIDENT_SERVICE_PATH f = File.new("sident_errs.txt", "wb") indices.each do |index| @@mylog.info "Procesing index #%i" % index.id service_url = service % [index.student.birth_number, index.specialization.code] @@mylog.debug "Service url is: %s" % service_url begin sident = @client.get_content(service_url) rescue URI::InvalidURIError @@mylog.error "Bad service url %s" % service_url next end if sident =~ /<SIDENT>(.*)<\/SIDENT>/ sident = $1 @@mylog.info "Got sident %i" % sident if sident != "-1" index.update_attribute(:sident, sident) @@mylog.info "Updated sident" else @@mylog.error "Service returned bad code for student #%i" % index.id f.puts "%i, %s, %s, %s" % [index.id, index.student.display_name, index.student.birth_number, index.specialization.code] end end end ensure f.close end
[ "def student\n unless logged_user.student? then\n render_403 and return\n end\n\n if request.get? then\n @student = logged_user.student\n elsif request.put? then\n student = Student.find(logged_user.student.id)\n student.specialty_id = params[:specialty]\n student.course = params[:course]\n if student.save then\n if params[:reg] then\n redirect_to :root\n else\n redirect_to :settings_student, alert: t('settings.save_suc')\n end\n else\n redirect_to :settings_student, notice: t('settings.save_fail')\n end\n end\n end", "def student_id\r\n\t\t\treturn 51875531\r\n\t\tend", "def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end", "def get_student(parameters)\n json_post('students/api.json', parameters)\n end", "def studentdetailupdateskc\n @domchange = Hash.new\n params[:domchange].each do |k, v| \n logger.debug \"k: \" + k.inspect + \" => v: \" + v.inspect \n @domchange[k] = v\n end\n\n # from / source\n # need to check if is from index area or schedule area\n # identified by the id\n # id = t11111 -> index\n # id = GUN2018... -> schedule\n if((result = /(s(\\d+))$/.match(params[:domchange][:object_id])))\n student_dbId = result[2].to_i\n @domchange['object_type'] = 'student'\n @domchange['object_id_old'] = @domchange['object_id']\n @domchange['object_id'] = result[1]\n end\n\n @student = Student.find(student_dbId)\n flagupdate = flagupdatestats = false\n case @domchange['updatefield']\n when 'comment'\n if @student.comment != @domchange['updatevalue']\n @student.comment = @domchange['updatevalue']\n flagupdate = true\n end\n when 'status'\n if @student.status != @domchange['updatevalue']\n @student.status = @domchange['updatevalue']\n flagupdatestats = flagupdate = true\n end\n when 'study'\n if @student.study != @domchange['updatevalue']\n @student.study = @domchange['updatevalue']\n flagupdate = true\n end\n end\n respond_to do |format|\n if @student.save\n format.json { render json: @domchange, status: :ok }\n #ActionCable.server.broadcast \"calendar_channel\", { json: @domchange }\n ably_rest.channels.get('calendar').publish('json', @domchange)\n # Need to get all the slots that these students are in.\n if flagupdatestats\n ##------------------------------- hints ------------------\n ## For includes (and joins):\n ## 1. Names are association names (not the table names!)\n ## 2. to load multiple associations, use an array\n ## 3. to load associations with children, use a hash => \n ## key is parent association name, \n ## value is description of child association\n ##--------------------------------------------------------\n #this_start_date = Time.now()\n this_start_date = Time.strptime(\"2018-06-25\", \"%Y-%m-%d\")\n #this_end_date = this_start_date + 3.days\n stats_slots = Slot\n .select('id', 'timeslot', 'location')\n .joins({lessons: :roles})\n .where('student_id = :sid AND\n timeslot > :sd', {sid: @student.id, sd: this_start_date})\n stats_slot_domids = stats_slots.map do |o| \n o.location[0,3].upcase + o.timeslot.strftime('%Y%m%d%H%M') +\n 'l' + o.id.to_s\n end\n logger.debug \"=============stats_slot_domids: \" + stats_slot_domids.inspect \n stats_slot_domids.each do |this_domid|\n # need to pass in slot_dom_id, however only extracts slot db id,\n # so do a fudge here so extraction of db_id works.\n get_slot_stats(this_domid) # need to pass in slot_dom_id\n logger.debug \"***************calling get_slot_stats: \" + this_domid.inspect\n end\n end\n else\n logger.debug(\"errors.messages: \" + @student.errors.messages.inspect)\n format.json { render json: @student.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def studentdetailupdateskc\n @domchange = Hash.new\n params[:domchange].each do |k, v| \n logger.debug \"k: \" + k.inspect + \" => v: \" + v.inspect \n @domchange[k] = v\n end\n\n # from / source\n # need to check if is from index area or schedule area\n # identified by the id\n # id = t11111 -> index\n # id = GUN2018... -> schedule\n if((result = /(s(\\d+))$/.match(params[:domchange][:object_id])))\n student_dbId = result[2].to_i\n @domchange['object_type'] = 'student'\n @domchange['object_id_old'] = @domchange['object_id']\n @domchange['object_id'] = result[1]\n end\n \n @student = Student.find(student_dbId)\n flagupdate = flagupdatestats = false\n case @domchange['updatefield']\n when 'comment'\n if @student.comment != @domchange['updatevalue']\n @student.comment = @domchange['updatevalue']\n flagupdate = true\n end\n when 'status'\n if @student.status != @domchange['updatevalue']\n @student.status = @domchange['updatevalue']\n flagupdatestats = flagupdate = true\n end\n when 'study'\n if @student.study != @domchange['updatevalue']\n @student.study = @domchange['updatevalue']\n flagupdate = true\n end\n end\n respond_to do |format|\n if @student.save\n format.json { render json: @domchange, status: :ok }\n #ActionCable.server.broadcast \"calendar_channel\", { json: @domchange }\n ably_rest.channels.get('calendar').publish('json', @domchange)\n # Need to get all the slots that these students are in.\n if flagupdatestats\n ##------------------------------- hints ------------------\n ## For includes (and joins):\n ## 1. Names are association names (not the table names!)\n ## 2. to load multiple associations, use an array\n ## 3. to load associations with children, use a hash => \n ## key is parent association name, \n ## value is description of child association\n ##--------------------------------------------------------\n this_start_date = Time.now()\n##########################################################################\n#\n# WARNING - next line is for testing with development data\n#\n##########################################################################\n #if Rails.env.development?\n # this_start_date = Time.strptime(\"2018-06-18\", \"%Y-%m-%d\")\n #this_end_date = this_start_date + 3.days\n #end\n stats_slots = Slot\n .select('id', 'timeslot', 'location')\n .joins({lessons: :roles})\n .where('student_id = :sid AND\n timeslot > :sd', {sid: @student.id, sd: this_start_date})\n stats_slot_domids = stats_slots.map do |o| \n o.location[0,3].upcase + o.timeslot.strftime('%Y%m%d%H%M') +\n 'l' + o.id.to_s\n end\n #logger.debug \"=============stats_slot_domids: \" + stats_slot_domids.inspect \n # Now to get all the slot stats and then send the set\n statschanges = Array.new\n stats_slot_domids.each do |this_domid|\n # need to pass in slot_dom_id, however only extracts slot db id,\n # so do a fudge here so extraction of db_id works.\n statschanges.push(get_slot_stats(this_domid)) # need to pass in slot_dom_id\n end\n ably_rest.channels.get('stats').publish('json', statschanges)\n end\n else\n logger.debug(\"errors.messages: \" + @student.errors.messages.inspect)\n format.json { render json: @student.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def mycourses_student\n sid = params[:id]\n if sid.to_i != current_user.id\n render :json => {\"error\" => \"Voit hakea vain omat kurssisi.\"}, status: 401\n else\n render :json => CourseService.student_courses(current_user.id), status: 200\n end\n end", "def sid=(sid)\n @sid = sid\n end", "def student\n @student ||= Student.find_by_uic(uic)\n end", "def get_ID\n @studentID\n end", "def get_student\n @student = Student.find(params[:student_id])\n end", "def student=(value)\n @student = value\n end", "def cur_student\n student\n end", "def update_im_student\n prepare_im_student unless im_student\n im_student.get_student_attributes\n im_student.save\n end", "def set_name_ssn(lname = :ssn)\n set_name\n line[lname] = forms('Biographical').find { |x|\n x.line[:whose] == 'mine'\n }.line[:ssn]\n end", "def access_student\n student_id = self.student_user_id\n student = User.find_by_id(student_id)\n return student\n end", "def get_siret_from_siren(siren)\n\t\t@result = HTTParty.get(\n\t\t\t\"https://api.insee.fr/entreprises/sirene/V3/siren/#{siren}\",\n\t\t\theaders: {\n\t\t \t\"Content-Type\": 'application/json',\n\t\t \t\"Accept\": 'application/json',\n\t\t \t\"Authorization\": \"Bearer #{@token}\"\n \t\t})\n\t\tunless no_result\n\t\t\tsiren+@result['uniteLegale'][\"periodesUniteLegale\"][0][\"nicSiegeUniteLegale\"]\n\t\tend\n\tend", "def find_student\n Student.find(params[:id])\n end", "def account_sid=(value); end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copies corridor subject from one to another corridor
def copy_corridor_subject(from_specialization, to_specialization) SpecializationSubject.find_all_by_specialization_id(from_specialization).each {|cs| csn = cs.clone csn.update_attribute(:specialization_id, to_specialization) } end
[ "def copy!(new_subject)\n copy(new_subject).save!\n end", "def copy!(new_subject)\n copy(new_subject).save!\n end", "def copy(new_subject)\n self.class.new(@attrs.merge(_subject: new_subject))\n end", "def copy(set, mailbox); end", "def change_subject item, subject\n return unless @path[item.path]\n raise \"Duplicate Subject '#{subject}'\" if @subject[subject]\n @subject.delete item.subject if item.subject\n item.subject = subject\n @subject[subject] = item\n end", "def copy_to(copy)\n known_tasks.each { |t| copy.known_tasks << t }\n free_events.each { |e| copy.free_events << e }\n copy.instance_variable_set :@task_index, task_index.dup\n\n missions.each { |t| copy.missions << t }\n permanent_tasks.each { |t| copy.permanent_tasks << t }\n permanent_events.each { |e| copy.permanent_events << e }\n end", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def copy(new_prefix, other_vals = {})\n new_i = self.dup\n new_i.prefix = new_prefix\n other_vals.select { |key, val| new_i[key] = val }\n\n new_i.save!\n new_i.cc_sequences.first.destroy\n\n ref = {control_constructs: {}}\n ccs = {}\n PROPERTIES.each do |key|\n next if [:cc_conditions, :cc_loops, :cc_questions, :cc_sequences, :cc_statements].include?(key)\n ref[key] = {}\n self.__send__(key).find_each do |obj|\n new_obj = obj.dup\n ref[key][obj.id] = new_obj\n\n obj.class.reflections.select do |association_name, reflection|\n if association_name.to_s != 'instrument' && reflection.macro == :belongs_to\n unless obj.__send__(association_name).nil?\n new_obj.association(association_name).writer(ref[obj.__send__(association_name).class.name.tableize.to_sym][obj.__send__(association_name).id])\n end\n end\n end\n new_i.__send__(key) << new_obj\n end\n end\n\n ### Copy the control construct tree\n new_top_sequence = self.top_sequence.dup\n new_top_sequence.instrument_id = new_i.id\n new_top_sequence.save!\n deep_copy_children = lambda do |new_item, item|\n item.children.each do |child|\n new_child = child.dup\n new_child.instrument_id = new_i.id\n\n child.class.reflections.select do |association_name, reflection|\n if association_name.to_s != 'instrument' && association_name.to_s != 'parent' && reflection.macro == :belongs_to\n unless child.__send__(association_name).nil?\n new_child.association(association_name).writer(ref[child.__send__(association_name).class.name.tableize.to_sym][child.__send__(association_name).id])\n end\n end\n end\n\n new_item.children << new_child\n new_item.save!\n if child.is_a?(ParentalConstruct)\n deep_copy_children.call(new_child, child)\n end\n end\n end\n\n deep_copy_children.call(new_top_sequence, self.top_sequence)\n\n new_i\n end", "def set_relation_between_any_two_subjects subjects:\n subjects.combination(2).each do |a,b|\n edge :relation, {\n a_subject_kind: a['kind'],\n a_subject_name: a['name'],\n b_subject_kind: b['kind'],\n b_subject_name: b['name'],\n }\n end\n end", "def copies\n relations_from.select { |r| r.relation_type == IssueRelation::TYPE_COPIED_TO }.collect { |r| r.issue_to }\n end", "def copy_to\n\n cc_list = [self.designer.email]\n cc_list << self.design.designer.email if self.design.designer_id > 0\n\n self.design.board.users.each do |cc|\n cc_list << cc.email if cc.active?\n end\n\n cc_list += Role.add_role_members(['Manager', 'PCB Input Gate'])\n return cc_list.uniq\n\n end", "def add_corridor_subjects(specialization_id, type, *ids)\n ids.each {|i|\n type.create(:subject_id => i, :specialization_id => specialization_id)\n }\n end", "def relink\n if twin\n part1.twin = twin.part2\n part2.twin = twin.part1\n part1.right = part1.twin.left\n part2.right = part2.twin.left\n end\n end", "def clone_cases_side\n source_participants.each_with_object({}) { |p, result| result[p] = clone_record(p) }\n end", "def contact_to!(subject)\n contact_to(subject) ||\n sent_contacts.create!(:receiver => Actor.normalize(subject))\n end", "def copy_group(from, to)\n sub_groups = from.getMemberGroups\n sub_groups.each do |g|\n to.addMember(g)\n end\n from.getMembers.each do |g|\n to.addMember(g)\n end\n to.update\n end", "def protector_subject\n # Owners are always loaded from the single source\n # having same protector_subject\n owners.first.protector_subject\n end", "def copy_collaborators_from_previous_submission\n last_submission = deliverable.submission_for_grading subject\n self.collaborators = last_submission.collaborators if last_submission\n end", "def rejoin_chromosomes(subsystem)\n sub_chromosomes = subsystem.chromosomes\n sub_chromosomes.each_with_index do |subchromo, i|\n subsystem.each_with_index do |g, j|\n @chromosomes[i][g] = subchromo[j]\n end\n evaluate_chromosome @chromosomes[i]\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds corridor subjects from type and subjects ids
def add_corridor_subjects(specialization_id, type, *ids) ids.each {|i| type.create(:subject_id => i, :specialization_id => specialization_id) } end
[ "def receiver_subjects(subject_type, options = {})\n # FIXME: DRY!\n subject_class = subject_type.to_s.classify.constantize\n\n cs = subject_class.\n select(\"DISTINCT #{ subject_class.quoted_table_name }.*\").\n with_received_ties &\n Tie.sent_by(self)\n\n if options[:include_self].blank?\n cs = cs.where(\"#{ self.class.quoted_table_name }.id != ?\", self.id)\n end\n\n if options[:relations].present?\n cs &=\n Tie.related_by(Tie.Relation(options[:relations], :mode => [ subject.class, subject_class ]))\n end\n\n cs\n end", "def sender_subjects(subject_type, options = {})\n # FIXME: DRY!\n subject_class = subject_type.to_s.classify.constantize\n\n cs = subject_class.\n select(\"DISTINCT #{ subject_class.quoted_table_name }.*\").\n with_sent_ties &\n Tie.received_by(self)\n\n if options[:include_self].blank?\n cs = cs.where(\"#{ self.class.quoted_table_name }.id != ?\", self.id)\n end\n\n if options[:relations].present?\n cs &=\n Tie.related_by(Tie.Relation(options[:relations], :mode => [ subject_class, self.subject.class ]))\n end\n\n cs\n end", "def add_subject(str, type = \"12\")\n subject = ::ONIX::Subject.new\n subject.subject_scheme_id = type.to_i\n subject.subject_code = str\n product.subjects << subject\n end", "def subjects=(value)\n @subjects = value\n end", "def create_subjects\n # One important subject for everybody\n user = User.where(:root => true).first\n time = DateTime.now - 20.days\n category = Category.where(:name => \"Mathraining\").first\n subject = Subject.create(user: user,\n title: \"Questions relatives à Mathraining\",\n content: \"Si vous avez la moindre question, n'hésitez pas !\",\n important: true,\n category: category,\n created_at: time,\n last_comment_time: time,\n last_comment_user: user)\n \n message = Message.create(subject: subject,\n user: User.where(:admin => false).order(:created_at).last,\n content: \"Je me demandais : comment devient-on correcteur ?\",\n created_at: DateTime.now - 5.days)\n subject.update_attributes(last_comment_time: message.created_at, last_comment_user: message.user)\n \n # One important subject for Wépion\n user = User.where(:root => true).first\n time = DateTime.now - 30.days\n category = Category.where(:name => \"Wépion\").first\n subject = Subject.create(user: user,\n title: \"Cours 2021-2022\",\n content: \"Voici l'horaire des cours de Wépion pour cette année.\",\n important: true,\n for_wepion: true,\n category: category,\n created_at: time,\n last_comment_time: time,\n last_comment_user: user)\n \n message = Message.create(subject: subject,\n user: User.where(:wepion => true).first,\n content: \"Merci pour cette information précieuse.\",\n created_at: time + 2.hours)\n subject.update_attributes(last_comment_time: message.created_at, last_comment_user: message.user)\n \n # One important subject for correctors\n user = User.where(:root => false, :admin => true).first\n time = DateTime.now - 10.days\n category = Category.where(:name => \"Mathraining\").first\n subject = Subject.create(user: user,\n title: \"Instructions pour les correcteurs\",\n content: \"Voici les instructions pour les nouveaux correcteurs :-)\",\n important: true,\n for_correctors: true,\n category: category,\n created_at: time,\n last_comment_time: time,\n last_comment_user: user)\n \n # One subject about a chapter\n user = User.where(:admin => false).first\n time = user.created_at + 2.hours\n chapter = Chapter.first\n subject = Subject.create(user: user,\n title: \"Hein !?\",\n content: \"Je ne comprends rien à ce chapitre, quelqu'un peut me le réexpliquer en entier ?\",\n section: chapter.section,\n chapter: chapter,\n created_at: time,\n last_comment_time: time,\n last_comment_user: user)\n \n message = Message.create(subject: subject,\n user: User.where(:admin => true).first,\n content: \"Relis le chapitre, tout simplement...\",\n created_at: time + 2.minutes)\n subject.update_attributes(last_comment_time: message.created_at, last_comment_user: message.user)\n \n # One subject about a question\n user = User.where(:admin => false).second\n time = user.created_at + 5.hours\n question = Section.where(:fondation => true).first.chapters.first.questions.first\n subject = Subject.create(user: user,\n title: \"Exercice incorrect ?\",\n content: \"Cet exercice me semble erroné, qu'en pensez-vous ?\",\n section: question.chapter.section,\n chapter: question.chapter,\n question: question,\n created_at: time,\n last_comment_time: time,\n last_comment_user: user)\n \n message = Message.create(subject: subject,\n user: User.where(:admin => false).third,\n content: \"J'en pense que tu dis des sottises !\",\n created_at: time + 7.hours)\n subject.update_attributes(last_comment_time: message.created_at, last_comment_user: message.user)\nend", "def subjects_with_permission(type, permission)\n raise Exceptions::NotACanHazSubject unless type.respond_to?(:acts_as_canhaz_subject)\n permissions = self.permissions_subjects.where(:type => self.class.to_s, :permission => permission.to_s)\n type.in(:id => permissions.collect(&:csubject_id))\n end", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def affect_subjects\n return if subjects.any?\n if structure.nil?\n destroy\n return\n end\n if plannings.any?\n self.subjects = plannings.flat_map{|planning| planning.course.subjects.at_depth(2) }.uniq\n else\n self.subjects = structure.subjects.at_depth(2).uniq\n end\n save\n nil\n end", "def copy_corridor_subject(from_specialization, to_specialization)\n SpecializationSubject.find_all_by_specialization_id(from_specialization).each {|cs|\n csn = cs.clone\n csn.update_attribute(:specialization_id, to_specialization)\n }\n end", "def set_relation_between_any_two_subjects subjects:\n subjects.combination(2).each do |a,b|\n edge :relation, {\n a_subject_kind: a['kind'],\n a_subject_name: a['name'],\n b_subject_kind: b['kind'],\n b_subject_name: b['name'],\n }\n end\n end", "def add_bic_subject(code)\n add_subject code, \"12\"\n end", "def add_bisac_subject(code)\n add_subject code, \"10\"\n end", "def collect_subjects_with_curriculums( school_class )\n subjects = school_class.curriculums.collect do |c|\n [ c.qualification.subject.subject_name, c.id ]\n end\n end", "def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end", "def add_subject_terminology(t)\n t.subject(:attributes=>{:authority=>\"UoH\"}) {\n t.topic\n t.temporal\n t.geographic\n }\n t.subject_topic(:proxy=>[:subject, :topic], :index_as=>[:displayable, :facetable])\n t.subject_geographic(:proxy=>[:subject, :geographic], :index_as=>[:displayable])\n t.subject_temporal(:proxy=>[:subject, :temporal], :index_as=>[:displayable])\n end", "def subjects_with_permission(type, permission)\n type.joins(\"INNER JOIN can_haz_permissions ON can_haz_permissions.csubject_id = #{type.table_name}.id\").where('cobject_id = ? AND cobject_type = ?', self.id, self.class.to_s).where('csubject_type = ?', type.to_s).where('permission_name = ?', permission)\n end", "def index\n @type_subjects = TypeSubject.all\n end", "def subjects(context = nil); triples(Triple.new(nil, nil, nil), context).map {|t| t.subject}.uniq; end", "def enhance_subjects(key, value)\n return unless key == 'dc_subject_sm'\n\n metadata[key] = value.map do |val|\n if subjects.include?(val)\n subjects[val]\n else\n val\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For each keyvalue pair in the second provided hash, predict the email given the format(s) in company_email_format_hash
def predict_email(prediction_dataset_hash) prediction_dataset_hash.each do |name, domain| new_email = EmailObject.new(name) new_email.domain = domain if @company_email_format_hash.key? domain new_email.email_format = @company_email_format_hash[domain] puts "Name: #{new_email.name} Domain: #{new_email.domain} Format:#{new_email.email_format}" if !new_email.email_format.include? "," generate_email_address(new_email,new_email.email_format) else new_email.email_format.split(",").each do |format| generate_email_address(new_email, format) end end else puts "We can't predict the email for " + new_email.domain + " as it wasn't in the sample hash" end puts "Email:#{new_email.email}" puts "\n" end end
[ "def emails_to_hash(emails)\n {\n :primary => emails.find { |email| email.primary }.email,\n :additional => emails.select { |email| !email.primary && email.verified}.map { |email| email.email }\n }\nend", "def similarity_email e1, e2\n return { full: 1.0,\n name: 1.0,\n domain: 1.0,\n result: true } if e1 == e2\n\n em1, em2 = [e1, e2].map { |e| e.split '@' }\n if em1.size != 2 || em2.size != 2\n raise MalformedEmailError.new(e1, e2) if RAISE_ON_MALFORMED_EMAIL\n return JW::DUMMY\n end\n\n domain = case\n when em1.last == em2.last then 1 # exact domain match\n when [em1, em2].map { |e| e.last.split('.')[-2] }.reduce(:==) then INEXACT_MATCH_COEFFICIENT\n else INEXACT_MATCH_COEFFICIENT / 2.0 * JW::MATCHER.distance(em1.last, em2.last)\n end\n name = case\n when em1.first == em2.first then 1 # exact match\n when ![em1, em2].map { |e| e.first.scan(/[a-z]+/) }.reduce(:&).empty? then INEXACT_MATCH_COEFFICIENT\n else INEXACT_MATCH_COEFFICIENT / 2.0 * JW::MATCHER.distance(em1.first, em2.first)\n end\n full = domain * (1.0 - INEXACT_MATCH_COEFFICIENT) + name * INEXACT_MATCH_COEFFICIENT\n { full: full, name: name, domain: domain, result: full >= INEXACT_MATCH_COEFFICIENT * INEXACT_MATCH_COEFFICIENT }\n end", "def email_config\n hash_for(email_keys).inject({}) do |memo, (key, val)|\n memo[key.to_s.gsub(/^email_/, '').to_sym] = val unless val.is_a?(String) && val.blank?\n memo\n end\n end", "def predicted_email_for(name:, domain:)\n if analyzed_data[domain].nil?\n return 'No training data available for that email domain.'\n end\n\n email_to_predict = PartialEmail.new(name, domain)\n email_formatter = analyzed_data[domain]\n\n email_formatter.predict_address_for(email: email_to_predict)\n end", "def normalize_and_hash_email(email)\n email_parts = email.downcase.split(\"@\")\n # Removes any '.' characters from the portion of the email address before the\n # domain if the domain is gmail.com or googlemail.com.\n if email_parts.last =~ /^(gmail|googlemail)\\.com\\s*/\n email_parts[0] = email_parts[0].gsub('.', '')\n end\n normalize_and_hash(email_parts.join('@'))\nend", "def parser_email(line)\n if line.include? MailHeader.from\n fields=line.split(MailHeader.key_separator)\n if fields.length>1\n\t\t\t\tvalue=fields[1].split(\" \")\n if value.length>1\n firstname_lastname=value[0];\n email_address=value[1].gsub(/[<>]/,'')\n company_url=\"www.\"+email_address.split('@')[1];\n # if the email address is not contains the '@',the address is not correct\n unless email_address.include? \"@\"\n mail_header_output.firstname_lastname=MailHeader.unknown\n mail_header_output.flastname=MailHeader.unknown\n end\n mail_header_output.company_url=company_url\n check_firstname_lastname(email_address)\n check_flastname(email_address)\n check_email_name_conflict()\n end #end value.length\n end #end fields.length\n end #end line include\n end", "def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend", "def email_job_result(jlh)\n return unless email_result?(jlh)\n email_expression = Regexp.new('EMAIL_RESULT_BELOW:(.*)EMAIL_RESULT_ABOVE',Regexp::MULTILINE)\n match = email_expression.match(jlh[:job_result])\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n if (match.nil?)\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid e-mail output!\")\n return\n end\n $logger.debug(\"The output for job_code #{jmd.job_code} does have valid e-mail output! See the rails log for details\")\n body = match[1]\n #get the subject from the body\n match = Regexp.new('SUBJECT:(.*)').match(body)\n subject = match[1] unless match.nil?\n body.sub!(\"SUBJECT:#{subject}\",'')#append on subject\n subject = $application_properties['service_subject'] + \" \" + subject if jlh.has_key?(:service)\n subject = subject + ' -- REMINDER ' + @reminder_hash[jmd.job_code].to_s if (jlh[:reminder_email])\n body.chomp!.reverse!.chomp!.reverse! unless jmd.email_content_type.eql?('text/html')\n from = $application_properties['PST_Team']\n content_type = jmd.email_content_type\n recipients = []\n cc = []# or should it be ''?\n #banana slug\n #integrate with escalation levels to get additional e-mails out of the escalation\n recipients = jlh[:email_to] if jlh.has_key?(:email_to)\n cc = jlh[:email_cc] if jlh.has_key?(:email_cc)\n\n if (jmd.track_status_change && jmd.email_on_status_change_only)\n esc = jle.get_escalation\n esc = JobLogEntry.before(jle).status_not(\"UNKNOWN\").limit(1).first.get_escalation if esc.nil? #if this is nil this jle is green\n\n if ! esc.nil? #this is added in the event that the alert has never been red and we are in this method because we are executing as a service\n esc_emails = esc.get_escalation_based_emails\n recipients = recipients | esc_emails[0]\n cc = cc | esc_emails[1]\n end\n end\n\n recipients = recipients.uniq.join(',')\n cc = cc.uniq.join(',')\n\n email_hash = {:request => jmd.job_code, :content_type => content_type, :subject=>subject,\n :recipients=>recipients, :from=>from, :cc=>cc,:body=>body,\n :incl_attachment=>jmd.incl_attachment,:attachment_path=>jmd.attachment_path,\n :jmd => jmd, :jle => jle}\n\n JobMailer.job_result(email_hash).deliver\n end", "def build_mail_merge\n {\"EMAIL\" => self.email, \"FNAME\" => self.first_name, \"LNAME\" => self.last_name }\n end", "def create_hash\n \n \thash = Hash[get_thoses_fucking_name.zip(get_bitches_mail)]\n \t\n \thash.each do |key, mail|\n\n\tputs \":nom => #{key} ; :e-mail => #{mail}\"\n\t\n\tend\nend", "def email_prediction()\n\t\tif input_check(@domain)\n\t\t\tif @domain == 'alphasights.com'\n\t\t\t\tputs first_name_dot_last_name()\n\t\t\telsif @domain == 'google.com'\n\t\t\t\tputs first_name_dot_last_initial()\n\t\t\t\tputs first_initial_dot_last_name()\n\t\t\telsif @domain == 'apple.com'\n\t\t\t\tputs first_initial_dot_last_initial()\n\t\t\tend\n\t\telsif input_check(@domain) == false\n\t\t\tputs 'Sorry, We cannot predict the email address requested at this time.'\n\t\tend\n\tend", "def to_email_info\n semantics = self.to_semantic_values\n info = BookmarkEmailInfo.new\n info.title = semantics[:title].join(\" \")\n info.author = semantics[:author].join(\" \")\n info.format = semantics[:format].join(\" \")\n info.language = semantics[:language].join(\" \")\n info.online_url = self[:url_fulltext_display].first if self[:url_fulltext_display]\n info.online_url_label = self[:url_suppl_display].first if self[:url_suppl_display]\n info.locations = self.location_names\n info.callnumbers = self[:callnumber_t] || []\n info\n end", "def correct_format_email(*args)\n\t\t\targs.each do |field|\n\t\t\t\tdefine_method(\"#{field}=\") do |val|\n\t\t\t\t\tself[field.to_sym] = val ? val.downcase.gsub(\",\",\".\") : val\n\t\t\t\tend\n\t\t\tend # args.each do field\n\t\tend", "def sort_email!\n raise EmptyInputError, ':final_hash is empty' if @final_hash.empty?\n\n @final_array = @final_hash.invert.sort.to_h.values\n end", "def predict_emails\n @test_dataset.each do |test_item|\n domain_name = test_item[1]\n if !@all_domains.keys.include?(domain_name)\n puts \"Predictions for \" + test_item[0] + \" are - \"\n puts \"Can not predict email for this domain as no sufficient information is available\"\n puts \"-\" * 50\n else\n current_domain = get_current_domain(domain_name) \n current_domain.display_predictions(test_item[0])\n end\n end\n end", "def recommend_email_address\n email_address_patterns = email_finder.find_company_email_patterns\n\n email_address_patterns.map do |pattern|\n email = EmailBuilder.new(advisor_name, company_domain, EmailAddressParser.new(advisor_name, company_domain, pattern))\n email.generate_email\n end\n end", "def email_prediction()\n\t\tif input_check(@domain)\n\t\t\tif @domain == 'alphasights.com'\n\t\t\t\tputs first_name_dot_last_name();\n\t\t\telsif @domain == 'google.com'\n\t\t\t\tputs first_name_dot_last_initial();\n\t\t\t\tputs first_initial_dot_last_name();\n\t\t\telsif @domain == 'apple.com'\n\t\t\t\tputs first_initial_dot_last_initial();\n\t\t\telse \n\t\t\t\t'This data does not exist'\n\t\t\tend\n\t\tend\n\tend", "def find_company_emails\n EMAIL_SAMPLES.each do |name, email|\n all_company_emails[name] = email if match_company_domain?(email)\n end\n all_company_emails\n end", "def unpack_emails_and_metadata emails\n mails_with_metadata = []\n emails.each do |e|\n mail_data = Hash.new\n mail_data[:mail] = Mail.new(e[ATTR][RFC822])\n mail_data[:uid] = e[ATTR][UID]\n mail_data[:thrid] = e[ATTR][GM_THRID]\n mail_data[:labels] = e[ATTR][GM_LABEL]\n mails_with_metadata << mail_data\n end\n mails_with_metadata\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1. For a given person, return their favourite tv show
def tv_show(person) return person[:favourites][:tv_show] end
[ "def tv_show(person)\n return person[:favourites][:tv_show]\nend", "def same_tv_show(people)\n tv_shows = {}\n same_tv_shows = {}\n\n for person in people\n show = person[:favourites][:tv_show]\n if tv_shows[show] != nil\n tv_shows[show] << person[:name]\n else\n tv_shows[show] = [person[:name]]\n end\n end\n\n for show_name in tv_shows.keys\n if tv_shows[show_name].length > 1\n same_tv_shows[show_name] = tv_shows[show_name]\n end\n end\n return same_tv_shows\nend", "def same_favourite_tv_show(people)\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n result = []\n for index in same_show\n result.push(people[index][:name])\n end\n return result\nend", "def find_show_buddies(people)\n\n tv_shows = []\n\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n show_buddies = []\n\n for index in same_show\n show_buddies.push(people[index][:name])\n end\n\n return show_buddies\nend", "def likes_the_same_tv(array_of_people)\n tv_shows = []\n show_match = []\n liked_show = person[:favourites][:tv_show]\n\n for person in array_of_people\n tv_shows << liked_show\n end\n\n counter = 0\n while counter < tv_shows.length\n for person in array_of_people\n show_match[counter] = []\n if liked_show.include? show\n show_match[counter] << person\n end\n end\n counter +=1\n end\n\n return show_match\nend", "def same_fav_tv_shows(people_array)\n favs = {}\n\n for person in people_array\n tv_show = person[:favourites][:tv_show]\n if favs[tv_show]\n favs[tv_show].push(person[:name])\n else\n favs[tv_show] = [person[:name]]\n end\n end\n\n favs.each do |key, value|\n favs.delete(key) if !(value.length > 1)\n end\n\n return favs\n end", "def favorite_players(fan)\n Fan.find_by(name: fan).players\nend", "def show_fav\n if Favorite.select{|t| t.user_id == self.id} == []\n puts \"You don't have any favorites yet! Try adding some!\"\n puts \"\"\n self.display_choices\n else\n puts \"\"\n puts \"FAVORITES:\"\n puts Favorite.select{|t| t.user_id == self.id}.map{|t| t.location.address + \", \" + t.location.boro.name + \", \" + t.location.zip.name}.uniq\n puts \"\"\n self.display_choices\n end\n end", "def favourite_heroes()\n sql = \"\n SELECT DISTINCT h.id, h.name FROM players p\n INNER JOIN favourites f\n ON f.player_id = p.id\n INNER JOIN heroes h\n ON h.id = f.hero_id\n WHERE player_id = #{@id};\n \"\n return Hero.get_many( sql )\n end", "def m_list(mood_name)\n self.favorites.select do |horo|\n horo.horoscope_mood == mood_name\n end\n end", "def favourites\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\")\n\t\t\tend", "def starring?(actor, films)\n movies = films.select do |film|\n film[:stars].include? actor\n end\n movies.collect{|film| film[:title]}\nend", "def everyones_favourite_food(people)\n all_food=[]\n for person in @people\n all_food << person[:favourites][:things_to_eat]\n end\n return all_food\nend", "def list_favorite_friends\n list_favorite_things(:friend)\n end", "def pick_movie(db,user_pref)\n matches = []\n search = db.execute(\"SELECT * FROM selections\")\n search.each do |movie|\n if \"#{movie['genre']}\" == user_pref\n matches << \"#{movie['title']}\"\n end\n end\n pick = matches.sample\n puts \"You are now watching...#{pick}\"\n pick\nend", "def all_fav_foods(people)\n fav_foods = []\n for person in people\n fav_foods.concat(person[:favourites][:things_to_eat])\nend\nreturn fav_foods\nend", "def food_liked_by_person?(person, food)\n persons_foods = person[:favourites][:things_to_eat]\n return persons_foods.include?(food)\nend", "def getFavorite(game)\n if game.spread <= 0\n return [game.home_team_id, \"home\", game.vis_team_id, \"vis\"]\n else\n return [game.vis_team_id, \"vis\", game.home_team_id, \"home\"]\n end\n end", "def favorite\n object.favorite\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
def bin_decision_backup(past_yield, desired_yield) if(past_yield <= desired_yield) bin = 1 else bin = rand(2..10) end return bin end
def bin_decision(threshold) tmp = rand(1..100) if(tmp <= threshold) bin = 1 else bin = rand(2..10) end return bin end
[ "def probability chance=5\n (rand(10)+1) <= chance\nend", "def make_bet\n #TODO: strategic, semi-random bet based on hand and cash\n @bet = @min_bet\n end", "def get_signal(rand_gen, a = 1)\r\n rand_gen.rand(2) == 0 ? -a : a\r\nend", "def generate_binary\n binary_num = []\n\n 8.times do\n binary_num << rand(0..1)\n end\n\n return binary_num\nend", "def probability\n rand(1..100)\n end", "def chance(c)\n return rand < c\nend", "def single_trial(cutoff)\n lower_value = rand() * PRIOR_LOWER_MAX\n higher_value = 2 * lower_value\n if rand() < 0.5 then\n \treturn (if lower_value >= cutoff then lower_value else higher_value end)\n else\n \treturn (if higher_value >= cutoff then higher_value else lower_value end)\n end\nend", "def meets_condition?(threshold)\n rand <= threshold\nend", "def binsearch arr, target\n return if arr.blank?\n low = 0\n high = arr.count\n loop do\n choice = (low + high) / 2\n bin_lower = arr[choice]\n bin_lower = yield(bin_lower) if block_given?\n bin_upper = arr[choice + 1]\n bin_upper = yield(bin_upper) if bin_upper and block_given?\n if target >= bin_lower\n return choice if !bin_upper || (bin_upper > target)\n # puts \"Rejected #{arr[choice]}->#{arr[choice+1]}: too low\"\n low = choice + 1\n else\n # puts \"Rejected #{arr[choice]}->#{arr[choice+1]}: too high\"\n return nil if high == choice\n high = choice\n end\n end\nend", "def generate_harder_value(rnd_obj, _)\n # generate from the top 70% upwards\n min, max = fetch_min_max_values\n diff = max-min\n top_seventy_percent = 0.7 * diff\n @value = rnd_obj.rand(Integer(top_seventy_percent)..max)\n end", "def generate_fake_binary_sequence\n s = \"\"\n 1500.times{|i| s << kernel.rand(1) }\n s\n end", "def randThreshold\n\t\t@threshold = rand(0)\n\tend", "def bet_amount(pool)\n mid = [pool, MAX_BET].min\n\n min = (mid * 0.5).to_i\n max = [(mid * 1.5).to_i, MAX_BET].min\n\n # bet at least one mushroom\n [1, rand(min..max)].max\n end", "def bernoulli(p)\r\n rnd <= p ? 1 : 0\r\n end", "def bit\n rand(2)\n end", "def bi_rand(v)\n rand(2) > 1 ? v : nil\n end", "def percent_chance( &block )\n result = !!( rand( 100 ) < self )\n block_given? ? ( result ? yield : nil ) : result\n end", "def rand_poisson(expected_value)\n target_cumulative = Math.exp(-expected_value)\n accumulator = 0\n p = rand\n\n while p > target_cumulative\n accumulator += 1\n p *= rand\n end\n\n accumulator\nend", "def add_noise( old_value, greatest_difference )\n new_value = old_value + $rng.nextInt( 2 * greatest_difference ) - greatest_difference\n if new_value > 255\n 255\n elsif new_value < 0\n 0\n else\n new_value\n end\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find a move number of a possible fork:
def move_number_fork current = @game.current_player if current == :O @count_spots.last if @game.fork?.size > 1 end end
[ "def forks_number\n number = fork? ? fork.forks_count : forks_count\n number ||= 0\n end", "def fork_check(wins, player, opponent)\n block_fork = find_fork(wins, opponent, player)\n get_fork = find_fork(wins, player, opponent)\n if get_fork.size > 0 # if possible to create fork, do it\n move = get_fork.sample\n elsif block_fork.size > 0 # otherwise if opponent can create fork, block it\n move = block_fork.sample\n else\n move = sel_rand(player, opponent) # otherwise take random position\n end\n end", "def blockPoint(forks)\n # this keeps track of the tiles that each fork has in common\n # the most frequent and unoccupied index will be returned\n commonIndicies = forks[0] # initializing\n # intersect each of the forks to find a the tile they all depend on\n for i in 1 ... forks.size\n commonIndicies &= forks[i]\n end\n validPositions = commonIndicies.select {|i| !position_taken?(i)}\n # finds the most frequent index\n return validPositions.max_by {|i| validPositions.count(i)}\n end", "def get_forks(forks, files_size)\n forks = [forks, files_size, MAX_SAUCE_NODES].min\n forks == 0 ? 1 : forks\n end", "def fork_possible?(player)\n fork_index = nil\n existing_indexes = game.board.cells.each_index.select{ |i| game.board.cells[i] == player.token}\n empty_indexes = $empty_positions.to_a.map!{|i| i - 1}\n empty_indexes.detect{|test_index|\n existing_indexes << test_index\n winning_indexes = two_in_a_row?(player)\n existing_indexes.pop\n if winning_indexes.count >= 2\n fork_index = test_index\n return true\n end\n }\n return fork_index\n end", "def forking_move(symbol)\n (0...3).each do |row|\n (0...3).each do |col|\n next unless @board[row][col].nil?\n\n @board[row][col] = symbol\n if has_fork?(symbol)\n @board[row][col] = nil\n return row, col\n end\n\n @board[row][col] = nil\n end\n end\n\n nil\n end", "def check_for_fork\n @game.game.free_positions.each do |position|\n possible_game = @game.clone\n possible_game.game = @game.game.clone\n possible_game.game.board = @game.game.board.clone\n possible_game.game.set_position!(position,marker)\n return position if possible_fork?(possible_game)\n end\n false\n end", "def forks\n repositories.map do |r|\n octokit.repository(r)['forks_count']\n end.inject(&:+)\n end", "def get_fork_count(repo_id)\n forks_count = client.repository(repo_id).forks_count\n rescue Octokit::NotFound\n nil\n end", "def copro_part_2\n start = (79 * 100) + 100_000\n stop = start + 17_000\n step = 17\n\n h = 0\n (start..stop).step(step) { |i| h += 1 unless i.prime? }\n h\n end", "def number_of_paths(n)\n return 0 if n < 0\n return 1 if n == 1 || n == 0\n number_of_paths(n - 1) + number_of_paths(n - 2) + number_of_paths(n - 3)\nend", "def possible_fork?(game_state)\n possible_wins = 0\n LINES.each do |line|\n markers = group_positions_by_marker(line,game_state)\n if markers[mark].length == 2 and markers.keys.include?(nil)\n possible_wins += 1 \n end\n return true if possible_wins == 2\n end\n nil\n end", "def get_forks\n turn_left()\n move()\n while ! any_beepers_in_beeper_bag?()\n while not next_to_a_beeper?()\n spin()\n end\n pick_beeper()\n end\n turn_around()\n move()\n put_beeper()\n move()\n while ! any_beepers_in_beeper_bag?()\n while not next_to_a_beeper?()\n spin()\n end\n pick_beeper()\n end\n turn_around()\n move()\n put_beeper()\n turn_right()\n end", "def block_fork\n forks = find_forks(@opponent_mark)\n if forks.length == 1\n forks.first\n elsif forks.length > 1\n # We look at the center to determine which case this is\n if @board.square(1,1) == @computer_mark\n side\n else\n corner\n end\n else\n nil\n end\n end", "def forks_count\n @repository[\"forks\"]\n end", "def number_of_parent_work(login=nil)\n count_by_frbr(login, :is_part_of, :how_many_works?) \n end", "def forking_moves(board, key)\n forking_moves =[]\n\n (0..2).each do |y|\n (0..2).each do |x|\n if board[y][x] == :_\n mutated_board = Marshal.load(Marshal.dump(board))\n mutated_board[y][x] = key\n mutated_winning_moves = winning_moves(mutated_board, key).uniq\n if mutated_winning_moves.count > 1\n forking_moves << mutated_winning_moves\n end\n end\n end\n end\n\n forking_moves.flatten\n \n end", "def climb_stairs(n)\n # return count if n == 0 #base case 0 steps \n # return count + 1 if n == 1 #base case 1 step remaining\n # #try both \n # count += 1\n # climb_stairs(n-1, count) + climb_stairs(n-2, count) \nend", "def process_count\n children.count\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an array of primary region replicas tableName table to return regions for
def getPrimaryRegionEncodedNames(tableName) c = HBaseConfiguration.new() tableNameObj = TableName.valueOf(tableName) t = HTable.new(c, tableNameObj) regions = t.getRegionsInRange(t.getStartKeys[0], t.getEndKeys[t.getEndKeys.size-1]) priRegions = Array.new regions.each do |r| if (r.getRegionInfo().getReplicaId() == 0) priRegions << r.getRegionInfo().getEncodedName() end end priRegions end
[ "def table_regions(name, start_row = nil, end_row = nil)\n raise NotImplementedError, \"Getting the table regions is not supported yet\"\n end", "def index\n @region_tables = RegionTable.all\n end", "def regions_for_select\n \t\tRegion.all.map { |p| [p.name, p.id] }\n \tend", "def regions\n DefinitionFactory.regions_repository.all\n end", "def all\n partitions.group_by { |row| row['table_name'] }.map(&method(:to_tablature_table))\n end", "def preferred_regions(ingredient, provider_id)\n resource_region_codes = filtered_resources(provider_id).map(&:region_code)\n region_areas = ingredient.region_constraints\n regions = Array.new\n region_areas.each do |region_area|\n preferred_region_codes = Set.new(Resource.region_codes(region_area))\n regions.push(resource_region_codes.map { |rrc| preferred_region_codes.member?(rrc) })\n end\n regions.flatten\n end", "def regions_for_solr\n regions.collect{|r| r.region_id}.join(' ')\n end", "def squares_by_region(region_id)\n @region_mapper[region_id] || []\n end", "def distributePrimaryRegions(priRegions)\n c = HBaseConfiguration.new()\n admin = HBaseAdmin.new(c)\n servers = Array.new()\n dServers = Array.new()\n dServers = admin.getClusterStatus.getDeadServerNames()\n serv = admin.getClusterStatus.getServers()\n serv.each do |s|\n if (!dServers.include?(s))\n servers << s.getServerName()\n end\n end\n count=0\n totRS = servers.size()\n priRegions.each do |r|\n puts r+\" will move to \"+servers[count%totRS]\n move r,servers[count%totRS]\n count+=1\n end\n puts priRegions.size().to_s() + \"primary regions moved\"\nend", "def isTableRegion(tableName, hri)\n return Bytes.equals(hri.getTableDesc().getName(), tableName)\nend", "def getRegions(config, servername)\n connection = HConnectionManager::getConnection(config);\n return ProtobufUtil::getOnlineRegions(connection.getAdmin(ServerName.valueOf(servername)));\nend", "def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n @regions << endpint['region']\n end\n end\n @regions.uniq!\n end\n @regions\n end", "def regions\n @root\n end", "def regions\n RegionBuilder.new(self.region_data || {})\n end", "def tables\n []\n end", "def split(table_or_region_name)\n @admin.split(table_or_region_name)\n end", "def regions\n AWS.regions.map(&:name)\n end", "def tables\n if Jetpants.topology.shards.first == self\n super\n else\n Jetpants.topology.shards.first.tables\n end\n end", "def aws_regions_list(access, secret)\n create_ec2_client(access, secret, 'us-west-2').describe_regions.regions.map { |record| record['region_name'] }\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Distribute the regions in the array passed uniformly across the server array provided
def distributePrimaryRegions(priRegions) c = HBaseConfiguration.new() admin = HBaseAdmin.new(c) servers = Array.new() dServers = Array.new() dServers = admin.getClusterStatus.getDeadServerNames() serv = admin.getClusterStatus.getServers() serv.each do |s| if (!dServers.include?(s)) servers << s.getServerName() end end count=0 totRS = servers.size() priRegions.each do |r| puts r+" will move to "+servers[count%totRS] move r,servers[count%totRS] count+=1 end puts priRegions.size().to_s() + "primary regions moved" end
[ "def shards(m, r=1); div(m).map{|n| [n,m/n*r]}; end", "def distribute population\n\t\thowManyGroups=population.size / @groupSize\n\t\tif howManyGroups > @amountGroups\n\t\t\thowManyGroups=@amountGroups\n\t\tend\n\t\t \n\t\t@arrayGroups=Array.new\n\t\thowManyGroups.times do\n\t\t\tgroup=Group.new @groupSize\n\t\t\t@groupSize.times do\n\t\t\t\tpos=rand(population.size)\n\t\t\t\tgroup.add population[pos]\n\t\t\t\tpopulation.delete_at pos\n\t\t\tend\n\t\t\t@arrayGroups << group\n\t\tend\n\tend", "def divide_individually(array_with_number_of_addresses)\n possible_ranges = []\n num = self.to_num()\n bits_to_move = 32 - @bits\n remaining_addresses = self.free\n array_with_number_of_addresses.each() {|number_of_addresses_for_subnet|\n if (2 ** bits_to_move) < number_of_addresses_for_subnet\n puts \"WARNING: could not allocate #{number_of_addresses_for_subnet} anymore (max #{(2 ** bits_to_move)})\"\n next\n end \n bits_to_move = [(Math.log(number_of_addresses_for_subnet+1)/Math.log(2)).to_i, bits_to_move].min \n possible_range = IpMask.create_from_num(num, 32 - bits_to_move)\n unless self.are_all_in_range?(possible_range)\n puts \"WARNING: the selected range '#{possible_range}' is outside the base range\"\n next\n end\n num += number_of_addresses_for_subnet\n puts \"[alloc #{number_of_addresses_for_subnet}] \\tpossible range: #{possible_range}\"\n possible_ranges << possible_range\n remaining_addresses -= (2 ** bits_to_move)\n #puts \"[to allocate = #{number_of_addresses_for_subnet}] => free = #{possible_range.free}\"\n }\n possible_ranges\n end", "def subgrids()\n sz.times.reduce([]) do |ac, i; ri, ci|\n ri = (i / s_sz) * s_sz\n ci = (i * s_sz) % sz\n ac.append((ri ... ri + s_sz).reduce([]) do |acc, j|\n acc.append(g[j][ci ... ci + s_sz])\n end)\n end\n end", "def distribute_players(players_pool_array)\n @radiant_array, @radiant_avg = players_pool_array.first(5), 0\n @dire_array, @dire_avg = players_pool_array.last(5), 0\n\n @radiant_array.each { |player| @radiant_avg += player[1] }\n @dire_array.each { |player| @dire_avg += player[1] }\n end", "def distributed_initialization()\n slices = @x.max / @mu.length\n (0..@mu.length-1).each do |j|\n @mu[j] = slices*j + rand()*(slices)\n end\n end", "def move_regions(server)\n if server.class == String\n server = region_servers.find { |a| a.get_server_name.include? server }\n end\n #puts \"moving regions on RS:#{server.to_s}\"\n max_try = 10\n\n r_count = region_count(server)\n while (r_count !=0 && max_try > 0) do\n\n get_regions(server).each { |region|\n move_region(region, @previous_region_server)\n }\n\n sleep 1\n current_count = region_count server\n\n while (r_count > current_count)\n r_count= current_count\n sleep(3)\n end\n end\n @previous_region_server = Bytes.toBytes(server.getServerName())\n\n return max_try > 0\n end", "def g_hub \n # Fetch random hub areas, order by random, split the array to chunks of 7 sized arrays\n @g_hub = Branches.where(:hub => 'y').order('rand()').limit(14).map{|i| i.branch_name}.each_slice(7).to_a \n end", "def setup_region_tile_mapping\n @region_tile_mapping = {}\n (0..63).each {|i| @region_tile_mapping[i] = []}\n for x in 0..data.xsize\n for y in 0..data.ysize\n @region_tile_mapping[region_id(x, y)] << [x,y]\n end\n end\n end", "def acct_group (roster_array)\n\n ran_arr = roster_array.shuffle\n for i in 3..5\n if ran_arr.size % i == 0\n ran_arr.each_slice(i) {|x| p x}\n end\n end\nend", "def create_groups(array)\n\tArray.new(array.shuffle.each_slice(4).to_a)\nend", "def create_server_array(args)\n dryrun = args[:dryrun]\n tmpl_server_array = args[:tmpl_server_array]\n server_array_name = args[:server_array_name]\n instances = args[:instances]\n release_version = args[:release_version]\n service = args[:service]\n env = args[:env]\n app_group = args[:app_group]\n right_client = args[:right_client]\n region = args[:region]\n\n packages = service.split(',')\n\n # Clone a server array\n if dryrun\n $log.info(\"SUCCESS. Created server array #{server_array_name}\")\n $log.info(\"Will install #{packages[-1]}=#{release_version} for all instances.\")\n $log.info(\"Will launch #{instances} instances.\")\n return\n end\n\n new_server_array = right_client.server_arrays(:id => tmpl_server_array).show.clone\n\n # Rename the newly created server array\n params = { :server_array => {\n :name => server_array_name,\n :state => 'enabled'\n }}\n new_server_array.show.update(params)\n $log.info(\"SUCCESS. Created server array #{server_array_name}\")\n puppet_facts = get_puppet_facts(:region => region,\n :service => service,\n :app_group => app_group,\n :release_version => release_version)\n new_server_array.show.next_instance.show.inputs.multi_update('inputs' => {\n 'nd-puppet/config/facts' => puppet_facts})\n $log.info(\"Updated puppet input #{puppet_facts}.\")\n $log.info(\"Will install #{service}=#{release_version} for all instances.\")\n\n # Launch new instances\n for i in 1..instances\n instance = new_server_array.launch\n if not instance.nil?\n $log.info(\"SUCCESS. Launched #{instance.show.name}.\")\n else\n $log.error('FAILED. Failed to launch an instance.')\n end\n end\n\n new_server_array = find_server_array(:right_client => right_client,\n :server_array_name => server_array_name)\n\n # Wait for at least one instance to become operational.\n num_operational_instances = 0\n while num_operational_instances == 0\n $log.info(\"No any instance is operational ... wait for 1 min ...\")\n sleep 60\n for instance in new_server_array.current_instances.index\n if instance.state == 'operational'\n num_operational_instances += 1\n $log.info(\"At least one instance is operational.\")\n break\n end\n end\n end\n\n return new_server_array\nend", "def pick_done_regions\n\t\t$logger.info \"entered\"\n\n\t\tlist = []\n\t\t(0...ai.rows).each do |row|\n\t\t\t(0...ai.cols).each do |col|\n\t\t\t\tsq = ai.map[row][col]\n\t\t\t\tlist << sq if sq.done_region\n\t\t\tend\n\t\tend\n\n\t\tindexes = []\n\t\twhile indexes.length < 10 and indexes.length < list.length\n\t\t\tn = rand( list.length )\n\t\t\tindexes << n unless indexes.include? n\n\t\tend\n\n\t\tout = []\n\t\tindexes.each {|i| out << list[i] }\n\n\t\tout\n\tend", "def distribute_gels\n show do\n title \"Equally distribute melted gel slices between tubes\"\n note \"Please equally distribute the volume of the following tubes each between two 1.5 mL tubes:\"\n table operations.select{ |op| op.temporary[:is_divided]}.start_table\n .input_item(INPUT)\n .end_table\n note \"Label the new tubes accordingly, and discard the old 1.5 mL tubes.\"\n end if operations.any? { |op| op.temporary[:is_divided] }\n end", "def tile_inward\n rising, num_summit_clients, falling = calculate_equilateral_triangle\n\n # distribute extra clients in the middle\n summit = []\n if num_summit_clients > 0\n split = num_summit_clients / 2\n carry = num_summit_clients % 2\n summit = [split, carry, split].reject(&:zero?)\n\n # one client per column cannot be considered as \"tiling\" so squeeze\n # these singular columns together to create one giant middle column\n if summit.length == num_summit_clients\n summit = [num_summit_clients]\n end\n end\n\n arrange_columns rising + summit + falling\n end", "def partition_ids_by_remote_region(ids)\n ids.partition { |id| self.id_in_current_region?(id) }\n end", "def squares_by_region(region_id)\n @region_mapper[region_id] || []\n end", "def divide_variables\n divisors = calculate_divisors\n s = divisors.sample\n @genes_per_group = s\n k = @num_genes / s\n @subsystems = Array.new(k) { Subsystem.new }\n end", "def distribute(m, n)\n # distribute m candies to n children, as easily as possible\n # iterate through n times, adding 1 to each element in this new return array, subtracting one from m, until m == 0\n distributions = []\n n.times do\n \n end\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes a new Ban object
def initialize(raw_ban) @raw_ban = raw_ban end
[ "def initialize (number, bots, flag)\n @number = number\n @bots = bots\n @ap = $ACTION_POINTS\n @flag = flag\n @mana = $MAX_MANA\n end", "def initialize()\n @bet = \"user:#{settings.id}:bet\"\n @redis = settings.redis\n @redis_money = \"user:#{settings.id}:money\"\n @redis_chips = \"user:#{settings.id}:chips\"\n @money = @redis.get @redis_money\n @money = @money.to_i\n end", "def initialize(name)\n # BankAccount BankAccount #initialize initializes with a name\n @name = name\n # BankAccount BankAccount #initialize always initializes with balance of 1000\n @balance = 1000\n # BankAccount BankAccount #initialize always initializes with a status of 'open'\n @status = 'open'\n end", "def initialize(cards, bet)\n @cards = cards\n @bet = bet\n end", "def create\n @ban = Ban.new(ban_params)\n\n respond_to do |format|\n if @ban.save\n format.html { redirect_to @ban, notice: 'Ban was successfully created.' }\n format.json { render :show, status: :created, location: @ban }\n else\n format.html { render :new }\n format.json { render json: @ban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@admin_ban = Ban.new(admin_ban_params)\n\t\t@admin_ban.user = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @admin_ban.save\n\t\t\t\tformat.html { redirect_to admin_bans_path, notice: 'Ban was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: admin_bans_path }\n\t\t\telse\n\t\t\t\tformat.html { broadcast_errors @admin_ban, admin_ban_params }\n\t\t\t\tformat.json { render json: @admin_ban.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def initialize\n super(\"Dealer\", 1000)\n @deck = []#Holds Deck\n @players = []\n # @actives = []\n end", "def initialize make, model, price\r\n\t\t# increment the Blender class' @@count by 1 when a blender gets created:\r\n\t\t@@count += 1\r\n\r\n\t\t# make, model, and price are initially set with the arguments we pass in to Blender.new:\r\n\t\t@make = make\r\n\t\t@model = model\r\n\t\t@price = price\r\n\r\n\t\t# every blender starts with @power_on set to false, so it doesn't\r\n\t\t@power_on = false\r\n\tend", "def initialize(account_id, start_balance, open_date, owner = Owner.new({last_name: \"The_Bank\"}))\n # Check that start_balance argument is a Fixnum & meets minimum balance\n if start_balance.to_i >= self.class::MINIMUM_BALANCE && start_balance.class == Fixnum\n @balance = start_balance\n else\n raise ArgumentError, \"Start balance must be greater than minimum balance: #{ self.class::MINIMUM_BALANCE } cents\"\n end\n\n # Check that owner argument is an Owner object\n if owner.class != Owner\n # If owner argument is a hash, attempt to initialize an Owner from it\n if owner.class == Hash\n owner = Owner.new(owner)\n else\n raise ArgumentError, \"Invalid owner info provided\"\n end\n end\n\n @account_id = account_id\n @open_date = open_date\n @owner = owner\n end", "def create\n\t\t@room_ban = RoomBan.new(room_ban_params)\n\t\t@room_ban.room = @room\n\t\t@room_ban.by = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @room_ban.save\n\t\t\t\tformat.html { redirect_to room_ban_path(@room, @room_ban), notice: 'Ban was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: room_ban_path(@room, @room_ban) }\n\t\t\telse\n\t\t\t\tformat.html { broadcast_errors @room_ban, room_ban_params }\n\t\t\t\tformat.json { render json: @room_ban.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n @boat = Boat.new\n end", "def initialize(args = {})\n @user = args[:user]\n @bet_type = args[:bet_type]\n @combo_bet_stake = args[:combo_bet_stake]\n initialize_other_params(args)\n end", "def create\n @ban = Ban.new(params[:ban])\n\n respond_to do |format|\n if @ban.save\n flash[:notice] = 'Ban was successfully created.'\n format.html { redirect_to(@ban) }\n format.xml { render :xml => @ban, :status => :created, :location => @ban }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ban.errors, :status => :unprocessable_entity }\n end\n end\n end", "def initialize(name, balance=100)\n @name = name\n @balance = balance\n end", "def init_bank\n @bank = Bank.new(self)\n bank.grant Money.new(BANK_SIZE)\n end", "def initialize(climber)\n @climber = climber\n end", "def initialize(troop_id, member_index, enemy_id = nil)\n super()\n @troop_id = troop_id\n @member_index = member_index\n troop = $data_troops[@troop_id]\n @enemy_id = enemy_id.nil? ? troop.members[@member_index].enemy_id : enemy_id\n enemy = $data_enemies[@enemy_id]\n @battler_name = enemy.battler_name\n @battler_hue = enemy.battler_hue\n @maxhp = maxhp\n @maxsp = maxsp\n @hp = @maxhp\n @sp = @maxsp\n @str = base_str\n @dex = base_dex\n @agi = base_agi\n @int = base_int\n @gold = gold\n @exp = exp\n @hidden = enemy_id.nil? ? troop.members[@member_index].hidden : false\n @immortal = enemy_id.nil? ? troop.members[@member_index].immortal : false\n @steal_items = Enemy_Steal[@enemy_id].to_a\n @steal_attempt = 0\n @moving = @sp_damage = false\n battler_position_setup\n end", "def initialize(fan)\n\n @fan = fan\n end", "def initialize(bc, block_id)\n\t\t\t@bc = bc\n\n\t\t\tunless @bc.is_a?(Bitcoin::Client)\n\t\t\t\traise TypeError, \"bc must be a Bitcoin::Client (#{@bc.class} given)\"\n\t\t\tend\n\n\t\t\tunless block_id.is_a?(String)\n\t\t\t\traise TypeError, \"block_id must be a String (#{block_id.class} given)\"\n\t\t\tend\n\n\t\t\tbegin\n\t\t\t\tblock_data = @bc.jr.getblock(block_id)\n\t\t\trescue Jr::ServerError => ex\n\t\t\t\tif ex.code == -5\n\t\t\t\t\traise UnknownBlock, block_id\n\t\t\t\telse\n\t\t\t\t\traise\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t{\n\t\t\t\tblock_id: :hash,\n\t\t\t\theight: :height,\n\t\t\t\tversion: :version,\n\t\t\t\tmerkle_root: :merkleroot,\n\t\t\t\tcreated_at_unix_time: :time,\n\t\t\t\tnonce: :nonce,\n\t\t\t\tdifficulty: :difficulty,\n\t\t\t\ttransaction_ids: :tx,\n\t\t\t\tprevious_block_id: :nextblockhash,\n\t\t\t\tnext_block_id: :previoushblockhash\n\t\t\t}.each do |our_attr, block_data_key|\n\t\t\t\tinstance_variable_set(\n\t\t\t\t\t\"@#{our_attr}\",\n\t\t\t\t\tblock_data[block_data_key.to_s].freeze\n\t\t\t\t)\n\t\t\tend\n\n\t\t\t@transactions ||= [].freeze\n\t\tend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The player's Steam 64 bit ID
def steam_id raw_ban['SteamId'].to_i end
[ "def id\n raw_profile['steamid'].to_i\n end", "def steam_id64\n @steam_id64 ||= self.class.resolve_vanity_url(@custom_url)\n end", "def to_steamID64\n # overwrite 1 as universe for reasons\n return SteamID64.new(1, 1, 1, accountID * 2 + id)\n end", "def id\n @custom_url || @steam_id64\n end", "def steam_id\n raw_friend['steamid'].to_i\n end", "def id\n raw_player['account_id']\n end", "def to_steamID32\n return SteamID64.new(type, id, accountID)\n end", "def check_steam_64_id\n @user.steam64id = JSON.parse(open(\"http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=47759AFAA400BE100A45F20F9A918C3E&vanityurl=\" + @user.steamid ).read)\n end", "def test_steam_id_by_steamid_64\n assert_nothing_raised do\n steam_id = SteamId.new(76561197961384956)\n p steam_id\n p steam_id.game_stats('tf2')\n end\n end", "def publicID\n return @trainerID&0xFFFF\n end", "def uid\n id && Base58GMP.encode(id)\n end", "def steam_id; end", "def accountID\n accountID64 >> 1\n end", "def unique_id\n @unique_id ||= @data[32, 4].unpack('N*')[0]\n end", "def url\n to_steamID64.url\n end", "def uid\n Base32::URL.encode(id, split: 4, length: 16)\n end", "def to_steamID32\n SteamID32.new(type, id, accountID)\n end", "def secure_id\n\t\t\"a\" + self.id.to_s + \"-\" + Digest::SHA1.hexdigest(self.id.to_s + MOBWRITE_SECRET_KEY)[0..7]\n\tend", "def steam_id=(_arg0); end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
String containing the player's ban status in the economy.
def economy_banned_status raw_ban['EconomyBan'] end
[ "def status_string\n if accepted?\n 'Loan Accepted'\n else\n \"Loan Rejected: #{reason}\"\n end\n end", "def ban_reason\n info['banReason']\n end", "def status_string\n [\"Pending\", \"Approved\", \"Denied\"].at(status)\n end", "def status\n\t\tif @status_ == :victory\n\t\t\treturn \"You Win!\"\n\t\telsif @status_ == :loss\n\t\t\treturn \"You Loose\"\n\t\telsif @status_ == :in_progress\n\t\t\treturn \"Still playing\"\n\t\tend\n\tend", "def to_s\n @status.to_s\n end", "def game_status_text(game)\n user_id = user_session.current_user.id\n case game.status\n when Game::PENDING\n 'Waiting for second player...' if game.waiting?\n when Game::P1_WON\n user_id == game.player1_id ? 'You won!' : 'You lost'\n when Game::P2_WON\n user_id == game.player2_id ? 'You won!' : 'You lost'\n when Game::DRAW\n 'Draw'\n when Game::P1_FORFEIT\n user_id == game.player1_id ? 'You resigned' : \"#{ game.player1.handle } resigned\"\n when Game::P2_FORFEIT\n user_id == game.player2_id ? 'You resigned' : \"#{ game.player2.handle } resigned\"\n end\n end", "def status_str\n case self.status\n when ACTIVE\n \"Active\"\n when INACTIVE\n \"Inactive\"\n when CLOSED\n \"Closed\"\n when NO_STRIPE\n \"No Stripe Account\"\n when UNKNOWN\n \"Unknown\"\n else\n \"Invalid\"\n end\n end", "def status_to_s\n \tSTATUSES[self.status].humanize\n end", "def status_name\n n = name\n n += \" *\" unless self.active?\n n += \" ᵖ\" if self.partner?\n n\n end", "def get_loss_confirmation()\n return \"#{@player.get_name()} loses with #{@player.get_weapon()}!\"\n end", "def status_message\n ret = ''\n\n hash = status\n if hash\n if hash.pct_complete\n ret += \"#{hash.pct_complete}%\"\n if hash.message\n ret += \": \"\n end\n end\n if hash.message\n ret += hash.message\n end\n end\n\n ret\n end", "def to_s() \n return \"Hand -> #{@cards.join(',')}. Hand value -> #{hand_value().to_s}. Bet value -> #{@bet.to_s}. Status -> #{is_bust()? \"Lost.\" : \"Active.\"}\"\n end", "def to_s\r\n return \"Player \" + @number.to_s + \": You have $\" + @money.to_s + \" left.\"\r\n end", "def banco\n '136'\n end", "def status_message\n if self.deleted_at\n return \"Cancelled\"\n else\n if self.chosen_presenter == nil\n if self.help_required\n return \"Help Required\"\n elsif self.presenters.present?\n return \"Bids Pending\"\n else\n return \"Awaiting Bids\"\n end\n else\n if self.booking_date < Time.now\n return \"Completed\"\n else\n return \"Locked in\"\n end\n end\n end\n end", "def status_name\n STATUSE.key(@status)\n end", "def get_other_loss_confirmation()\n return \"#{@player.get_other_name()} loses with #{@player.get_other_weapon()}!\"\n end", "def status_text\n\t\treturn '<span style=\"color:#009933;\">Verified Vuln</span>' if (verified && !falsepos)\n\t\treturn '<span style=\"color:#B40404;\">Unverified Vuln</span>' if !verified\n\t\treturn '<span style=\"color:#8A6D3B;\">False Positive</span>' if falsepos\n\tend", "def render_bid_status(accepted)\n if accepted\n status = \"ACCEPTED\"\n color_class = \"text-green\"\n else\n status = \"REJECTED\"\n color_class = \"text-red\"\n end\n \"<span class='#{color_class}'>#{status}</span>\".html_safe\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Due to `if Jets::Stack.has_resources?` check early on in the bootstraping process The code has not been built at that point. So we use a placeholder and will replace the placeholder as part of the cfn template build process after the code has been built and the code_s3_key with md5 is available.
def code_s3_key "code_s3_key_placeholder" end
[ "def calculate_s3_key\n filename && place_id && source_id && \"places/#{place_id}/#{source_id}/#{filename}\" || nil\n end", "def calculate_s3_key\n if photo && photo.filename && photo.source_id && name\n \"places/#{photo.place_id}/#{photo.source_id}/#{photo.file_parts[:root]}-#{name}.#{photo.file_parts[:extension]}\"\n else\n nil\n end\n end", "def bucket_name\n 'ios-ksr-builds'\nend", "def generate_s3_key first_name, last_name\n\n\t\"#{first_name}#{last_name}#{Time.new.to_i}.html\".downcase\n\t\nend", "def cfn_use_s3?\n cfn_force_s3? || (cfn_template.bytesize > 51200)\n end", "def run_hook(_resources)\n setup_code_deploy_s3_buckets\n end", "def cfn_s3_upload\n fail_task('No S3 bucket set for template upload: please set cfn_s3_path') unless cfn_s3_path\n uri = URI(cfn_s3_path)\n obj = ::Aws::S3::Object.new(bucket_name: uri.host, key: uri.path.sub(/^\\//, ''))\n obj.put(body: cfn_template)\n obj.public_url + ((v = obj.version_id) ? \"?versionId=#{v}\" : '')\n end", "def update_function_code(params={})\n function_name = params.delete('FunctionName')\n\n s3_bucket = params.delete('S3Bucket')\n s3_key = params.delete('S3Key')\n s3_object_ver = params.delete('S3ObjectVersion')\n zip_file = params.delete('ZipFile')\n\n update = {}\n update.merge!('S3Bucket' => s3_bucket) if s3_bucket\n update.merge!('S3Key' => s3_key) if s3_key\n update.merge!('S3ObjectVersion' => s3_object_ver) if s3_object_ver\n update.merge!('ZipFile' => zip_file) if zip_file\n\n request({\n :method => 'PUT',\n :path => \"/functions/#{function_name}/versions/HEAD/code\",\n :body => Fog::JSON.encode(update),\n :parser => Fog::AWS::Parsers::Lambda::Base.new\n }.merge(params))\n end", "def get_terraform_statefile(namespace, filename)\n cmd = \"aws --quiet s3 cp #{S3_BUCKET_PATH}/#{namespace}/terraform.tfstate #{filename}\"\n execute cmd\nend", "def set_variables\n @version = \"1.1.0\"\n begin\n s3 = Struct.new(:url, :port, :bucket, :token, :shared_secret, :ip_addresses)\n if ENV['S3_ACCESS_KEY_ID'] && ENV['S3_SECRET_ACCESS_KEY'] && ENV['S3_URL'] && ENV['S3_PORT'] && ENV['S3_BUCKET']\n @s3 = s3.new(ENV['S3_URL'], ENV['S3_PORT'].to_i, ENV['S3_BUCKET'], ENV['S3_ACCESS_KEY_ID'], ENV['S3_SECRET_ACCESS_KEY'], \"\")\n end\n rescue\n end\n end", "def elasticbeanstalk_app_template\n # parameters\n # prompt user for SECRET_KEY_BASE\n secret_key_param = AwsParameter.new(:logical_id => \"SecretKeyBase\", :description => \"Rails secret key base for production\", :default => \"CHANGEME\")\n secret_key_param.add_option(:minLength, 1)\n \n # prompt user for S3 bucket name\n bucket_name_param = AwsParameter.new(:logical_id => \"BucketName\", :description => \"S3 Bucket name where Rails project is stored\")\n bucket_name_param.add_option(:minLength, 1)\n\n # prompt user for Rails project zip file\n project_zip_param = AwsParameter.new(:logical_id => \"ProjectZip\", :description => \"Rails project zip file\")\n project_zip_param.add_option(:minLength, 1)\n \n eb_app = AwsElasticBeanstalkApplication.new\n\n eb_version = AwsElasticBeanstalkApplicationVersion.new\n eb_version.set_application_name eb_app.get_reference\n # application source is passed in via user params\n eb_version.set_source bucket_name_param.get_reference, project_zip_param.get_reference\n\n eb_config = AwsElasticBeanstalkConfigurationTemplate.new\n eb_config.set_application_name eb_app.get_reference\n eb_config.enable_single_instance\n eb_config.set_instance_type 't2.micro'\n eb_config.set_stack_name \"64bit Amazon Linux 2015.03 v1.3.0 running Ruby 2.2 (Passenger Standalone)\"\n # let rails access the secret key base, which is provided via user params\n # required for running in production\n eb_config.set_option \"aws:elasticbeanstalk:application:environment\", \"SECRET_KEY_BASE\", secret_key_param.get_reference\n\n eb_env = AwsElasticBeanstalkEnvironment.new\n eb_env.set_application_name eb_app.get_reference\n eb_env.set_template_name eb_config.get_reference\n eb_env.set_version_label eb_version.get_reference\n \n # create a blank template and add all the resources/parameters we need\n template = AwsTemplate.new(:description => 'Create an elasticbeanstalk app from a rails zip file stored in s3')\n template.add_resources [eb_app, eb_version, eb_config, eb_env]\n template.add_parameters [secret_key_param, bucket_name_param, project_zip_param]\n\n return template\nend", "def pyspark_lambda_trigger_key(structure)\n %{#{pyspark_s3_key_prefix(structure)}/#{structure[:etl_job_name]}_trigger_lambda.py}\n end", "def cfn_template_url\n @_cfn_template_url ||= cfn_use_s3? ? cfn_s3_upload : nil\n end", "def integration_context_i3s\n default_config = 'spec/integration/i3s_config.json'\n @config_path_i3s ||= ENV['I3S_INTEGRATION_CONFIG'] || default_config\n # Ensure config & secrets files exist\n unless File.file?(@config_path_i3s)\n STDERR.puts \"\\n\\n\"\n STDERR.puts 'ERROR: Integration config i3s file not found' unless File.file?(@config_path_i3s)\n STDERR.puts \"\\n\\n\"\n exit!\n end\n\n # Creates the global config variable\n $config_i3s ||= OneviewSDK::Config.load(@config_path_i3s)\nend", "def s3_key\n @attributes[:s3_key] ||= calculate_s3_key\n end", "def s3_configuration; end", "def build_code\n blob1 = make_blob(5).upcase\n blob2 = make_blob(5).upcase\n blob3 = make_blob(5).upcase\n final_code = blob1 + \"-\" + blob2 + \"-\" + blob3\n end", "def s3_configuration=(_arg0); end", "def database_installation_files_s3_bucket_name\n data[:database_installation_files_s3_bucket_name]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dump given message to the log device without any formatting. If no log device exists, return +nil+.
def <<(msg) unless @logdev.nil? @logdev.write(msg) end end
[ "def debug message\n @syslog.debug '%s', message\n end", "def log message\n logger.info(\"[Pdftk] #{message}\") if logging?\n end", "def debugonce(message)\n logger.debugonce(message)\n nil\n end", "def print(message)\n out.print(message) unless silent?\n end", "def log_capture_device\n @log_capture_device ||= STDOUT\n end", "def write( event )\n pri = LOG_DEBUG\n message = if event.instance_of?(::Logging::LogEvent)\n pri = @map[event.level]\n @layout.format(event)\n else\n event.to_s\n end\n return if message.empty?\n\n @mutex.synchronize { @syslog.log(pri, '%s', message) }\n self\n end", "def debug(message)\n @out_logger.debug(message + ANSI.clear_eol)\n @file_logger.debug(message)\n end", "def write(message)\n \n @log_devices.each do |log_device|\n log_device.write(message)\n end\n \n end", "def log\n driver.wiredump_dev\n end", "def debug(message)\n logger.debug(message) if logger\n end", "def write( event )\n pri = SyslogProtocol::SEVERITIES['debug']\n message = if event.instance_of?(::Logging::LogEvent)\n pri = @map[event.level]\n @layout.format(event)\n else\n event.to_s\n end\n return if message.empty?\n\n udp_sender = RemoteSyslogLogger::UdpSender.new(\n @syslog_server,\n @port,\n :facility => @facility,\n :severity => pri,\n :program => @ident\n )\n\n udp_sender.write(prepare_message(message))\n\n self\n end", "def debug(message='')\n @logfile.write(\"#{Time.now}#{DEBUG}#{message}\\n\")\n @logfile.rewind\n end", "def debug(message)\n begin\n I3::log.debug(@appname) { message }\n rescue\n STDERR.puts(\"Error logging DEBUG: %s (%s)\" % [message, $!.to_s])\n end\n end", "def format_log_message( message )\n\t\treturn message.to_s[ 0 ... self.max_message_bytesize ].dump\n\tend", "def log(message)\n @collector.sending_stream.puts pack(:log, message)\n end", "def <<( message )\n\t\tunless self.logdev.nil?\n\t\t\tself.add( Logger::DEBUG, message )\n\t\tend\n\tend", "def create_device_log(sku, message)\n data = { message: message }\n post(\"/devices/#{sku}/logs\", data)['log']\n end", "def debug_print(message)\n message = message.to_s\n puts message.if_respond(:light_red, message) if debug?\n end", "def write_device_logs(scenario)\n log_name = case Maze::Helper.get_current_platform\n when 'android'\n 'logcat'\n when 'ios'\n 'syslog'\n end\n logs = Maze.driver.get_log(log_name)\n\n Maze::MazeOutput.new(scenario).write_device_logs(logs)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close the logging device.
def close @logdev.close if @logdev end
[ "def close\n @logdev.close if @logdev\n end", "def close\n @logdevs.each do |name, ld|\n ld[:dev].close\n end\n end", "def closeLog()\n @logger.close() ;\n end", "def close\n @log_file.close\n end", "def close\n flush\n @log.close if @log.respond_to?(:close)\n @log = nil\n end", "def close\n @logfile&.close # if @logfile\n end", "def close\n\t log_file.close\n end", "def close\n @loggers.each do |k,v|\n v.close\n v = nil\n end\n @loggers.clear\n end", "def close\n checkpoint\n @logfile.close\n end", "def close\n Escper.log \"[close] ============\"\n @open_printers.each do |key, value|\n begin\n # File, SerialPort, and TCPSocket all have the close method\n value[:device].close\n Escper.log \"[close] Closing #{ value[:name] } @ #{ value[:device].inspect }\"\n @open_printers.delete(key)\n rescue => e\n Escper.log \"[close] Error during closing of #{ value[:device] }: #{ e.inspect }\"\n end\n end\n end", "def close!\n dump!\n @log_file.close\n File.delete(@log_file.path)\n self\n class <<self\n alias :insert :raise_volume_closed\n alias :close! :raise_volume_closed\n alias :dump! :raise_volume_closed\n def closed?; true; end\n end\n end", "def close\n ensure_handle_is_valid\n DeviceManager::close_device(@handle)\n end", "def close_logfile\n return unless @__current_logfile\n\n @__current_logfile.close\n logfile = @__current_logfile\n @__current_logfile = nil\n logfile\n end", "def close\n @loggers.map(&:close)\n end", "def close\n DeregisterEventSource(@eventlog_handle)\n ensure\n @eventlog_handle = nil\n end", "def close!\n puts \"Closing MIDI connection to '#{device}'\"\n midi.close\n end", "def close_logs()\n\t\t if @log\n \t\t @log.close\n \t\t @log = nil\n \t\tend\n \t\tif @syslog\n \t\t @syslog.close\n \t\t @syslog = nil\n \t\tend\n\t\tend", "def close\n logger.debug { 'Logging out' }\n unless @connection.nil?\n logger.debug { 'Sending logout commands' }\n @connection.puts('bye') { |c| logger.debug c }\n @connection.close\n end\n\n logger.debug { 'Disconnected from FIBS' }\n end", "def close\n @db.close if @db\n log \"Database closed\"\n @logfile.close if @logfile\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /ios_topbars/new GET /ios_topbars/new.json
def new @ios_topbar = @user.build_ios_topbar respond_to do |format| format.html # new.html.erb format.json { render json: @ios_topbar } end end
[ "def new\n @topbar = Topbar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topbar }\n end\n end", "def create\n @topbar = Topbar.new(params[:topbar])\n\n respond_to do |format|\n if @topbar.save\n format.html { redirect_to @topbar, notice: 'Topbar was successfully created.' }\n format.json { render json: @topbar, status: :created, location: @topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @top_item = TopItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @top_item }\n end\n end", "def new\n @smalltop = Smalltop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smalltop }\n end\n end", "def new\n @top_section = TopSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @top_section }\n end\n end", "def create\n @ios_topbar = @user.build_ios_topbar(params[:ios_topbar])\n\n respond_to do |format|\n if @ios_topbar.save\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @ios_topbar, status: :created, location: @ios_topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @barrack = Barrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrack }\n end\n end", "def new\n @toppick = Toppick.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @toppick }\n end\n end", "def new\n @bar = Bar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bar }\n end\n end", "def new\n @pushup = Pushup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pushup }\n end\n end", "def new\n @non_smoking_bar = NonSmokingBar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @non_smoking_bar }\n end\n end", "def new\n @top_route = TopRoute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @top_route }\n end\n end", "def new\n @android_topbar = @user.build_android_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @android_topbar }\n end\n end", "def new\n @barn = Barn.new\n set_page_title\n if current_user.is_admin?\n @farms = Farm.all\n @locations = []\n @barns = []\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barn }\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n @barrio = Barrio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrio }\n end\n end", "def new\n @troop = Troop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @troop }\n end\n end", "def new\n @bottom_type = BottomType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bottom_type }\n end\n end", "def new\n @why_sumbar = WhySumbar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @why_sumbar }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /ios_topbars POST /ios_topbars.json
def create @ios_topbar = @user.build_ios_topbar(params[:ios_topbar]) respond_to do |format| if @ios_topbar.save format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } } format.json { render json: @ios_topbar, status: :created, location: @ios_topbar } else format.html { render action: "new" } format.json { render json: @ios_topbar.errors, status: :unprocessable_entity } end end end
[ "def create\n @topbar = Topbar.new(params[:topbar])\n\n respond_to do |format|\n if @topbar.save\n format.html { redirect_to @topbar, notice: 'Topbar was successfully created.' }\n format.json { render json: @topbar, status: :created, location: @topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @ios_topbar = @user.build_ios_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ios_topbar }\n end\n end", "def new\n @topbar = Topbar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topbar }\n end\n end", "def create\n @android_topbar = @user.build_android_topbar(params[:android_topbar])\n\n respond_to do |format|\n if @android_topbar.save\n format.html { redirect_to user_android_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @android_topbar, status: :created, location: @android_topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @android_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end", "def destroy\n @ios_topbar = @user.ios_topbar\n @ios_topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def create\n @mobile_web_topbar = @user.build_mobile_web_topbar(params[:mobile_web_topbar])\n\n respond_to do |format|\n if @mobile_web_topbar.save\n format.html { redirect_to user_mobile_web_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @mobile_web_topbar, status: :created, location: @mobile_web_topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mobile_web_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_top_ui\n @top = UI::Summary_Top.new(@viewport)\n end", "def show\n @topbar = Topbar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topbar }\n end\n end", "def update\n @ios_topbar = @user.ios_topbar\n\n respond_to do |format|\n if @ios_topbar.update_attributes(params[:ios_topbar])\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bar_event = BarEvent.new\n @bar_event.bar_id = params[:bar_id]\n @bar_event.detail = params[:detail]\n \n #for header in request.env.select {|k,v| k.match(\"^HTTP.*\")}\n # print header\n #end\n #print \"Bar id: \" + request.env[\"HTTP_BAR_ID\"] + \"\\n\"\n #print \"Session id: \" + request.env[\"HTTP_SESSION_ID\"] + \"\\n\"\n #print \"Bar name: \" + request.env[\"HTTP_BAR_NAME\"] + \"\\n\"\n #print \"CSRF token: \" + request.env[\"HTTP_X_CSRF_TOKEN\"] + \"\\n\"\n \n # Get data and save to the bar_event object\n #print params.to_s\n\n respond_to do |format|\n if @bar_event.save\n #format.html { redirect_to @bar_event, :notice => 'Bar event was successfully created.' }\n format.html { render :text => @bar_event.id }\n format.json { render :json => @bar_event, :status => :created, :location => @bar_event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bar_event.errors, :status => :unprocessable_entity }\n end\n\tend\n end", "def destroy\n @topbar = Topbar.find(params[:id])\n @topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to topbars_url }\n format.json { head :no_content }\n end\n end", "def create\n @top = Top.new(top_params)\n\n respond_to do |format|\n if @top.save\n format.html { redirect_to @top, notice: 'Top was successfully created.' }\n format.json { render :show, status: :created, location: @top }\n else\n format.html { render :new }\n format.json { render json: @top.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @android_topbar = @user.build_android_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @android_topbar }\n end\n end", "def create\n @topup = Topup.new(topup_params)\n\n respond_to do |format|\n if @topup.save\n format.html { redirect_to @topup, notice: 'Topup was successfully created.' }\n format.json { render :show, status: :created, location: @topup }\n else\n format.html { render :new }\n format.json { render json: @topup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_sin_bar\n create_sinergy_viewports\n create_sinergy_graphic\n end", "def create\n @top_item = TopItem.new(params[:top_item])\n\n respond_to do |format|\n if @top_item.save\n format.html { redirect_to @top_item, notice: 'Top item was successfully created.' }\n format.json { render json: @top_item, status: :created, location: @top_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @top_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @barns = current_user.barns\n\n set_page_title\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @barns }\n end\n end", "def create_hp_bar\n bar = UI::Bar.new(@viewport, @x + 64, @y + 34, RPG::Cache.interface('team/HPBars'), 53, 4, 0, 0, 3)\n # Define the data source of the HP Bar\n bar.data_source = :hp_rate\n return bar\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /ios_topbars/1 PUT /ios_topbars/1.json
def update @ios_topbar = @user.ios_topbar respond_to do |format| if @ios_topbar.update_attributes(params[:ios_topbar]) format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @ios_topbar.errors, status: :unprocessable_entity } end end end
[ "def update\n @topbar = Topbar.find(params[:id])\n\n respond_to do |format|\n if @topbar.update_attributes(params[:topbar])\n format.html { redirect_to @topbar, notice: 'Topbar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @topbar = Topbar.new(params[:topbar])\n\n respond_to do |format|\n if @topbar.save\n format.html { redirect_to @topbar, notice: 'Topbar was successfully created.' }\n format.json { render json: @topbar, status: :created, location: @topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ios_topbar = @user.build_ios_topbar(params[:ios_topbar])\n\n respond_to do |format|\n if @ios_topbar.save\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @ios_topbar, status: :created, location: @ios_topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @android_topbar = @user.android_topbar\n\n respond_to do |format|\n if @android_topbar.update_attributes(params[:android_topbar])\n format.html { redirect_to user_android_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @android_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @topbar = Topbar.find(params[:id])\n @topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to topbars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ios_topbar = @user.ios_topbar\n @ios_topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def new\n @ios_topbar = @user.build_ios_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ios_topbar }\n end\n end", "def update\n respond_to do |format|\n if @top.update(top_params)\n format.html { redirect_to @top, notice: 'Top was successfully updated.' }\n format.json { render :show, status: :ok, location: @top }\n else\n format.html { render :edit }\n format.json { render json: @top.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @topbar = Topbar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topbar }\n end\n end", "def update\n respond_to do |format|\n if @slider_top.update(slider_top_params)\n format.html { redirect_to @slider_top, notice: 'Slider top was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_top }\n else\n format.html { render :edit }\n format.json { render json: @slider_top.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @topbar = Topbar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topbar }\n end\n end", "def update\n @mobile_web_topbar = @user.mobile_web_topbar\n\n respond_to do |format|\n if @mobile_web_topbar.update_attributes(params[:mobile_web_topbar])\n format.html { redirect_to user_mobile_web_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mobile_web_topbar.errors, status: :unprocessable_entity }\n end\n end\n end", "def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end", "def update\n if @set_top_box.update(set_top_box_params)\n flash[:success] = \"Update success!\"\n redirect_to @set_top_box\n else\n render 'edit'\n end\n end", "def update\n @top_item = TopItem.find(params[:id])\n\n respond_to do |format|\n if @top_item.update_attributes(params[:top_item])\n format.html { redirect_to @top_item, notice: 'Top item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @top_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bar80.update(bar80_params)\n format.html { redirect_to @bar80, notice: \"Bar80 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar80 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar80.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_boss_hp_bar\n return unless @boss_hp_bar\n @boss_hp_bar.update\n end", "def update\n @top_up = TopUp.find(params[:id])\n\n respond_to do |format|\n if @top_up.update_attributes(params[:top_up])\n format.html { redirect_to @top_up, notice: 'Top up was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @top_up.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @topup.update(topup_params)\n format.html { redirect_to @topup, notice: 'Topup was successfully updated.' }\n format.json { render :show, status: :ok, location: @topup }\n else\n format.html { render :edit }\n format.json { render json: @topup.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /ios_topbars/1 DELETE /ios_topbars/1.json
def destroy @ios_topbar = @user.ios_topbar @ios_topbar.destroy respond_to do |format| format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } } format.json { head :no_content } end end
[ "def destroy\n @topbar = Topbar.find(params[:id])\n @topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to topbars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @android_topbar = @user.android_topbar\n @android_topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_android_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_web_topbar = @user.mobile_web_topbar\n @mobile_web_topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_mobile_web_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n # Make sure the request came from an admin\n unless session[:admin_id]\n redirect_to_home\n return\n end\n \n @bar = Bar.find(params[:id])\n @bar.destroy\n\n respond_to do |format|\n format.html { redirect_to bars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar_item.destroy\n respond_to do |format|\n format.html { redirect_to bar_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar = Bar.find(params[:id])\n @bar.destroy\n\n respond_to do |format|\n format.html { redirect_to bars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar = Bar.find(params[:id])\n @bar.destroy\n\n respond_to do |format|\n format.html { redirect_to bars_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bar80.destroy\n respond_to do |format|\n format.html { redirect_to bar80s_url, notice: \"Bar80 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrack = Barrack.find(params[:id])\n @barrack.destroy\n\n respond_to do |format|\n format.html { redirect_to barracks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar8.destroy\n respond_to do |format|\n format.html { redirect_to bar8s_url, notice: \"Bar8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @smalltop = Smalltop.find(params[:id])\n @smalltop.destroy\n\n respond_to do |format|\n format.html { redirect_to smalltops_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @why_sumbar = WhySumbar.find(params[:id])\n @why_sumbar.destroy\n\n respond_to do |format|\n format.html { redirect_to why_sumbars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @top_item = TopItem.find(params[:id])\n @top_item.destroy\n\n respond_to do |format|\n format.html { redirect_to top_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n\n head :no_content\n end", "def destroy\n @top_up = TopUp.find(params[:id])\n @top_up.destroy\n\n respond_to do |format|\n format.html { redirect_to top_ups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_stats_bar.destroy\n respond_to do |format|\n format.html { redirect_to admin_stats_bars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar52.destroy\n respond_to do |format|\n format.html { redirect_to bar52s_url, notice: \"Bar52 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @top_section = TopSection.find(params[:id])\n @top_section.destroy\n\n respond_to do |format|\n format.html { redirect_to top_sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @non_smoking_bar = NonSmokingBar.find(params[:id])\n @non_smoking_bar.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Successfully deleted.' }\n format.json { head :ok }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description Test useful to check correctness of conversion and cross browser visibility of all elements of kind Video Mode Html Specific filters ApplicationControlleradmin_authenticate Skipped filters ApplicationControllerauthenticate ApplicationControllerinitialize_location ApplicationControllerinitialize_players_counter
def videos_test end
[ "def validate_video_element(video_doc, video_options)\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:gallery_loc').text).to eq(video_options[:gallery_loc])\n expect(video_doc.at_xpath('video:gallery_loc').attribute('title').text).to eq(video_options[:gallery_title])\n expect(video_doc.at_xpath('video:title').text).to eq(video_options[:title])\n expect(video_doc.at_xpath('video:view_count').text).to eq(video_options[:view_count].to_s)\n expect(video_doc.at_xpath('video:duration').text).to eq(video_options[:duration].to_s)\n expect(video_doc.at_xpath('video:rating').text).to eq('%0.1f' % video_options[:rating])\n expect(video_doc.at_xpath('video:content_loc').text).to eq(video_options[:content_loc])\n expect(video_doc.at_xpath('video:category').text).to eq(video_options[:category])\n expect(video_doc.xpath('video:tag').collect(&:text)).to eq(video_options[:tags])\n expect(video_doc.at_xpath('video:expiration_date').text).to eq(video_options[:expiration_date].iso8601)\n expect(video_doc.at_xpath('video:publication_date').text).to eq(video_options[:publication_date].iso8601)\n expect(video_doc.at_xpath('video:player_loc').text).to eq(video_options[:player_loc])\n expect(video_doc.at_xpath('video:player_loc').attribute('allow_embed').text).to eq(video_options[:allow_embed] ? 'yes' : 'no')\n expect(video_doc.at_xpath('video:player_loc').attribute('autoplay').text).to eq(video_options[:autoplay])\n expect(video_doc.at_xpath('video:uploader').text).to eq(video_options[:uploader])\n expect(video_doc.at_xpath('video:uploader').attribute('info').text).to eq(video_options[:uploader_info])\n expect(video_doc.at_xpath('video:price').text).to eq(video_options[:price].to_s)\n expect(video_doc.at_xpath('video:price').attribute('resolution').text).to eq(video_options[:price_resolution].to_s)\n expect(video_doc.at_xpath('video:price').attribute('type').text).to eq(video_options[:price_type].to_s)\n expect(video_doc.at_xpath('video:price').attribute('currency').text).to eq(video_options[:price_currency].to_s)\n xml_fragment_should_validate_against_schema(video_doc, 'sitemap-video', 'xmlns:video' => SitemapGenerator::SCHEMAS['video'])\n end", "def verify_user_can_access_channel_or_video\n public_token = params[:channel_token]\n user_can_access_either_one = (public_token and public_token.strip == @video.channel.public_token) || user_can_access_channel\n \n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end", "def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend", "def test_wd_st_015\n printf \"\\n+ Test 015\"\n open_warning_diff_file\n click $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_present($warning_diff_xpath[\"pagination\"]))\n\t\twarning_result = get_xpath_count($warning_diff_xpath[\"row\"])\n\t\t@selenium.select \"status\", _(\"All\")\n\t\tclick $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_present($warning_diff_xpath[\"pagination\"]))\n\t\twarning_result = get_xpath_count($warning_diff_xpath[\"row\"])\n\t\tassert_equal 15, warning_result\n logout\n end", "def common_elements?()\n assert_not_nil(@driver, \"Driver is nill for view #{@view} and tab #{@tab}.\")\n # Check header\n header?\n # Check nav1\n nav1?\n # Check sidebar\n sidebar?\n # Check search\n search?\n # Check footer\n footer?\n end", "def home_front_mediaindex_videos()\n videosContainer=all(\".video-items-container.videos-container\")\n puts videosContainer.count\n for i in 0..(videosContainer.count - 1)\n videos_total=videosContainer[i].all(\".media-grid-item.video-item \")\n puts videos_total.count\n for j in 0..(videos_total.count - 1)\n video_duration=videos_total[j].find(\".video-first-duration\").native.text\n puts video_duration\n video_title=videos_total[j].find(\".video-first-title\").native.text\n puts video_title\n expect(video_duration).to match(/^\\d{2}:\\d{2}/)\n expect(video_title).to match(/\\w/)\n end\n end\nend", "def test04_MediaPhotoVideo\n\t\tlogin $editor_1_email, $master_password\n\t\t$browser.goto($patch_boards_pre_closed_article_new)\n\t\t\n#\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n#\t\t$post_media_description.set(\"mt townsend is my favorite mountain #{random}.\")\n\t\tif $environment == 'nixon'\t\n\t\t\trepostGroupPop #category already selected in staging\n\t\tend\n\t\t$post_article_title.set(\"Mountain #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('mt townsend is my favorite mountain #{random}.')\")\n\t\tsleep 2\n\t\t$post_add_media_article.click\n\t\tfile_upload \"DungenessSpit102.26.2012.mov\"\n\t\tsleep 2\n\t\t$post_add_media_article.click\n\t\tfile_upload \"GlacierBasinTrailMtRainier.JPG\"\n if $environment == 'staging'\n\t\t\tsleep 10 #loads \n\t\tend\n\t\t$post_now_edit.fire_event(\"onclick\")\n\n\t\tsleep 2\n\t\tassert $post_new_post.exists?\n\tend", "def test_valley_smoketest\n @driver.get(@base_url)\n verify_home_page()\n verify_services_page()\n verify_about_page()\n verify_contact_page()\n verify_faq_page()\n verify_links_page()\n end", "def get_detection_html(user_agent)\n ua_info = fingerprint_user_agent(user_agent)\n os = ua_info[:os_name]\n client = ua_info[:ua_name]\n\n code = ERB.new(%Q|\n <%= js_base64 %>\n <%= js_os_detect %>\n <%= js_ajax_post %>\n <%= js_misc_addons_detect %>\n <%= js_ie_addons_detect if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n\n function objToQuery(obj) {\n var q = [];\n for (var key in obj) {\n q.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n }\n return Base64.encode(q.join('&'));\n }\n\n function isEmpty(str) {\n return (!str \\|\\| 0 === str.length);\n }\n\n function sendInfo(info) {\n var query = objToQuery(info);\n postInfo(\"<%=get_resource.chomp(\"/\")%>/<%=@info_receiver_page%>/\", query, function(){\n window.location=\"<%= get_module_resource %>\";\n });\n }\n\n var flashVersion = \"\";\n var doInterval = true;\n var maxTimeout = null;\n var intervalTimeout = null;\n\n function setFlashVersion(ver) {\n flashVersion = ver\n if (maxTimeout != null) {\n clearTimeout(maxTimeout);\n maxTimeout = null\n }\n doInterval = false\n return;\n }\n\n function createFlashObject(src, attributes, parameters) {\n var i, html, div, obj, attr = attributes \\|\\| {}, param = parameters \\|\\| {};\n attr.type = 'application/x-shockwave-flash';\n if (window.ActiveXObject) {\n attr.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';\n param.movie = src;\n } else {\n attr.data = src;\n }\n\n html = '<object';\n for (i in attr) {\n html += ' ' + i + '=\"' + attr[i] + '\"';\n }\n html += '>';\n for (i in param) {\n html += '<param name=\"' + i + '\" value=\"' + param[i] + '\" />';\n }\n html += '</object>';\n div = document.createElement('div');\n div.innerHTML = html;\n obj = div.firstChild;\n div.removeChild(obj);\n return obj;\n }\n\n window.onload = function() {\n var osInfo = os_detect.getVersion();\n var d = {\n \"os_vendor\" : osInfo.os_vendor,\n \"os_device\" : osInfo.os_device,\n \"ua_name\" : osInfo.ua_name,\n \"ua_ver\" : osInfo.ua_version,\n \"arch\" : osInfo.arch,\n \"java\" : misc_addons_detect.getJavaVersion(),\n \"silverlight\" : misc_addons_detect.hasSilverlight(),\n \"flash\" : misc_addons_detect.getFlashVersion(),\n \"vuln_test\" : <%= js_vuln_test %>,\n \"os_name\" : osInfo.os_name\n };\n\n <% if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n d['office'] = ie_addons_detect.getMsOfficeVersion();\n d['mshtml_build'] = ScriptEngineBuildVersion().toString();\n <%\n activex = @requirements[:activex]\n if activex\n activex.each do \\|a\\|\n clsid = a[:clsid]\n method = a[:method]\n %>\n var ax = ie_addons_detect.hasActiveX('<%=clsid%>', '<%=method%>');\n d['activex'] = \"\";\n if (ax == true) {\n d['activex'] += \"<%=clsid%>=><%=method%>=>true;\";\n } else {\n d['activex'] += \"<%=clsid%>=><%=method%>=>false;\";\n }\n <% end %>\n <% end %>\n <% end %>\n\n if (d[\"flash\"] != null && (d[\"flash\"].match(/[\\\\d]+.[\\\\d]+.[\\\\d]+.[\\\\d]+/)) == null) {\n var flashObject = createFlashObject('<%=get_resource.chomp(\"/\")%>/<%=@flash_swf%>', {width: 1, height: 1}, {allowScriptAccess: 'always', Play: 'True'});\n\n // After 5s stop waiting and use the version retrieved with JS if there isn't anything\n maxTimeout = setTimeout(function() {\n if (intervalTimeout != null) {\n doInterval = false\n clearInterval(intervalTimeout)\n }\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }, 5000);\n\n // Check if there is a new flash version every 100ms\n intervalTimeout = setInterval(function() {\n if (!doInterval) {\n clearInterval(intervalTimeout);\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }\n }, 100);\n\n document.body.appendChild(flashObject)\n } else {\n sendInfo(d)\n }\n }\n |).result(binding())\n\n js = ::Rex::Exploitation::JSObfu.new code\n js.obfuscate\n\n %Q|\n <script>\n #{js}\n </script>\n <noscript>\n <img style=\"visibility:hidden\" src=\"#{get_resource.chomp(\"/\")}/#{@noscript_receiver_page}/\">\n <meta http-equiv=\"refresh\" content=\"1; url=#{get_module_resource}\">\n </noscript>\n |\n end", "def used_in_private_lessons\n return false if @parameters[:initial_video].nil?\n @parameters[:initial_video].media_elements_slides.any?\n end", "def iframes; end", "def setup\n\t\t# disable the 'save your password' prompt\n\t\tcaps = Selenium::WebDriver::Remote::Capabilities.chrome(\"chromeOptions\" => {'prefs' => {'credentials_enable_service' => false}})\n\t\toptions = Selenium::WebDriver::Chrome::Options.new\n\t\toptions.add_argument('--enable-webgl-draft-extensions')\n\t\toptions.add_argument('--incognito')\n\t\t@driver = Selenium::WebDriver::Driver.for :chrome, driver_path: $chromedriver_dir,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptions: options, desired_capabilities: caps,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdriver_opts: {log_path: '/tmp/webdriver.log'}\n\t\t@driver.manage.window.maximize\n\t\t@base_url = $portal_url\n\t\t@accept_next_alert = true\n\t\t@driver.manage.timeouts.implicit_wait = 15\n\t\t# only Google auth\n\n\t\t@genes = %w(Itm2a Sergef Chil5 Fam109a Dhx9 Ssu72 Olfr1018 Fam71e2 Eif2b2)\n\t\t@wait = Selenium::WebDriver::Wait.new(:timeout => 30)\n\t\t@test_data_path = File.expand_path(File.join(File.dirname(__FILE__), 'test_data')) + '/'\n\t\t@base_path = File.expand_path(File.join(File.dirname(__FILE__), '..'))\n\t\tputs \"\\n\"\n\tend", "def test02_EventPhotoVideo\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_new_event)\n\n \t\t$post_event_title.when_present.set(\"Event #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{next_year}-05-23\") \n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"8:00 AM\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n \t\t$post_add_media_article.when_present.click\n\t\tfile_upload \"GlacierBasinTrailMtRainier.JPG\"\n \t\t$post_add_media_article.when_present.click\n\t\tfile_upload \"DungenessSpitVideo.mov\"\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\tsleep 2\t\t\n\t\tif $environment == 'staging'\n\t\t sleep 10\n\t\tend\n\t\tassert $post_new_post.exists?\n\t\t#verify details?\n\tend", "def add_visibility_verifier; end", "def test_wd_st_014\n printf \"\\n+ Test 014\"\n open_warning_diff_file\n\t\t@selenium.select \"status\", \"Added\"\n click $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(!is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_not_present($warning_diff_xpath[\"pagination\"]))\n\n\t\t@selenium.select \"status\", \"Deleted\"\n click $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(!is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_not_present($warning_diff_xpath[\"pagination\"]))\n logout\n end", "def verify_buttons_platforms_skills\n\n$i = 0\n$num = 3\ndata_ex = [nil, \"Mobile iOS\", \"Mobile Android OS\", \"Windows 8/7/Vista/XP\"]\ndata_zz = [nil, \"apple operation system\", \"android operation system\",\"microsoft windows\"]\n while $i < $num do\n\n $i +=1\n if $i == 1 || 2 || 3\n $xpath = \"//*[@id='programming-front']//div[contains(text(),'#{data_ex[$i]}')]\"\n end\n find(:xpath, $xpath).click\n\n if find(:xpath, \"//*[@id='programming-front']//div[contains(text(),'#{data_zz[$i]}')]\").visible? \n puts \"'#{data_ex[$i]}' = true\"\n end\n find(:xpath, $xpath).click\n end\n page.should have_no_content('apple operation system')\n page.should have_no_content('android operation system')\n page.should have_no_content('microsoft windows')\nend", "def test_authorization_of_protocols_and_datafiles_links\n #sanity check the fixtures are correct\n check_fixtures_for_authorization_of_protocols_and_datafiles_links\n login_as(:model_owner)\n experiment=experiments(:experiment_with_public_and_private_protocols_and_datafiles)\n assert_difference('ActivityLog.count') do\n get :show, :id=>experiment.id\n end\n\n assert_response :success\n\n assert_select \"div.tabbertab\" do\n assert_select \"h3\", :text=>\"Protocols (1+1)\", :count=>1\n assert_select \"h3\", :text=>\"Data Files (1+1)\", :count=>1\n end\n\n assert_select \"div.list_item\" do\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :text=>\"Protocol with fully public policy\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :text=>\"Download Only\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n end\n\n end", "def test_00030_view_upcoming_event\n @admin_events_page.start!(user_for_test)\n check_events\n \t@browser.wait_until{ @admin_events_page.first_event_item.present? }\n \ttitle = @admin_events_page.first_event_title.text\n \t# topics = @admin_events_page.first_event_topics.map{ |x|x.inner_html }\n \t@admin_events_page.event_view.click\n @browser.wait_until{ @admin_events_page.pic_view.present? }\n assert @admin_events_page.content_view.text.include? title\n # topics_view = @admin_events_page.related_topics_view.map{ |x|x.inner_html }\n # assert topics.sort == topics_view.sort\n end", "def test_p1_SET2_00010_topicdetailpage_support\n @topicdetailpage.goto_topicdetail_page(\"support\")\n \tassert @topicdetailpage.topic_filter.present?\n @loginpage = CommunityLoginPage.new(@browser)\n assert @loginpage.topnav.present?\n @topicdetailpage.newline\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description Test useful to check correctness of conversion and cross browser visibility of all elements of kind Audio Mode Html Specific filters ApplicationControlleradmin_authenticate Skipped filters ApplicationControllerauthenticate ApplicationControllerinitialize_location ApplicationControllerinitialize_players_counter
def audios_test end
[ "def videos_test\n end", "def show_display_page\n \tget \"/music_page/display\"\n \tassert_response :success\n \tassert_template \"display\"\n \tassert_equal 2, session[:music].size\n end", "def test_wd_st_015\n printf \"\\n+ Test 015\"\n open_warning_diff_file\n click $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_present($warning_diff_xpath[\"pagination\"]))\n\t\twarning_result = get_xpath_count($warning_diff_xpath[\"row\"])\n\t\t@selenium.select \"status\", _(\"All\")\n\t\tclick $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_present($warning_diff_xpath[\"pagination\"]))\n\t\twarning_result = get_xpath_count($warning_diff_xpath[\"row\"])\n\t\tassert_equal 15, warning_result\n logout\n end", "def verify_buttons_platforms_skills\n\n$i = 0\n$num = 3\ndata_ex = [nil, \"Mobile iOS\", \"Mobile Android OS\", \"Windows 8/7/Vista/XP\"]\ndata_zz = [nil, \"apple operation system\", \"android operation system\",\"microsoft windows\"]\n while $i < $num do\n\n $i +=1\n if $i == 1 || 2 || 3\n $xpath = \"//*[@id='programming-front']//div[contains(text(),'#{data_ex[$i]}')]\"\n end\n find(:xpath, $xpath).click\n\n if find(:xpath, \"//*[@id='programming-front']//div[contains(text(),'#{data_zz[$i]}')]\").visible? \n puts \"'#{data_ex[$i]}' = true\"\n end\n find(:xpath, $xpath).click\n end\n page.should have_no_content('apple operation system')\n page.should have_no_content('android operation system')\n page.should have_no_content('microsoft windows')\nend", "def browser_setup\n @js_loaded = false\n @browser_running = false\n Logger.log \"setting up...\"\n room = 'http://plug.dj/fractionradio/'\n\n # Make our browser instance, if we need it\n @browser = Watir::Browser.new :firefox, profile: 'default' unless @browser && @browser.exists?\n\n @browser.goto room # Try to load the room\n google_button = @browser.div(id: \"google\")\n if google_button.exists? # Do we need to log in?\n Logger.log \"logging in...\" # Yup\n google_button.click\n @browser.text_field(id: \"Email\").set OPTIONS[\"email\"] # provide email\n @browser.text_field(id: \"Passwd\").set OPTIONS[\"pass\"] # and pass\n @browser.button(id: \"signIn\").click\n @browser.wait # Wait for the lobby to load\n @browser.goto room # head to our room\n end\n\n Logger.log \"loading room...\"\n @browser.wait # Wait while the room loads\n\n begin\n Logger.log \"injecting javascript...\"\n @browser.execute_script JS # Inject Javascript\n @js_loaded = true\n Logger.log \"setting authorized users...\"\n @browser.execute_script \"RuB.setAuthorizedUsers(#{OPTIONS[\"users\"]})\" # Set authorized users\n rescue Selenium::WebDriver::Error::JavascriptError => e\n Logger.log e # Something may go wrong (I'm not perfect, after all)\n @js_loaded = false\n if e.message.match(\"API is not defined\") # If plug's API is not defined, we should be a little worried\n if @browser.url != room # Check that we're in the right place\n @browser.goto room # If not, let's go there\n @browser.wait\n else\n @browser.execute_script \"delete window.RuB\" # If we are, delete the existing instance. It failed to run anyways\n end\n\n retry # Try loading the JS again\n end\n end\n\n Logger.log \"loading last playing song...\"\n @current_song = YAML.load_file(FILES[:song]) # Load up the song that was playing the last time we were here\n\n Logger.log \"setup complete!\"\n @browser_running = true # ALL DONE!\n #bot.post_to_chat \"DJ-RuB is in the HOUSE!\"\n end", "def verifySpeakersDisplayed()\n speakers= speakersDisplayed()\n #assert_equal speakers, true, \"In people>>speaker screen speakers should be shown\"\n end", "def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend", "def common_elements?()\n assert_not_nil(@driver, \"Driver is nill for view #{@view} and tab #{@tab}.\")\n # Check header\n header?\n # Check nav1\n nav1?\n # Check sidebar\n sidebar?\n # Check search\n search?\n # Check footer\n footer?\n end", "def verify_coder_is_loaded\n if clear_filter.visible?\n clear_filter.click\n sleep 1\n clear_filter.click\n wait_for_clear_filter\n else\n sleep 2\n puts \"Waited #{Capybara.default_wait_time} seconds for coder to load it was still not responding. Test may continue ...\"\n end\n end", "def test_removeWebSourcing\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n EnableOldInterfaceSL(false)\n \n begin\n Common.go_to_short_list()\n test = [{\"displayed\" => SetupEditPage::EDIT_BUTTON_ON_SHORT_LIST_SETUP_XPATH},\n {\"click\" => SetupEditPage::EDIT_BUTTON_ON_SHORT_LIST_SETUP_XPATH},\n {\"displayed\" => SetupEditPage::CHECKBOX_SPEEDREVIEW_XPATH},\n {\"unchecked\" => SetupEditPage::CHECKBOX_SPEEDREVIEW_XPATH},\n {\"unchecked\" => SetupEditPage::CHECKBOX_WEB_SOURCING_XPATH},\n {\"click\" => SetupEditPage::SAVE_BUTTON_SHORT_LIST_XPATH}]\n Common.main(test)\n \n Common.goToTab(HomePage::SHORT_LIST_TAB_LINK_XPATH)\n Common.displayed(ShortListHomePage::SHORT_LIST_RECORD_XPATH_2)\n Common.click(ShortListHomePage::SHORT_LIST_RECORD_XPATH_2)\n #Common.displayed(ShortListDetailPage::SL_RECORD_XPATH)\n assert $wait.until {\n #$browser.find_element(:xpath, ShortListDetailPage::ADD_CONTACT_ICON_XPATH).displayed?\n Common.itemNotExists(ShortListDetailPage::SPEED_REVIEW_ICON_XPATH)\n } \n \n Common.go_to_short_list()\n \n test = [{\"displayed\" => SetupEditPage::EDIT_BUTTON_ON_SHORT_LIST_SETUP_XPATH},\n {\"click\" => SetupEditPage::EDIT_BUTTON_ON_SHORT_LIST_SETUP_XPATH},\n {\"displayed\" => SetupEditPage::CHECKBOX_SPEEDREVIEW_XPATH},\n {\"checked\" => SetupEditPage::CHECKBOX_SPEEDREVIEW_XPATH},\n {\"checked\" => SetupEditPage::CHECKBOX_WEB_SOURCING_XPATH},\n {\"click\" => SetupEditPage::SAVE_BUTTON_SHORT_LIST_XPATH}] \n rescue\n Common.go_to_short_list()\n test = [{\"displayed\" => SetupEditPage::EDIT_BUTTON_ON_SHORT_LIST_SETUP_XPATH},\n {\"click\" => SetupEditPage::EDIT_BUTTON_ON_SHORT_LIST_SETUP_XPATH},\n {\"displayed\" => SetupEditPage::CHECKBOX_SPEEDREVIEW_XPATH},\n {\"checked\" => SetupEditPage::CHECKBOX_SPEEDREVIEW_XPATH},\n {\"checked\" => SetupEditPage::CHECKBOX_WEB_SOURCING_XPATH},\n {\"click\" => SetupEditPage::SAVE_BUTTON_SHORT_LIST_XPATH}] \n end \nend", "def network_audio\n if Page.exists?(custom_route: \"network-audio-#{website.brand.name.to_param.downcase}\")\n @page = Page.where(custom_route: \"network-audio-#{website.brand.name.to_param.downcase}\").first\n show and return false\n elsif Page.exists?(custom_route: \"network-audio\")\n @page = Page.where(custom_route: \"network-audio\").first\n show and return false\n else\n @hide_main_container = true\n render_template\n end\n end", "def get_detection_html(user_agent)\n ua_info = fingerprint_user_agent(user_agent)\n os = ua_info[:os_name]\n client = ua_info[:ua_name]\n\n code = ERB.new(%Q|\n <%= js_base64 %>\n <%= js_os_detect %>\n <%= js_ajax_post %>\n <%= js_misc_addons_detect %>\n <%= js_ie_addons_detect if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n\n function objToQuery(obj) {\n var q = [];\n for (var key in obj) {\n q.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n }\n return Base64.encode(q.join('&'));\n }\n\n function isEmpty(str) {\n return (!str \\|\\| 0 === str.length);\n }\n\n function sendInfo(info) {\n var query = objToQuery(info);\n postInfo(\"<%=get_resource.chomp(\"/\")%>/<%=@info_receiver_page%>/\", query, function(){\n window.location=\"<%= get_module_resource %>\";\n });\n }\n\n var flashVersion = \"\";\n var doInterval = true;\n var maxTimeout = null;\n var intervalTimeout = null;\n\n function setFlashVersion(ver) {\n flashVersion = ver\n if (maxTimeout != null) {\n clearTimeout(maxTimeout);\n maxTimeout = null\n }\n doInterval = false\n return;\n }\n\n function createFlashObject(src, attributes, parameters) {\n var i, html, div, obj, attr = attributes \\|\\| {}, param = parameters \\|\\| {};\n attr.type = 'application/x-shockwave-flash';\n if (window.ActiveXObject) {\n attr.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';\n param.movie = src;\n } else {\n attr.data = src;\n }\n\n html = '<object';\n for (i in attr) {\n html += ' ' + i + '=\"' + attr[i] + '\"';\n }\n html += '>';\n for (i in param) {\n html += '<param name=\"' + i + '\" value=\"' + param[i] + '\" />';\n }\n html += '</object>';\n div = document.createElement('div');\n div.innerHTML = html;\n obj = div.firstChild;\n div.removeChild(obj);\n return obj;\n }\n\n window.onload = function() {\n var osInfo = os_detect.getVersion();\n var d = {\n \"os_vendor\" : osInfo.os_vendor,\n \"os_device\" : osInfo.os_device,\n \"ua_name\" : osInfo.ua_name,\n \"ua_ver\" : osInfo.ua_version,\n \"arch\" : osInfo.arch,\n \"java\" : misc_addons_detect.getJavaVersion(),\n \"silverlight\" : misc_addons_detect.hasSilverlight(),\n \"flash\" : misc_addons_detect.getFlashVersion(),\n \"vuln_test\" : <%= js_vuln_test %>,\n \"os_name\" : osInfo.os_name\n };\n\n <% if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n d['office'] = ie_addons_detect.getMsOfficeVersion();\n d['mshtml_build'] = ScriptEngineBuildVersion().toString();\n <%\n activex = @requirements[:activex]\n if activex\n activex.each do \\|a\\|\n clsid = a[:clsid]\n method = a[:method]\n %>\n var ax = ie_addons_detect.hasActiveX('<%=clsid%>', '<%=method%>');\n d['activex'] = \"\";\n if (ax == true) {\n d['activex'] += \"<%=clsid%>=><%=method%>=>true;\";\n } else {\n d['activex'] += \"<%=clsid%>=><%=method%>=>false;\";\n }\n <% end %>\n <% end %>\n <% end %>\n\n if (d[\"flash\"] != null && (d[\"flash\"].match(/[\\\\d]+.[\\\\d]+.[\\\\d]+.[\\\\d]+/)) == null) {\n var flashObject = createFlashObject('<%=get_resource.chomp(\"/\")%>/<%=@flash_swf%>', {width: 1, height: 1}, {allowScriptAccess: 'always', Play: 'True'});\n\n // After 5s stop waiting and use the version retrieved with JS if there isn't anything\n maxTimeout = setTimeout(function() {\n if (intervalTimeout != null) {\n doInterval = false\n clearInterval(intervalTimeout)\n }\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }, 5000);\n\n // Check if there is a new flash version every 100ms\n intervalTimeout = setInterval(function() {\n if (!doInterval) {\n clearInterval(intervalTimeout);\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }\n }, 100);\n\n document.body.appendChild(flashObject)\n } else {\n sendInfo(d)\n }\n }\n |).result(binding())\n\n js = ::Rex::Exploitation::JSObfu.new code\n js.obfuscate\n\n %Q|\n <script>\n #{js}\n </script>\n <noscript>\n <img style=\"visibility:hidden\" src=\"#{get_resource.chomp(\"/\")}/#{@noscript_receiver_page}/\">\n <meta http-equiv=\"refresh\" content=\"1; url=#{get_module_resource}\">\n </noscript>\n |\n end", "def get_audios_and_videos_for_reload\n x = current_user.own_media_elements(1, GalleriesController::AUDIOS_FOR_PAGE, Filters::AUDIO, true)\n @audios = x[:records]\n @audios_tot_pages = x[:pages_amount]\n x = current_user.own_media_elements(1, GalleriesController::VIDEOS_FOR_PAGE, Filters::VIDEO, true)\n @videos = x[:records]\n @videos_tot_pages = x[:pages_amount]\n end", "def test_Browser_001_DisplayWatirEnv\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_DisplayWatirEnv\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - display_watir_env\")\n display_watir_env()\n\n end", "def test_20_filter_styles\n\t\tprintTestHeader \"filter_styles Option\"\n\t\trval = bc = nil\n\n\t\t# Test as a 1st-level param\n\t\tassert_nothing_raised {\n\t\t\tbc = BlueCloth::new( DangerousHtml, :filter_styles )\n\t\t}\n\t\tassert_instance_of BlueCloth, bc\n\t\t\n\t\t# Accessors\n\t\tassert_nothing_raised { rval = bc.filter_styles }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_html }\n\t\tassert_equal nil, rval\n\n\t\t# Test rendering with filters on\n\t\tassert_nothing_raised { rval = bc.to_html }\n\t\tassert_equal DangerousStylesOutput, rval\n\n\t\t# Test setting it in a subarray\n\t\tassert_nothing_raised {\n\t\t\tbc = BlueCloth::new( DangerousHtml, [:filter_styles] )\n\t\t}\n\t\tassert_instance_of BlueCloth, bc\n\n\t\t# Accessors\n\t\tassert_nothing_raised { rval = bc.filter_styles }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_html }\n\t\tassert_equal nil, rval\n\n\t\t# Test rendering with filters on\n\t\tassert_nothing_raised { rval = bc.to_html }\n\t\tassert_equal DangerousStylesOutput, rval\n\n\tend", "def test_Search_001_ACCESS\n\n sTestCase_Name = \"test_Search_001_ACCESS\"\n puts2(\"\\nStarting Testcase: #{sTestCase_Name}\")\n\n @@bPassed = false # Clear flag since test has NOT passed yet\n\n begin\n\n # Start browser\n browser = Watir::Browser.new\n\n # Display a blank page\n browser.goto(\"about:blank\")\n\n # Access the Web site URL for the environment that was set on the workbook's Environment sheet\n browser.goto($sAccessURL)\n puts2(\"Current URL: \" + browser.url )\n puts2(\" Emulating Web Browser version: \" + browser.get_doc_app_version)\n\n ### BEGIN - IMAGES PAGE ##############################\n\n puts2(\"\\nAccessing page - Images...\")\n browser.link(:text, \"Images\").click\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record URL on the web page\n puts2(\" Current URL: \" + browser.url)\n\n puts2(\"Return to the Home page...\")\n # Return to the Home page\n browser.goto($sAccessURL)\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record URL on the web page\n puts2(\" Current URL: \" + browser.url)\n\n ### BEGIN - VIDEOS PAGE ##############################\n\n puts2(\"\\nAccessing page - Videos...\")\n browser.link(:text, \"Videos\").click\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record info on the web page\n puts2(\" Current URL: \" + browser.url)\n\n puts2(\"Return to the Home page...\")\n # Return to the Home page\n browser.goto($sAccessURL)\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record URL on the web page\n puts2(\" Current URL: \" + browser.url)\n\n ### BEGIN - MAPS PAGE ##############################\n\n puts2(\"\\nAccessing page - Maps...\")\n if(browser.link(:text, \"Maps\").exists?)\n browser.link(:text, \"Maps\").click\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record info on the web page\n puts2(\" Current URL: \" + browser.url)\n\n puts2(\"Return to the Home page...\")\n # Return to the Home page\n browser.goto($sAccessURL)\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record URL on the web page\n puts2(\" Current URL: \" + browser.url)\n else\n puts2(\"#{$sExecution_Env} does not have a Maps page\")\n end\n\n ### BEGIN - NEWS PAGE ##############################\n\n puts2(\"\\nAccessing page - News...\")\n browser.link(:text, \"News\").click\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record info on the web page\n puts2(\" Current URL: \" + browser.url)\n\n puts2(\"Return to the Home page...\")\n # Return to the Home page\n browser.goto($sAccessURL)\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record URL on the web page\n puts2(\" Current URL: \" + browser.url)\n\n ### BEGIN - SHOPING PAGE ##############################\n\n puts2(\"\\nAccessing page - Shopping...\")\n if(browser.link(:text, \"Maps\").exists?)\n browser.link(:text, \"Shopping\").click\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record info on the web page\n puts2(\" Current URL: \" + browser.url)\n\n puts2(\"Return to the Home page...\")\n # Return to the Home page\n browser.goto($sAccessURL)\n sleep(@@iDelay) # Allow time for page to complete loading\n\n # Record URL on the web page\n puts2(\" Current URL: \" + browser.url)\n\n else\n puts2(\"#{$sExecution_Env} does not have a Shopping page\")\n end\n\n #######################################\n\n puts2(\" Close the browser...\")\n if(browser.is_firefox?)\n # Force any open browsers to exit\n kill_browsers()\n else\n # Close the browser\n browser.close\n end\n\n rescue => e\n\n puts2(\"*** ERROR Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"), \"ERROR\")\n\n # Re-collect HTML tag counts on the current page\n if(@@bPassed == false)\n puts2(\"\\nCollecting current HTML tag counts...\")\n browser.generate_testcode_html_tag_counts()\n end\n\n # Force any open browsers to exit\n kill_browsers()\n\n raise(\"*** TESTCASE - #{sTestCase_Name}\")\n\n ensure\n\n end\n end", "def setup\n\t\t# disable the 'save your password' prompt\n\t\tcaps = Selenium::WebDriver::Remote::Capabilities.chrome(\"chromeOptions\" => {'prefs' => {'credentials_enable_service' => false}})\n\t\toptions = Selenium::WebDriver::Chrome::Options.new\n\t\toptions.add_argument('--enable-webgl-draft-extensions')\n\t\toptions.add_argument('--incognito')\n\t\t@driver = Selenium::WebDriver::Driver.for :chrome, driver_path: $chromedriver_dir,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptions: options, desired_capabilities: caps,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdriver_opts: {log_path: '/tmp/webdriver.log'}\n\t\t@driver.manage.window.maximize\n\t\t@base_url = $portal_url\n\t\t@accept_next_alert = true\n\t\t@driver.manage.timeouts.implicit_wait = 15\n\t\t# only Google auth\n\n\t\t@genes = %w(Itm2a Sergef Chil5 Fam109a Dhx9 Ssu72 Olfr1018 Fam71e2 Eif2b2)\n\t\t@wait = Selenium::WebDriver::Wait.new(:timeout => 30)\n\t\t@test_data_path = File.expand_path(File.join(File.dirname(__FILE__), 'test_data')) + '/'\n\t\t@base_path = File.expand_path(File.join(File.dirname(__FILE__), '..'))\n\t\tputs \"\\n\"\n\tend", "def test_a_filter_all\n filter = 'filter-all'\n tag_name='All'\n basic_check_list(filter, tag_name)\n end", "def test_wd_st_014\n printf \"\\n+ Test 014\"\n open_warning_diff_file\n\t\t@selenium.select \"status\", \"Added\"\n click $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(!is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_not_present($warning_diff_xpath[\"pagination\"]))\n\n\t\t@selenium.select \"status\", \"Deleted\"\n click $warning_diff_xpath[\"filtering_button\"]\n sleep SLEEP_TIME\n assert(!is_text_present($warning_diff[\"pagination_text\"]))\n\t\tassert(is_element_not_present($warning_diff_xpath[\"pagination\"]))\n logout\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description Main page of the section 'elements'. When it's called via ajax it's because of the application of filters, paginations, or after an operation that changed the number of items in the page. Mode Html + Ajax Specific filters ApplicationControllerinitialize_layout MediaElementsControllerinitialize_paginator
def index get_own_media_elements if @page > @pages_amount && @pages_amount != 0 @page = @pages_amount get_own_media_elements end render_js_or_html_index end
[ "def advance_search \n if params[:entity_type]==\"static-fragment\"\n @page_properties={:selected_menu=>'static_fragment',:menu_title=>'Static Fragment List'}\n else\n @page_properties={:selected_menu=>'static_articles',:menu_title=>'Static Page List'}\n end \n @search=true \n @search_data=SearchData.new(params[:search_data]) if params[:search_data] \n @article_path=\"static_page\" \n @selected_section=@site.static_sections.find(params[:search_data][:section_id]) if params[:search_data] and params[:search_data][:section_id]!=\"\"\n session[:per_page]=params[:per_page] if params[:per_page]!=nil\n sort_init \"updated_at\"\n sort_update\n respond_to do |format|\n format.html do \n render :action=>\"index\" ,:entity_type => params[:entity_type]\n end\n format.js do\n render :update do |page| \n page.replace_html 'article_list',component_table_list(@site.find_component_by_name(\"static_article_search\"))\n end\n end\n end \n end", "def ajax_will_paginate(collection)\n pagination = will_paginate(collection)\n return if pagination.nil?\n html = pagination\n html << \"\\n\"\n html << javascript_tag do\n <<-eof\n $(document).ready(function(){\n $('div.pagination a').click(function() {\n $.getScript(this.href);\n return false;\n })\n $('div#facebox div.pagination a').click(function() {\n $.facebox({ajax: this.href});\n return false;\n })\n });\n eof\n end\n html\n end", "def pagination\n element_text 'Pagination'\n end", "def initialize_paginator_and_filters_for_media_elements\n @filter = Filters::MEDIA_ELEMENTS_SEARCH_SET.include?(params[:filter]) ? params[:filter] : Filters::ALL_MEDIA_ELEMENTS\n @order = SearchOrders::MEDIA_ELEMENTS_SET.include?(params[:order]) ? params[:order] : SearchOrders::TITLE\n @for_page = MEDIA_ELEMENTS_FOR_PAGE\n end", "def index\n get_own_documents\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_documents\n end\n render_js_or_html_index\n end", "def show\n @page = @element.page\n @options = params[:options]\n\n respond_to do |format|\n format.html\n format.js { @container_id = params[:container_id] }\n format.json do\n render json: @element.to_json(\n only: [:id, :name, :updated_at],\n methods: [:tag_list],\n include: {\n contents: {\n only: [:id, :name, :updated_at, :essence_type],\n methods: [:ingredient],\n include: {\n essence: {\n except: [:created_at, :creator_id, :do_not_index, :public, :updater_id]\n }\n }\n }\n }\n )\n end\n end\n end", "def show\n @page = @element.page\n @options = params[:options]\n\n respond_to do |format|\n format.html\n format.js { @container_id = params[:container_id] }\n format.json do\n render json: @element.to_json(\n only: [:id, :name, :updated_at],\n methods: [:tag_list],\n include: {\n contents: {\n only: [:id, :name, :updated_at, :essence_type],\n methods: [:ingredient],\n include: {\n essence: {\n except: [:created_at, :creator_id, :public, :updater_id]\n }\n }\n }\n }\n )\n end\n end\n end", "def pagination_elements()\n results_list.all(\".pagination\")\n end", "def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_lessons\n end\n render_js_or_html_index\n end", "def page_elements\n []\n end", "def show_about\n @metadata_profile = @collection.effective_metadata_profile\n @submission_profile = @collection.effective_submission_profile\n @num_downloads = MonthlyCollectionItemDownloadCount.sum_for_collection(collection: @collection)\n @num_submitted_items = @collection.submitted_item_count\n @subcollections = Collection.search.\n institution(@collection.institution).\n parent_collection(@collection).\n include_children(true).\n order(\"#{Collection::IndexFields::TITLE}.sort\").\n limit(999)\n render partial: \"show_about_tab\"\n end", "def index\n @az_project_blocks = AzProjectBlock.paginate(:all, :conditions => {:copy_of => nil}, :page => params[:page], :order => 'id desc')\n\n @title = 'Компоненты сайтов'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @az_project_blocks }\n end\n end", "def render(options = nil, extra_options = {}, &block)\n # your code goes here\n prep_pagination_info(@results_h[:pagination_info]) if @results_h && @results_h[:pagination_info]\n \n # call the ActionController::Base render to show the page\n super\n end", "def pagination_elements()\n results.find_elements(:class, \"pagination\")\n end", "def scroll_paginate(options)\n # initialize variables\n setup_options(options)\n html = \"<script type='text/javascript'>\n $(document).ready(function(){\n $('body').flexiPagination({\n url: '#{@url}',\n totalResults: #{@total_results},\n container: '#{@container}',\n currentPage: #{@current_page},\n perPage: #{@per_page},\n pagerVar : '#{@pager_var}',\n loaderImgPath: '#{@loader_img_path}',\n loaderText: '#{@loader_text}',\n debug : #{@debug}\n });\n });\n </script>\"\n end", "def kopal_layout_after_page_meta\n\n end", "def render_pagination\n num_pages = Document.num_results.to_f / @per_page.to_f\n num_pages = Integer(num_pages.ceil)\n return '' if num_pages == 0\n\n content_tag :div, :class => 'ui-grid-c' do\n content = content_tag(:div, :class => 'ui-block-a') do\n if @page != 0\n page_link(I18n.t(:'search.index.first_button'), 0, 'back')\n end\n end\n content << content_tag(:div, :class => 'ui-block-b') do\n if @page != 0\n page_link(I18n.t(:'search.index.previous_button'), @page - 1, 'arrow-l')\n end\n end\n\n content << content_tag(:div, :class => 'ui-block-c') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.next_button'), @page + 1, 'arrow-r', true)\n end\n end\n content << content_tag(:div, :class => 'ui-block-d') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.last_button'), num_pages - 1, 'forward', true)\n end\n end\n\n content\n end\n end", "def more\n\t\t@menu = Menu.find(params[:menu_id])\n\t\t@comments = @menu.comments.paginate(page: params[:page], per_page: 10)\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def index_display(page_title, title_for_add_button, index_partial)\n src = ''\n src << \"<h2> #{page_title}</h2>\"\n src << render(:partial => \"shared/flashes\")\n \n src << '<table>'\n #src << '<thead>'\n #src << pagination_display(items, item_name, column_titles.size, pagination_opts) unless items.nil?\n #src << '</thead>'\n src << '<tr><td>'\n src << render(:partial => index_partial)\n src << \"</td></tr>\"\n src << '</table>'\n src\n \n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }