query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Tests that course's total_fee is not nil and is greater than or equal to 0 and returns true or false.
def total_fee_is_valid? return ((self.total_fee != nil) and (self.total_fee >= 0)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end", "def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end", "def free?\n self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0\n end", "def free?\n\t\t\t\tnot(fee?)\n\t\t\tend", "def payment_required?\n billing_total.to_f > 0.0\n end", "def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end", "def free?\n cost == 0.0 || payment_not_required\n end", "def fully_paid?\n amount_owed <= 0\n end", "def money_enough?\n remaining_sum > 0\n end", "def can_pay_total?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_total = (['total','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end", "def check_free_venue\n if @total >= 20\n return true\n end\n end", "def calculated?\n fee_type&.calculated?.nil? ? true : fee_type.calculated?\n end", "def add_fee_is_integer\n if !params[:add_fee].nil?\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !amount.empty? && !(amount.to_i.to_s.eql? amount)\n return false\n end\n end\n end\n return true\n end", "def add_fee_filled_or_empty\n if !params[:add_fee].nil?\n add_fee_keys = params[:add_fee].keys\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !((!student_type.empty? && !amount.empty? && !time_period.empty?) ||\n (student_type.empty? && amount.empty? && time_period.empty?))\n return false\n end\n end\n end\n return true\n end", "def calculate_fee\n Application::courses_fee(course_selections_count > 1 ? :multiple : :single)\n end", "def discount_running?\n !discount_period.nil? && discount_period > 0\n end", "def technically_paid?\n unconfirmed_value_paid >= value_needed\n end", "def paid?(amt)\n # Predicate methods should always return\n # true or false.\n amt.to_i > 0\nend", "def completely_valid?\n course_valid = course.valid?\n valid? && course_valid\n end", "def allowed_to_pay_renewal_member_fee?\n return false if admin?\n\n (current_member? || in_grace_period?) &&\n RequirementsForRenewal.requirements_excluding_payments_met?(self)\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @total_servicos.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_nacionais.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_internacionais.nil?\n return false\n end\n\n \n \n \n \n end", "def for_profit?\n !foreign? && !facility_code.nil? && facility_code[0] == \"2\"\n end", "def fulfilled?\n amount_remaining.zero?\n end", "def free?\n price.blank? || price.zero?\n end", "def paid?\n rate.present? && rate.cents > 0\n end", "def charge_fee\r\n\t\tif_member = Participant.find_by(participantID: participantID)\r\n\t\tif_course = Course.find_by(courseID: courseID)\r\n\t\t\r\n\t\tif if_course != nil && if_member != nil\r\n\t\t\tearlyBirdTime = if_course.startDate.months_ago(1)\r\n\t\t\tif if_member.expirydate > Date.today\r\n\t\t\t\tif Date.today >= earlyBirdTime && Date.today < if_course.startDate\r\n\t\t\t\t\treturn if_course.earlybirdPrice\r\n\t\t\t\telse\r\n\t\t\t\t\treturn if_course.memberPrice\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\treturn if_course.nonmemberPrice\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def is_percentage_fee_overriden?\n if !self.override_percentage_fee.blank? and self.override_percentage_fee > 0 and self.override_percentage_fee != StaticDataLancer::JOB_ORDER_PERCENTAGE_FEE\n return true\n else\n return false\n end\n end", "def applicable?\n mandatory || amount != 0\n end", "def valid_account(sports_centre) # pass in current_sports_centre\n if sports_centre != nil\n return true if Date.current <= sports_centre.nextPaymentDue\n else\n return false\n end\n end", "def delivery_required?\n total_weight > BigDecimal(0)\n end" ]
[ "0.7698745", "0.7017238", "0.686757", "0.68662935", "0.6678528", "0.66256934", "0.6557586", "0.6436912", "0.6390961", "0.63814205", "0.63697875", "0.62293804", "0.62135327", "0.618787", "0.6171076", "0.61420584", "0.61293584", "0.6064821", "0.6049073", "0.602505", "0.6005423", "0.5976299", "0.5976103", "0.59728867", "0.5965319", "0.595268", "0.59463143", "0.5914594", "0.58945006", "0.5888469" ]
0.83600813
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 instructor_active\n if self.instructor != nil\n if self.instructor.active == false\n errors.add(:instructor_id, \"should be active\")\n end \n end \n end", "def create\n @instructor = Instructor.new(params[:instructor])\n render :action => :new unless @instructor.save\n end", "def grade_is_valid\n errors.add(:grade, 'Invalid grade entered.') unless grade_is_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 validity\n msg=\"\"\n valid=true\n unless self.default_location.nil?\n # test si la salle est deja allouee a une classe\n unless self.default_location.class_school.nil? || self.default_location.class_school==self\n msg=\"La salle est déja occupée (#{self.default_location.class_school.ident}) !!\"\n valid=false\n else\n if self.nb_max_student > self.default_location.location_nb_max_person\n msg=\"La salle est trop petite (#{self.default_location.location_nb_max_person}) !!\"\n valid=false\n end\n end\n end\n self.errors.add(:base, \"Class school is not valid:#{msg}\") unless valid\n valid\n end", "def valid?\n super\n if attendee.valid?\n validate_mandatory_plan_cats(selected_plans)\n validate_single_plan_categories(selected_plans)\n validate_disabled_plans(persisted_plan_selections, selected_plans)\n validate_models(selected_attendee_plans)\n validate_activities\n else\n merge_errors(attendee.errors)\n end\n @errors.empty?\n end", "def validate\n # add errors if not validate\n end", "def create\n @instructor = Instructor.new(instructor_params)\n @instructor.deleteable = true\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to admin_path(current_user), notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: admin_path(current_user) }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\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\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def extra_validations\n success\n end", "def validate!\n # Set @error_text if the options are not valid\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 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 run_validations\n true\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 create\n @course_instructor = CourseInstructor.new(course_instructor_params)\n\n respond_to do |format|\n if @course_instructor.save\n format.html { redirect_to @course_instructor, notice: 'Course instructor was successfully created.' }\n format.json { render :show, status: :created, location: @course_instructor }\n else\n format.html { render :new }\n format.json { render json: @course_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend", "def has_errors?\n taking_courses.each do |course|\n unless course.is_time_valid?\n return true\n end\n end\n false\n end", "def create\n @manage_instructor = Instructor.new(params[:manage_instructor])\n\n respond_to do |format|\n if @manage_instructor.save\n format.html { redirect_to @manage_instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @manage_instructor, status: :created, location: @manage_instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @instructor, status: :created, location: @instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def teacher_is_valid?\n return self.teacher_id != nil\n end", "def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end", "def is_valid?\n instructor_approved || (non_rejected_student_memberships.size >= assignment.group_min)\n end", "def valid_age\n\t\treturn true if self.student == nil || self.section == nil\n\t\tunless self.student.age >= self.section.min_age && self.student.age <= self.section.max_age\n\t\t\terrors.add(:student, \"does not have the appropriate age to be registered\")\n\t\tend\n\tend" ]
[ "0.7986762", "0.6713823", "0.6494201", "0.6046265", "0.600162", "0.59047836", "0.58997005", "0.58126855", "0.5809437", "0.57614034", "0.57481265", "0.5746208", "0.57296884", "0.57296884", "0.57296884", "0.566712", "0.5664021", "0.56560785", "0.56548095", "0.56395245", "0.5607387", "0.557904", "0.5565671", "0.5554716", "0.55442977", "0.5540525", "0.5536621", "0.5517022", "0.55000424", "0.5488655" ]
0.8588355
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CA_only?\n course_assistant? && (not instructor?)\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 CA_only?\n course_assistant? && !instructor?\n end", "def ptainstructor_is_valid\n errors.add(:ptainstructor,'No PTA instructor was selected.') unless ptainstructor_is_valid?\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 course_planned?(course)\n course_id = course.is_a?(Course) ? course.id : course\n planned_courses.any? do |planned_course|\n planned_course.course_id == course_id\n end\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 is_user_ta?(instructor_id, child)\n # instructor created the course, current user is the ta of this course.\n session[:user].role_id == 6 and\n Ta.get_my_instructors(session[:user].id).include?(instructor_id) and ta_for_current_course?(child)\n end", "def course_owner?(course)\n tutor? && current_user?(course.tutor)\n end", "def is_user_ta?(instructor_id, child)\n # instructor created the course, current user is the ta of this course.\n (session[:user].role_id == 6) &&\n Ta.get_my_instructors(session[:user].id).include?(instructor_id) && ta_for_current_course?(child)\n end", "def tutor_check?(academic_session, student_id)\n \tcurrent_user.is_student_tutor?(academic_session, student_id)\n end", "def course_is_available?(node)\n instructor_for_course?(node) || ta_for_course?(node)\n end", "def attended_exam_in? course\n exams.for_course(course).attended.present?\n end", "def completely_valid?\n course_valid = course.valid?\n valid? && course_valid\n end", "def assigned_course_or_script?\n assigned_courses.any? || any_visible_assigned_scripts?\n end", "def teacher_is_valid?\n return self.teacher_id != nil\n end", "def is_taking?(course)\n courses.include?(course)\n end", "def plan_to_take_course?(course)\n taking_courses.where(:course_id => course).size >0\n end", "def instructor_active\n if self.instructor != nil\n if self.instructor.active == false\n errors.add(:instructor_id, \"should be active\")\n end \n end \n end", "def ensure_not_referenced_by_any_course\n if courses.empty?\n return true\n else\n errors.add(:base, 'Courses present')\n return false\n end\n end", "def valid?\n court && slot\n end", "def ta_for_course?(node)\n ta_mappings = TaMapping.where(ta_id: session[:user].id)\n course_id = node.is_a?(CourseNode) ? node.node_object_id : Assignment.find(node.node_object_id).course_id\n ta_mappings.any? { |ta_mapping| ta_mapping.course_id == course_id }\n end", "def is_attending? course\n exams.for_course(course).attending.present?\n end", "def instructor?(item=nil)\n defined?(@_is_instructor) or @_is_instructor = self.sessions.present?\n return @_is_instructor unless item\n return sessions.any? { |s| s.topic_id == item.id } if item.is_a? Topic\n return sessions.include?(item) if item.is_a? Session\n false\n end", "def is_taking_course?(course, term = nil)\n term ||= Utils::Term::now\n taking_courses.each do |c|\n if c.course == course and c.year == term.year and c.semester == term.semester\n return true\n end\n end\n false\n end", "def has_course?(course)\n self.courses.include?(course)\n end", "def has_course?(course)\n self.courses.include?(course)\n end", "def can_add_course?\n self.available_courses > 0 || self.clearance?\n end" ]
[ "0.73070735", "0.72831607", "0.7220261", "0.71659905", "0.65088296", "0.650151", "0.6478992", "0.6473052", "0.6441444", "0.63904697", "0.637861", "0.6372246", "0.6317061", "0.63082796", "0.62789655", "0.62364626", "0.6220693", "0.6195924", "0.61431336", "0.6139531", "0.6102591", "0.6042091", "0.60065186", "0.600254", "0.5993181", "0.5962848", "0.5959883", "0.59550637", "0.59550637", "0.59227574" ]
0.833853
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teacher_is_valid?\n return self.teacher_id != nil\n end", "def check_destroy\n valid=true\n msg=\"\"\n if matters.count > 0\n valid=false\n msg+=\" There are #{matters.count} teacher_matters references\"\n end\n if teachings.count > 0\n valid=false\n msg+=\" There are #{teachings.count} teachings references\"\n end\n self.errors.add(:base, \"Teacher can't be destroyed:#{msg}\") unless valid\n valid\n end", "def teacher_enabled?\n self.errors.add(\"Not attached to zone. Please contact your co-ordinator.\") if self.teacher.state == Teacher::STATE_UNATTACHED\n end", "def cant_be_assigned_to_retired_teacher\n if teacher && teacher.retirement_date\n errors.add(:teacher_id,\"Students cannot be assigned to retiring teachers.\")\n end\n end", "def create\n @teacher = Teacher.new(params[:teacher])\n @user = User.new(params[:user]) do |u|\n u.rolable = @teacher\n u.skip_password_validation = true\n u.is_admin = params[:user][:is_admin] if current_user.is_admin # is_admin is non accessible\n end\n \n valid = @user.valid? \n valid = @teacher.valid? && valid\n \n if valid\n create_and_send_invitation(@user, @teacher, \"Teacher\")\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def ptainstructor_is_valid\n errors.add(:ptainstructor,'No PTA instructor was selected.') unless ptainstructor_is_valid?\n end", "def least_teacher\n unless is_teacher\n flash[:danger] = \"You do not have access to that page.\"\n redirect_to root_path\n end\n end", "def 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 required_teacher\n require_user_type(:teacher)\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 create\n @teacher = Teacher.new(teacher_params)\n if @teacher.save\n redirect_to @teacher, notice: 'Teacher was successfully created.'\n else\n render :new\n end\n end", "def create\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\t\t@teacher = Teacher.new(teacher_params)\n\t\[email protected]_id = getLoginEventId\n\t\[email protected] = @teacher.getCode\n\t\[email protected]_id = getLoginUserId\n\t\trespond_to do |format|\n\t\t\tif @teacher.save\n\t\t\t\tformat.html { redirect_to @teacher, notice: 'Der Lehrer wurde erfolgreich eröffnet.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @teacher }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @teacher.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def has_teacher?(teacher)\n return @has_teacher\n end", "def create\n if session[:subscription].nil?\n redirect_to :controller => \"about\", :action => \"pricing\"\n elsif session[:school].nil?\n redirect_to :controller => \"schools\", :action => \"check\"\n end\n @subscription = session[:subscription]\n @school = session[:school]\n\n @new_teacher = User.new(params[:user])\n\n if params[:user][:first_name].blank? or params[:user][:last_name].blank? or params[:user][:email].blank? or params[:user][:password].blank?\n flash[:error] = \"Please fill out all of the fields before continuing.\"\n render :action => \"new\" and return\n else\n # unless User.is_valid_email_domain(params[:user][:email])\n # flash[:error] = \"Please make sure you have entered a valid email address.\"\n # render :action => \"new\"\n # end\n if User.is_email_in_use(params[:user][:email])\n flash[:error] = \"That email address is already in our database.<br />Please get in touch if you'd like help reactivating your account.\".html_safe\n render :action => \"new\" and return\n else\n @new_teacher.role = \"teacher\"\n session[:teacher] = @new_teacher\n redirect_to :controller => \"subscription\", :action => \"confirm\"\n end\n end\n end", "def create\n @teacher = Teacher.new(teacher_params)\n \n respond_to do |format|\n if @teacher.save\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(teacher_params)\n @school = School.find(@teacher.school_id)\n\n if @teacher.save\n flash[ :success] = \"Teacher #{ @teacher.full_name } was successfully created.\"\n redirect_to teachers_path\n else\n render :new\n end\n end", "def teacher_user\n\t\t\tredirect_to(root_url) unless current_user.role == \"teacher\"\n\t\tend", "def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :gender, :date_of_birth, :mobile_number, :email, :listening_skills_jaws, :writing_skills_with_jaws, :strengths, :weaknesses, :tirms, :user_id)\n end", "def create\n @teacher = Teacher.new(params.require(:teacher).permit(:email, :password, :password_confirmation, :name, :last, :times, :reserved)) #Create a new teacher instance with set variables\n @teacher.reserved = [\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\"] #Create teacher time slots\n if @teacher.save#If teacher saves correctly\n redirect_to prin_user_path #Redirect to the home page\n else\n render \"new\" #If else, redirect back to creation screen\n \n end\nend", "def teacher_params\n params.require(:teacher).permit(:name, :degree, :university_id, :phone_number, :email)\n end", "def set_teacher\n current_teacher = Teacher.find_by_id(params[:teacher_id])\n redirect_to root_path if !current_teacher\n end", "def logged_in_as_teacher?\n redirect_to :back, notice: \"You do not have permission to access that page.\" unless current_user && current_user.person_type == \"Teacher\"\n rescue ActionController::RedirectBackError\n redirect_to root_path\n end", "def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Преподаватель создан!' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new } \n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def teacher_only\n false\n end", "def teacher_only\n false\n end", "def teacher_only\n false\n end", "def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_destroy\n valid=true\n msg=\"\"\n if students.count > 0\n valid=false\n end\n if teachings.count > 0\n valid=false\n msg+=\" There are #{teachings.count} teachings references\"\n end\n self.errors.add(:base, \"Class school can't be destroyed:#{msg}\") unless valid\n valid\n end", "def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :title, :email, :password, \n :password_confirmation, :current_class, :user_number, :school_id)\n end" ]
[ "0.7701353", "0.65671885", "0.64631915", "0.64056695", "0.6350357", "0.622444", "0.6196493", "0.60277474", "0.59879917", "0.59725815", "0.5956702", "0.5930681", "0.59111017", "0.5903324", "0.5900726", "0.5898185", "0.58875984", "0.58524483", "0.5836989", "0.5834455", "0.5829431", "0.5817145", "0.5817053", "0.5803632", "0.5803632", "0.5803632", "0.5782847", "0.5782847", "0.5769218", "0.57272077" ]
0.85017115
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_teacher?(teacher)\n return @has_teacher\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 is_teacher?\n #get_role == TEACHER\n get_role == false\n end", "def logged_in?\n !current_teacher.nil?\n end", "def logged_in?\n !current_teacher.nil?\n end", "def teacher_is_valid\n errors.add(:teacher,'No classroom location was selected.') unless teacher_is_valid?\n end", "def tutor_check?(academic_session, student_id)\n \tcurrent_user.is_student_tutor?(academic_session, student_id)\n end", "def ptainstructor_is_valid?\n return self.ptainstructor_id != nil\n end", "def set_course_has_teacher\n @course_has_teacher = CourseHasTeacher.find(params[:id])\n end", "def teacher_only\n false\n end", "def teacher_only\n false\n end", "def teacher_only\n false\n end", "def teacher_logged_in?\n @teacher_logged_in ||= user_signed_in? and cur_teacher\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 logged_out?\n current_teacher.nil?\n end", "def CA_only?\n course_assistant? && (not instructor?)\n end", "def is_super?\n current_teacher && current_teacher.id == 1\n end", "def is_taking_course?(course, term = nil)\n term ||= Utils::Term::now\n taking_courses.each do |c|\n if c.course == course and c.year == term.year and c.semester == term.semester\n return true\n end\n end\n false\n end", "def teacher_enabled?\n self.errors.add(\"Not attached to zone. Please contact your co-ordinator.\") if self.teacher.state == Teacher::STATE_UNATTACHED\n end", "def CA_only?\n course_assistant? && !instructor?\n end", "def is_student?\n student.nil?\n end", "def required_teacher\n require_user_type(:teacher)\n end", "def create?\n user.has_role?(:teacher)\n end", "def create?\n user.has_role?(:teacher)\n end", "def create?\n user.has_role?(:teacher)\n end", "def teacher_is_suspended?( teacher)\n teacher.suspended\n end", "def is_user_ta?(instructor_id, child)\n # instructor created the course, current user is the ta of this course.\n session[:user].role_id == 6 and\n Ta.get_my_instructors(session[:user].id).include?(instructor_id) and ta_for_current_course?(child)\n end", "def user_active?\n\t\treturn true if teacher? && !activated\n\tend", "def is_taking?(course)\n courses.include?(course)\n end" ]
[ "0.7449263", "0.7200843", "0.68973225", "0.67134386", "0.67134386", "0.6505894", "0.6498933", "0.64595133", "0.64591366", "0.64050275", "0.64050275", "0.64050275", "0.63600016", "0.63040674", "0.62889653", "0.6263735", "0.6236275", "0.62268835", "0.61472505", "0.61325", "0.6129215", "0.6111554", "0.60876966", "0.60552746", "0.60552746", "0.60552746", "0.60207534", "0.5986317", "0.596375", "0.5947824" ]
0.81804997
0
Returns array with number of students in course and class_max.
def class_how_full? return [self.students.count, self.class_max] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expected_grades\n assignment.course.students.count\n end", "def expected_grades\n metrics.count * course.students.count\n end", "def num_grades (student)\n @grades[student].length\n end", "def find_max\n\t# Use method: stu_max = @students_list.max_by{|x| x.avg}\n\t max =0\n\t for i in 0..(@students_list.length-1) \n\t\tif @students_list[i].avg > max\n\t\t max = @students_list[i].avg\n\t\t stu_max = @students_list[i]\n\t\tend\n\t end\n\t puts \"Student who has max avg\".center(30)\n\t puts \"Name: #{stu_max.name}\".rjust(20)\n\t puts \"Birthday: #{stu_max.birthday}\".rjust(20)\n\t puts \"Math: #{stu_max.math}\".rjust(20)\n\t puts \"Literature: #{stu_max.liter}\".rjust(20)\n\t puts \"English: #{stu_max.eng}\".rjust(20)\n\t puts \"AVG: #{stu_max.avg}\".rjust(20)\n\tend", "def count_students\n students.size\n end", "def count_students\n students.size\n end", "def available_courses\n MAX_COURSES - self.course_selections_count\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 get_students\n ret=[]\n self.get_class_schools.each do |classe|\n ret.concat classe.students\n end\n #puts \"========================== teacher.get_students: #{ret.count}\"\n ret\n end", "def total_students\n students = 0\n self.booked_customers.each do |school|\n students += school.number_students\n end\n return students\n end", "def unique_course_count\n return courses.group(:name).count\n end", "def num_students\n self.students.count\n end", "def get_class_schools\n ret=[]\n self.teachings.to_a.each do |teaching|\n ret<< teaching.teaching_class_school\n end\n #puts \"========================== teacher.get_class_schools: #{ret.count}\"\n ret\n end", "def student_membership_number\n accepted_students.size + pending_students.size\n end", "def students_scheduled\n self.lessons.size\n end", "def popularities\n result = {}\n @courses.each do |cl|\n result[cl.name] = Hash.new(0)\n end\n @students.each do |student|\n student.each_with_index do |course_choice, i|\n result[course_choice.name][i] += 1\n end\n end\n result\n end", "def find_all_students_with_grade(grade)\n count = 0;\n self.students.each { |student|\n if student.grade == grade\n count = count+1\n end\n }\n return count;\n end", "def max_total_score\n review_criterions.collect{|c| c.max_score}.sum\n end", "def print_course_class_total_item_counts\n puts \"=> Course Class Total Item Counts\"\n @course_classes.each do |course_class|\n puts \"% 20s % 4d\" % [ course_class, course_class.count ]\n end\n end", "def find_max_chars\n @students.each do |student|\n student.each do |k, v|\n key_length = k.to_s.length\n value_length = ((v.is_a? Array) ? v.join(', ') : v.to_s).length\n current_max = (key_length > value_length ? key_length : value_length) + 2\n if (@max_chars[k] == nil) || (current_max > @max_chars[k])\n @max_chars[k] = current_max\n end\n end\n end\nend", "def max_donors(students, blood_types)\n\tdonor_lengths = []\n\n\tstudents.each_with_index do |student, i|\n\t\tstudent_blood_type = blood_type(students, blood_types, student)\n\t\tbloods_list = blood_type_accepted(students, student_blood_type, student)\n\t\tstudent_donor_list = donor_list(students, blood_types, bloods_list)\n\t\tdonor_lengths.push(student_donor_list.length)\n\n\tend\n\n\tindex = 0\n\tdonor_max = donor_lengths[0]\n\tmax_donor_list = []\n\tdonor_lengths.each_with_index do |count, i|\n\t\tif count > donor_max\n\t\t\tdonor_max = count\n\t\t\tindex = i\n\t\tend\n\tend\n\tdonor_lengths.each_with_index do |count, i|\n\t\tif count == donor_max\n\t\t\tmax_donor_list.push(students[i])\n\t\tend\n\tend\n\treturn max_donor_list, donor_max\nend", "def total_students(students)\n\ttotal = 0\n\tstudents.each do |cohort, number| \n\t\ttotal += number.to_i\n\tend\n\tputs total\nend", "def get_max_included_snps\n max_snps = 0\n @chromarray.each do |num|\n if @chromhash[num].snp_list.get_num_included_snps > max_snps\n max_snps = @chromhash[num].snp_list.get_num_included_snps\n end\n end\n return max_snps\n end", "def maximum\n\t\tif 2 < course.users.length and 0 < worth\n\t\t\tmaximum = 0\n\t\t\t\n\t\t\tcourse.users.each do |user|\n\t\t\t\tgrade = self.user_grade(user)\n\t\t\t\t\n\t\t\t\tif grade and maximum < grade\n\t\t\t\t\tmaximum = grade\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn maximum\n\t\tend\n\tend", "def get_num_students_per_grade(num_students)\n min = @scenarioYAML[\"MINIMUM_GRADE_PERCENTAGE\"]\n max = @scenarioYAML[\"MAXIMUM_GRADE_PERCENTAGE\"]\n\n if min.nil?\n @log.error \"MINIMUM_GRADE_PERCENTAGE must be set for a world to be created --> Exiting...\"\n abort\n end\n if max.nil?\n @log.error \"MAXIMUM_GRADE_PERCENTAGE must be set for a world to be created --> Exiting...\"\n abort\n end\n\n ((random_on_interval(min, max) / 100) * num_students).round\n end", "def enrollee_count\n count = 0\n courses.each do |c|\n count += c.course.all_enrollee_count\n end\n count += extra_enrollees.size\n count\n end", "def max_y\n vertical_code_list&.codes&.count.to_i + roster_rows.to_i\n end", "def factor_max_labs\n \tfactors.map do |factor|\n \t\tfactor.max_score\n \tend\n end", "def solution(a)\n return a.count(a.max)\nend", "def max_scores\n next_boards.map(&:max_score)\n end" ]
[ "0.6461427", "0.6382975", "0.6140354", "0.59984523", "0.59177566", "0.59177566", "0.59030765", "0.58153164", "0.5814784", "0.57280606", "0.56930727", "0.5684635", "0.5638393", "0.5582642", "0.55610883", "0.55566406", "0.55316156", "0.55268115", "0.55179995", "0.54999554", "0.5483156", "0.5479953", "0.5455065", "0.54510367", "0.54142636", "0.54109323", "0.5364753", "0.5359149", "0.5321879", "0.5303266" ]
0.72358114
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 add_filepath_to_source(filepath)\n\t\tFile.open(@source, 'r+') do |file|\n\t\t\tlines = self.get_source_content\n\t\t\tlines.push(filepath)\n\t\t\tlines.uniq!\n\t\t\tlines.sort!\n\t\t\tfile.puts lines.join(\"\\n\")\n\t\tend\n\tend", "def characterize(save: true)\n TikaFileCharacterizationService.new(file_node: file_node, persister: persister).characterize\n external_metadata_service.characterize if external_metadata_service.valid?\n end", "def characterize(save: true)\n unzip_original_file if zip_file?\n new_file = original_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 @file_set = @persister.save(resource: @file_set) if save\n clean_up_zip_directory if zip_file?\n @file_set\n end", "def characterize(save: true)\n TikaFileCharacterizationService.new(file_set: file_set, persister: persister).characterize\n end", "def parse_file\n @filecontent ||= File.read(@filepath)\n end", "def include_file(filepath)\n content = File.read(filepath)\n mime = MimeMagic.by_path(filepath)\n if mime.text?\n return content\n elsif mime.image?\n return Base64.strict_encode64(content)\n else\n raise \"File '${filepath}' of type '${mime}' can't be included as text\"\n end\n end", "def translate_file(filename)\n f = File.read(filename)\n f = translate_title(f)\n f = translate_body(f)\n f = update_category(f)\n f\n end", "def extract_text_from(filepath)\n extension = filepath.split('.').last\n textfile = extension ? filepath.gsub(extension, 'txt') : filepath + \".txt\"\n text = \"\"\n case extension\n when 'pdf'\n text = `pdftotext #{filepath} -`\n when 'doc'\n text = `antiword #{filepath}`\n when 'html'\n \"\"\n when 'txt'\n \"\"\n else\n \"\"\n end\n RAILS_DEFAULT_LOGGER.warn(\"text is #{text.size} characters long\")\n text\n end", "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 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 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 fetch!\n\n open(fetch_txt_file) do |io|\n \n io.readlines.each do |line|\n \n (url, length, path) = line.chomp.split(/\\s+/, 3)\n \n add_file(path) do |io|\n io.write open(url)\n end\n \n end\n \n end\n\n # rename the old fetch.txt\n Dir[\"#{fetch_txt_file}.?*\"].sort.reverse.each do |f|\n \n if f =~ /fetch.txt.(\\d+)$/\n new_f = File.join File.dirname(f), \"fetch.txt.#{$1.to_i + 1}\"\n FileUtils::mv f, new_f\n end\n \n end\n\n # move the current fetch_txt\n FileUtils::mv fetch_txt_file, \"#{fetch_txt_file}.0\"\n end", "def convert_file filename, content, in_dir, out_dir, language\n # Convert the file\n converter = AutoHeathen::Converter.new( { logger: logger } )\n action = converter.get_action content.content_type\n logger.debug \" convert: #{File.basename(filename)}, content_type: #{content.content_type}, action: #{action}\"\n start_time = Time.now\n outfile, data = converter.convert action, language, filename, content\n logger.debug \" conversion took %0.2f s\"%[Time.now-start_time]\n\n # Save the file\n outfile = to_outfile in_dir, filename, out_dir, outfile\n logger.info \" writing file: #{outfile}\"\n File.open outfile, \"wb\" do |f|\n f.write data\n end\nend", "def in_file(filename); end", "def read_input_file(filename)\n output = File.open(filename, \"r\").read.delete!(\"\\r\")\n output.sanitize_unicode\n end", "def read(path, rev=nil)\n if rev.nil?\n file = pathname(path)\n return file.read\n else\n git :show, %(#{rev}:\"./#{path.shellescape}\")\n end\n rescue\n raise FileNotFound, \"no such file in repo - #{path}\"\n end", "def translate_file(inp, literal=false)\n pn = Pathname.new(inp)\n # check file exists\n if pn.exist?\n # open and read\n text = File.open(inp).read\n ruleset = text.gsub(/\\r\\n?/, \"\\n\").split(\"\\n\") # split into rules\n out = \"\"\n # feed rules into converter and put output into variable\n ruleset.each { |rule| out << \"#{Phomo2Sce.new(rule).to_sce(literal)}\\n\" }\n out # return translated file\n else\n puts \"Error! Could not find file with path #{inp}\"\n end\nend", "def compile_file_from_path(filepath, options={})\n defaults = {:strict => true, :compress => false}\n options = defaults.merge options\n \n ext = filepath.split('/')[-1].split('.')[-1]\n if ext != 'wml'\n puts ext\n if options[:strict]\n raise Exception, \"Invalid extension for (#{filepath}). Must be .wml.\"\n else\n return\n end\n end\n \n file = File.open(filepath, 'rb')\n data = file.read\n \n html = Compiler.new(:text => data, :compress => options[:compress]).output\n \n temp = filepath.split('/')\n temp.pop()\n filename = temp.join('/') << '/' << filepath.split('/')[-1].split('.')[0] << '.html'\n File.open(filename, 'wb') {|f| f.write(html) }\nend", "def read_file name\n\topen(\"https://raw.githubusercontent.com/NotEnoughIdea/Ideas/master/resources/#{name}.txt\").read\nend", "def transliterate_whole_file_to_utf8!\n if ::UnixUtils.available?('iconv')\n local_copy.in_place :iconv, RemoteTable::EXTERNAL_ENCODING_ICONV, encoding\n else\n ::Kernel.warn %{[remote_table] iconv not available in your $PATH, not performing transliteration}\n end\n # now that we've force-transliterated to UTF-8, act as though this is what the user had specified\n @encoding = RemoteTable::EXTERNAL_ENCODING\n end", "def mime_from_file(filepath)\n # moved here, as mimemagic can cause installation issues\n require 'mimemagic'\n require 'mimemagic/version'\n require 'mimemagic/overlay' if MimeMagic::VERSION.start_with?('0.3.')\n # check magic number inside file (empty string if not found)\n detected_mime=MimeMagic.by_magic(File.open(filepath)).to_s\n # check extension only\n if !SUPPORTED_MIME_TYPES.has_key?(detected_mime)\n Log.log.debug(\"no conversion for #{detected_mime}, trying extension\")\n detected_mime=MimeMagic.by_extension(File.extname(filepath)).to_s\n end\n detected_mime=nil if detected_mime.empty?\n Log.log.debug(\"mimemagic: #{detected_mime.class.name} [#{detected_mime}]\")\n return detected_mime\n end", "def distro_file(filename)\n if File.exist?(file(filename))\n file(filename)\n else\n @distro.file(filename)\n end\n end", "def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end", "def parse_file(filename)\n # [review] - Rename method input param to filename (more verbose?)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n _relative_path = filename\n _absolute_path = File.absolute_path(filename)\n\n # Error check on input, use input filename to make sure relative path is correct\n if Watson::FS.check_file(_relative_path)\n debug_print \"Opened #{ _relative_path } for parsing\\n\"\n debug_print \"Short path: #{ _relative_path }\\n\"\n else\n print \"Unable to open #{ _relative_path }, exiting\\n\"\n return false\n end\n\n\n # Get filetype and set corresponding comment type\n _comment_type = get_comment_type(_relative_path)\n unless _comment_type\n debug_print \"Using default (#) comment type\\n\"\n _comment_type = ['#']\n end\n\n # Escape out comment type for safety\n # [review] - Is there a way to do inplace join?\n _comment_type = _comment_type.map { |comment| Regexp.escape(comment) }.join(\"|\")\n debug_print \"Comment type #{ _comment_type }\\n\"\n\n # [review] - It is possible to embed the valid tags in the regexp,\n # with a ~5% performance gain, but this would loose the warning about\n # unrecognized tags.\n _tag_format = Regexp.escape(@config.tag_format).gsub('\\\\ ', ' ')\n _tag_format_regex = _tag_format\n .gsub(\"TAG\", '(\\w+)')\n .gsub(\"COMMENT\", '(.+)')\n .gsub(' ' , '\\s+')\n\n _comment_regex = /^(?:\\s*[#{_comment_type}]+\\s*)+#{_tag_format_regex}/\n\n debug_print \"Comment regex: #{_comment_regex}\\n\"\n\n # Open file and read in entire thing into an array\n # Use an array so we can look ahead when creating issues later\n # [review] - Better var name than data for read in file?\n _data = File.read(_absolute_path).encode('UTF-8', :invalid => :replace).lines\n\n # Initialize issue list hash\n _issue_list = Hash.new()\n _issue_list[:relative_path] = _relative_path\n _issue_list[:absolute_path] = _absolute_path\n _issue_list[:has_issues] = false\n @config.tag_list.each do | _tag |\n debug_print \"Creating array named #{ _tag }\\n\"\n # [review] - Use to_sym to make tag into symbol instead of string?\n _issue_list[_tag] = Array.new\n end\n\n # Loop through all array elements (lines in file) and look for issues\n _data.each_with_index do |_line, _i|\n\n # Find any comment line with [tag] - text (any comb of space and # acceptable)\n # Using if match to stay consistent (with config.rb) see there for\n # explanation of why I do this (not a good good one persay...)\n begin\n _mtch = _line.match(_comment_regex)\n rescue ArgumentError\n debug_print \"Could not encode to UTF-8, non-text\\n\"\n end\n\n unless _mtch\n # debug_print \"No valid tag found in line, skipping\\n\"\n next\n end\n\n # Set tag\n _tag = _mtch[1].downcase\n\n # Make sure that the tag that was found is something we accept\n # If not, skip it but tell user about an unrecognized tag\n unless @config.tag_list.include?(_tag)\n formatter = Printer.new(@config).build_formatter\n formatter.print_status \"+\", GREEN\n print \"Unknown tag [#{ _tag }] found, ignoring\\n\"\n print \" You might want to include it in your RC or with the -t/--tags flag\\n\"\n next\n end\n\n # Found a valid match (with recognized tag)\n # Set flag for this issue_list (for file) to indicate that\n _issue_list[:has_issues] = true\n\n # [review] - This could probably be done better, elsewhere!\n # If it's a HTML or Handlebars comment, remove trailing -->, --}}\n if _mtch[0].match(/[<{]+(!--)?(#)?/)\n _title = _mtch[2].gsub(/(--)?(#)?[>}]+/, \"\")\n else\n _title = _mtch[2]\n end\n debug_print \"Issue found\\n\"\n debug_print \"Tag: #{ _tag }\\n\"\n debug_print \"Issue: #{ _title }\\n\"\n\n # Create hash for each issue found\n _issue = Hash.new\n _issue[:line_number] = _i + 1\n _issue[:title] = _title\n\n # Grab context of issue specified by Config param (+1 to include issue itself)\n _context = _data[_i..(_i + @config.context_depth + 1)]\n\n # [review] - There has got to be a better way to do this...\n # Go through each line of context and determine indentation\n # Used to preserve indentation in post\n _cut = Array.new\n _context.each do |_line_sub|\n _max = 0\n # Until we reach a non indent OR the line is empty, keep slicin'\n until !_line_sub.match(/^( |\\t|\\n)/) || _line_sub.empty?\n # [fix] - Replace with inplace slice!\n _line_sub = _line_sub.slice(1..-1)\n _max = _max + 1\n\n debug_print \"New line: #{ _line_sub }\\n\"\n debug_print \"Max indent: #{ _max }\\n\"\n end\n\n # Push max indent for current line to the _cut array\n _cut.push(_max)\n end\n\n # Print old _context\n debug_print \"\\n\\n Old Context \\n\"\n debug_print PP.pp(_context, '')\n debug_print \"\\n\\n\"\n\n # Trim the context lines to be left aligned but maintain indentation\n # Then add a single \\t to the beginning so the Markdown is pretty on GitHub/Bitbucket\n _context.map! { |_line_sub| \"\\t#{ _line_sub.slice(_cut.min .. -1) }\" }\n\n # Print new _context\n debug_print(\"\\n\\n New Context \\n\")\n debug_print PP.pp(_context, '')\n debug_print(\"\\n\\n\")\n\n _issue[:context] = _context\n\n # These are accessible from _issue_list, but we pass individual issues\n # to the remote poster, so we need this here to reference them for GitHub/Bitbucket\n _issue[:tag] = _tag\n _issue[:path] = _relative_path\n\n # Generate md5 hash for each specific issue (for bookkeeping)\n _issue[:md5] = ::Digest::MD5.hexdigest(\"#{ _tag }, #{ _relative_path }, #{ _title }\")\n debug_print \"#{ _issue }\\n\"\n\n\n # [todo] - Figure out a way to queue up posts so user has a progress bar?\n # That way user can tell that wait is because of http calls not app\n\n # If GitHub is valid, pass _issue to GitHub poster function\n # [review] - Keep Remote as a static method and pass config every time?\n # Or convert to a regular class and make an instance with @config\n\n\n # [review] - Use _tag string as symbol reference in hash or keep as string?\n # Look into to_sym to keep format of all _issue params the same\n _issue_list[_tag].push(_issue)\n\n # Increment issue counter for posting status\n @config.issue_count = @config.issue_count.next\n end\n\n # [review] - Return of parse_file is different than watson-perl\n # Not sure which makes more sense, ruby version seems simpler\n # perl version might have to stay since hash scoping is weird in perl\n debug_print \"\\nIssue list: #{ _issue_list }\\n\"\n\n _issue_list\n end" ]
[ "0.52823174", "0.5210008", "0.5159241", "0.51019925", "0.5078289", "0.50264984", "0.50216323", "0.49831176", "0.49456105", "0.49415442", "0.48564264", "0.4850974", "0.47973493", "0.47727823", "0.47692093", "0.4724287", "0.47218582", "0.46690923", "0.46659172", "0.46640107", "0.4659307", "0.4650534", "0.46466792", "0.4643845", "0.46430957", "0.4636432", "0.46322897", "0.46243292", "0.4609344", "0.46037155" ]
0.58841264
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_for_commas(token); 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 parse_multiple_values\n next_token if peek_token == :lparen #skip :lparen\n value = []\n value << current_token if String === next_token until peek_token.nil? || peek_token == :rparen\n next_token if peek_token == :rparen # consume the :rparen\n value.join(',')\n end", "def param_list(param)\n if params[param].blank?\n nil\n else\n params[param].split(',')\n end\n end", "def parse_into_search_elements(key, value)\n # separate value for \"OR\" search if it has a comma\n return Array.wrap(value.split(OR_SEARCH_SEPARATOR)) if value.include?(OR_SEARCH_SEPARATOR)\n # format value for \"AND\" search if it has '^'\n return Array.wrap(value.split(AND_SEARCH_SEPARATOR)) if value.include?(AND_SEARCH_SEPARATOR)\n # make sure returned value is an array\n Array.wrap(value)\n end", "def parse_into_search_elements(key, value)\n # separate value for \"OR\" search if it has a comma\n return Array.wrap(value.split(OR_SEARCH_SEPARATOR)) if value.include?(OR_SEARCH_SEPARATOR)\n # format value for \"AND\" search if it has '^'\n return Array.wrap(value.split(AND_SEARCH_SEPARATOR)) if value.include?(AND_SEARCH_SEPARATOR)\n # make sure returned value is an array\n Array.wrap(value)\n end", "def comma\n match(Token.new(:symbol, ','))\n end", "def group_param_values\n @group_param_values ||= group_param_string.split(/[#{FacetTerm::OPERATOR_MAPPING.values.join}]/)\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 tokenize\n return @value.split(/\\s+/)\n end", "def extract_params(idx)\n params = []\n return params if idx[:param_tokens].nil?\n\n e = idx[:param_tokens].each\n begin\n while (ptok = e.next)\n next unless ptok.type == :VARIABLE\n\n params << ptok\n nesting = 0\n # skip to the next parameter to avoid finding default values of variables\n loop do\n ptok = e.next\n case ptok.type\n when :LPAREN, :LBRACK\n nesting += 1\n when :RPAREN, :RBRACK\n nesting -= 1\n when :COMMA\n break unless nesting.positive?\n end\n end\n end\n rescue StopIteration; end # rubocop:disable Lint/SuppressedException\n params\n end", "def get_token(string)\n case string\n when /'(\\S+)/\n $1\n when *$token_table.keys\n $token_table[string]\n when $pats[:int]\n $&.to_i\n when /\\A\n \\[\n (.*)\n \\]\n \\Z/x\n a = $1.split(/\\s*,\\s*/)\n a.collect{|elem| get_token(elem)}\n else\n string\n end\nend", "def tokenize_config_value(str)\n str.scan(/([^\"\\s]+)?(?:\"([^\"]+)\")?\\s*/).map(&:join)\n end", "def value_for(value, expression)\n value.split(\",\").find { |obj| obj.strip =~ expression }\n end", "def delimiter_regexp\n /\\A.*=.*((([^\\w\\s\\+\\)\\(])|([_]))\\s?)\\w+=.*\\z/\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 tokenize_config_value(str); end", "def scan_for_and(token); end", "def value_scan(value)\n value.reverse.scan(PARAMETER_REGEXP).each do |s|\n s.compact!.reverse!\n yield s[0].reverse if block_given?\n end\n end", "def find_token\n shift_token || find_regex_token || find_string_token\n end", "def set_token(lines)\n match = nil\n lines.find_index { |line| match = line.match(REGEX[:token]) }\n\n raise \"No Delimiter Token Set\" if match.nil?\n\n match.captures[0]\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n begin\n # at line 501:5: parameter ( ',' parameter )*\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_486 )\n parameter\n @state.following.pop\n # at line 501:15: ( ',' parameter )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == T__34 )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 501:16: ',' parameter\n match( T__34, TOKENS_FOLLOWING_T__34_IN_parameters_489 )\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_491 )\n parameter\n @state.following.pop\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\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__, 8 )\n\n end\n \n return \n end", "def match(s)\n\n a = []\n\n if s =~ /^\\w+\\(/ then\n\n found, token, remainder = lmatch(s.chars, '(',')')\n\n if found == ')' then\n a << token\n end\n\n elsif s =~ /^[\\w\\/]+\\[/\n\n found, token, remainder = lmatch(s.chars, '[',']') \n a << token\n a2 = match remainder\n\n token << a2.first if a2.first \n a.concat a2[1..-1]\n\n a2\n\n else\n token = s.slice!(/^[\\w\\/]+/)\n a << token\n remainder = s\n end\n\n operator = remainder.slice!(/^\\s*\\|\\s*/)\n\n if operator then\n a.concat [operator, *match(remainder)]\n end\n \n a\n end", "def get_search_breadcrumb_terms(q_param)\n q_param.scan(/(\"[^\"]+\"|\\w+)/).flatten\n end", "def empty_block_params_delimiters(params)\n op = pop_token(:'@||')\n ldelim = Ruby::Token.new('|', op.position, op.prolog)\n rdelim = Ruby::Token.new('|', op.position).tap { |o| o.position.col += 1 }\n [ldelim, rdelim]\n end", "def param_list\n read_next.must_be_identifier!(\"(\")\n if next_token.is_identifier?(\")\")\n ASTList.create\n else\n params\n end.tap do\n read_next.must_be_identifier!(\")\")\n end\n end", "def values\n @values ||= begin\n matches = []\n\n text.scan(VALUE_REGEXP) do\n offset = Regexp.last_match.offset(1)\n matches << loc.expression.adjust(begin_pos: offset.first)\n .with(end_pos: loc.expression.begin_pos + offset.last)\n end\n\n matches\n end\n end", "def scan_comma_spaces; end", "def parametros\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n return_value = ParametrosReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __COMA135__ = nil\n valor134 = nil\n valor136 = nil\n\n\n tree_for_COMA135 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 143:4: valor ( COMA valor )*\n @state.following.push( TOKENS_FOLLOWING_valor_IN_parametros_634 )\n valor134 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor134.tree )\n end\n\n # at line 143:10: ( COMA valor )*\n while true # decision 17\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == COMA )\n alt_17 = 1\n\n end\n case alt_17\n when 1\n # at line 143:11: COMA valor\n __COMA135__ = match( COMA, TOKENS_FOLLOWING_COMA_IN_parametros_637 )\n if @state.backtracking == 0\n tree_for_COMA135 = @adaptor.create_with_payload( __COMA135__ )\n @adaptor.add_child( root_0, tree_for_COMA135 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_parametros_639 )\n valor136 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor136.tree )\n end\n\n\n else\n break # out of loop for decision 17\n end\n end # loop for decision 17\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\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\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\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end\n\n return return_value\n end" ]
[ "0.6007873", "0.58190423", "0.5797972", "0.5745399", "0.5708995", "0.5708995", "0.5694716", "0.5653947", "0.56236243", "0.56137717", "0.5551762", "0.5526229", "0.5504136", "0.54743356", "0.5433497", "0.54331636", "0.5410425", "0.53768414", "0.5353954", "0.5281074", "0.52628964", "0.524522", "0.52425903", "0.52314645", "0.52161384", "0.52158004", "0.5209441", "0.51920944", "0.5173932", "0.5156924" ]
0.7109807
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_multiple_values\n next_token if peek_token == :lparen #skip :lparen\n value = []\n value << current_token if String === next_token until peek_token.nil? || peek_token == :rparen\n next_token if peek_token == :rparen # consume the :rparen\n value.join(',')\n 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_list\n recursive_expression(:expression, :comma)\n end", "def parameter_list_tail\n if @enum.peek.value == ','\n @instruction.push(@enum.peek.value)\n comma\n @instruction.push(@enum.peek.value)\n match(Token.new(:reserved, 'int'))\n @instruction.push(@enum.peek.value)\n match(:identifier)\n parameter_list_tail\n end\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 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 parse_parenth\n expect :lparen\n if showNext.is_a?(:others) # e.g : (others=>'0')\n acceptIt\n expect :imply\n parse_expression\n else\n parse_expression\n end\n\n while showNext.is_a?(:comma) # aggregate\n acceptIt\n parse_expression\n end\n expect :rparen\n end", "def get_token(string)\n case string\n when /'(\\S+)/\n $1\n when *$token_table.keys\n $token_table[string]\n when $pats[:int]\n $&.to_i\n when /\\A\n \\[\n (.*)\n \\]\n \\Z/x\n a = $1.split(/\\s*,\\s*/)\n a.collect{|elem| get_token(elem)}\n else\n string\n end\nend", "def parameter_list\n case @enum.peek.value\n when 'void'\n @instruction.push(@enum.peek.value)\n match(Token.new(:reserved, 'void'))\n when 'int'\n @instruction.push(@enum.peek.value)\n match(Token.new(:reserved, 'int'))\n @instruction.push(@enum.peek.value)\n match(:identifier)\n parameter_list_tail\n end\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 param_list\n read_next.must_be_identifier!(\"(\")\n if next_token.is_identifier?(\")\")\n ASTList.create\n else\n params\n end.tap do\n read_next.must_be_identifier!(\")\")\n end\n end", "def parse_call_parameters(tk)\n end_token = case tk[:kind]\n when :on_lparen\n :on_rparen\n when :on_rparen\n return \"\"\n else\n :on_nl\n end\n nest = 0\n\n loop do\n break if tk.nil?\n case tk[:kind]\n when :on_semicolon\n break\n when :on_lparen\n nest += 1\n when end_token\n if end_token == :on_rparen\n nest -= 1\n break if RDoc::Parser::RipperStateLex.end?(tk) and nest <= 0\n else\n break if RDoc::Parser::RipperStateLex.end?(tk)\n end\n when :on_comment, :on_embdoc\n unget_tk(tk)\n break\n when :on_op\n if tk[:text] =~ /^(.{1,2})?=$/\n unget_tk(tk)\n break\n end\n end\n tk = get_tk\n end\n\n get_tkread_clean \"\\n\", \" \"\n end", "def extract_params(idx)\n params = []\n return params if idx[:param_tokens].nil?\n\n e = idx[:param_tokens].each\n begin\n while (ptok = e.next)\n next unless ptok.type == :VARIABLE\n\n params << ptok\n nesting = 0\n # skip to the next parameter to avoid finding default values of variables\n loop do\n ptok = e.next\n case ptok.type\n when :LPAREN, :LBRACK\n nesting += 1\n when :RPAREN, :RBRACK\n nesting -= 1\n when :COMMA\n break unless nesting.positive?\n end\n end\n end\n rescue StopIteration; end # rubocop:disable Lint/SuppressedException\n params\n end", "def parse\n @tokens = tokenize\n while @tokens.last.is_a?(Symbol) do\n @tokens.delete_at(@tokens.size - 1)\n end\n parse_expression_sequence(true).simplify\n end", "def get_token\n return nil if @token_index >= @arguments.size\n\n begin\n case chr(@arguments[@token_index])\n when \"[\"\n return \"statement\", gen_substatement\n\n when \"]\"\n return \"]\"\n\n when \"(\"\n return \"(\", \"(\"\n\n when \")\"\n return \")\", \")\"\n\n when \"n\"\n if (chr(@arguments[@token_index + 1]) == \"o\") && (chr(@arguments[@token_index + 2]) == \"t\") && ((chr(@arguments[@token_index + 3]) == \" \") || (chr(@arguments[@token_index + 3]) == \"(\"))\n @token_index += 2\n return \"not\", \"not\"\n else\n gen_statement\n end\n\n when \"!\"\n return \"not\", \"not\"\n\n when \"a\"\n if (chr(@arguments[@token_index + 1]) == \"n\") && (chr(@arguments[@token_index + 2]) == \"d\") && ((chr(@arguments[@token_index + 3]) == \" \") || (chr(@arguments[@token_index + 3]) == \"(\"))\n @token_index += 2\n return \"and\", \"and\"\n else\n gen_statement\n end\n\n when \"&\"\n if chr(@arguments[@token_index + 1]) == \"&\"\n @token_index += 1\n return \"and\", \"and\"\n else\n gen_statement\n end\n\n when \"o\"\n if (chr(@arguments[@token_index + 1]) == \"r\") && ((chr(@arguments[@token_index + 2]) == \" \") || (chr(@arguments[@token_index + 2]) == \"(\"))\n @token_index += 1\n return \"or\", \"or\"\n else\n gen_statement\n end\n\n when \"|\"\n if chr(@arguments[@token_index + 1]) == \"|\"\n @token_index += 1\n return \"or\", \"or\"\n else\n gen_statement\n end\n\n when \"+\"\n value = \"\"\n i = @token_index + 1\n\n begin\n value += chr(@arguments[i])\n i += 1\n end until (i >= @arguments.size) || (chr(@arguments[i]) =~ /\\s|\\)/)\n\n @token_index = i - 1\n return \"+\", value\n\n when \"-\"\n value = \"\"\n i = @token_index + 1\n\n begin\n value += chr(@arguments[i])\n i += 1\n end until (i >= @arguments.size) || (chr(@arguments[i]) =~ /\\s|\\)/)\n\n @token_index = i - 1\n return \"-\", value\n\n when \" \"\n return \" \", \" \"\n\n else\n gen_statement\n end\n end\n rescue NoMethodError\n raise \"Error. Expression cannot be parsed.\"\n end", "def parse_tail(tok)\n\t\tif tok.size == 0\n\t\t\traise SyntaxError, 'EOF unexpected'\n\t\tend\n\t\tfirst_tok = tok.delete_at(0)\n\t\tif '(' == first_tok\n\t\t\tx = []\n\t\t\twhile tok[0] != ')'\n\t\t\t\tx << parse_tail(tok)\n\t\t\tend\n\t\t\ttok.delete_at(0)\n\t\t\treturn x\n\t\telsif ')' == first_tok\n\t\t\traise SyntaxError, '\\')\\' unexpected'\n\t\telse\n\t\t \treturn convert_tok(first_tok)\n\t\tend\n\tend", "def argument_list\n recursive_expression(:identifier, :comma)\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n begin\n # at line 501:5: parameter ( ',' parameter )*\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_486 )\n parameter\n @state.following.pop\n # at line 501:15: ( ',' parameter )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == T__34 )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 501:16: ',' parameter\n match( T__34, TOKENS_FOLLOWING_T__34_IN_parameters_489 )\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_491 )\n parameter\n @state.following.pop\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\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__, 8 )\n\n end\n \n return \n end", "def parse_arguments\n args_list = []\n\n expect(:L_PARANTH)\n\n args_list = parse_expression_list unless peek?(:R_PARANTH)\n\n expect(:R_PARANTH)\n\n args_list\n end", "def tokenize(node)\n case Array(node)[0]\n when :module\n name = node[1]\n [ :module, name, node.comments, tokenize(node[2..-1]) ]\n when :class\n name = node[1]\n [ :class, name, node.comments, tokenize(node[3..-1]) ]\n when :defn\n name = node[1]\n args = args_for_node(node[2])\n [ :imethod, name, node.comments, args ]\n when :defs\n name = node[2]\n args = args_for_node(node[3])\n [ :cmethod, name, node.comments, args ]\n when :block\n tokenize(node[1..-1])\n when :scope\n tokenize(node[1])\n when Array\n node.map { |n| tokenize(n) }.compact\n end\n end", "def get_valid_tokens(type, opts={})\n candidates = token_tuples(type)\n valid_tokens(type, candidates, opts)\nend", "def comma\n match(Token.new(:symbol, ','))\n end", "def parameters\n @ast.parameters.map { |p| as_java_type(p.type) }\n end", "def scan_for_commas(token); end", "def op_tokenize (p_token, lineno, pos)\n\n\tcase p_token\n\twhen \"=\"\n\t\treturn Token.new(\"T_ASSIGNMENT\", p_token, lineno, pos)\n\twhen \"{\"\n\t\treturn Token.new(\"T_LBRACE\", p_token, lineno, pos)\n\twhen \"}\"\n\t\treturn Token.new(\"T_RBRACE\", p_token, lineno, pos)\n\twhen \"(\"\n\t\treturn Token.new(\"T_LPAREN\", p_token, lineno, pos)\n\twhen \")\"\n\t\treturn Token.new(\"T_RPAREN\", p_token, lineno, pos)\n\twhen \"\\\"\"\n\t\treturn Token.new(\"T_QUOTE\", p_token, lineno, pos)\n\twhen \"==\"\n\t\treturn Token.new(\"T_BOOLOP\", p_token, lineno, pos)\n\twhen \"!=\"\n\t\treturn Token.new(\"T_BOOLOP\", p_token, lineno, pos)\n\twhen \"+\"\n\t\treturn Token.new(\"T_PLUS\", p_token, lineno, pos)\n\twhen \"$\"\n\t\treturn Token.new(\"T_EOFSIGN\", p_token, lineno, pos)\n\telse\n\t\traise UnknownSymbolError.new(p_token, lineno, pos)\n\tend\nend", "def parse_symbol_arg_paren no # :nodoc:\n args = []\n\n loop do\n skip_tkspace_comment\n if tk1 = parse_symbol_in_arg\n args.push tk1\n break if no and args.size >= no\n end\n\n skip_tkspace_comment\n case (tk2 = get_tk)[:kind]\n when :on_rparen\n break\n when :on_comma\n else\n warn(\"unexpected token: '#{tk2.inspect}'\") if $DEBUG_RDOC\n break\n end\n end\n\n args\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 read_from_tokens(tokens)\n raise SyntaxError, 'unexpected EOF while reading' if tokens.size == 0\n token = tokens.shift\n if '(' == token\n sexp = []\n sexp.push(read_from_tokens(tokens)) while tokens.first != ')'\n tokens.shift # remove the ')'\n return sexp\n elsif ')' == token\n raise SyntaxError, 'unexpected )'\n else\n return atom(token)\n end\nend", "def next_token\n\n token = nil\n\n until ss.eos? or token do\n token =\n case state\n when nil then\n case\n when ss.skip(/\\s+/) then\n # do nothing\n when ss.skip(/:(#{SYMBOL_NAME})/o) then\n action { emit :tSYMBOL, &:to_sym }\n when ss.skip(/\"(.+?)\"/) then\n action { emit :tSTRING }\n when ss.skip(/[-+]?\\d+\\.\\d+/) then\n action { emit :tNUMBER, &:to_f }\n when ss.skip(/[-+]?\\d+/) then\n action { emit :tNUMBER, &:to_i }\n when ss.skip(/#{Regexp.union(\n %w\"( ) { | } [ ] < > $ ! ^ ` ... + * ? ,\"\n )}/o) then\n action { emit ss.matched, &:to_sym }\n when ss.skip(/#{REGEXP}/o) then\n action { emit_regexp }\n when ss.skip(/%?(#{CONST_NAME})/o) then\n action { emit :tPARAM_CONST }\n when ss.skip(/%([a-z_]+)/) then\n action { emit :tPARAM_NAMED }\n when ss.skip(/%(\\d*)/) then\n action { emit(:tPARAM_NUMBER) { |s| s.empty? ? 1 : s.to_i } } # Map `%` to `%1`\n when ss.skip(/_(#{IDENTIFIER})/o) then\n action { emit :tUNIFY }\n when ss.skip(/_/o) then\n action { emit :tWILDCARD }\n when ss.skip(/\\#(#{CALL})/o) then\n action { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }\n when ss.skip(/#{IDENTIFIER}\\?/o) then\n action { @state = :ARG; emit :tPREDICATE, &:to_sym }\n when ss.skip(/#{NODE_TYPE}/o) then\n action { emit :tNODE_TYPE, &:to_sym }\n when ss.skip(/\\#.*/) then\n action { emit_comment }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n when :ARG then\n case\n when ss.skip(/\\(/) then\n action { @state = nil; emit :tARG_LIST }\n when ss.skip(//) then\n action { @state = nil }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def tokens_rpn\n output = []\n operators = []\n\n @tokens.each do |token|\n case token.type\n when :value\n output.push(token)\n when :operator\n if operators.any? && token.lexeme.precedence >= operators.last.lexeme.precedence\n output.push(operators.pop)\n end\n\n operators.push(token)\n end\n end\n\n output.concat(operators.reverse)\n end" ]
[ "0.66376424", "0.6580629", "0.6500217", "0.63559425", "0.61661", "0.6093485", "0.60577714", "0.6030269", "0.59247357", "0.5919154", "0.5918971", "0.5834444", "0.5763134", "0.57408804", "0.5736345", "0.56850344", "0.56667316", "0.56598485", "0.5652574", "0.5630184", "0.5615968", "0.5599615", "0.558743", "0.5579662", "0.5578407", "0.5573424", "0.5569774", "0.55612606", "0.5529826", "0.5517349" ]
0.79251134
0
returns true if this location has no more offerings
def isEmpty? return self.offerings.count == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_more?\n return false unless @eligibles.empty?\n NO_MORE\n 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 has_offsite_holdings?\n return false unless self[:location_facet].present?\n\n # string regexp against the location field\n self[:location_facet].each do |location_facet|\n return true if location_facet =~ /^Offsite/\n return true if location_facet =~ /ReCAP/i\n # (this should not really happen)\n return true if location_facet =~ /scsb/i\n end\n\n # No offsite location found\n false\n end", "def no_appts_avail?\n appointments.empty?\n end", "def no_more_offers?\n message = first('#message')\n message && message.text == \"Come back later for more offers.\"\n end", "def has_shopped?\n self.points_entries.purchases.count > 0\n end", "def available?\n self.available_product_supplies.length > 0 and not self.delete?\n end", "def has_places?\n capacity > 0\n end", "def offer_available?\n #return self.approved? && self.offers.last.present? && self.offers.last.effective?\n return self.offers.last.present? && self.offers.last.effective?\n end", "def no_more?\n more_results == :NO_MORE_RESULTS\n end", "def available?\n self.available_count > 0\n end", "def check_free_venue\n if @total >= 20\n return true\n end\n end", "def mainly_portal_offers? offers\n (offers.map { |o| o if o.encounter == 'portal' }.compact.count.to_f /\n offers.count.to_f) >= 0.6\n end", "def no_delivery?\n self.distance == NO_DISTANCE\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 has_ads?\n self.ads.count == 0\n end", "def has_ads?\n self.ads.count == 0\n end", "def offers_reward?\n !self.rewards.visible.empty?\n end", "def any_requested_booking_not_confirmed?\n count = 0\n index\n @requested_bookings.each do |booking|\n count += 1 if !booking.confirmed\n end\n true if count.positive?\n end", "def is_available?\n count_available > 0\n end", "def should_be_store?\n listings.where(state: ['active', 'draft', 'removed', 'sold']).count >= 10\n end", "def is_greedy?(location)\n !@fixed_cost.include? location\n end", "def sold_out?\n spots_left.zero?\n end", "def is_empty\n self.openings == @size\n end", "def over_capacity?\n @passengers.length > @capacity\n end", "def available?\n if @available_rooms.length > 0\n return true\n end\n end", "def deletable?\n return pallets.includes(:reservations).all.all? do |pallet|\n (customer.last_count.nil? or pallet.arrived_at > customer.last_count) and pallet.reservations.empty?\n end\n end", "def waiver?\n free_agent? && !waiver_bid\n end", "def here?\n @locations.any?(&:here)\n end" ]
[ "0.73762673", "0.67329735", "0.66097456", "0.6604794", "0.6591897", "0.6465306", "0.6453284", "0.6357941", "0.63112307", "0.61815304", "0.6155567", "0.613523", "0.6133661", "0.61175406", "0.6083638", "0.60711193", "0.60544145", "0.60544145", "0.60503423", "0.60490185", "0.60373956", "0.599328", "0.59611696", "0.5938121", "0.59248763", "0.5915014", "0.5896756", "0.58834004", "0.58793193", "0.58656484" ]
0.7491813
0
Format share descriptions a bit nicer by converting and to spaces.
def share_description(value) raw(value).gsub("<br>", " ").gsub("<br />", " ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\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 to_verbose_sharing\n \"#{friend.get_full_name} #{ I18n.t('social.shares') }: \" <<\n [\n ( shares_passages ? \"#{ I18n.t('social.passages') }\" : '' ),\n ( shares_trainings ? \"#{ I18n.t('social.trainings') }\" : '' ),\n ( shares_calendars ? \"#{ I18n.t('social.calendars') }\" : '' )\n ].join(', ')\n end", "def format_description_title(obj)\n obj = obj.description if obj.respond_to?(:description)\n obj = obj.gsub(/\\s/i, ' ')\n obj.truncate(200, separator: ' ')\n end", "def formatted_description\n CGI.escapeHTML(description).split(/\\n|\\r\\n?/).join(\"<br />\").html_safe\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 share_text_short\n \"I'm looking at #{self.latest_name.titleize} on Dinesafe.\"\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 humanize\n @fields.collect do |_, field|\n field.meaning\n end.join(\"; \").chomp(\"; \")\n end", "def details\n format_description(@description) + \"site name: \" + format_name\n end", "def format_description\r\n description.gsub(':)', '![alternative text](/images/smileys/smile.gif)').gsub(':D', '![alternative text](/images/smileys/laugh.gif)').\r\n gsub(':(', '![alternative text](/images/smileys/disappointed.gif)').gsub(':O', '![alternative text](/images/smileys/shocked.gif)').\r\n gsub(\":,(\", '![alternative text](/images/smileys/sad.gif)').gsub(':/', '![alternative text](/images/smileys/double_minded.gif)').\r\n gsub('8)', '![alternative text](/images/smileys/cool.gif)').gsub(':crazy:', '![alternative text](/images/smileys/crazy.gif)').\r\n gsub(':yeah:', '![alternative text](/images/smileys/yeah.gif)')\r\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 kase_description_in_words(kase)\n result = []\n result << followers_count_in_words(kase).to_s.capitalize\n\t result << replies_count_in_words(kase)\n\t result << kase_type_and_time_in_words(kase)\n\t result.compact.map {|m| m.to_s.strip}.reject {|i| i.empty?}.join(', ')\n end", "def social_description\n @social_description ||= social_description_card&.format(:text)&.text_description\n end", "def indentify\n 'description'\n end", "def indentify\n 'description'\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 description\n text = ['A']\n text << [duration, 'minute'] if duration.present?\n text << [format, 'publication']\n text << [ 'from', pretty_date(published_on) ] if published_on.present?\n text << ['by', presentations.first.speaker_names] if presentations.present?\n text.join(' ')\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 add_desc(heading,list)\n description = \"\\n\\n#{heading}: #{list.length.to_s}\\n\\n\\t\"\n description << list.join(\"\\n\\t\") unless list.empty?\n description\n end", "def help\n prettify(description)\n end", "def description\n [@group.description,@description].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 title\n description.truncate(30, :separator =>' ')\n end", "def two_lines_description charity, style_class = :charity_details\n charity.name.length < 24 ? desc_chars = 90 : desc_chars = 72\n short_description(charity, desc_chars, style_class)\n end" ]
[ "0.6643694", "0.6355451", "0.6085365", "0.60843813", "0.60843813", "0.6040165", "0.60256976", "0.6025095", "0.5960897", "0.58909446", "0.5823", "0.58066446", "0.5805102", "0.57892996", "0.57788354", "0.5769854", "0.570135", "0.56535614", "0.56459296", "0.56459296", "0.5631979", "0.56102604", "0.5608095", "0.55981123", "0.55202776", "0.5498021", "0.54881126", "0.54770756", "0.54531413", "0.5449134" ]
0.6755102
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to (label, url)\n \"<a href='#{url}'>#{label}</a>\"\n end", "def link\n Html::Link.new(:href => url) << display_name\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 build_link\n @label ||= ''\n return label if link.nil?\n return link_to(label, link)\n end", "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "def link_to_external url ,link_label\n link_to \"#{link_label}\" ,\"#{url}\" , :target=>'_blank'\n end", "def linkify(str)\n\t\t\tstr.gsub( %r{http://[^\"\\s]+} ) do |url|\n\t\t\t\tshort = url.gsub(%r{^.*#{Regexp.quote(request.host_with_port)}}, '')\n \t\t\"<a href='#{url}'>#{short}</a>\"\n\t\t\tend\n\tend", "def to_link(text)\n URI::encode(@base_url + text.strip.gsub(/\\s+/, @space_replacement))\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 link() url; end", "def link() url; end", "def make_link(url, text)\n return (\"[#{text}|#{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 link(link, title, content)\n \"#{content} (#{link})\"\n end", "def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end", "def link_to(url, text = nil, label = nil, attributes = {})\n if label.is_a?(Hash)\n attributes = label\n label = nil\n end\n if text.is_a?(Model) || text.is_a?(Class) && text.ancestors.include?(Model)\n text.link_for(url, label, attributes)\n elsif url.is_a?(Model) || url.is_a?(Class) && url.ancestors.include?(Model)\n url.link_for(url, text, attributes)\n else\n tag(:a, text, attributes.merge(href: url))\n end\n end", "def link(link, title, content)\n if no_links\n content\n else\n # \"<a href=\\\"#{DashboardRouter.normalize(link)}\\\" target=\\\"_top\\\">#{content}</a>\"\n \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end\n end", "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url url, url\n end", "def gen_url(url, text)\n if url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n path = $2\n else\n type = \"http\"\n path = url\n url = \"http://#{url}\"\n end\n\n if type == \"link\" then\n url = if path[0, 1] == '#' then # is this meaningful?\n path\n else\n self.class.gen_relative_url @from_path, path\n end\n end\n\n if (type == \"http\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n \"<img src=\\\"#{url}\\\" />\"\n else\n \"<a href=\\\"#{url}\\\">#{text.sub(%r{^#{type}:/*}, '')}</a>\"\n end\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", "def gen_url url, text\n if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then\n type = \"link\"\n elsif url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n else\n type = \"http\"\n end\n\n if (type == \"http\" or type == \"https\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n ''\n else\n text.sub(%r%^#{type}:/*%, '')\n end\n end", "def link(link, title, content)\n link = OodAppkit.files.api(path: @app_path.to_s + '/' + link).to_s if @app_path && relative?(link)\n return \"<a href=\\\"#{link}\\\" rel=\\\"noopener\\\" target=\\\"_blank\\\">#{content}</a>\" unless id_link?(link)\n return \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end", "def link(text, url = nil)\n if url.nil?\n colorize(text, :red, :bold)\n else\n \"#{text} (#{colorize(url, :blue, :bold)})\"\n end\n end", "def link_to_post (post, label = nil)\n label ||= post.title\n \"<a href='/#{post.slug}'>#{label}</a>\"\n end", "def linkify(options = {})\n url = options[:value].first\n link_to url, url\n end", "def linkify(text)\n text.gsub(URL_REGEXP, '<a href=\"\\0\">\\0</a>') rescue text\n end", "def link(text, url = nil)\n url = text if url.nil?\n tag(:a, text, :href => url)\n end", "def link_to(body, url)\n \"[#{body}](#{url})\" if !AIPP.options.check_links || url_exists?(url)\n end" ]
[ "0.74292344", "0.69627106", "0.68916947", "0.6874132", "0.6842955", "0.6818617", "0.68048346", "0.67558837", "0.66976136", "0.66417", "0.66417", "0.66399485", "0.66192704", "0.6571805", "0.65665644", "0.6544465", "0.6539952", "0.65295047", "0.65069044", "0.6494934", "0.64942414", "0.6491123", "0.64907956", "0.6471887", "0.64637065", "0.6452106", "0.64462113", "0.64232254", "0.64217836", "0.6421405" ]
0.7181887
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inline_svg(path)\n file = File.open(\"public/images/#{path}\", \"rb\")\n file.read\n end", "def image file, opts = {}\n # FIXME handle case when SVG is a File or IO object\n if ::String === file && (file.downcase.end_with? '.svg')\n opts[:fallback_font_name] ||= default_svg_font if respond_to? :default_svg_font\n svg((::IO.read file), opts)\n else\n _initial_image file, opts\n end\n end", "def svg(s)\n convert(s, mime: 'image/svg+xml')\n end", "def inline_svg(file)\n file = File.open(\"app/assets/images/svg/#{file}.svg\", \"rb\")\n raw file.read\n end", "def svg!\n raise unless @icons.find { |i| File.extname(i) == 'svg' }\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 to_image()\n embed_svg(svg: to_svg)\n end", "def to_svg\n image.to_s\n end", "def add_svg(x:, y:, width:, height:, svg:)\n %{<image x=\"#{x}\" y=\"#{y}\" width=\"#{width}\" height=\"#{height}\" xlink:href='#{embed_svg(svg: svg)}' />\\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\n svg = ng_xml.at_xpath('svg')\n svg['aria-label'] = icon_label if label\n svg['role'] = role\n svg.prepend_child(\"<title>#{icon_label}</title>\") if label\n ng_xml.to_xml\n end", "def write_png_from_svg(input, output, width, height)\n success = true\n begin\n Magick::Image.read(input).first.resize(width, height).write(output)\n rescue\n success = false\n end\n success\nend", "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 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 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", "def inline_svg(filename, options = {})\n asset = sprockets.find_asset(filename)\n\n # If the file wasn't found, embed error SVG\n if asset.nil?\n return nil\n %(\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 400 30\"\n width=\"400px\" height=\"30px\"\n >\n <text font-size=\"16\" x=\"8\" y=\"20\" fill=\"#cc0000\">\n Error: '#{filename}' could not be found.\n </text>\n <rect\n x=\"1\" y=\"1\" width=\"398\" height=\"28\" fill=\"none\"\n stroke-width=\"1\" stroke=\"#cc0000\"\n />\n </svg>\n )\n\n # If the file was found, parse it, add optional classes, and then embed it\n else\n file = asset.source.force_encoding(\"UTF-8\")\n doc = Nokogiri::HTML::DocumentFragment.parse file\n svg = doc.at_css \"svg\"\n\n if options[:class].present?\n svg[\"class\"] = options[:class]\n end\n\n doc\n end\n end", "def svg_filename\r\n return \"#{File.expand_path(File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))))}/templates/branding-slide.svg\"\r\n end", "def create_svg filename, script=nil\n vis = Interpreter.new(filename, script).eval_script\n svg = vis.to_svg\n end", "def image_url(max_size=1600)\r\n\r\n src_width = self.DELIV_OPS.svg_image.svg_width.first.to_f\r\n src_height = self.DELIV_OPS.svg_image.svg_height.first.to_f\r\n\r\n ratio = [ max_size / src_width , max_size / src_height ].min\r\n\r\n dest_width = (src_width * ratio).to_i\r\n dest_height = (src_height * ratio).to_i\r\n\r\n \"#{DIL_CONFIG['aware_region_url']}#{self.DELIV_OPS.svg_image.svg_image_path.first}&destwidth=#{dest_width}&destheight=#{dest_height}&padh=center&padv=center\"\r\n end", "def raw_svg(path, color = nil)\n assert_type path, :String\n assert_type color, :Color unless color.nil?\n\n svg = _read_svg_file_and_recolor_paths(path, color)\n\n Sass::Script::String.new(\"'#{svg}'\")\n end", "def set_binary_image_from_uri!\n unless SvgInlineFileExtractor.use_mini_magick?\n raise MiniMagickMissing, '#set_binary_image_from_uri! requires the MiniMagick gem to be installed.'\n end\n SvgInlineFileExtractor.with_temp_image(nokogiri_element.value) do |temp_image|\n format = SvgInlineFileExtractor.identify_image(temp_image).to_s.downcase\n nokogiri_element.value = \"data:image/#{format};base64,#{encode(temp_image)}\"\n nokogiri_element.name = 'href'\n end\n true\n end", "def image(full_path, opts = {})\n image_name = template.add_image(full_path)\n output = '<draw:frame text:anchor-type=\"as-char\" '\n opts[:width] && output << %Q(svg:width=\"#{opts[:width]}cm\" )\n opts[:height] && output << %Q(svg:height=\"#{opts[:height]}cm\")\n output << '>'\n output << %Q(<draw:image xlink:href=\"Pictures/#{image_name}\" )\n output <<\n 'xlink:type=\"simple\" xlink:show=\"embed\" xlink:actuate=\"onLoad\"/>'\n output << '</draw:frame>'\n end", "def strip_images(node)\n node.css('img').each do |img|\n match = ASSET_IMAGE_SRC_REGEX.match(img['src'])\n\n insert_tag(HANDLEBARS_TEMPLATE_ASSET_IMAGE % match[1].to_i) if match\n img.remove\n end\n\n node\n end", "def convert_standalone_image(el, _opts, img); end", "def make_image(options={})\n file = options.fetch :file, nil\n suffix = options.fetch :suffix, nil\n type = options.fetch :type, 'svg'\n\n unless file\n unless suffix\n suffix = dot_plot_number\n self.dot_plot_number += 1\n end\n if suffix.is_a? Integer\n suffix = suffix.to_s.rjust 5, '0'\n end\n graph_name = uid || 'graph'\n file = \"#{graph_name}-#{suffix}.#{type}\"\n end\n info \"Writing the graph image: '#{suffix}' to the file: '#{file}'\"\n command = ['dot', '-T', type, '-o', file]\n Open3.popen2e(*command) do |stdin, out, process|\n stdin.puts to_dot\n stdin.close\n output = out.read\n debug output unless output.empty?\n process.value.exitstatus == 0\n end\n end", "def render_graph_svg_data machine, opts = { }\n require 'tempfile'\n tmp = Tempfile.new(\"red_steak_dot\")\n self.file_dot = tmp.path + \".dot\"\n self.file_svg = nil\n render_graph(machine, opts)\n result = File.open(self.file_svg, \"r\") { | fh | fh.read }\n if opts[:xml_header] == false || options[:xml_header] == false\n result.sub!(/\\A.*?<svg /m, '<svg ')\n end\n # puts \"#{result[0..200]}...\"\n result\n ensure\n tmp.unlink rescue nil\n File.unlink(self.file_dot) rescue nil\n File.unlink(self.file_svg) rescue nil\n end", "def is_svg?(file)\n /\\.svg\\z/.match?(file)\n end", "def augment_svg(svg_file, svg_out, add_fragment_index: false)\n def get_classes(element)\n attr = element.attribute('class')\n if attr\n Set.new(attr.value.split(/\\s+/))\n else\n Set.new([])\n end\n end\n\n def set_classes(element, collection)\n if collection.empty?\n element.remove_attribute('class')\n else\n element['class'] = collection.to_a.join(\" \")\n end\n element['class']\n end\n\n def add_class(element, class_name)\n classes = get_classes(element)\n classes.add(class_name)\n set_classes(element, classes)\n end\n\n def remove_class(element, class_name)\n classes = get_classes(element)\n classes.delete(class_name)\n set_classes(element, classes)\n end\n\n def add_fragment(element)\n add_class(element, 'fragment')\n end\n\n def remove_fragment(g)\n remove_class(g, 'fragment')\n g.remove_attribute('data-fragment-index')\n end\n\n image = File.open(svg_file) { |f| Nokogiri::XML(f) }\n image.remove_namespaces!\n layers = image.xpath(\"//g[@id]\")\n\n if layers.length == 0\n # Nothing to do\n elsif layers.length == 1\n # There's only one layer. No sense causing incremental display.\n # Remove any existing fragments.\n puts \"Image #{svg_file} is a single-layer image. No animation.\"\n g = layers[0]\n remove_fragment(g)\n else\n layers.each_with_index do |g, i|\n # Don't mark the first layer; that should show up when the slide\n # shows up.\n if i == 0\n remove_fragment(g)\n else\n add_fragment(g)\n\n if add_fragment_index\n g['data-fragment-index'] = i.to_s\n end\n end\n\n id = g.attribute('id')\n if id.value.include?('one-time')\n add_class(g, 'current-visible')\n end\n end\n end\n\n #%w{x y viewBox height width}.each { |attr| image.root.delete(attr) }\n %w{x y height width}.each { |attr| image.root.delete(attr) }\n File.open svg_out, \"w\" do |f|\n # Skip to the SVG element, in case there's a processing instruction or\n # doctype. They're not necessary, since we're embedding.\n f.write(image.at_xpath('//svg').to_xml)\n end\n\nend", "def image_for(file_name, dest = '')\n prefix = data_path.dup\n file_name = file_name.split('/').last unless file_name.empty?\n file_name = file_name.gsub(/.svg/i, '.png')\n case dest\n when 'mobile_inspire'\n \"#{prefix}/inspire/mobile/#{file_name}\"\n when 'desktop_inspire'\n \"#{prefix}/inspire/desktop/#{file_name}\"\n when 'thumbnails'\n \"#{prefix}/thumbnails/#{file_name}\"\n when 'show_image_desk'\n \"#{prefix}/show_images/desktop/#{file_name}\"\n when 'show_image_mob'\n \"#{prefix}/show_images/mobile/#{file_name}\"\n when 'show'\n \"#{prefix}/show_images/show/#{file_name}\"\n end\n end" ]
[ "0.6976713", "0.69373757", "0.6889673", "0.6708993", "0.6666454", "0.6664146", "0.66472864", "0.66189384", "0.6558477", "0.62838167", "0.626389", "0.6240496", "0.61302423", "0.61154705", "0.61154705", "0.60168093", "0.59429413", "0.5888581", "0.58310914", "0.5781527", "0.5745485", "0.5721666", "0.5690856", "0.56368107", "0.5601569", "0.55655116", "0.55000705", "0.54772294", "0.54748565", "0.54427063" ]
0.75487447
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_feeling\n @feeling = Feeling.find(params[:id])\n end", "def index\n @feelings = Feeling.where(user: current_user).all\n end", "def find_feeling(user)\n self.feelings.where( user_id: user.id ).first\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 destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n render :ok, json: { feeling: @feeling }\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 @belief = Belief.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @belief }\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 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", "def show\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_food }\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 api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end", "def show\n @flaw = Flaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flaw }\n end\n end", "def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end", "def destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n\n respond_to do |format|\n format.html { redirect_to feelings_url }\n format.json { head :ok }\n end\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @meal }\n end\n end", "def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\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 show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end", "def show\n @butterfly = Butterfly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @butterfly }\n end\n end", "def show\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_recipe }\n end\n end", "def show\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fiction }\n end\n end", "def show\n #@feat = Feat.find(params[:id])\n @feat = @character.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 show\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fishing_method }\n end\n end" ]
[ "0.6516207", "0.64383405", "0.63671356", "0.6219716", "0.59933156", "0.59692436", "0.59370697", "0.5857662", "0.5825682", "0.57739466", "0.5749843", "0.57436013", "0.57394665", "0.5708842", "0.5706743", "0.56900954", "0.56874657", "0.5677101", "0.56712615", "0.56625116", "0.56579566", "0.5633058", "0.5618639", "0.56100446", "0.5593762", "0.55936915", "0.55703086", "0.5567774", "0.5563796", "0.55517447" ]
0.6761551
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @belief = Belief.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @belief }\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 @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 @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 @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 @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 @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 @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @favorite_flyer = FavoriteFlyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favorite_flyer }\n end\n end", "def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end", "def new\n @favourite_food = FavouriteFood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favourite_food }\n end\n end", "def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end", "def new\n @saying = Saying.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @saying }\n end\n end", "def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @good }\n end\n end", "def new\n @frete = Frete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frete }\n end\n end", "def new\n @star_fact = Star::Fact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_fact }\n end\n end", "def new\n @fact = fact_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fact }\n end\n end", "def new\n @laugh = Laugh.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laugh }\n end\n end", "def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end", "def new\n @cheer = Cheer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cheer }\n end\n end", "def new\n @beverage = Beverage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beverage }\n end\n end", "def new\n @faction = Faction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faction }\n end\n end", "def new\n #@klass_fee = KlassFee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @klass_fee }\n end\n end", "def new\n @look_book = LookBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @look_book }\n end\n end", "def new\n @stalking = Stalking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stalking }\n end\n end", "def new\n @food_recipe = FoodRecipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food_recipe }\n end\n end" ]
[ "0.69000375", "0.689388", "0.686288", "0.68234533", "0.6801308", "0.67607284", "0.67200273", "0.671727", "0.66915035", "0.66681135", "0.66681135", "0.6653322", "0.6639211", "0.66371816", "0.66341233", "0.65769696", "0.6576178", "0.65605223", "0.65164644", "0.6514515", "0.6512328", "0.6510643", "0.650664", "0.65016896", "0.6482244", "0.645146", "0.6446622", "0.6438892", "0.64348996", "0.6434726" ]
0.7440437
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_feeling\n @feeling = Feeling.find(params[:id])\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 @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 @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 #@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 destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n render :ok, json: { feeling: @feeling }\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 feeling_params\n params.require(:feeling).permit(:feeling_card_id, :super_category, :category, :vfeeling, :experience_id, :note).merge(user_id: current_user.id)\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 @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n if @fishing_method.update_attributes(params[:fishing_method])\n format.html { redirect_to @fishing_method, notice: 'Fishing method was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fishing_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n if @familiar.update_attributes(params[:familiar])\n format.html { redirect_to @familiar, notice: 'Familiar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familiar.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @faq.update(faqs_params)\n json_response(@faq)\n end", "def destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n\n respond_to do |format|\n format.html { redirect_to feelings_url }\n format.json { head :ok }\n end\n end", "def update\n @saying = Saying.find(params[:id])\n\n respond_to do |format|\n if @saying.update_attributes(params[:saying])\n format.html { redirect_to @saying}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @saying.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hearted.update(hearted_params)\n format.html { redirect_to @hearted, notice: 'Hearted was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hearted.errors, status: :unprocessable_entity }\n end\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 update\n respond_to do |format|\n if @favorite_recipe.update(favorite_recipe_params)\n format.html { redirect_to @favorite_recipe, notice: 'Favorite recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_recipe }\n else\n format.html { render :edit }\n format.json { render json: @favorite_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fast_food.update(fast_food_params)\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully updated.' }\n format.json { render :show, status: :ok, location: @fast_food }\n else\n format.html { render :edit }\n format.json { render json: @fast_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n if @favourite_food.update_attributes(params[:favourite_food])\n format.html { redirect_to @favourite_food, notice: 'Favourite food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favourite_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @foodhamper = Foodhamper.find(params[:id])\n\n respond_to do |format|\n if @foodhamper.update_attributes(params[:foodhamper])\n format.html { redirect_to @foodhamper, notice: 'Foodhamper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foodhamper.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n if @idea.update_attributes(params[:idea])\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\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\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n if @klass_fee.update_attributes(params[:klass_fee])\n format.html { redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @klass_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meal_food.update(meal_food_params)\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_food }\n else\n format.html { render :edit }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_feeling_card\n @feeling_card = FeelingCard.find(params[:id])\n end" ]
[ "0.6885447", "0.6589147", "0.62522805", "0.612598", "0.6112526", "0.6074186", "0.60537636", "0.60494673", "0.6044397", "0.60422385", "0.6028454", "0.59988153", "0.5990904", "0.59555966", "0.5932589", "0.592771", "0.59120136", "0.58992726", "0.5899209", "0.58894825", "0.58824635", "0.586134", "0.58514935", "0.58511055", "0.58509624", "0.5845517", "0.5843388", "0.58410424", "0.5836514", "0.58348566" ]
0.7325833
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n render :ok, json: { feeling: @feeling }\n end", "def destroy\n @feeling.destroy\n respond_to do |format|\n format.html { redirect_to feelings_url, notice: 'Feeling 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 @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 @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 @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", "def destroy\n @fee = Fee.find(params[:id])\n @fee.destroy\n\n respond_to do |format|\n format.html { redirect_to fees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feeling_card.destroy\n respond_to do |format|\n format.html { redirect_to feeling_cards_url, notice: 'Feeling card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to @fee.booth, flash: { warning: 'Fee was deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n #@feat = Feat.find(params[:id])\n @feat = @character.feats.find(params[:id])\n @feat.destroy\n\n respond_to do |format|\n format.html { redirect_to(edit_character_path(@character)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @butterfly = Butterfly.find(params[:id])\n @butterfly.destroy\n\n respond_to do |format|\n format.html { redirect_to butterflies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@klass_fee = KlassFee.find(params[:id])\n #@klass_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to klass_fees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feild.destroy\n respond_to do |format|\n format.html { redirect_to feilds_url, notice: 'Feild was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @foodhamper = Foodhamper.find(params[:id])\n @foodhamper.destroy\n\n respond_to do |format|\n format.html { redirect_to foodhampers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n @favorite_flyer.destroy\n\n respond_to do |format|\n format.html { redirect_to favorite_flyers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @appraisal_fee.destroy\n respond_to do |format|\n format.html { redirect_to appraisal_fees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fantasy_draft_style.destroy\n respond_to do |format|\n format.html { redirect_to fantasy_draft_styles_url, notice: 'Fantasy draft style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_recipe = FoodRecipe.find(params[:id])\n @food_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to food_recipes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @featured_duffel = FeaturedDuffel.find_by_permalink(params[:id])\n @featured_duffel.destroy\n\n respond_to do |format|\n format.html { redirect_to(featured_duffels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @saying = Saying.find(params[:id])\n @saying.destroy\n\n respond_to do |format|\n format.html { redirect_to sayings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_food.destroy\n respond_to do |format|\n format.html { redirect_to meal_foods_url, notice: 'Meal food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wfeat.destroy\n respond_to do |format|\n format.html { redirect_to wfeats_url, notice: 'Wfeat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @articy_draft.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @frais_hebergement = FraisHebergement.find(params[:id])\n @frais_hebergement.destroy\n\n respond_to do |format|\n format.html { redirect_to frais_hebergements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.75347584", "0.7383757", "0.6595079", "0.65502685", "0.65330356", "0.64812326", "0.6477097", "0.6459164", "0.6458657", "0.6448738", "0.64453256", "0.6416836", "0.636335", "0.6354889", "0.6345786", "0.6336549", "0.6336549", "0.6334268", "0.6329851", "0.6329404", "0.6311851", "0.6294713", "0.62907946", "0.6290192", "0.6286661", "0.62634534", "0.6262752", "0.626187", "0.62546504", "0.62546504" ]
0.76134413
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notice!\n self.severity = :NOTICE\n end", "def notice; end", "def notify_or_ignore(exception, context = {})\n notify(exception, context) unless ignored?(exception)\n end", "def rescue_action_in_public_with_errornot(exception)\n unless errornot_ignore_user_agent?\n ErrornotNotifier.notify_or_ignore(exception, errornot_request_data)\n end\n rescue_action_in_public_without_errornot(exception)\n end", "def notice?\n severity == :NOTICE\n end", "def notice\n #\n end", "def send_exception_to_honeybadger_unless_filtered(exception_info)\n if exception_info.send_to_honeybadger?\n send_exception_to_honeybadger(exception_info)\n else\n log_info(\"Filtered exception using '#{exception_info.exception_description.filter_name}'; not sending notification to Honeybadger\")\n :skipped\n end\n end", "def without_notices\n # execute the block with NOTICE messages disabled\n begin\n execute('SET client_min_messages = warning')\n yield\n ensure\n execute('RESET client_min_messages')\n end\n end", "def notify_or_raise(ex)\n if should_raise?\n fail ex\n else\n notify_or_ignore_with_options(ex)\n end\n end", "def notice=(message); end", "def notice=(message); 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 notify(exception, options = {})\n send_notice(build_notice_for(exception, options))\n end", "def catch_simple\n begin\n yield\n rescue => e\n Rails.logger.info e.message\n end\n end", "def no_rescue(*exceptions)\n @options[:rescue] =\n if !exceptions.nil? and !exceptions.empty?\n ->(e) { !e.class.in?(exceptions) }\n else\n NONE\n end\n end", "def ignore &block\n begin; block.call; rescue; end\n end", "def test_notice_error_returns_nil\n begin\n raise 'WTF'\n rescue => e\n assert_nil ::NewRelic::Agent.notice_error(e)\n end\n end", "def notify(exception, opts = {})\n send_notice(build_notice_for(exception, opts))\n end", "def wont_throw(sym, msg=nil)\n ThrowAssay.refute!(sym, :message=>msg, :backtrace=>caller, &self)\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 test_does_not_consider_unknown_errors\n ig = ScoutApm::ErrorService::IgnoredExceptions.new(context, [\"ThisDoesNotExist\", \"IgnoredExceptionsTest::FakeError\"])\n assert ig.ignored?(FakeError.new(\"ignore this one\"))\n end", "def ignore!\n\t\t\t\tSignal.trap(@name, \"IGNORE\")\n\t\t\tend", "def notice_signal\n @selfpipe[:writer].write_nonblock( '.' )\n rescue Errno::EAGAIN\n # Ignore writes that would block\n rescue Errno::EINTR\n # Retry if another signal arrived while writing\n retry\n end", "def notice(msg) log(5, msg); end", "def catch_exceptions; 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 ignore!\n\t\t\t\tSignal.trap(@name, :IGNORE)\n\t\t\tend", "def octokit_warn(*message)\n unless ENV['OCTOKIT_SILENT']\n warn message\n end\n end", "def gocdkit_warn(*message)\n unless ENV['GOCDKIT_SILENT']\n warn message\n end\n end", "def notice(target, message)\n send_data(\"NOTICE #{target} :#{message}\")\n end" ]
[ "0.65168333", "0.6434321", "0.640824", "0.621561", "0.6197395", "0.61959904", "0.6174005", "0.6072776", "0.60374594", "0.5936417", "0.5936417", "0.5920188", "0.59181964", "0.587393", "0.5858212", "0.5795644", "0.57782435", "0.57683146", "0.57156485", "0.57066834", "0.5706503", "0.568325", "0.56602067", "0.5653671", "0.5648821", "0.5646353", "0.5624539", "0.5621187", "0.5614422", "0.56062245" ]
0.72404635
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 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 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 chmod(acl)\n if(acl == 777)\n mode = \"777\"\n end\n end", "def chmod( mode ) File.chmod( mode, expand_tilde ) end", "def chmod ctx, path, mode\n\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", "def set_mode\n chmod = command? 'chmod'\n find = command? 'find'\n\n return unless chmod && find\n\n {fmode: 'f', dmode: 'd'}.each do |k, v|\n next if send(k).nil?\n cmd = [find, destination_path, '-type', v, '-exec']\n cmd.concat [chmod, send(k).to_s(8), '{}', '+']\n logger.debug { \"Running command: #{cmd.join ' '}\" }\n system(*cmd)\n end\n end", "def set_mode\n if (mode = target_mode) && (mode != (stat.mode & 007777))\n File.chmod(target_mode, file)\n Chef::Log.info(\"#{log_string} mode changed to #{mode.to_s(8)}\")\n modified\n end\n end", "def add(*permissions)\n permissions.flatten!\n control_definitions(permissions)\n permissions.each do |permission|\n new_permission = defined_permissions[permission]\n @permissions_integer += new_permission unless include?(permission)\n end\n sync_with_owner\n end", "def chmod(mode, options={})\n #list = list.to_a\n fileutils.chmod(mode, list, options)\n end", "def set_permissions\n return if @permissions_set\n\n @permissions_set = true\n resource[:configure_permission] ||= configure_permission\n resource[:read_permission] ||= read_permission\n resource[:write_permission] ||= write_permission\n rabbitmqctl(\n 'set_permissions',\n '-p', should_vhost,\n should_user,\n resource[:configure_permission],\n resource[:write_permission],\n resource[:read_permission]\n )\n end", "def set_permissions(file, perms)\n # Check local filesystem to see if it supports ACL's. If not, bail early\n # because the GetFileSecurity function will not fail on an unsupported FS.\n unless supports_acls?(file)\n raise ArgumentError, \"Filesystem does not implement ACL support\"\n end\n\n wide_file = string_check(file).wincode\n raise TypeError unless perms.kind_of?(Hash)\n\n sec_desc = FFI::MemoryPointer.new(:pointer, SECURITY_DESCRIPTOR_MIN_LENGTH)\n\n unless InitializeSecurityDescriptor(sec_desc, 1)\n raise SystemCallError.new(\"InitializeSecurityDescriptor\", FFI.errno)\n end\n\n acl_new = FFI::MemoryPointer.new(ACL, 100)\n\n unless InitializeAcl(acl_new, acl_new.size, ACL_REVISION2)\n raise SystemCallError.new(\"InitializeAcl\", FFI.errno)\n end\n\n perms.each{ |account, mask|\n next if mask.nil?\n\n # reset account_rights for each entry in perms:\n account_rights = 0\n\n server, account = account.split(\"\\\\\")\n\n if ['BUILTIN', 'NT AUTHORITY'].include?(server.upcase)\n wide_server = nil\n elsif account.nil?\n wide_server = nil\n account = server\n else\n wide_server = server.wincode\n end\n\n wide_account = account.wincode\n\n sid = FFI::MemoryPointer.new(:uchar, 1024)\n sid_size = FFI::MemoryPointer.new(:ulong)\n sid_size.write_ulong(sid.size)\n\n domain = FFI::MemoryPointer.new(:uchar, 260)\n domain_size = FFI::MemoryPointer.new(:ulong)\n domain_size.write_ulong(domain.size)\n\n use_ptr = FFI::MemoryPointer.new(:ulong)\n\n val = LookupAccountNameW(\n wide_server,\n wide_account,\n sid,\n sid_size,\n domain,\n domain_size,\n use_ptr\n )\n\n raise SystemCallError.new(\"LookupAccountName\", FFI.errno) unless val\n\n all_ace = ACCESS_ALLOWED_ACE2.new\n\n val = CopySid(\n ALLOW_ACE_LENGTH - ACCESS_ALLOWED_ACE.size,\n all_ace.to_ptr+8,\n sid\n )\n\n raise SystemCallError.new(\"CopySid\", FFI.errno) unless val\n\n if (GENERIC_ALL & mask).nonzero?\n account_rights = GENERIC_ALL & mask\n elsif (GENERIC_RIGHTS_CHK & mask).nonzero?\n account_rights = GENERIC_RIGHTS_MASK & mask\n else\n # Do nothing, leave it set to zero.\n end\n\n all_ace[:Header][:AceFlags] = INHERIT_ONLY_ACE | OBJECT_INHERIT_ACE\n\n 2.times{\n if account_rights != 0\n all_ace[:Header][:AceSize] = 8 + GetLengthSid(sid)\n all_ace[:Mask] = account_rights\n\n val = AddAce(\n acl_new,\n ACL_REVISION2,\n MAXDWORD,\n all_ace,\n all_ace[:Header][:AceSize]\n )\n\n raise SystemCallError.new(\"AddAce\", FFI.errno) unless val\n\n all_ace[:Header][:AceFlags] = CONTAINER_INHERIT_ACE\n else\n all_ace[:Header][:AceFlags] = 0\n end\n\n account_rights = REST_RIGHTS_MASK & mask\n }\n }\n\n unless SetSecurityDescriptorDacl(sec_desc, 1, acl_new, 0)\n raise SystemCallError.new(\"SetSecurityDescriptorDacl\", FFI.errno)\n end\n\n unless SetFileSecurityW(wide_file, DACL_SECURITY_INFORMATION, sec_desc)\n raise SystemCallError.new(\"SetFileSecurity\", FFI.errno)\n end\n\n self\n end", "def chmod\n raise ParamsError.new(@params) if @params.nil? # PERMISSIONS cannot be nil, but database not checking this\n\n IONe.new($client, $db).UpdateAnsiblePlaybook(\"id\" => @body['id'], \"extra_data\" => @body['extra_data'].merge(\"PERMISSIONS\" => @params))\n nil\n end", "def setable_permissions\n setable_permissions = Erp::AccessControl.permissions - Erp::AccessControl.public_permissions\n setable_permissions -= Erp::AccessControl.members_only_permissions if builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Erp::AccessControl.loggedin_only_permissions if builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end", "def chmod(mode = nil)\n return unless mode\n begin\n Integer mode\n mode = Integer mode.size == 3 ? \"0#{mode}\" : mode\n rescue ArgumentError\n end\n FileUtils.chmod mode, selected_items.map(&:path)\n ls\n end", "def chmod(file)\n mode = options[:mode]\n return unless mode\n\n FileUtils.chmod(mode, file)\n end", "def files filename,attrib={}\n\t\tif has_attrib? filename \n\t\t\teval(send('form_files',filename))\n\t\telse\n\t\t\toptions = map('files',check_pattern(attrib,filename))\n\t\t\t(owner,group,mode) = pop_options(options,:owner,:group,:mode)\n\t\t\tbegin\n\t\t\t\t\t# p [filename,owner,group,mode,options]\n if options[:shell]\n\t\t\t\t \tCfruby::FileOps.shell_chown_mod filename,owner,group,mode,options\n else\n\t\t\t\t\t Cfruby::FileOps.chown_mod filename,owner,group,mode,options\n end\n options[:shell] = nil\n\t\t\trescue Cfruby::FileFind::FileExistError\n\t\t\t\tCfruby.controller.inform('verbose', \"Can not chmod on non-existing file #{filename}\")\n\t\t\tend\n\t\tend\n\tend", "def permits=(permissions)\n # make a copy!\n @permissions = {}.merge(permissions)\n end", "def permits=(permissions)\n # make a copy!\n @permissions = {}.merge(permissions)\n end", "def chmod(mode, args, options)\n FileUtils.chmod_R(mode, args, **options)\n end" ]
[ "0.61778283", "0.6151694", "0.6135356", "0.6115305", "0.6100644", "0.6083128", "0.59712285", "0.59698904", "0.59641623", "0.58579946", "0.5851635", "0.5821485", "0.58096987", "0.578552", "0.5781495", "0.5779447", "0.5756283", "0.5678055", "0.56312793", "0.5623642", "0.56124187", "0.55907375", "0.55799514", "0.55723506", "0.55598724", "0.5522173", "0.5485391", "0.5458087", "0.5458087", "0.5451974" ]
0.72598076
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_file_path\n Rails.root.join('uploads', filepath).to_s\n end", "def upload_full_path\n @upload_full_path ||= File.join(@upload_file_path, name)\n end", "def full_path\n @full_path ||= path ? File.join(root, path) : root\n end", "def full_path\n File.join(@path, @name)\n end", "def full_path\n must_be File\n File.realpath(self.path)\n end", "def path\n return self.saved? ? @realfile.path : nil\n end", "def fullpath\n File.join(@root, @path)\n end", "def fullpath\n File.expand_path( @file )\n end", "def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end", "def full_path\n self.read_attribute(:full_path) || self.assign_full_path\n end", "def full_path\n path\n end", "def fullpath\n @fullpath = File.join(root, path)\n end", "def current_path\n file.try(: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 full_path(relative_filename)\n File.join(@mount_dir, relative_filename)\n end", "def local_file_path\n afilePath = building.local_path + SAVE_PATH + id.to_s\n\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix\n end\n\n afilePath \n end", "def full_path\n container.root.join(path)\n end", "def full_path\n container.root.join(path)\n end", "def path\n return if @file.blank?\n if is_path?\n File.expand_path(@file)\n elsif @file.respond_to?(:path) && [email protected]?\n File.expand_path(@file.path)\n end\n end", "def current_file_path\n current_file.to_path\n end", "def absolutepath\n if absolute?\n self\n elsif to_s == \".\"\n realpath\n else\n parent.absolutepath + self.basename\n end\n end", "def get_file_path\n @path\n end", "def path\n \"/#{UPLOAD_DIR}/#{filename}\"\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 base_path\n File.join(attachment_options[:path_prefix], attachment_path_id)\n end", "def full_path\n File.dirname(File.expand_path(serialized_filename))\n end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def file_path\n base_image ? base_image.base_filename : nil\n end", "def full_path; end" ]
[ "0.7924824", "0.7746192", "0.7309491", "0.7155678", "0.7129289", "0.71280617", "0.71274024", "0.7108221", "0.71034974", "0.7069348", "0.7019013", "0.69260925", "0.6884028", "0.6842242", "0.6799916", "0.6784461", "0.67746043", "0.67746043", "0.6749577", "0.6685508", "0.6606524", "0.66031635", "0.6574641", "0.6538787", "0.6537065", "0.6528727", "0.6508778", "0.6508778", "0.6502748", "0.6486711" ]
0.8146056
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_path\n update_column :path, file.url unless url?\n end", "def rename_file\n return unless @old_filename && @old_filename != full_filename\n if save_attachment? && File.exists?(@old_filename)\n FileUtils.rm @old_filename\n elsif File.exists?(@old_filename)\n FileUtils.mv @old_filename, full_filename\n end\n @old_filename = nil\n true\n 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 rename_file\n return unless @old_filename and @old_filename != full_filename\n start_ssh do |ssh|\n if save_attachment?\n ssh.exec!(\"rm #{e @old_filename}\")\n else\n ssh.exec!(\"mv #{e @old_filename} #{e full_filename}\")\n end\n end\n @old_filename = nil\n true\n end", "def update_file_path\n if self.number_changed? || self.organization_id_changed?\n old_organization = Organization.find(self.organization_id_was)\n old_url_part = url_part_safe(self.number_was)\n \n old_path = File.join(old_organization.storage_path, old_url_part)\n \n if File.directory?(old_path)\n new_path = self.storage_path\n \n # If the organization folder does not exist, create it.\n if !File.directory?(self.organization.storage_path)\n FileUtils.mkdir_p self.organization.storage_path\n end\n \n FileUtils.mv old_path, new_path\n end\n end\n end", "def rename_file\n @old_path = Rails.root.to_s+'/public/vendorlogos/'+self.id.to_s\n @new_path = Rails.root.to_s+'/public/vendorlogos/'+self.id.to_s+\".\"+self.logo.to_s\n if(File.exists?(@old_path))\n File.rename(@old_path, @new_path)\n end\n end", "def filename=(value)\n @old_filename = full_filename unless filename.nil? or @old_filename\n write_attribute :filename, sanitize_filename(value)\n end", "def filename\n if original_filename\n # This is pretty gross. We only want to reuse the existing filename if\n # a new avatar isn't being uploaded, we look at the *_change attribute to\n # determine if that happened.\n if model && model.read_attribute(mounted_as).present? && !model.send(:\"#{mounted_as}_change\")\n model.read_attribute(mounted_as)\n else\n # new filename\n @name ||= \"#{timestamp}.#{model.send(mounted_as).file.extension}\" if original_filename\n end\n end\n end", "def filename=(value)\n @old_filename = filename unless filename.nil? || @old_filename\n write_attribute :filename, sanitize_filename(value)\n end", "def save_original_filename(file)\n return true unless model.respond_to?(\"#{mounted_as}_original_filename\")\n return true unless file.respond_to?(:original_filename)\n model.send(\"#{mounted_as}_original_filename=\", file.original_filename)\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 local_path_to_file=(value)\n @attributes[:local_path_to_file] = value\n reset_attributes\n calculate_attributes\n value\n end", "def update_from_filename filename\n self.original_filename = filename\n self.valid?\n end", "def update_file_path\n if self.season_changed? || self.year_changed?\n old_url_part = \"#{SEASON_PATH_NAMES.rassoc(self.season_was).first}-#{self.year_was}\"\n course_ids = self.assignments.pluck(:course_id).uniq\n \n course_ids.each do |course_id|\n course = Course.find(course_id)\n old_path = File.join(course.storage_path, old_url_part)\n \n if File.directory?(old_path)\n new_path = File.join(course.storage_path, self.url_part)\n \n FileUtils.mv old_path, new_path\n end\n end\n end\n end", "def before_save\n\t\t\tself.name ||= ''\n\t\t\tself.filename ||= self.name.downcase.gsub(/[^a-z0-9]+/, '-')\n\t\t\tif self.parent.nil?\n\t\t\t\tself.path = ''\n\t\t\telsif self.parent.path.empty?\n\t\t\t\tself.path = filename\n\t\t\telse\n\t\t\t\tself.path = self.parent.path + '/' + self.filename\n\t\t\tend\n\t\tend", "def after_update\r\n\t\t\tself.children.each do |child|\r\n\t\t\t\tchild.path = self.path + '/' + child.filename\r\n\t\t\t\tchild.save\r\n\t\t\tend\r\n\t\tend", "def after_update\n\t\t\tself.children.each do |child|\n\t\t\t\tchild.path = self.path + '/' + child.filename\n\t\t\t\tchild.save\n\t\t\tend\n\t\tend", "def path\n @new_filename || @filename\n end", "def rename_file\n true\n end", "def changed?(uploaded_file)\n record.reload\n super\n end", "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 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 modified?(path); end", "def fix\n path = Rails.root.join(\"public/system/files/#{self.id}/original/#{self.file_file_name}\")\n Formatador.display_line(\"Uploading file at: [green]#{path}[/]\")\n if File.exists?(path)\n self.attached_file.store!(File.open(path))\n self.update_attribute(:attached_file, self.file_file_name)\n Formatador.display_line(\"[yellow]Done![/]\")\n else\n Formatador.display_line(\"[red]ERROR: [/]File does not exist!\")\n end\n end", "def fix_row_file_path!(row)\n # We know that Saikuro rows are broken\n # next unless row['metric'] == :saikuro\n key = [row[\"class_name\"], row[\"method_name\"]]\n current_file_path = row[\"file_path\"].to_s\n correct_file_path = @class_and_method_to_file[key]\n if !correct_file_path.nil? && correct_file_path.include?(current_file_path)\n row[\"file_path\"] = correct_file_path\n else\n # There wasn't an exact match, so we can do a substring match\n matching_file_path = file_paths.detect {|file_path|\n !file_path.nil? && file_path.include?(current_file_path)\n }\n if matching_file_path\n row[\"file_path\"] = matching_file_path\n end\n end\n end", "def update\n uploaded_io = params[:product][:image]\n # if uploaded_io != nil\n # @product.pathToImg = @product.prodCategory + '/' + @product.prodCode\n # end\n # uploaded_io.rename(uploaded_io.original_filename, @product.prodCode.to_s)\n if uploaded_io != nil\n File.open(Rails.root.join('app','assets', 'images', @product.prodCategory.to_s.downcase, uploaded_io.original_filename), 'wb') do |file|\n # puts \"[products_controller] original file name \" +uploaded_io.original_filename.to_s\n # file.rename(uploaded_io.original_filename, @product.prodCode.to_s)\n file.write(uploaded_io.read)\n end\n @product.pathToImg = @product.prodCategory.downcase + '/' + uploaded_io.original_filename\n end\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\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 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 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" ]
[ "0.64164037", "0.6395799", "0.63228154", "0.6070498", "0.59627134", "0.5951", "0.584486", "0.5843303", "0.58145225", "0.57840216", "0.5773075", "0.57341856", "0.5700501", "0.5687526", "0.5684828", "0.565464", "0.5646318", "0.5643698", "0.5638444", "0.56376165", "0.5627437", "0.5605478", "0.55479336", "0.5524169", "0.5504155", "0.5445487", "0.5442392", "0.5396089", "0.53880394", "0.53867984" ]
0.66050786
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_directory\n FileUtils.mkdir_p(to_s)\n self\n end", "def ensure_meta_info_dir_exists!\n FileUtils.mkdir_p(RubyFileReader::Reader.meta_info_dir_pathname)\n end", "def ensureDir(filename)\n dir = File::dirname(filename) ;\n system(\"mkdir -p #{dir}\") ;\n end", "def ensure_dir( d )\n\n fu().mkdir_p( d ) unless File.exist?( d )\n d\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 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 create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end", "def write_to(path)\n if !File.exists?(path)\n FileUtils.mkdir_p(path)\n else\n raise FileExists.new(\"#{path} already exists\")\n end\nend", "def check_dest_dir\n dir = File.dirname absolute_filename\n FileUtils.mkdir_p(dir) unless Dir.exist?(dir)\n end", "def make_dir(path)\n FileUtils.mkdir_p( path )# unless File.exists?(path)\n end", "def verify_file_path(file)\n FileUtils.mkdir_p(File.dirname(file)) unless File.exists?(File.dirname(file))\n end", "def verify_file_path(file)\n FileUtils.mkdir_p(File.dirname(file)) unless File.exists?(File.dirname(file))\n end", "def ensure_dir(dir_name)\n FileUtils::mkdir_p(dir_name)\n end", "def make_directory\n FileUtils.mkdir_p output_directory unless File.exist? output_directory\n end", "def ensure_directory(dir)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n dir\n end", "def ensure_dir(path)\n directory path do\n action :create\n recursive true\n end\nend", "def ensure_filepath(file)\n ensure_directory(File.dirname(file))\n end", "def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end", "def prepare_path\n log(\"prepare_path\")\n FileUtils.mkdir_p(path) unless Dir.exist?(path)\n rescue Exception => e\n log(\"prepare_path\", \"ERROR #{e}\")\n notify( \"reader.error\", { :error => \"prepare_path\" } )\n end", "def assert_directory_exists!(path)\n dir = File.dirname(path)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n end", "def create_dir(dir)\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\nend", "def create_dir(path)\n is_file = File.file?(path)\n is_dir = File.directory?(path)\n\n # Check for existing file/dir, and offer to overwrite\n if is_file || is_dir\n puts \"File #{path} already exists.\" if is_file\n puts \"Directory #{path} already exists.\" if is_dir\n\n if prompt(\"WARNING: Existing #{path} will be deleted. Continue?\")\n puts \"Removing existing #{path} ...\"\n FileUtils.rm_rf(path)\n else\n puts \"Please use another directory.\"\n Process.exit\n end\n end\n\n puts \"Creating directory #{path} ...\"\n FileUtils.mkdir_p(path)\n end", "def create\n FileUtils.mkdir_p(directory) unless exist?\n end", "def check_directory(directory)\n #Make sure directory exists, making it if needed.\n if not File.directory?(directory) then\n FileUtils.mkpath(directory) #logging and user notification.\n end\n directory\n end", "def make_output_dir (src_path)\n delete_all_files(src_path) if directory_exists?(src_path) == true\n Dir.mkdir(src_path)\nend", "def verify_writable_dir(dir)\n unless (File.directory?(dir) && File.writable?(dir)) ||\n FileUtils.mkdir_p(dir)\n raise IOError.new(\"Directory #{dir} must exist and be writable\")\n end\n end", "def create\n FileUtils.mkdir_p path\n end" ]
[ "0.7606959", "0.7197922", "0.7135695", "0.7133732", "0.7124492", "0.7109498", "0.7090023", "0.699093", "0.6986757", "0.6981973", "0.69757754", "0.69732857", "0.69710934", "0.69115514", "0.69115514", "0.68944305", "0.68728375", "0.6853175", "0.683741", "0.6814181", "0.6808982", "0.67493385", "0.6740764", "0.6702645", "0.6680655", "0.66586065", "0.66082853", "0.6589617", "0.65693545", "0.65677667" ]
0.772864
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_file_and_clean_directories( path )\n # first, delete the file\n delete_file( path )\n # recursively remove any parent directories, but only if they are empty, stop if they are not\n remove_empty_folders_recursively( path )\n end", "def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end", "def clean(path)\n path.dirname.ascend do |pathname|\n if Dir.empty?(pathname) && pathname != directory\n pathname.rmdir\n else\n break\n end\n end\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 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 delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\n end", "def clean_dir\n\n path = self.get_dir\n _clean_dir(path)\n end", "def destroy\n delete_files_and_empty_parent_directories\n end", "def delete_empty(directory) \n log_file(\"[START] running empty folder deletion...\")\n\n dir(directory + '**/*').each do |path|\n if (File.directory?(path) && tree_empty?(path)) then\n log_file(\"This folder is empty and will be deleted: \" + path)\n trash(path)\n end\n end\n log_file(\"[COMPLETE] ...empty folder deletion done.\")\n\nend", "def clean(id)\n path(id).dirname.ascend do |pathname|\n if pathname.children.empty? && pathname != directory\n pathname.rmdir\n else\n break\n end\n end\n end", "def destroy_upload_dir\n dir = File.expand_path \"../\", file.path\n FileUtils.rm_rf dir\n end", "def unlink_file\n unless is_placeholder_directory?\n FileUtils.rm path if File.file?(path)\n else\n FileUtils.rmdir path if Dir.entries(path) == [\".\", \"..\"]\n end\n end", "def clean_out_log_directory(dir)\n Pathstring(dir).children.each do |item|\n if item.directory?\n # First clean out inside the directory\n clean_out_log_directory(item)\n\n # Then, if it is empty, delete it\n if item.empty?\n # OSX::NSLog \"Removing directory: #{file.basename}\"\n item.unlink\n end\n else # Not a directory, so a normal file\n unless Pathstring(item).basename.scan(/rolling/)[0] # Note: This depends on the convention to include 'rolling' in the name of persistent files. TODO: Remove older rolling logs.\n # If it is not a persistent log\n # remove it\n # OSX::NSLog \"Removing log: #{item.basename}\"\n item.unlink\n end\n end\n end\nend", "def clean_dir(dir)\n Dir.glob(File.join(dir, '*')).each {|d| clean_dir(d); Dir.rmdir(d) rescue nil}\nend", "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 cleanup\n if dir and File.exists?(dir)\n FileUtils.rm_rf(dir)\n end\n\n nil\n end", "def purge(directory)\n\tDir[\"#{directory}/*\"].each do |file|\n\t\tnext if file == '.' || file == '..'\n\t\tif File.directory? file\n\t\t\tif ($silent == false || $silent == nil)\n#\t\t\t\tputs \" purging #{File.expand_path(file).gsub($basedir, '')}\"\n\t\t\tend#if\n\t\t\tpurge(File.expand_path(file))\n\t\t\tif (Dir.entries(file) - %w[ . .. ]).empty?\n\t\t\t\tif ($silent == false || $silent == nil)\n#\t\t\t\t\tputs \" cleaning #{file.gsub($basedir, '')}\"\n\t\t\t\tend#if\n\t\t\t\tDir.rmdir file\n\t\t\tend#if\n\t\telsif file !~ /^\\..*$/ # ignore dot files\n\t\t\tif ($silent == false || $silent == nil)\n#\t\t\t\tputs \" removing #{file.gsub($basedir, '')}\"\n\t\t\tend#if\n\t\t\tFileUtils.rm_rf file, :noop => false, :verbose => false\n\t\tend#if\n\tend#each\nend", "def rmdir() Dir.rmdir(path) end", "def destroy_file\n FileUtils.rm full_filename\n # remove directory also if it is now empty\n Dir.rmdir(File.dirname(full_filename)) if (Dir.entries(File.dirname(full_filename))-['.','..']).empty?\n rescue\n logger.info \"Exception destroying #{full_filename.inspect}: [#{$!.class.name}] #{$1.to_s}\"\n logger.warn $!.backtrace.collect { |b| \" > #{b}\" }.join(\"\\n\")\n 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", "def clean_directory\n Dir.foreach(@server_dir) do |file|\n fn = File.join(@server_dir, file)\n File.delete(fn) if fn[-1] != '.'\n end\n end", "def clear_directory(dir)\n puts dir\n if(File.exists?(dir))\n Dir.foreach(dir){|entry|\n puts entry\n if(File.file?(entry))\n File.delete(entry)\n end\n }\n end\n end", "def delete_empty_directories(dir)\n return if File.realpath(dir) == File.realpath(@root_path)\n if Dir.entries(dir).reject{ |f| EXCLUDED_DIRS.include?(f) }.empty?\n Dir.delete(dir) rescue nil\n delete_empty_directories(File.dirname(dir))\n end\n end", "def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end", "def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end", "def remove_directory(path)\n FileUtils.rm_rf(path)\n end", "def remove_directory(path)\n FileUtils.rm_rf(path)\n end" ]
[ "0.7876363", "0.7431147", "0.735552", "0.7164017", "0.7158658", "0.7134201", "0.70936924", "0.6960207", "0.6943068", "0.68454456", "0.6800318", "0.6778718", "0.6776878", "0.6767045", "0.6748883", "0.67399156", "0.67366195", "0.66414785", "0.65970296", "0.6578105", "0.6546556", "0.65314996", "0.651571", "0.6511351", "0.6501819", "0.64889055", "0.6463383", "0.6460649", "0.6454319", "0.6454319" ]
0.7812255
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 return unless representsCompany?\n\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 @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", "def new\r\n @administration_category = Category.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @administration_category }\r\n end\r\n end", "def new\n @category = Category.new\n\n # @categories = Category.all\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 @technology = Technology.new\n @categories = Category.find(:all)\n\n if @categories.count == 0\n flash[:error] = 'You need to create a category before you can create a technology'\n redirect_to new_category_path and return\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @technology }\n end\n end", "def new\n @level_category = LevelCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level_category }\n end\n end", "def new\n @categorialivro = Categorialivro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @categorialivro }\n end\n end", "def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n @pcategory = Pcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pcategory }\n end\n end", "def new\n # category instance\n @category = Category.new\n end", "def new\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 @category_type = CategoryType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_type }\n end\n end", "def new\n @kategory = Kategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kategory }\n end\n end" ]
[ "0.74364746", "0.73833764", "0.73656535", "0.7362489", "0.7362489", "0.7362489", "0.7362489", "0.7362489", "0.7362489", "0.7362489", "0.7362489", "0.7362489", "0.7344639", "0.73279166", "0.7327913", "0.7300623", "0.7237526", "0.7175016", "0.71696764", "0.71354294", "0.71328616", "0.7131727", "0.71264595", "0.7124879", "0.7123689", "0.70924675", "0.7084681", "0.7060058", "0.70527756", "0.7050586" ]
0.77980167
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\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\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 action: 'index', 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 @categorium = Categorium.new(categorium_params)\n\n respond_to do |format|\n if @categorium.save\n format.html { redirect_to @categorium, 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 @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 @expense = @current_user.expenses.create(params[:expense])\n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to(@expense) }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n format.iphone { redirect_to(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"new\" }\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 category = @current_user.categories.create!(category_params)\n render json: { category: category }\n end", "def create\n json_create(category_params, Category)\n end", "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 @categoria = Categoria.new(categoria_params)\n\n if @categoria.save\n flash[:success] = 'Se inserto exitosamente la nueva categoría.'\n redirect_to categorias_path\n else\n render 'new'\n end\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def create\n @proyectos_categoria = ProyectosCategoria.new(proyectos_categoria_params)\n\n respond_to do |format|\n if @proyectos_categoria.save\n format.html { redirect_to @proyectos_categoria, notice: 'Proyectos categoria was successfully created.' }\n format.json { render :show, status: :created, location: @proyectos_categoria }\n else\n format.html { render :new }\n format.json { render json: @proyectos_categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def create\n @category = current_user.categories.new(name: params[:name])\n if @category.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @category.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def new\n @exhibitior_category = ExhibitiorCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exhibitior_category }\n end\n end", "def create\n if @category.save\n render json: @category, status: :created, location: @category\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\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 [:admin, @categoria], :notice => 'Exemplo 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 @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mk_categoria = MkCategoria.new(mk_categoria_params)\n\n respond_to do |format|\n if @mk_categoria.save\n format.html { redirect_to @mk_categoria, notice: 'Mk categoria was successfully created.' }\n format.json { render :show, status: :created, location: @mk_categoria }\n else\n format.html { render :new }\n format.json { render json: @mk_categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @echocategory = current_profile.echocategories.build(echocategory_params)\n\n respond_to do |format|\n if @echocategory.save\n format.html { redirect_to @echocategory, notice: 'Echocategory was successfully created.' }\n format.json { render :show, status: :created, location: @echocategory }\n else\n format.html { render :new }\n format.json { render json: @echocategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorie_analytique = CategorieAnalytique.new(params[:categorie_analytique])\n\n respond_to do |format|\n if @categorie_analytique.save\n format.html { redirect_to @categorie_analytique, notice: 'Categorie analytique was successfully created.' }\n format.json { render json: @categorie_analytique, status: :created, location: @categorie_analytique }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categorie_analytique.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend" ]
[ "0.67995447", "0.67280954", "0.6692331", "0.6446782", "0.64250207", "0.6298797", "0.62950927", "0.6272612", "0.6272286", "0.62249583", "0.62238014", "0.621838", "0.61868274", "0.61715853", "0.61662114", "0.61554", "0.61518496", "0.6138151", "0.6121284", "0.6093589", "0.60908616", "0.6085796", "0.60809445", "0.60590476", "0.60500187", "0.6032568", "0.6029759", "0.6024609", "0.6013093", "0.597123" ]
0.698518
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n 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\n existing_categories = (Exercise.find_by id: params[:id]).categories\n is_already_category = (Exercise.find_by id: params[:id]).exercise_categorizations.pluck(:category_id).include? params[:category_id].to_i\n\n if(params[:checked] == \"checked\" )\n if(!is_already_category)\n existing_categories << (Category.find_by id: params[:category_id])\n end\n else\n if(is_already_category)\n existing_categories.delete(params[:category_id])\n end\n end\n\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\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 @expense.categories_expenses.destroy_all\n if (params[:expense][:categories]) \n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n end\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to(@expense) }\n format.xml { head :ok }\n format.iphone { redirect_to :controller => \"welcome\", :action => \"home\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"edit\" }\n end\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 json_update(category,category_params, Category)\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 existing_categories = (Ebook.find_by id: params[:id]).categories\n is_already_category = (Ebook.find_by id: params[:id]).ebook_categorizations.pluck(:category_id).include? params[:category_id].to_i\n\n if(params[:checked] == \"checked\" )\n if(!is_already_category)\n existing_categories << (Category.find_by id: params[:category_id])\n end\n else\n if(is_already_category)\n existing_categories.delete(params[:category_id])\n end\n end\n\n respond_to do |format|\n if @ebook.update(ebook_params)\n format.html { redirect_to @ebook, notice: \"#{@ebook_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\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 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 @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\n if params[:create_exercise_category]\n cu_id = current_user.id\n category = ExerciseCategory.find_or_new_by_category(cu_id, params[:create_category])\n params[:exercise][:exercise_category_attributes][:category] = category.category\n @exercise = current_user.exercises.find_by_id(params[:id])\n @exercise.exercise_category = category\n set_up_categories\n else\n @exercise = current_user.exercises.find_by_id(params[:id])\n if @exercise.update_attributes(params[:exercise])\n flash[:notice] = 'Edit was successful'\n redirect_to :action => 'show', :id => @exercise.id\n return\n else\n flash.now[:error] = \"Your exercise didn't update properly\"\n flash.now[:errors] = @exercise.errors\n end\n end\n render :action => 'edit'\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 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_category, notice: 'Exercise category was successfully updated.' }\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 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 modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend", "def user_category_edit\n @user = User.where(contact: params[:contact]).first\n @user.categories.destroy_all\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-categories\", data: \"categories updated\"}, status: :ok\n end", "def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update(request)\n if options[:multiple]\n cats = request.every(options[:category])\n cats.each do |cat|\n if cat || options[:nils]\n @categories[cat] ||= 0\n @categories[cat] += 1\n end \n end\n \n else\n cat = @categorizer.call(request)\n if cat || options[:nils]\n @categories[cat] ||= 0\n @categories[cat] += 1\n end\n end\n end", "def update\n @expense = @household.expenses.find(params[:id])\n respond_to do |format|\n if @expense.update(expense_params)\n\n # c = Category.find cat_params[:category].to_i\n #\n # if @expense.categories << c\n # puts 'SUPER'\n # else\n # puts 'SCHEIßE'\n # end\n\n flash[:alert] = 'Expense was successfully updated.'\n format.html {redirect_to household_expenses_path(@household)}\n format.json {render :show, status: :ok, location: @expense}\n else\n format.html {render :edit}\n format.json {render json: @expense.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @categoria = Categoria.find(params[:id])\n\n @categoria.update_attributes(params[:categoria])\n render :layout => false\n end", "def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t @expense = Expense.find(params[:id])\n\t @expense.categories = params[:categories].split(',')\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n add_tagger_to_taggings(@expense)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update! {admin_categories_path}\n end", "def update\n @categorias = CategoriaObjeto.all.order(:nome).map { |categoria| [categoria.nome, categoria.id]}.prepend(['Selecione uma categoria', 0])\n \n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_categories_category_expense\n @categories_category_expense = Categories::CategoryExpense.find(params[:id])\n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end" ]
[ "0.68047875", "0.6802997", "0.65672714", "0.65645427", "0.6486565", "0.6376908", "0.630117", "0.6256176", "0.62543267", "0.6214432", "0.6180587", "0.61505646", "0.61470294", "0.6122314", "0.6117411", "0.611602", "0.61112916", "0.60785085", "0.6060442", "0.60554504", "0.60426974", "0.6040011", "0.6002861", "0.59883916", "0.5974536", "0.5972019", "0.59716773", "0.59704214", "0.5945084", "0.5945084" ]
0.7001599
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 #@incidentcategory.destroy\n render json: {}, status: 200\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 category = set_category\n if category.destroy\n head :no_content\n else\n render json: { status: 500 }\n end\n \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 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 @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 @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 @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 @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n @categorium.destroy\n respond_to do |format|\n format.html { redirect_to categoria_url, notice: 'Categoría fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorie_analytique = CategorieAnalytique.find(params[:id])\n @categorie_analytique.destroy\n\n respond_to do |format|\n format.html { redirect_to categorie_analytiques_url }\n format.json { head :ok }\n end\n end", "def destroy\n @category.destroy\n render json: { notice: 'Categoria eliminada exitosamente' }\n end", "def destroy\n @categorie_droit.destroy\n respond_to do |format|\n format.html { redirect_to categorie_droits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria.destroy\n respond_to do |format|\n format.html { redirect_to categorias_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end", "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @cathegory.destroy\n respond_to do |format|\n format.html { redirect_to cathegories_url, notice: 'Cathegory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @personality_category.destroy\n respond_to do |format|\n format.html { redirect_to personality_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @catagory.destroy\n respond_to do |format|\n format.html { redirect_to back_catagories_url, notice: I18n.t('view.notice.deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @categ.destroy\n respond_to do |format|\n format.html { redirect_to categs_url, notice: 'Categ was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @echocategory.destroy\n respond_to do |format|\n format.html { redirect_to echocategories_url, notice: 'Echocategory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria_norma.destroy\n respond_to do |format|\n format.html { redirect_to categoria_normas_url, notice: 'Categoria norma was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @desserts_category.destroy\n respond_to do |format|\n format.html { redirect_to desserts_categories_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_contcategory.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcategories_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @cetegory.destroy\n respond_to do |format|\n format.html { redirect_to cetegories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mk_categoria.destroy\n respond_to do |format|\n format.html { redirect_to mk_categories_url, notice: 'Mk categoria was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @convention_category = ConventionCategory.find(params[:id])\n @convention_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_convention_categories_url }\n format.json { head :ok }\n end\n end", "def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end", "def destroy\n @categorie_competence.destroy\n respond_to do |format|\n format.html { redirect_to categorie_competences_url, notice: 'Categorie competence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.73797965", "0.73602843", "0.7295814", "0.7242014", "0.72043025", "0.7200795", "0.7151931", "0.712239", "0.71190214", "0.71094865", "0.7101901", "0.7101655", "0.7088081", "0.70532817", "0.7044528", "0.70421284", "0.7000866", "0.6995815", "0.6992089", "0.698252", "0.6978376", "0.69677544", "0.6956404", "0.6952935", "0.6951471", "0.6950771", "0.6941075", "0.6930555", "0.692017", "0.6907185" ]
0.77388936
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 monthly\n end", "def month=(_arg0); end", "def month; end", "def month; end", "def calculate_month_and_next_month(year, month)\n check_date = Time.new(year, month)\n {:actual => check_date, :next => check_date.next_month}\n end", "def test_yearly_by_month_loop\n parse(\n 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA',\n '2012-01-01 15:45:00',\n [\n '2012-02-01 15:45:00'\n ],\n '2012-01-29 23:00:00'\n )\n end", "def months() 30 * days end", "def commitment_period_origin\n I18n.l(created_at.advance(months: subscription_plan.commitment_period).to_date)\n end", "def expiration_month\n @months = [\"01\",\"02\",\"03\",\"04\",\"05\",\"06\",\"07\",\"08\",\"09\",\"10\",\"11\",\"12\"]\n end", "def all_movement_by_period(period)\n\t\tmonth,year = period.split(\"/\")\n\t\tperiod = \"#{year}-#{month}\"\n\t\tcash_bank_bank_movements.all(:conditions => [\"SUBSTRING(date,1,7) = '#{period}'\"])\n\tend", "def month_depot\n \"#{depot.name} \"+\"#{issue_date.strftime(\"%b\")} \"+\"#{issue_date.year}\"\n end", "def increment_month!\n if month != 12\n # just bump up a number\n self.date = ZDate.format_date(year_str, month + 1)\n else\n self.date = ZDate.format_date(year + 1)\n end\n end", "def calculate_month_by_month\n return StandardError, 'Already calculated stats for period' if @calculated.include?(:month_by_month)\n check_for_dates\n\n months_list.each do |date|\n start = date.beginning_of_month\n final = date.end_of_month\n month_key = start.strftime(MONTH_KEY)\n\n calculate_stats_for(month_key, Statistic::VIEW, start, final)\n calculate_stats_for(month_key, Statistic::STREAM, start, final) if include_streaming\n calculate_stats_for(month_key, Statistic::DOWNLOAD, start, final)\n end\n @calculated << :month_by_month\n self\n end", "def month_payment(dept)\n result = Hash.new\n credit_percent = (dept * @percent/12)\n credit_payment = (@base - credit_percent)\n result[:res_credit_payment] = credit_payment\n result[:res_credit_percent] = credit_percent\n result[:res_credit] = @base\n result[:res_remainder] = (dept - credit_payment)\n result\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\n @year = params[:year].to_i\n @month = params[:month].to_i\n @first_day = @event.first_day_of_month(@year, @month)\n @last_day_of_month = Date.new(@year, @month, 1).end_of_month\n end", "def monthly(options = {})\n branch options.merge(every: :month)\n end", "def monthly(options = {})\n branch options.merge(every: :month)\n end", "def months ; self * 30.days ; end", "def monthly_payment(salary_per_annum)\n return salary_per_annum / 12\nend", "def month\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 get_month(year, month)\n entries = month_entries(@pages, year, month) \n\n budget_month = BudgetMonth.new(entries, year, month)\n\n budget_month\n end", "def rsmonth(month)\n case month\n when 1\n return 'januar'\n when 2\n return 'februar'\n when 3\n return 'mart'\n when 4\n return 'april'\n when 5\n return 'maj'\n when 6\n return 'jun'\n when 7\n return 'jul'\n when 8\n return 'avgust'\n when 9\n return 'septembar'\n when 10\n return 'oktobar'\n when 11\n return 'novembar'\n when 12\n return 'decembar'\n end\nend", "def payment_data(period_data = 'this_month')\n res = payments.completed\n range, daily_report = period_data.to_s.report_period_to_range\n data = [[period_data.to_s.report_period_to_title] + UserGroup::PAYMENT_GOALS.values]\n range.each do |d| \n r = [d.beginning_of_day, (daily_report ? d.end_of_day : d.end_of_month.end_of_day)]\n d = [d.strftime(daily_report ? '%d' : '%Y-%m')]\n UserGroup::PAYMENT_GOALS.each{|k, v| d << res.where(payment_at: r[0]..r[1], goal: k).sum(:amount).to_f }\n data << d\n end\n data\n end", "def month_name(number); end", "def card_month\n card[:month].to_i\n end" ]
[ "0.66572005", "0.6550886", "0.6426259", "0.6388943", "0.6368296", "0.6368296", "0.6343893", "0.63118684", "0.62379336", "0.62376076", "0.6217388", "0.6216285", "0.6178661", "0.61545473", "0.61245275", "0.6068385", "0.60121477", "0.60079324", "0.5964177", "0.5949472", "0.5949472", "0.5933059", "0.59314907", "0.59255236", "0.5914241", "0.5902927", "0.58894813", "0.5888177", "0.58801395", "0.58759433" ]
0.6724994
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def month() end", "def expenses_for(m)\n d = Date.parse(m)\n exp = self.expenses.within_range(d, ((d + 1.month) - 1.day)).sum(:amount)\n exp.nil? ? 0 : exp\n end", "def month_depot\n \"#{depot.name} \"+\"#{issue_date.strftime(\"%b\")} \"+\"#{issue_date.year}\"\n end", "def month; end", "def month; end", "def monthly\n 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 month=(_arg0); end", "def calculate_month_by_month\n return StandardError, 'Already calculated stats for period' if @calculated.include?(:month_by_month)\n check_for_dates\n\n months_list.each do |date|\n start = date.beginning_of_month\n final = date.end_of_month\n month_key = start.strftime(MONTH_KEY)\n\n calculate_stats_for(month_key, Statistic::VIEW, start, final)\n calculate_stats_for(month_key, Statistic::STREAM, start, final) if include_streaming\n calculate_stats_for(month_key, Statistic::DOWNLOAD, start, final)\n end\n @calculated << :month_by_month\n self\n end", "def month_by_month_table(event)\n headers = ['Title']\n month_column_headers = months_list.map { |m| m.strftime(MONTH_KEY) }\n headers.concat(month_column_headers)\n table = [headers]\n\n each do |item|\n monthly_stats = months_list.map { |m| item.get_stat(event, m.strftime(MONTH_KEY)) }\n table << [item.document.title].concat(monthly_stats)\n end\n\n total_stats = months_list.map { |m| total_for(event, m.strftime(MONTH_KEY)) }\n table << ['Totals:'].concat(total_stats)\n\n table\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 month_names; end", "def index\n if @expense.nil?\n today = Date.today\n year = params[:year].to_i if params[:year]\n month = params[:month].to_i if params[:month]\n \n @date = today\n \n if year && month\n day = today.day\n if year != today.year || month != today.month\n day = 1\n end\n @date = Date.civil(year, month, day)\n end\n else\n @date = @expense.date\n end\n \n @expenses = Expense.by_month(@date)\n \n respond_to do |format|\n format.html { render :action => 'index' }\n format.xml { render :xml => @expenses }\n end\n end", "def make_month_stats(month)\n rows = Account.all(:order => \"position\").map{|account|\n items = Item.all(:conditions => {\n :account_id => account.id,\n :date => month_range(month), \n :type => [\"Expense\", \"Income\"]\n }).group_by(&:category)\n\n make_row(account.name, items)\n }\n\n return rows.push make_sum_row(rows)\n end", "def month\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 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 show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end", "def months() 30 * days end", "def month\n set_function_and_argument(:month, nil)\n end", "def displayTransactionsMonth(month)\n displayTransactionsBlankRow\n row do\n @pastMonthDeployed = true\n column(getRuleString(@transWidth_1))\n column(getRuleString(@transWidth_2))\n column(getRuleString(@transWidth_3))\n column(\" [ #{month.upcase} ] #{getRuleString(@transWidth_4 - (month.length + 6))}\")\n column(getRuleString(@transWidth_5))\n column(getRuleString(@transWidth_6))\n column(getRuleString(@transWidth_7))\n end\n displayTransactionsBlankRow\n end", "def rsmonth(month)\n case month\n when 1\n return 'januar'\n when 2\n return 'februar'\n when 3\n return 'mart'\n when 4\n return 'april'\n when 5\n return 'maj'\n when 6\n return 'jun'\n when 7\n return 'jul'\n when 8\n return 'avgust'\n when 9\n return 'septembar'\n when 10\n return 'oktobar'\n when 11\n return 'novembar'\n when 12\n return 'decembar'\n end\nend", "def calculated_spend_by_month\n return if !organisation.respond_to?(:payments) || organisation.payments.count == 0\n res_hsh = {}\n group_by = case ActiveRecord::Base.connection.adapter_name\n when 'MySQL'\n # https://github.com/django/django/blob/master/django/db/backends/mysql/base.py#L207\n \"CAST(DATE_FORMAT(date, '%Y-%m-01 00:00:00') AS DATETIME)\"\n else # PostgreSQL\n # https://github.com/django/django/blob/master/django/db/backends/postgresql_psycopg2/operations.py#L35\n \"DATE_TRUNC('month', date)\"\n end\n ft_sums = organisation.payments.sum(:value, :conditions => {:date_fuzziness => nil}, :group => group_by).to_a\n fuzzy_sums = organisation.payments.all(:select => 'SUM(value) AS value, date, date_fuzziness', :conditions => \"date_fuzziness IS NOT NULL\", :group => 'date, date_fuzziness')\n\n fuzzy_sums.each{ |fs| ft_sums += fs.averaged_date_and_value }\n\n ft_sums.each do |ft_sum|\n res_hsh[ft_sum.first.to_date.beginning_of_month] = res_hsh[ft_sum.first.to_date.beginning_of_month].to_f + ft_sum.last\n end\n\n months_with_vals = res_hsh.sort\n \n first_month, last_month = months_with_vals.first, months_with_vals.last\n spend_by_month_array(first_month.first, last_month.first, months_with_vals)\n end", "def each_month\n @all_expenses ||= Expense.find(:all, :order => 'date')\n return if @all_expenses.empty?\n date = @all_expenses.first.date.beginning_of_month\n end_date = @all_expenses.last.date\n while date <= end_date\n yield date\n date += 1.month\n end\n end", "def index\n @expense_by_category_and_month = {}\n @expense_by_category = {}\n expenses_total_by_month = {}\n @expense_month = []\n @expense_total = []\n @expenses = current_user.expenses.all\n if @expenses.present?\n @start_date = @expenses[0].date\n end\n\n\n # hack to make sure it is not nil\n @expense_by_category_and_month['Bills & Utilities'] = []\n @expense_by_category_and_month['Food & Dining'] = []\n @expense_by_category_and_month['Auto & Transport'] = []\n @expense_by_category_and_month['Entertainment'] = []\n @expense_by_category_and_month['Health & Fitness'] = []\n @expense_by_category_and_month['Shopping'] = []\n @expense_by_category_and_month['Kids'] = []\n @expense_by_category_and_month['Pet'] = []\n @expense_by_category_and_month['Home'] = []\n @expense_by_category_and_month['Uncatagorized'] = []\n\n expense_by_month_by_category = {}\n\n current_user.expenses.select(\"to_char(expenses.date, 'YYYY-MM') as expense_month, expenses.category as expense_category, SUM(expenses.amount_cents) as total\").group(\"category, to_char(expenses.date, 'YYYY-MM')\").order(\"to_char(expenses.date, 'YYYY-MM'), category\").each do | exp |\n\n # Use for column\n if not expense_by_month_by_category.has_key?(exp.expense_month)\n expense_by_month_by_category[exp.expense_month] = {}\n end\n expense_by_month_by_category[exp.expense_month][exp.expense_category] = exp.total.to_i/100\n\n\n # Expense by category and month within category\n #if not @expense_by_category_and_month.has_key?(exp.expense_category)\n # @expense_by_category_and_month[exp.expense_category] = []\n #end\n #@expense_by_category_and_month[exp.expense_category] << exp.total.to_i/100\n\n # Use for pie chart\n if not @expense_by_category.has_key?(exp.expense_category)\n @expense_by_category[exp.expense_category] = exp.total.to_i/100\n else\n @expense_by_category[exp.expense_category] += exp.total.to_i/100\n end\n\n # Total expenses by month\n if expenses_total_by_month[exp.expense_month].present?\n expenses_total_by_month[exp.expense_month] += exp.total.to_i/100\n else\n expenses_total_by_month[exp.expense_month] = exp.total.to_i/100\n end\n end\n\n # Calculate the columns. Handle missing ones\n expense_by_month_by_category.keys.sort.each do | month |\n @expense_by_category_and_month.keys.each do | category |\n if expense_by_month_by_category[month][category].present?\n @expense_by_category_and_month[category] << expense_by_month_by_category[month][category]\n else\n @expense_by_category_and_month[category] << 0\n end\n end\n\n end\n\n\n #current_user.expenses.select(\"to_char(expenses.date, 'YYYY-MM') as expense_month, SUM(expenses.amount_cents) as total\").group(\"to_char(expenses.date, 'YYYY-MM')\").each do | exp |\n # expenses_total_by_month[exp.expense_month] = exp.total.to_i/100\n #end\n\n expenses_total_by_month.sort.map {|k,v| @expense_total << v}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n rescue\n puts \"#{$!}\"\n end", "def monthly_summary_params\n params.require(:monthly_summary).permit(:year, :month, :begin_at, :end_at, :carryover_amount, :this_month_amount, :amount, :customer_id)\n end", "def index\n d = Date.today\n @expenses = @household.expenses.monthly_statement(d.month, d.year).order(spent_at: :desc)\n end", "def report_period_to_title\n case self\n when 'this_month'\n 'Days'\n when 'last_month'\n 'Days'\n when 'last_6_months'\n 'Months'\n when 'this_year'\n 'Months'\n end\n end" ]
[ "0.68188566", "0.677088", "0.666363", "0.66531795", "0.66531795", "0.6549146", "0.63745123", "0.63384", "0.63263035", "0.6311498", "0.6289573", "0.6287287", "0.6285008", "0.62812096", "0.62656796", "0.61824304", "0.61760306", "0.6157619", "0.6134104", "0.60981125", "0.60656774", "0.6024642", "0.5998149", "0.59848404", "0.59718746", "0.59572816", "0.5956518", "0.59521407", "0.5927532", "0.59269506" ]
0.6889355
0
Returns an Array of dependencies on the target
def dependency_list @target.dependencies.map(&:display_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 dependencies\n []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies(source, done=[])\n d_path = source.ext(\"d\") # get the dependency file\n Rake::Task[d_path].invoke # ensure the dependency file exists\n d_file = IO.read(d_path) # read the dependencies from dependency file\n d_file = d_file.split(': ')[1].gsub(\"\\n\",'').gsub('\\\\ ','').gsub(/\\s+/,' ').split(' ') # get a list of dependencies\n d_list = [] # list of dependencies\n # only save dependencies which are in our source directories\n d_file.each do |d|\n SRC_DIRS.each do |dir|\n if File.dirname(d)==dir then\n d_list << d\n end\n end\n end\n # get the dependencies of these dependencies, if we don't know them already\n done << source.ext(\"o\")\n done.uniq!\n d_list.each do |d|\n d = d.ext(\"o\")\n next if done.include? d\n done += dependencies(d, done)\n end\n done.uniq!\n return done\nend", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies_for(specification)\n []\n end", "def dependencies\n @dependencies\n end", "def get_dependencies\n @dependencies\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 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 runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def dependency_paths\n @dependency_paths ||= []\n end", "def dependencies\n manager.dependencies\n end", "def dependencies\n self.config.depends || []\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def dependencies\n @dependencies ||= {}\n end", "def dependencies\n node.output[carrier].keys\n end" ]
[ "0.78034174", "0.77154183", "0.7679972", "0.76735425", "0.76414096", "0.7542985", "0.7542985", "0.7542985", "0.7542985", "0.74957013", "0.7423224", "0.7314318", "0.7239806", "0.7239806", "0.7239806", "0.7198187", "0.71836644", "0.7183548", "0.7125391", "0.70432097", "0.703956", "0.70287883", "0.7027921", "0.687791", "0.68747866", "0.6862177", "0.6852439", "0.68385816", "0.6809505", "0.68086874" ]
0.80951196
0
Returns names of files with duplicates imports.
def files_with_duplicate_imports files.select(&:has_duplicate_import?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_unique_imports\n files.map(&:all_imports).flatten.uniq\n 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 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 unique_modules\n @unique_modules\n end", "def package_files\n (rdoc_files + lib_files + tests + doc_files + \n programs + extra_files + extension_files).uniq\n end", "def unique_classes_and_modules\n @unique_classes + @unique_modules\n end", "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 find_same_files\n # loop over find_similar_files groups\n # diff -b file1 file2\n end", "def resolve_conflict(files)\n filename = files\n .map {|f| f['path']}\n .sort\n .first\n puts %[rm \"#{filename}\"]\nend", "def file_extensions\n [@file_extensions].flatten.compact.uniq\n end", "def file_patterns\n [@file_patterns].flatten.compact.uniq\n end", "def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end", "def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end", "def files\n @files ||= lambda {\n sorted_relevant_files = []\n\n file_globs.each do |glob|\n current_glob_files = Pathname.glob(glob)\n relevant_glob_files = relevant_files & current_glob_files\n\n relevant_glob_files.map! do |file|\n File.new(path: file,\n namespaces: namespaces,\n decryption_keys: decryption_keys,\n encryption_keys: encryption_keys,\n signature_name: signature_name)\n end\n\n sorted_relevant_files += relevant_glob_files\n end\n\n sorted_relevant_files.uniq\n }.call\n end", "def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\t\tasset[att].values.compact.map do |path|\r\n\t\t\t\t\t\tpath.sub!(/#.+/,'')\r\n\t\t\t\t\t\tabsolute_path(path) unless path.empty?\r\n\t\t\t\t\tend.compact\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind.flat_map do |asset|\r\n\t\t\t\tasset.properties.select{ |name,prop| prop.type=='Texture' }.flat_map do |name,prop|\r\n\t\t\t\t\tasset[name].values.compact.uniq.map{ |path| absolute_path(path) }\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind(_type:'Text').flat_map do |asset|\r\n\t\t\t\tasset['font'].values.compact.map{ |font| absolute_path(font) }\r\n\t\t\tend +\r\n\t\t\[email protected]('/UIP/Project/Classes/*/@sourcepath').map{ |att| absolute_path att.value }\r\n\t\t).uniq\r\n\tend", "def unprocessed_files\n Dir.glob(@data_location + '/*.jl').sort\n end", "def source_files\n @source_files ||= find_files( @source_search_paths, @source_file_extension ).uniq\n @source_files\n end", "def files\n modules = (changed?) ? tag_configuration_plugins.collect {|p| p.plugin.modules} : \n plugins.collect {|p| p.modules}\n modules << Plugin::JshubCore.instance.modules\n modules.flatten!\n modules.sort!\n modules.uniq.collect { |m| m.name }\n end", "def file_sets\n @iss_file.file_sets.select {|fs| fs.components.include? name }\n end", "def existing\n select { |fn| File.exist?(fn) }.uniq\n end", "def tag_manifested_files\n tagmanifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n path\n end\n }\n (acc + files).uniq\n end\n end", "def manifest_files\n files = []\n exclude = Regexp.new(PROJ.exclude.join('|'))\n Find.find '.' do |path|\n path.sub! %r/^(\\.\\/|\\/)/o, ''\n next unless test ?f, path\n next if path =~ exclude\n files << path\n end\n files.sort!\nend", "def duplicate_names\n array = all.pluck(:name)\n array.select{|element| array.count(element) > 1 }.uniq\n end", "def duplicate_names\n array = all.pluck(:name)\n array.select{|element| array.count(element) > 1 }.uniq\n end", "def manifested_files\n manifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n decode_filename(path)\n end\n }\n\n (acc + files).uniq\n end\n end", "def test_files\n files = tests\n files = files.map{ |f| Dir[f] }.flatten\n files = files.map{ |f| File.directory?(f) ? Dir[File.join(f, '**/*.rb')] : f }\n files = files.flatten.uniq\n files = files.map{ |f| File.expand_path(f) }\n files\n end" ]
[ "0.8267978", "0.7631692", "0.6641064", "0.64679164", "0.6379785", "0.6194772", "0.61196035", "0.6074548", "0.5990646", "0.5987395", "0.59770125", "0.59103966", "0.58946514", "0.5876847", "0.5834983", "0.57414603", "0.57414603", "0.5686114", "0.5671773", "0.5630323", "0.55875474", "0.5576867", "0.5555629", "0.552148", "0.54817456", "0.5473683", "0.54722714", "0.54717946", "0.54510623", "0.54377353" ]
0.8417419
0
Returns the unused dependencies on the target
def unused_dependencies_list imports = all_unique_imports.map { |import| import.split.last } dependency_list - imports end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 enabled_dependencies\n @dependencies.reject(&:ignore?)\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 runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def dependencies\n []\n end", "def dependencies\n []\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 skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def required_dependencies\n dependencies - optional_dependencies\n end", "def dependencies\n @dependencies.values\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def dependencies\n @dependencies\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def dependencies\n\t\t0\n\tend", "def get_dependencies\n @dependencies\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def dependencies\n @dependencies ||= {}\n end", "def linkDepsOrdered()\n\t\ttempLinkDeps = BuildEnv::allLinkDepsOrdered(target()) - targets().to_a #in correct order for the link line\n\t\t#remove project-internal static libs; since the object files we need are in our list anyway, we never need to include intlibs in executables\n\t\tfinalLinkDeps = tempLinkDeps.select {|entity| BuildEnv::entityTypeSafe(entity)[0] != :intlib}\n\t\treturn finalLinkDeps\n\tend", "def os_dependencies\n []\n end", "def getDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getDeps(csproj) \r\n end\r\n return deps.uniq\r\nend", "def get_dependencies(_fidl, _interaction_types, _project_dependencies)\n # noop\n end", "def test_dependencies\n []\n end" ]
[ "0.75177723", "0.7088838", "0.6891703", "0.68696356", "0.6738311", "0.6725072", "0.66946477", "0.66920424", "0.6681482", "0.6672426", "0.66719073", "0.6666976", "0.66294324", "0.6573338", "0.65641856", "0.65641856", "0.65641856", "0.65641856", "0.6527892", "0.64535195", "0.64527726", "0.64282703", "0.6411801", "0.6382588", "0.6344923", "0.6323369", "0.62908447", "0.6236199", "0.6210768", "0.6208544" ]
0.7489569
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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_duplicate_dependencies(installer)\n \n applicationTargets = [\n 'Pods-Base-Project',\n ]\n libraryTargets = [\n 'Pods-AnalyticsManager',\n ]\n\n embedded_targets = installer.aggregate_targets.select { |aggregate_target|\n libraryTargets.include? aggregate_target.name\n }\n embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }\n host_targets = installer.aggregate_targets.select { |aggregate_target|\n applicationTargets.include? aggregate_target.name\n }\n\n # We only want to remove pods from Application targets, not libraries\n host_targets.each do |host_target|\n host_target.xcconfigs.each do |config_name, config_file|\n host_target.pod_targets.each do |pod_target|\n if embedded_pod_targets.include? pod_target\n pod_target.specs.each do |spec|\n if spec.attributes_hash['ios'] != nil\n frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']\n else\n frameworkPaths = spec.attributes_hash['vendored_frameworks']\n end\n if frameworkPaths != nil\n frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|\n extension = File.extname filename\n File.basename filename, extension\n end\n frameworkNames.each do |name|\n puts \"Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}\"\n config_file.frameworks.delete(name)\n end\n end\n end\n end\n end\n xcconfig_path = host_target.xcconfig_path(config_name)\n config_file.save_as(xcconfig_path)\n end\n end\n\nend", "def clean()\n\t\tSystem::clean target()\n\tend", "def clean()\n\t\tSystem::clean target()\n\tend", "def remove\n unrealize\n remove_from_dependencies\n remove_from_dependents\n end", "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 clean(*includes)\n Rake.application.IncludeCleanTargets(includes)\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def remove_dependencies(package_names, verbose=false)\n\n hard_deps = dependencies.dup\n old_deps = build_local_dependency_list(false)\n\n package_names.each do |pkg_name|\n raise \"'#{pkg_name}' is not a dependency\" if hard_deps[pkg_name].nil?\n hard_deps.delete pkg_name\n end\n\n @dependencies = hard_deps\n rebuild_dependency_list hard_deps, verbose\n\n old_deps.each do |dep|\n next if local_deps.find { |pkg| (pkg.name == dep.name) && (pkg.version == dep.version) }\n say \"Removed package '#{dep.name}' (#{dep.version})\"\n end\n\n save!\n\n end", "def reset\n @dependencies_are_ready = nil\n @dependencies_have_failed = nil\n reset_forward\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_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 clean\n build addl_cmake_bld_args: '--target clean'\n end", "def no_project_dependencies\n @project_dependencies = false\n end", "def remove_package_deps(pkg_name)\n if @index[:packages].key?(pkg_name) &&\n !@index[:packages][pkg_name].empty?\n @index[:packages][pkg_name].each do |dep|\n @index[:deps][dep].delete(pkg_name)\n end\n end\n end", "def cleanup_nontarget_files\n\n delete_dir = File.expand_path(File.join(app.build_dir, 'Resources/', 'Base.lproj/', 'assets/', 'images/'))\n\n puts_blue \"Cleaning up excess image files from target '#{options.Target}'\"\n puts_red \"Images for the following targets are being deleted from the build directory:\"\n\n (options.Targets.keys - [options.Target]).each do |target|\n\n puts_red \"#{target.to_s}\"\n Dir.glob(\"#{delete_dir}/**/#{target}-*.{jpg,png,gif}\").each do |f|\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n puts_red \"\\nImages prefixed all- are being deleted if a corresponding #{options.Target}- exists.\"\n\n Dir.glob(\"#{delete_dir}/**/all-*.{jpg,png,gif}\").each do |f|\n if File.exist?( f.sub(\"all-\", \"#{options.Target}-\") )\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def clear_targets\n @builder_sets.clear\n end", "def delete_all\n target.clear\n end", "def delete_all_targets\n\t\tWmapTarget.delete_all\n\tend", "def orphan_tasks\n each_task.reject do |task|\n task.dependency_backward_any? or task.dependency_forward_any?\n end\n end", "def remove()\n CCProcess.start(\"sdk-manage --target --remove '#{@name}'\", (_ :removing_target) + \" #{@name}\", 60*15)\n @@targets.delete(@name)\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def clear_dependencies\n if self == ActiveRecord::Base.acl_manager.initial_destroy\n ActiveRecord::Base.acl_manager.destroy_pool = []\n ActiveRecord::Base.acl_manager.initial_destroy = nil\n end\n end", "def remove_dependencies(dependencies: required(\"dependencies\"), options: {}, **data)\n with_params = data.merge(dependencies: dependencies).reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.post(\"/tasks/#{gid}/removeDependencies\", body: with_params, options: options)), type: self.class, client: client)\n end", "def remove_nim_resources\n Log.log_info('In remove_nim_resources')\n @targets.each do |target|\n Log.log_debug('target=' + target)\n nim_lpp_source_resource = get_flrtvc_name(:NIM_res, target)\n exists = Nim.lpp_source_exists?(nim_lpp_source_resource)\n Log.log_debug('exists=' +\n exists.to_s)\n if exists\n Nim.remove_lpp_source(nim_lpp_source_resource)\n Log.log_debug('Removing NIM resource ' +\n nim_lpp_source_resource)\n else\n Log.log_debug('Already removed NIM resource ' +\n nim_lpp_source_resource)\n end\n end\n end" ]
[ "0.6889047", "0.6659218", "0.6656846", "0.653687", "0.647297", "0.647297", "0.63622", "0.6326725", "0.6312936", "0.6293903", "0.62418056", "0.62074286", "0.61986613", "0.6183366", "0.6173584", "0.61659145", "0.6149706", "0.6058918", "0.60501415", "0.60405105", "0.6039996", "0.60279554", "0.60116255", "0.59728134", "0.59500486", "0.5947637", "0.58850867", "0.58660233", "0.583699", "0.58285093" ]
0.85026187
0
Removes all the duplicate import statements from all the files linked to the target
def remove_duplicate_imports files.each(&:remove_duplicate_imports) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 all_unique_imports\n files.map(&:all_imports).flatten.uniq\n end", "def files_with_duplicate_imports\n files.select(&:has_duplicate_import?)\n end", "def clear\n @autoloaded_classes.to_a.reverse_each do |klass|\n RubyCodeAutoreloader::ClassLoader.remove_constant(klass)\n @autoloaded_classes.delete(klass)\n end\n\n @existing_modules_before_load.clear\n @autoloaded_files = []\n ActiveSupport::DescendantsTracker.clear\n ActiveSupport::Dependencies.clear\n end", "def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end", "def clear_import_cache\n self.import_cache = {}\n self.import_errors = false\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 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 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 clear_all\n clear_modules\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", "def cleanup\n reshaper_orig_cleanup\n\n # remove some unwanted pages\n pages.delete_if do |page|\n path = page.destination(source)\n path =~ /shared\\/layouts/ or\n path =~ /shared\\/includes/\n end\n\n # remove some unwanted static files\n static_files.delete_if do |file|\n file.path =~ /shared\\/includes/ or\n file.path =~ /\\.styl$/ or # stylus files should be generated into site.css\n file.path =~ /readme\\./ # readme files are for github\n end\n\n end", "def remove_non_base_statements\n remove_has_target_statements\n remove_has_body_statements\n end", "def remove_jcl_over_slf\n dir_glob = Dir.glob(File.join @app_dir, 'WEB-INF', 'lib', 'jcl-over-slf4*.jar')\n dir_glob.each do |f|\n File.delete f\n end\n end", "def remove_python_compiled_files path\n logger.debug(\"Now removing python object and compiled files from the virtualenv\")\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 reshuffle_jars()\n FileUtils.mkdir_p(\"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/\")\n FileUtils.cp(Dir[\"#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*\"],\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/\")\n # These have been placed in $CATALINA_HOME/lib\n [\"mail\", \"activation\", \"javamail\", \"commons-logging\", \"log4j\"].each do |jar|\n FileUtils.rm_rf(Dir[\"#{self.build_dir()}/src/webapp/WEB-INF/lib/#{jar}-*\"])\n end\n end", "def clean_arb_named_files(src)\n\n clean_list = $config[\"clean\"][\"remove_named\"].split(/,/)\n\n Find.find(src) do |path|\n next if File.basename(path) =~ /^\\._/\n clean_list.each do |name|\n next if path !~ /#{name}\\./\n FileUtils.rm(path,$options) if File.exists? path\n end\n\n end\nend", "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 unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def resolve_conflict(files)\n filename = files\n .map {|f| f['path']}\n .sort\n .first\n puts %[rm \"#{filename}\"]\nend", "def merge(import_statement)\n if import_statement.default_import &&\n @default_import != import_statement.default_import\n @default_import = import_statement.default_import\n clear_import_string_cache\n end\n\n if import_statement.named_imports?\n @named_imports ||= []\n original_named_imports = @named_imports.clone\n @named_imports.concat(import_statement.named_imports)\n @named_imports.sort!.uniq!\n clear_import_string_cache if original_named_imports != @named_imports\n end\n\n if @declaration_keyword != import_statement.declaration_keyword\n @declaration_keyword = import_statement.declaration_keyword\n clear_import_string_cache\n end\n end", "def fix_import(version_name, file)\n tempfile = file + '.tmp'\n outfile = File.new(tempfile, 'w')\n File.open(file, 'r') do |infile|\n infile.each do |line|\n if (line =~ /require.*Service.*\\.rb/)\n outfile << line.gsub(/require '(.*)Service(.*)\\.rb'/,\n \"require 'adwords4r/#{version_name}/\\\\1Service\\\\2'\")\n else\n outfile << line\n end\n end\n end\n outfile.close\n File.rename(tempfile, file)\nend", "def clear_ignored\n invalidate_ignored_package_names\n ignored_packages.clear\n end", "def remove_old_package\n template_files.clear\n test_cases.clear\n self.import_job = nil\n end", "def remove_dead_symlinks\n base_paths.each do |path|\n command = \"find #{path} -xtype l -delete\"\n Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)\n end\n end", "def remove_files_we_dont_need\n say 'Remove files we don\\'t need'\n build :remove_public_index\n build :remove_readme_rdoc\n end" ]
[ "0.6893452", "0.67451614", "0.6592932", "0.60712755", "0.60682005", "0.59842294", "0.5977443", "0.5866538", "0.5861052", "0.5858443", "0.58310634", "0.58169115", "0.578584", "0.57832396", "0.5782469", "0.5743226", "0.572319", "0.5685762", "0.56426513", "0.56395173", "0.56240135", "0.5604043", "0.55993277", "0.5598189", "0.55951893", "0.55675995", "0.5562231", "0.55611426", "0.5554449", "0.5518762" ]
0.83346874
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def index\n @books = Book.all\n render json: @books\n end", "def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @books = Book.all\n \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\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\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 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 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 index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\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 index\n @user_books = UserBook.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_books }\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 get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend", "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 books = current_user.books.all\n render json: { books: books }\n end", "def get_books(response)\n response[\"items\"]\nend", "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", "def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end", "def index\n @user_businesses = Business.where({user_id: current_user.id})\n render json: JSONAPI::Serializer.serialize(@user_businesses, is_collection: true)\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end", "def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def index\n @businesses = Business.all.offset(offset).limit(limit)\n render json: @businesses\n end", "def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end" ]
[ "0.7298897", "0.70421624", "0.695971", "0.69306314", "0.68328303", "0.67693084", "0.672795", "0.66955805", "0.66766506", "0.66766506", "0.66766506", "0.6676336", "0.6658967", "0.6612253", "0.6606977", "0.6593214", "0.65840733", "0.6574277", "0.65341747", "0.6504094", "0.6503924", "0.6502345", "0.64988303", "0.64973944", "0.64881", "0.64696425", "0.6466241", "0.6450122", "0.64476514", "0.64202905" ]
0.7229365
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "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 @books = Book.all\n render json: @books\n end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @books = Book.all\n \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\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\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 show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\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 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 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 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 list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end", "def get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend", "def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\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", "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 show\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end" ]
[ "0.699776", "0.6908427", "0.6835466", "0.6817468", "0.6666077", "0.66522855", "0.66353226", "0.66289055", "0.6626388", "0.6619751", "0.6619751", "0.6619751", "0.6552016", "0.6552016", "0.6552016", "0.6543199", "0.65218496", "0.65097106", "0.64712507", "0.6463741", "0.6460948", "0.64609283", "0.6440174", "0.6431381", "0.64251435", "0.64068", "0.64068", "0.6397528", "0.6397528", "0.6397528" ]
0.7402133
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 load_data\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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\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\t\t@book = Book.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @book }\n\t\tend\n\tend", "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 @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 @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 @cookbook = Cookbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cookbook }\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end", "def new\n @library_book = LibraryBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library_book }\n end\n end", "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "def new\n @business_object = BusinessObject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @business_object }\n end\n end", "def new\n # @collection = Collection.find(params[:collection_id])\n @book = @collection.books.build\n #original: @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" ]
[ "0.7581938", "0.7581938", "0.7566873", "0.75459146", "0.75042427", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7498681", "0.7489435", "0.747616", "0.74659175", "0.7336534", "0.73196006", "0.72637177", "0.7255175", "0.7254423", "0.7241786", "0.7231443", "0.720183", "0.720183", "0.7174863", "0.7166079" ]
0.7909274
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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\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 @business = Business.new(params[:business])\n\n respond_to do |format|\n if @business.save\n format.html { redirect_to action: \"index\"}\n format.json { render json: @business, status: :created, location: @business }\n else\n format.html { render action: \"new\" }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @business = Business.new(business_params)\n respond_to do |format|\n if @business.save\n format.html { redirect_to businesses_path, notice: I18n.t('commons.successfully_created') }\n format.json { render json: @business, status: :created, location: @business }\n else\n format.html { render action: \"new\" }\n format.json { render json: @business.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.create(booking_params)\n render json: booking\n end", "def create\n @business = Business.new(business_params)\n respond_to do |format|\n if @business.save\n format.html { redirect_to root_path, 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 @business = Business.new(business_params)\n\n respond_to do |format|\n if @business.save\n format.html { redirect_to @business, 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 @business = current_user.owned_businesses.new(business_params)\n\n respond_to do |format|\n if @business.save\n format.html { redirect_to business_path(@business), notice: 'Business was successfully created.' }\n format.json { render json: @business, status: :created, location: @business }\n else\n format.html { render action: \"new\" }\n format.json { render json: @business.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 @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, 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 @book = Book.new(params[:book])\n \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, 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 @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 @business = Business.new(business_params)\n @num = 1\n while Business.where([\"business_id = ?\", @num]).size > 0\n @num = @num + 1\n end\n @business.business_id = @num\n @business.user_email = current_user.email\n respond_to do |format|\n if @business.save\n format.html { redirect_to @business, 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 @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 @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, 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 @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, 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 @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, 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 @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, 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 @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, 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 @book = @collection.books.build(params[:book])\n #original: @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), 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 @borrowed_book = BorrowedBook.new(borrowed_book_params)\n\n respond_to do |format|\n if @borrowed_book.save\n format.html { redirect_to @borrowed_book, notice: \"Borrowed book was successfully created.\" }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to manage_books_path, 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 submit_business_api_call(date, begin_time, budget, location, itinerary)\n preferences_request_biz = current_user.supplemental_preferences\n designated_preference_biz = preferences_request_biz.sample\n category_request_biz = designated_preference_biz.business_categories.sample\n business_search_term = designated_preference_biz.keywords.sample\n open_date_time = user_input_to_unix(date, begin_time)\n user_budget = convert_to_yelp_budget(budget)\n y = YelpResponse.new\n response = y.get_businesses_response({term: business_search_term, categories: category_request_biz, location: location, price: user_budget, open_at: open_date_time, limit: 20})\n response_container = []\n response_container << response[\"businesses\"].sample\n response_convert_hash = {}\n response_convert_hash[\"businesses\"] = response_container\n handle_businesses_response(response_convert_hash, y, itinerary)\n end", "def create\n @book = Book.find(book_request_params[:book_id])\n @account = Account.find(params[:account_id])\n @book_request = BookRequest.new(book: @book, reader: @account, holder: @book.account)\n respond_to do |format|\n if @book_request.save\n format.json {\n render json:\n {\n book_id: @book_request.book_id,\n book_request_state: @book_request.state_name\n }\n }\n else\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n @categories = Category.all.order('name asc')\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_url, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @library_book = LibraryBook.new(params[:library_book])\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render json: @library_book, status: :created, location: @library_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend" ]
[ "0.65611285", "0.6463056", "0.6416757", "0.64146", "0.6325686", "0.62910694", "0.6285444", "0.62647307", "0.61569035", "0.6153173", "0.61375266", "0.61241496", "0.6092917", "0.6091869", "0.60832745", "0.6066547", "0.60340077", "0.6032788", "0.6032788", "0.6032788", "0.6032788", "0.6032788", "0.602", "0.59957033", "0.59897465", "0.5985564", "0.59847784", "0.598103", "0.59759074", "0.5971307" ]
0.7194014
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\[email protected] = book.title\n\t\t\[email protected] = strip_tags(book.description)\n\t\t\[email protected] = book.work.original_title\n\t\t\[email protected] = book.num_pages\n\t\t\[email protected] = book.average_rating\n\t\t\[email protected] = book.authors.author.name\n\t\t\[email protected] = book.publisher\n\t\t\[email protected]\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end", "def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n format.html { redirect_to aciton: \"index\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business.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 @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(business_params)\n format.html { redirect_to businesses_path, notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @business = Business.find(params[:id])\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\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\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def putBusiness( name, building_number, branch_name, address1, address2, address3, district, town, county, province, postcode, country, latitude, longitude, timezone, telephone_number, additional_telephone_number, email, website, category_id, category_type, do_not_display, referrer_url, referrer_name, destructive, delete_mode, master_entity_id)\n params = Hash.new\n params['name'] = name\n params['building_number'] = building_number\n params['branch_name'] = branch_name\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['district'] = district\n params['town'] = town\n params['county'] = county\n params['province'] = province\n params['postcode'] = postcode\n params['country'] = country\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['timezone'] = timezone\n params['telephone_number'] = telephone_number\n params['additional_telephone_number'] = additional_telephone_number\n params['email'] = email\n params['website'] = website\n params['category_id'] = category_id\n params['category_type'] = category_type\n params['do_not_display'] = do_not_display\n params['referrer_url'] = referrer_url\n params['referrer_name'] = referrer_name\n params['destructive'] = destructive\n params['delete_mode'] = delete_mode\n params['master_entity_id'] = master_entity_id\n return doCurl(\"put\",\"/business\",params)\n end", "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to businesses_path, notice: 'Business was successfully updated.' }\n format.json { render :index, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @business.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 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 @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\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 format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.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 @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to '/books', notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\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 format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\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 format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\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 format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\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 format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\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 format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\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 format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6816322", "0.68015784", "0.6615512", "0.64487374", "0.64161587", "0.6367759", "0.63424164", "0.6319049", "0.6302526", "0.6262543", "0.6261328", "0.6230062", "0.6225963", "0.62095773", "0.6199712", "0.6150143", "0.6147326", "0.61428815", "0.6136365", "0.61291105", "0.61208934", "0.6119501", "0.61129636", "0.61098146", "0.6104201", "0.6104201", "0.6104201", "0.6104201", "0.6104201", "0.6104201" ]
0.69470376
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @business = Business.find(params[:id])\n @business.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_businesses_url }\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 book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\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 @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\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 @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 :ok }\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 :ok }\n end\n end", "def destroy\n @business_object = BusinessObject.find(params[:id])\n @business_object.destroy\n\n respond_to do |format|\n format.html { redirect_to business_objects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/books\" }\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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 delete\n client.delete(\"/#{id}\")\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 :ok }\n end \n end", "def destroy\n @bl = Bl.find(params[:id])\n @bl.destroy\n\n respond_to do |format|\n format.html { redirect_to bls_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end" ]
[ "0.72218", "0.7198506", "0.7082027", "0.7044859", "0.6987978", "0.6974579", "0.6963525", "0.6953768", "0.6933736", "0.6933736", "0.6932949", "0.69251823", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.69176364", "0.6910351", "0.6903573", "0.6894569", "0.68894124", "0.6885215", "0.68775225" ]
0.77143854
0
GET /admin/digersayfas GET /admin/digersayfas.json
def index @admin_digersayfas = Admin::Digersayfa.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_admin_digersayfa\n @admin_digersayfa = Admin::Digersayfa.find(params[:id])\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 show\n @plan = Plan.find(params[:id])\n @plan_days = @plan.plan_days\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\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 @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 consulta\n fiesta = Fiesta.all\n render json: fiesta\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 get_all_taxes\n self.class.get(\"/aldebaran-taxes/v2/taxes\", :basic_auth => @auth)\n end", "def index\n @taxes = Tax.all\n\n render json: @taxes\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def index\r\n @classdays = Classday.all\r\n\r\n render json: @classdays\r\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def index\n @disfrazs = Disfraz.all\n end", "def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end", "def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end", "def index\n @pendaftaran_kelas = PendaftaranKela.all\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n\n respond_to do |format| \n format.html do\n @days = Day.all\n # Movement.permitted_for_user(@current_user).pluck(day)\n\n end\n format.json do\n end\n\n end\n\n end", "def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def flights_fields\n render json: Search.getFlightsFieldInfo()\n end", "def index\n @kegiatans = Kegiatan.all\n end", "def index\n @shipping_fees = ShippingFee.all\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devans }\n end\n end", "def show\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_fund }\n end\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def show\n @transportadora_fiscal_pass = Transportadora::FiscalPasse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transportadora_fiscal_pass }\n end\n end" ]
[ "0.6332812", "0.5838458", "0.5823415", "0.5746072", "0.5675711", "0.5658039", "0.5600863", "0.55869013", "0.5580449", "0.5578242", "0.5536106", "0.5519336", "0.5491851", "0.5478802", "0.54681295", "0.54366094", "0.5430967", "0.54264057", "0.5415979", "0.54115105", "0.5406339", "0.53944105", "0.538999", "0.53897154", "0.5382546", "0.5381569", "0.5380485", "0.53757393", "0.53600276", "0.53522605" ]
0.7174638
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_digersayfa_params\n params.require(:admin_digersayfa).permit(:baslik, :metin, :tur, :dosya) \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 add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "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 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 set_admin_digersayfa\n @admin_digersayfa = Admin::Digersayfa.find(params[:id])\n end", "def tank_fuelday_params\n params.require(:tank_fuelday).permit(:day, :data_asset_id, :user_id, :employee_id, :site_asset_id, asset_fueldays_attributes: AssetFuelday.attribute_names.map(&:to_sym).push(:_destroy))\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", "def create\n \n dns_entry_response = RestClient.post('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n\n if JSON.parse(dns_entry_response)[\"success\"]\n @dns_entry = DnsEntry.new(dns_entry_params)\n\n respond_to do |format|\n if @dns_entry.save\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully created.\" }\n format.json { render :show, status: :created, location: @dns_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n\n end", "def create\n @disfraz = Disfraz.new(disfraz_params)\n\n respond_to do |format|\n if @disfraz.save\n format.html { redirect_to @disfraz, notice: 'Disfraz was successfully created.' }\n format.json { render :show, status: :created, location: @disfraz }\n else\n format.html { render :new }\n format.json { render json: @disfraz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospitalization_day = @adverse_event.hospitalization_days.create(hospitalization_day_params)\n\n respond_to do |format|\n if @hospitalization_day.save\n format.html { redirect_to adverse_event_path(@adverse_event), notice: 'Día de estancia ingresado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @hospitalization_day }\n else\n format.html { render :new }\n format.json { render json: @hospitalization_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kegiatan = Kegiatan.new(kegiatan_params)\n\n respond_to do |format|\n if @kegiatan.save\n format.html { redirect_to @kegiatan, notice: 'Kegiatan was successfully created.' }\n format.json { render :show, status: :created, location: @kegiatan }\n else\n format.html { render :new }\n format.json { render json: @kegiatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @frais_annex = FraisAnnex.new(params[:frais_annex])\n\n respond_to do |format|\n if @frais_annex.save\n format.html { redirect_to @frais_annex, :notice => 'Le frais annexe a bien été créé' }\n format.json { render :json => @frais_annex, :status => :created, :location => @frais_annex }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_annex.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @appraisal_fee = AppraisalFee.new(appraisal_fee_params)\n @appraisal_fee.loan_id = session[:current_loan_id]\n\n respond_to do |format|\n if @appraisal_fee.save\n # format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully created.' }\n format.html { redirect_to Loan.find(@appraisal_fee.loan) }\n format.json { render action: 'show', status: :created, location: @appraisal_fee }\n else\n format.html { render action: 'new' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pay_fee = PayFee.new(pay_fee_params)\n\n respond_to do |format|\n if @pay_fee.save\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully created.' }\n format.json { render :show, status: :created, location: @pay_fee }\n else\n format.html { render :new }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pendaftaran = Pendaftaran.new(pendaftaran_params)\n\n respond_to do |format|\n if @pendaftaran.save\n format.html { redirect_to @pendaftaran, notice: \"Pendaftaran was successfully created.\" }\n format.json { render :show, status: :created, location: @pendaftaran }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pendaftaran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxfree = Taxfree.new(taxfree_params)\n\n respond_to do |format|\n if @taxfree.save\n format.html { redirect_to @taxfree, notice: 'Taxfree was successfully created.' }\n format.json { render :show, status: :created, location: @taxfree }\n else\n format.html { render :new }\n format.json { render json: @taxfree.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise penduduk_params.to_yaml\n @penduduk = Penduduk.new(penduduk_params)\n @golongan_darahs = GolonganDarah.all\n @agamas = Agama.all\n @pekerjaans= Pekerjaan.all\n @status_keluargas = StatusKeluarga.all\n @pendidikans = Pendidikan.all\n @kelurahans = Kelurahan.all\n @kecamatans = Kecamatan.all\n @kabupatens = Kabupaten.all\n @penghasilans = Penghasilan.all \n respond_to do |format|\n if @penduduk.save\n format.html { redirect_to @penduduk, notice: 'Penduduk was successfully created.' }\n format.json { render :show, status: :created, location: @penduduk }\n else\n format.html { render :new }\n format.json { render json: @penduduk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dias_semanas_vaga = DiasSemanasVaga.new(dias_semanas_vaga_params)\n\n respond_to do |format|\n if @dias_semanas_vaga.save\n format.html { redirect_to @dias_semanas_vaga, notice: 'Dias semanas vaga was successfully created.' }\n format.json { render :show, status: :created, location: @dias_semanas_vaga }\n else\n format.html { render :new }\n format.json { render json: @dias_semanas_vaga.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@klass_fee = KlassFee.new(params[:klass_fee])\n ap params[:fee]\n begin\n params[:fee].each do |fee_type_id, amount|\n puts \"=======xx==========\"\n ap KlassFee.create({klass_id: @klass.id, fee_type_id: fee_type_id, amount: amount[:amount]})\n end\n \n redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully created.'\n #rescue Exception => e\n # render action: \"new\" \n end\n end", "def create\n @essay = Essay.new(params[:essay])\n\n respond_to do |format|\n if @essay.save\n format.html { redirect_to @essay, notice: 'Essay was successfully created.' }\n format.json { render json: @essay, status: :created, location: @essay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @essay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zayavk = Zayavk.new(zayavk_params)\n\n respond_to do |format|\n if @zayavk.save\n format.html { redirect_to @zayavk, notice: 'Заявка была успешно создана.' }\n format.json { render :show, status: :created, location: @zayavk }\n else\n format.html { render :new }\n format.json { render json: @zayavk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @assay = Assay.new(params[:assay])\n\n respond_to do |format|\n if @assay.save\n format.html { redirect_to @assay, notice: 'Assay was successfully created.' }\n format.json { render json: @assay, status: :created, location: @assay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fee_structure = FeeStructure.new(fee_structure_params)\n\n respond_to do |format|\n if @fee_structure.save\n format.html { redirect_to fee_structures_path, notice: 'Fee structure was successfully created.' }\n format.json { render :show, status: :created, location: @fee_structure }\n else\n format.html { render :new }\n format.json { render json: @fee_structure.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.59678805", "0.58623284", "0.5756909", "0.5643321", "0.55046505", "0.54953986", "0.5492916", "0.54927695", "0.54807836", "0.5457218", "0.5453056", "0.5415985", "0.535122", "0.5335929", "0.53337973", "0.5330513", "0.5296965", "0.5279655", "0.5257377", "0.52537113", "0.52519494", "0.52122545", "0.52028686", "0.5200855", "0.5197822", "0.51896465", "0.5175817", "0.5156104", "0.51527995", "0.51477444" ]
0.6569528
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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\r\n respond_to do |format|\r\n @egresso.skip_fields_validation = false\r\n if @egresso.update(egresso_params)\r\n if current_admin.try(:adm?)\r\n format.html { redirect_to egressos_path, notice: 'Egresso atualizado com sucesso.' }\r\n format.json { render :show, status: :ok, location: egressos_path }\r\n else\r\n format.html { redirect_to :back, notice: 'Dados atualizados com sucesso.' }\r\n format.json { render :show, status: :ok, location: :back }\r\n end\r\n\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @egresso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\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 patch!\n request! :patch\n end", "def update\n data = tenant_update_params\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"customer_id\": @tenant.customer_id,\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/edit\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n respond_to do |format|\n if response[\"status\"] == 200\n if @tenant.update(tenant_update_params)\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n if @tenant.active == true\n end\n end\n @tenant.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { redirect_to tenants_url, notice: 'Tenant was not updated.' }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\nend", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\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_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 patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n respond_to do |format|\n if @tipo_despesa.update(tipo_despesa_params)\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_despesa }\n else\n format.html { render :edit }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\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 patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\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 respond_to do |format|\n if @adminwenhua.update(adminwenhuas_paths)\n format.html { redirect_to adminwenhuas_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @adminwenhua }\n else\n format.html { render :edit }\n format.json { render json: @adminwenhuas.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\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_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @admin = Admin.find(params[:id])\n\n if @admin.update(admin_params)\n head :no_content\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @admin_pricing_fabric.update(admin_pricing_fabric_params)\n format.html { redirect_to admin_pricing_fabrics_path, notice: mk_notice(@admin_pricing_fabric, @admin_pricing_fabric.brand.name, 'قیمت برای برند‌ پارچه', :update) }\n format.json { render json: @admin_pricing_fabric, status: :ok, location: admin_pricing_fabrics_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_pricing_fabric.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gaz_assay = GazAssay.find(params[:id])\n @authorized_user = User.find(session[:user_id])\n respond_to do |format|\n if @gaz_assay.update_attributes(params[:gaz_assay])\n format.html { redirect_to gaz_assays_url, notice: 'Данные качественного анализа газа успешно скорректированы.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gaz_assay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @tenant.update(tenant_params)\n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n format.html { redirect_to @tenant, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { render :edit }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n\n if params[:generate_lease]\n generate_lease(@tenant)\n elsif params[:expense_add]\n expense_addendum(@tenant)\n else\n #do nothing\n end\n\n end", "def update\n respond_to do |format|\n if @admin_recurso.update(admin_recurso_params)\n format.html { redirect_to @admin_recurso, notice: 'Recurso was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_recurso }\n else\n format.html { render :edit }\n format.json { render json: @admin_recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end" ]
[ "0.6654816", "0.6445601", "0.62220114", "0.6175265", "0.61671823", "0.6163973", "0.6111223", "0.60848165", "0.603647", "0.6017741", "0.6017741", "0.5998265", "0.5995518", "0.59791595", "0.5892284", "0.5880789", "0.58544594", "0.58405834", "0.58374256", "0.5806576", "0.5792266", "0.57700634", "0.5769394", "0.5759633", "0.57514185", "0.57189304", "0.57141125", "0.5705195", "0.5700815", "0.5700815" ]
0.68653923
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete\n request(:delete)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n api(\"Delete\")\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete path\n make_request(path, \"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 delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete!\n request! :delete\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def delete\n\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 delete\n api_client.delete(url)\n end", "def delete\n \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 \n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end" ]
[ "0.74236", "0.7324176", "0.7195265", "0.71433914", "0.71433914", "0.71433914", "0.71433914", "0.70854354", "0.7054274", "0.69827485", "0.6969745", "0.6968206", "0.6907897", "0.6904587", "0.68939435", "0.68937755", "0.68937755", "0.6888857", "0.6878041", "0.68323946", "0.6807762", "0.67919606", "0.6791511", "0.6785738", "0.6770234", "0.6755147", "0.67380315", "0.6736664", "0.67296535", "0.6719949" ]
0.75525564
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @instancia = Instancium.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 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 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 dame_institucion\n i = Metamares::Institucion.new\n i.nombre_institucion = params[:nombre_institucion]\n\n respond_to do |format|\n format.json { render json: i.busca_institucion.map{ |i| { id: i.id, value: i.nombre_institucion } } }\n format.html { @institucion = i }\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 @institucions = Institucion.search(params[:search], params[:page])\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 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 @iniciativa = Iniciativa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @iniciativa }\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 index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def index\n @instituicao_responsavels = InstituicaoResponsavel.all\n end", "def index\n @inventarios = Inventario.all\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def index\n @integrantes = Integrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @integrantes }\n end\n end", "def show\n @institucion = Institucion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institucion }\n end\n end", "def index\n @inscricaos = Inscricao.all\n end", "def index\n @inscripcions = Inscripcion.all\n end", "def index\n @instituicao_cursos = InstituicaoCurso.all\n end", "def show\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entrada_inventario }\n end\n end", "def show\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicacao }\n end\n end" ]
[ "0.751949", "0.6958533", "0.68788326", "0.68244416", "0.6755332", "0.6747474", "0.67021245", "0.6619203", "0.6611335", "0.66074824", "0.6586544", "0.65787476", "0.64574796", "0.64278275", "0.641245", "0.6407009", "0.640509", "0.640509", "0.63766575", "0.63558304", "0.634916", "0.6342545", "0.63383824", "0.63339275", "0.63058066", "0.627389", "0.6253505", "0.6242972", "0.6240181", "0.6233277" ]
0.7875285
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 dame_institucion\n i = Metamares::Institucion.new\n i.nombre_institucion = params[:nombre_institucion]\n\n respond_to do |format|\n format.json { render json: i.busca_institucion.map{ |i| { id: i.id, value: i.nombre_institucion } } }\n format.html { @institucion = i }\n end\n end", "def index\n @instancia = Instancium.all\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 @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 @institucion = Institucion.where(:id => params[:institucion_id]).first\n @institucioncatalogos = Institucioncatalogo.where(:institucion_id => params[:institucion_id])\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 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 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 @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @iniciativa = Iniciativa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @iniciativa }\n end\n end", "def show\n @institucion = Institucion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institucion }\n end\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def show\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicacao }\n end\n end", "def show\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entrada_inventario }\n end\n end", "def index\n @institucions = Institucion.search(params[:search], params[:page])\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @ivas = Iva.all\n\n render json: @ivas\n end", "def show\n @impuesto = Impuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @impuesto }\n end\n end", "def new\n @institucional = Institucional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institucional }\n end\n end", "def show\n @inspiration = Inspiration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inspiration }\n end\n end", "def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end", "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def index\n @integrantes = Integrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @integrantes }\n end\n end" ]
[ "0.7704511", "0.70620894", "0.69456315", "0.68963146", "0.6868936", "0.685834", "0.6730599", "0.66842204", "0.6682483", "0.6668672", "0.66208", "0.65291506", "0.65291506", "0.6524573", "0.65057886", "0.65046215", "0.65035135", "0.64633906", "0.64383066", "0.6434014", "0.6391661", "0.6387585", "0.63863957", "0.6347882", "0.6347221", "0.6334777", "0.63069344", "0.63044155", "0.62984186", "0.6263851" ]
0.766338
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 @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 @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", "def new\n @institucional = Institucional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institucional }\n end\n end", "def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n end\n end", "def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\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.json { render json: @instituicao, status: :created, location: @instituicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instituicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end", "def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "def new\n @tipo_convenio = TipoConvenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "def new\n @tenni = Tenni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenni }\n end\n end", "def new\n @institucion = Institucion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @institucion }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end", "def new\n @asignatura = Asignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asignatura }\n end\n end", "def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end", "def new\n @estatuto = Estatuto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estatuto }\n end\n end", "def new\n @inspiration = Inspiration.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inspiration }\n end\n end", "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "def new\n @publicidad = Publicidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publicidad }\n end\n end", "def new\n @coisa = Coisa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @coisa }\n end\n end", "def new\n @ci = Ci.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ci }\n end\n end", "def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end", "def new\n @status_de_la_inscripcion = StatusDeLaInscripcion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end" ]
[ "0.7481899", "0.74592733", "0.7392899", "0.7371191", "0.7345058", "0.7335122", "0.7324422", "0.72810566", "0.727145", "0.72610426", "0.7247983", "0.7228057", "0.72174495", "0.71782017", "0.7171193", "0.7157048", "0.7149544", "0.71336293", "0.71280897", "0.71144384", "0.70921487", "0.7088236", "0.7087868", "0.70860994", "0.70846593", "0.7081903", "0.7079993", "0.7073579", "0.70719343", "0.7069585" ]
0.79367125
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @institucion = Institucion.new(institucion_params)\n\n respond_to do |format|\n if @institucion.save\n format.html { redirect_to @institucion, notice: 'Empresa se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @institucion }\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 @instancium = Instancium.new(instancium_params)\n\n respond_to do |format|\n if @instancium.save\n format.html { redirect_to @instancium, notice: 'Instancium was successfully created.' }\n format.json { render :show, status: :created, location: @instancium }\n else\n format.html { render :new }\n format.json { render json: @instancium.errors, status: :unprocessable_entity }\n end\n end\n end", "def dame_institucion\n i = Metamares::Institucion.new\n i.nombre_institucion = params[:nombre_institucion]\n\n respond_to do |format|\n format.json { render json: i.busca_institucion.map{ |i| { id: i.id, value: i.nombre_institucion } } }\n format.html { @institucion = i }\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 @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 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 @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 @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 instituto_params\n params.require(:instituto).permit(:nome, :sigla, :local)\n end", "def instituicao_params\n params.require(:instituicao).permit(:nome, :cod_mec, :mantenedora_id, :site, :sigla, :telefone, :org, :emails, :categoria, :endereco_id)\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", "def create\n @insumo = Insumo.new(insumo_params)\n\n respond_to do |format|\n if @insumo.save\n format.html { redirect_to insumos_url, notice: 'Insumo was successfully created.' }\n format.json { render :show, status: :created, location: @insumo }\n else\n format.html { render :new }\n format.json { render json: @insumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @infraccion = Infraccion.new(infraccion_params)\n\n respond_to do |format|\n if @infraccion.save\n format.html { redirect_to @infraccion, notice: 'Infraccion was successfully created.' }\n format.json { render :show, status: :created, location: @infraccion }\n else\n format.html { render :new }\n format.json { render json: @infraccion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @iscrizione = Iscrizione.new(iscrizione_params)\n\n respond_to do |format|\n if @iscrizione.save\n format.html { redirect_to @iscrizione, notice: \"Iscrizione was successfully created.\" }\n format.json { render :show, status: :created, location: @iscrizione }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @iscrizione.errors, status: :unprocessable_entity }\n end\n end\n 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 create\n\n @instum = current_user.insta.build(instum_params)\n # @instum.user_id = current_user.id\n\n respond_to do |format|\n if @instum.valid?\n @instum.save\n # binding.pry\n # redirect_to insta_path, notice: \"写真を投稿しました!\"\n # NoticeMailer.sendmail_insta(@instum).deliver\n format.html { redirect_to @instum, notice: '投稿が成功しました!' }\n format.json { render :show, status: :created, location: @instum }\n else\n format.html { render :new }\n format.json { render json: @instum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecnica_de_impresion = TecnicaDeImpresion.new(tecnica_de_impresion_params)\n\n respond_to do |format|\n if @tecnica_de_impresion.save\n format.html { redirect_to @tecnica_de_impresion, notice: 'Tecnica de impresion was successfully created.' }\n format.json { render :show, status: :created, location: @tecnica_de_impresion }\n else\n format.html { render :new }\n format.json { render json: @tecnica_de_impresion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @instituto.save\n format.html { redirect_to(@instituto, :notice => 'Instituto fue creado exitosamente.') }\n format.xml { render :xml => @instituto, :status => :created, :location => @instituto }\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 @instagrampic = Instagrampic.new(instagrampic_params)\n\n respond_to do |format|\n if @instagrampic.save\n format.html { redirect_to @instagrampic, notice: 'Instagrampic was successfully created.' }\n format.json { render :show, status: :created, location: @instagrampic }\n else\n format.html { render :new }\n format.json { render json: @instagrampic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n self.validar_admin\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 creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end", "def create\n @instance_eni = InstanceEni.new(instance_eni_params)\n\n respond_to do |format|\n if @instance_eni.save\n format.html { redirect_to @instance_eni, notice: 'Instance eni was successfully created.' }\n format.json { render :show, status: :created, location: @instance_eni }\n else\n format.html { render :new }\n format.json { render json: @instance_eni.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inscricao = Inscricao.new(inscricao_params)\n\n respond_to do |format|\n if @inscricao.save\n format.html { redirect_to @inscricao, notice: \"Inscricao was successfully created.\" }\n format.json { render :show, status: :created, location: @inscricao }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @inscricao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @insta_post = InstaPost.new(insta_post_params)\n\n respond_to do |format|\n if @insta_post.save\n format.html { redirect_to @insta_post, notice: 'Insta post was successfully created.' }\n format.json { render :show, status: :created, location: @insta_post }\n else\n format.html { render :new }\n format.json { render json: @insta_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interesado = Interesado.new(interesado_params)\n\n respond_to do |format|\n if @interesado.save\n format.html { redirect_to @interesado, notice: 'Interesado was successfully created.' }\n format.json { render :show, status: :created, location: @interesado }\n else\n format.html { render :new }\n format.json { render json: @interesado.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70578986", "0.68975914", "0.6834867", "0.6772598", "0.67714244", "0.6739272", "0.661475", "0.6461626", "0.64222103", "0.641717", "0.6408052", "0.640658", "0.64003813", "0.63718206", "0.6368992", "0.6346715", "0.6300704", "0.6297224", "0.6296384", "0.62830585", "0.62819237", "0.62807095", "0.6275996", "0.6263828", "0.62380576", "0.622548", "0.622294", "0.6213001", "0.62123185", "0.61935514" ]
0.7440674
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 respond_to do |format|\n if @institucion.update(institucion_params)\n format.html { redirect_to @institucion, notice: 'Empresa se ha actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @institucion }\n else\n format.html { render :edit }\n format.json { render json: @institucion.errors, status: :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\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 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 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 set_instituto\n @instituto = Instituto.find(params[:id])\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 @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 @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 @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 set_inventario\n @inventario = Inventario.find(params[:id])\n end", "def set_inventario\n @inventario = Inventario.find(params[:id])\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", "def update\n respond_to do |format|\n if @infraccion.update(infraccion_params)\n format.html { redirect_to @infraccion, notice: 'Infraccion was successfully updated.' }\n format.json { render :show, status: :ok, location: @infraccion }\n else\n format.html { render :edit }\n format.json { render json: @infraccion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inicio.update(inicio_params)\n format.html { redirect_to @inicio, notice: 'Inicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @inicio }\n else\n format.html { render :edit }\n format.json { render json: @inicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inscricao.update(inscricao_params)\n format.html { redirect_to @inscricao, notice: 'Inscricao was successfully updated.' }\n format.json { render :show, status: :ok, location: @inscricao }\n else\n format.html { render :edit }\n format.json { render json: @inscricao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.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.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @valores = Catalogo.all\n @institucion = Institucion.where(:id => institucioncatalogo_params['institucion_id']).first\n respond_to do |format|\n if @institucioncatalogo.update(institucioncatalogo_params)\n format.html { redirect_to institucion_institucioncatalogos_url(@institucion), notice: 'El registro se ha actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @institucioncatalogo }\n else\n format.html { render :edit }\n format.json { render json: @institucioncatalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inscricao.update(inscricao_params)\n format.html { redirect_to @inscricao, notice: \"Inscricao was successfully updated.\" }\n format.json { render :show, status: :ok, location: @inscricao }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @inscricao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @topico.update(topico_params)\n format.html { redirect_to set_path, notice: 'Tópico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n if @entrada_inventario.update_attributes(params[:entrada_inventario])\n format.html { redirect_to @entrada_inventario, notice: 'Entrada inventario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entrada_inventario.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6810022", "0.6726203", "0.6404884", "0.63641167", "0.636172", "0.6285308", "0.6285308", "0.6281354", "0.62721556", "0.62643033", "0.6262745", "0.625416", "0.6218062", "0.62179774", "0.6217759", "0.6217759", "0.6208347", "0.6200834", "0.6161696", "0.6144672", "0.6143541", "0.61388874", "0.6121636", "0.61123884", "0.6101549", "0.609833", "0.60949814", "0.6081268", "0.60787684", "0.6076496" ]
0.71600014
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @instancium.destroy\n respond_to do |format|\n format.html { redirect_to instancia_url, notice: 'Instancium was successfully destroyed.' }\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 @institucion.destroy\n respond_to do |format|\n format.html { redirect_to institucions_url, notice: 'Empresa se ha eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\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 @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\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\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", "def destroy\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 @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @indicacao = Indicacao.find(params[:id])\n @indicacao.destroy\n\n respond_to do |format|\n format.html { redirect_to indicacoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institucional = Institucional.find(params[:id])\n @institucional.destroy\n\n respond_to do |format|\n format.html { redirect_to institucionals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @interessado.destroy\n respond_to do |format|\n format.html { redirect_to interessados_url }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @infraccion.destroy\n respond_to do |format|\n format.html { redirect_to infraccions_url, notice: 'Infraccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instum.destroy\n respond_to do |format|\n format.html { redirect_to insta_url, notice: '投稿が削除されました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inicio.destroy\n respond_to do |format|\n format.html { redirect_to inicios_url, notice: 'Inicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventario.destroy\n respond_to do |format|\n format.html { redirect_to inventarios_url, notice: 'Inventario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventario.destroy\n respond_to do |format|\n format.html { redirect_to inventarios_url, notice: 'Inventario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @entrada_inventario = EntradaInventario.find(params[:id])\n @entrada_inventario.destroy\n\n respond_to do |format|\n format.html { redirect_to entrada_inventarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @instituicao_curso.destroy\n respond_to do |format|\n format.html { redirect_to instituicao_cursos_url, notice: 'Instituicao curso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7370825", "0.73668385", "0.73220986", "0.73165035", "0.7307515", "0.7260004", "0.71701807", "0.71200705", "0.7117085", "0.7117085", "0.7085163", "0.7083893", "0.7060684", "0.7056958", "0.7053504", "0.70364827", "0.7032805", "0.7027775", "0.70275205", "0.701552", "0.70151556", "0.70139253", "0.7012865", "0.7012865", "0.7006869", "0.6998561", "0.6994908", "0.6992323", "0.6990851", "0.6990851" ]
0.7671489
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\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_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend", "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 save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\n end\n end", "def create\n @item_datum = ItemData.new(params[:item_datum])\n\n respond_to do |format|\n if @item_datum.save\n format.html { redirect_to @item_datum, notice: 'Item datum was successfully created.' }\n format.json { render json: @item_datum, status: :created, location: @item_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end", "def data_item_params\n params.require(:data_item).permit(:name, :data_class_id, :data_source_id)\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\nend", "def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end", "def item_data(data)\r\n BnetApi.make_request(\"/d3/data/item/#{data}\")\r\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n @items.to_json\n end", "def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\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\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end", "def bulk_item_data\n prm = manifest_item_bulk_post_params\n items = prm[:data]\n raise_failure(\"not an Array: #{items.inspect}\") unless items.is_a?(Array)\n raise_failure('no item data') unless items.present?\n row = prm[:row].to_i\n delta = prm[:delta].to_i\n items.map do |item|\n raise_failure(\"not a Hash: #{item.inspect}\") unless item.is_a?(Hash)\n item[:manifest_id] = item.delete(:manifest) if item.key?(:manifest)\n if item[:manifest_id].blank?\n item[:manifest_id] = manifest_id\n elsif item[:manifest_id] != manifest_id\n raise_failure(\"invalid manifest_id for #{item.inspect}\")\n end\n row = (item[:row] ||= row)\n delta = (item[:delta] ||= delta + 1)\n ManifestItem.normalize_attributes(item).except!(:attr_opt)\n end\n end", "def post(payload, request_opts={})\n if payload.is_a?(Hash)\n payload = self.class.item_class.new(payload) # apply data type conversion\n end\n qs = payload.query_string_params\n payload = payload.as_hash\n response = http(request_opts).post(resolved_path + qs, payload)\n new_item = self.class.item_class.new\n new_item.store_result(response)\n new_item\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\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 attributes_for_new_item(data)\n { data: data }\n end", "def item_params\n params.require(:item).permit(:item, :body)\n end", "def add_multiple_food_items(items)\n items.each do |item|\n item['_id'] = FoodItem.create_id item[:api_key], item[:item_id]\n FoodItem.new_item item\n end\n items\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end", "def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6995797", "0.6736687", "0.67053056", "0.662083", "0.660447", "0.6530322", "0.64518636", "0.64164734", "0.6386439", "0.6361424", "0.63582677", "0.63432807", "0.62786186", "0.6271697", "0.62401927", "0.62266135", "0.61705756", "0.61504644", "0.61439097", "0.6133691", "0.61323947", "0.6121007", "0.61142045", "0.61101514", "0.6083331", "0.60808355", "0.607985", "0.6079417", "0.60624224", "0.6061215" ]
0.6744072
1
Get the underlying type size in bits
def type_size @type.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n (@bit_length*@length*@count)/8.0\n end", "def size\n @type.size\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 raw_num_bytes\n @type.num_bytes\n end", "def size\n BitCounter.count(@val)\n end", "def byte_size()\n @value.length * 4\n end", "def byte_size()\n @value.length * 4\n end", "def size\n if self.class.const_defined?(:BYTESIZE)\n self.class.const_get(:BYTESIZE)\n else\n raise NotImplementedError.new(\"#{self.class}#size\")\n end\n end", "def bit_set_size\n @bit_set.size\n 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 size\r\n @pack.size\r\n end", "def bLength\n self[:bLength]\n end", "def get_length_size\n return false if @data.empty?\n\n # High bits used for length type\n # Low bits used as first bits of length\n \n # 0xxxxxxx = 7 bit length\n # 10xxxxxx = 14 bit length\n # 110xxxxx = 21 bit length\n # 1110xxxx = 28 bit length\n # 11110000 = 32 bit length follows\n\n t = @data.unpack('C').first\n\n return 7 if t & 0b10000000 == 0\n return 14 if t & 0b01000000 == 0\n return 21 if t & 0b00100000 == 0\n return 28 if t & 0b00010000 == 0\n return 32 if t == 0b11110000\n\n raise ArgumentError, \"Invalid length type encoding\"\n end", "def sizeof_type(type)\n if is_pointer_type?(type)\n return pointer_size\n end\n\n if type.kind_of? String\n if is_array_type?(type)\n element_type, length = split_array_type(type)\n return length * sizeof_type(element_type)\n else\n return sizeof_type(type.to_sym)\n end\n end\n\n if is_struct_type?(type)\n return sizeof_struct(type)\n end\n\n if TYPE_DEFINITIONS.has_key?(type)\n primitive = TYPE_DEFINITIONS[type]\n\n if primitive == :pointer\n return pointer_size\n end\n\n if PRIMITIVE_TYPE_SIZES.has_key?(primitive)\n return PRIMITIVE_TYPE_SIZES[primitive]\n else\n raise \"Type #{type} was mapped to non-existent primitive #{primitive}\"\n end\n end\n\n raise \"Unable to determine size for type #{type}.\"\n end", "def size64_high\n @ole.Size64High\n end", "def size\n\n clib.tcmaprnum(pointer_or_raise)\n end", "def type_size=(sz)\n t = eval \"Int#{sz}\"\n raise \"unsupported enum size #{sz}\" unless t\n @type = t\n return sz\n end", "def size\n\n self.to_h.size\n end", "def size\n @structure.size\n end", "def header_size\n TYPE_SIZE\n end", "def size #:nodoc:\n 1\n end", "def size #:nodoc:\n 1\n end", "def short_binary_type; end", "def getBits(binary)\n length = binary[0].length\n return length\n end", "def size\n return instance_get(:size)\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", "def size\n\n clib.tclistnum(@pointer)\n end", "def determine_bit_depth\n case size\n when 1..2 then 1\n when 3..4 then 2\n when 5..16 then 4\n when 17..256 then 8\n end\n end" ]
[ "0.7705189", "0.7467742", "0.7450963", "0.7417675", "0.734754", "0.70911944", "0.70911944", "0.7063093", "0.70573896", "0.68974715", "0.6862758", "0.6853569", "0.67551893", "0.66868585", "0.6642069", "0.6633071", "0.660719", "0.6605012", "0.657718", "0.6556635", "0.65282625", "0.65013146", "0.649749", "0.649749", "0.64924526", "0.6450709", "0.6434521", "0.64323753", "0.6424624", "0.642229" ]
0.7743193
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_size=(sz)\n t = eval \"Int#{sz}\"\n raise \"unsupported enum size #{sz}\" unless t\n @type = t\n return sz\n end", "def initialize\n @type = LENGTH\n @value = UNSET\n @value_list = [SHORT, LONG].freeze\n end", "def size=(size)\n instance_set(:size, size)\n end", "def size=(size)\n end", "def size(size)\n @value[:size] = size\n self\n end", "def set_size!(size) \n @transforms << SIZES[size]\n self \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 set_size(nwords)\n newbits = Array.typed(::Java::Long).new(nwords) { 0 }\n n = Math.min(nwords, @bits.attr_length)\n System.arraycopy(@bits, 0, newbits, 0, n)\n @bits = newbits\n end", "def attr_set_ub8(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def size=(size)\n self.width = self.height = @size = size\n end", "def size=(value)\n @size = value\n end", "def size=(value)\n @size = value\n end", "def adjust(type)\n case type\n when :Byte, :byte, :b, :B\n primitive_max = 2**7 - 1\n primitive_min = -2**7\n when :Short, :short, :s, :S\n primitive_max = 2**15 - 1\n primitive_min = -2**15\n when :Integer, :Int, :int, :i, :I\n primitive_max = 2**31 - 1\n primitive_min = -2**31\n when :Long, :long, :l, :L\n primitive_max = 2**63 - 1\n primitive_min = -2**63\n when :Nibble, :nibble, :n, :N\n primitive_max = 2**4 - 1\n primitive_min = -2**4\n else\n primitive_max = 2**31 - 1\n primitive_min = -2**31\n end\n self < -primitive_max ? -1 * (-self & primitive_max) : self\n self > primitive_min ? (self & primitive_max) : self\n end", "def type=(new_type)\n self[:type_flags] = (flags | TYPES[new_type])\n end", "def size=(size)\n check_is_a!(size, Integer)\n check_gt!(size, 0)\n @attributes[:Size] = size\n end", "def initialize(type, size)\n @type = type\n @size = size\n end", "def set_binary_mode size=nil\n set_text_mode size\n end", "def short_binary_type; end", "def set_size\n self.size = attachment.size if attachment.size\n end", "def size=(arg)\n @view__.size = arg.is_a?(Vector) ? arg.getInternal__ : arg\n arg\n end", "def attr_set_integer(attr_type, number)\n #This is a stub, used for indexing\n end", "def setSize _obj, _args\n \"_obj setSize _args;\" \n end", "def size=(size)\n throw ArgumentError.new('new size is negative') if size.negative?\n size -= data.size\n if size.positive?\n @data += '\\0' * size\n elsif size.negative?\n @data = @data[0...size]\n end\n @data.size\n end", "def attr_set_binary(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def value=(val)\n if(val.nil?)\n self[:length] = 0\n self[:value] = val\n elsif(val.is_a?(String))\n buff = FFI::MemoryPointer.from_string(val)\n self[:length] = val.length\n self[:value] = buff\n elsif(val.is_a?(Fixnum))\n buff = FFI::MemoryPointer.new :OM_uint32\n buff.write_int val\n self[:length] = FFI::type_size :OM_uint32\n self[:value] = buff\n else\n raise StandardError, \"Can't handle type #{val.class.name}\"\n end\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", "def initialize(size)\n @bits = 0\n @size = size\n end", "def size= (x)\n change_options({\"size\" => x})\n end" ]
[ "0.6069003", "0.59874624", "0.5922158", "0.58663684", "0.5863692", "0.5747521", "0.57346654", "0.5697523", "0.5636921", "0.562953", "0.55702984", "0.55702984", "0.5555129", "0.55262977", "0.55237573", "0.552178", "0.5498379", "0.54919183", "0.5478183", "0.544552", "0.5405694", "0.5395475", "0.5390508", "0.53831744", "0.53745383", "0.53569347", "0.5354836", "0.53489137", "0.53426856", "0.53167975" ]
0.75745386
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n \"#{brand.name} #{name} (#{vehicle_type.name})\"\n \n end", "def snake_name\n @mountain.name.gsub(/./,'').gsub(/ /,'_').downcase\n end", "def name\n 'occupant'\n end", "def human_from_name; end", "def appellant_fullname_readable\n appellant_name&.titleize\n end", "def name; termid;end", "def three_word_name; end", "def name\n \"Lord Admiral #{@name}\"\n 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 spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend", "def display_name\n phylum_name\n end", "def middle_name; end", "def name\n return 'AedgSmallToMediumOfficeRoofConstruction'\n end", "def name; \"#{accidental.name}f\"; end", "def fullname()\n\t\t[self.name(), self.sport().titleize, self.variety().titleize].join(\" \")\n\tend", "def name; nutrdesc; end", "def name_with_middle; end", "def display_name\n kingdom_name\n end", "def alias_manager(name)\n name = name.downcase\n name = name.split(\" \").reverse.join(\" \")\n name = name.split(\"\")\n index = 0\n consonant = \"bcdfghjklmnpqrstvwqyz\"\n vowel = \"aeiou\"\n while index < name.length\n if\n !consonant.index(name[index]) && !vowel.index(name[index])\n elsif\n index_of_letter = vowel.index(name[index])\n new_letter = vowel[index_of_letter + 1]\n name[index] = new_letter\n else\n index_of_letter = consonant.index(name[index])\n new_letter = consonant[index_of_letter + 1]\n name[index]= new_letter\n end\n index += 1\n end\n name.join(\"\")\nend", "def masculine_name; end", "def ou_to_short(name)\n name = name.upcase\n\n case name\n when \"DSS IT SERVICE CENTER\", \"DSS IT SHARED SERVICE CENTER\"\n return \"IT\"\n when \"DSS HR/PAYROLL SERVICE CENTER\"\n return \"HR\"\n when \"CALIFORNIA HISTORY SS PROJECT\"\n return \"CHP\"\n when \"UC CENTER SACRAMENTO\"\n return \"UCCS\"\n when \"HEMISPHERIC INSTITUTE-AMERICAS\"\n return \"PHE\"\n when \"HISTORY PROJECT\", \"HISTORY PROJECT UCD\"\n return \"HP\"\n when \"SOCIAL SCIENCES PROGRAM\"\n return \"SSP\"\n when \"PHYSICAL EDUCATION PROGRAM\"\n return \"PHE\"\n when \"DSS RESEARCH SERVICE CENTER\"\n return \"RSC\"\n when \"GEOGRAPHY\"\n return \"GEO\"\n when \"ANTHROPOLOGY\"\n return \"ANT\"\n when \"COMMUNICATION\"\n return \"CMN\"\n when \"ECONOMICS\"\n return \"ECN\"\n when \"HISTORY\"\n return \"HIS\"\n when \"LINGUISTICS\"\n return \"LIN\"\n when \"MILITARY SCIENCE\"\n return \"MSC\"\n when \"PHILOSOPHY\"\n return \"PHI\"\n when \"POLITICAL SCIENCE\"\n return \"POL\"\n when \"PSYCHOLOGY\"\n return \"PSC\"\n when \"EASTERN ASIAN STUDIES\"\n return \"EAS\"\n when \"INTERNATIONAL RELATIONS\"\n return \"IRE\"\n when \"MIDDLE EAST/SOUTH ASIA STUDIES\", \"MIDDLE EAST/SOUTH ASIA PROGRAM\"\n return \"MSA\"\n when \"SCIENCE & TECHNOLOGY STUDIES\"\n return \"STS\"\n when \"CENTER FOR MIND AND BRAIN\", \"CENTER FOR MIND & BRAIN\"\n return \"CMB\"\n when \"SOCIOLOGY\"\n return \"SOC\"\n when \"COM, PHIL & LIN RED CLUSTER\"\n return \"RED\"\n when \"POLI SCI, IR ORANGE CLUSTER\", \"SOCIAL SCIENCE ORANGE CLUSTER\"\n return \"ORANGE\"\n when \"ECON, HIS, MS BLUE CLUSTER\", \"SOCIAL SCIENCES BLUE CLUSTER\"\n return \"BLUE\"\n when \"ANT, SOC GREEN CLUSTER\", \"SOCIAL SCIENCES GREEN CLUSTER\"\n return \"GREEN\"\n when \"L&S DEANS - SOCIAL SCIENCES\"\n return \"DEANS\"\n when \"PSYCH, CMB YELLOW CLUSTER\", \"SOCIAL SCIENCE YELLOW CLUSTER\"\n return \"YELLOW\"\n when \"EDUCATION - PH.D.\"\n return \"EDU\"\n when \"COMMUNITY DEVELOPMENT\"\n return \"ComDev\"\n when \"NEUROSCIENCE\", \"CENTER FOR NEUROSCIENCE\"\n return \"NueroSci\"\n when \"CENTER FOR INNOVATION STUDIES\"\n return \"CSIS\"\n when \"ASUCD\", \"UC DAVIS\", \"ASIAN AMERICAN\", \"UNIVERSITY EXTENSION\", \"CHEDDAR\", \"STUDENT EMPLOYMENT CENTER\",\n \"TEMPORARY EMPLOYMENT SERVICE\", \"CAMPUS RECREATION AND UNIONS\", \"CRESS DEPARTMENT\", \"LIBRARY\", \"POLICE\",\n \"COMPARATIVE LITERATURE\", \"PRIMATE CENTER\", \"L&S DEANS - U/G ED & ADVISING\", \"STATISTICS\",\n \"AGR & ENV SCI DEANS OFFICE\", \"OFFICE OF THE CHANCELLOR\", \"UNDERGRADUATE ADMISSIONS\",\n \"UNIVERSITY WRITING PROGRAM\", \"TEXTILES & CLOTHING\", \"STUDENT HOUSING\", \"ENGLISH\", \"ANIMAL SCIENCE\",\n \"IRB ADMINISTRATION\", \"SCHOOL OF LAW-DEANS OFFICE\", \"STUDENT ACADEMIC SUCCESS CTR\", \"GERMAN & RUSSIAN\",\n \"INTERCOLLEGIATE ATHLETICS\", \"HUMAN ECOLOGY\", \"GRADUATE DIVISION\", \"MED: NEUROLOGY\",\n \"ENVIRONMENTAL TOXICOLOGY\", \"SCHOOL OF MED - STAFF\", \"L&S DEANS - DEVELOPMENT\",\n \"TEMPORARY EMPLOYMENT POOL ADMN\", \"SCHOOL OF MED - APS\", \"MED: GENERAL PEDIATRICS\",\n \"MED:PSYCHIATRY & BEHAV SCI\", \"NATIVE AMERICAN STUDIES\", \"ART\", \"VP UNDERGRADUATE EDUCATION\", \"GEOLOGY\",\n \"VM: CTR COMPARATIVE MEDICINE\", \"ENGR COMPUTER SCIENCE\", \"MED: DIV OF INTERNAL MED\",\n \"FM: CUSTODIAL SERVICES\", \"VOORHIES ADMINISTRATIVE UNIT\", \"MED: OPHTHALMOLOGY\", \"MED: PUBLIC HEALTH SCIENCES\",\n \"NEURO PHYSIO & BEHAVIOR\", \"INST OF TRANSPORTATION STUDIES\", \"ENVIRONMENTAL HEALTH & SAFETY\",\n \"MEDIEVAL STUDIES\", \"EDUCATION\", \"ACADEMIC AFFAIRS\", \"ANR SUSTAINABLE AG PROG\"\n return nil\n else\n Rails.logger.warn \"AD Sync: Missing OU for translation to container name: #{name}\"\n ActivityLog.err!(\"Could not translate unknown organization to AD group equivalent: #{name}\", ['active_directory'])\n end\n\n return false\nend", "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 layar_name\n \t\"apollo\" + self.name.strip.downcase.gsub(/[^a-z0-9]/, '')\n end", "def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end", "def full_name\n return \"#{make.name} #{name}\"\n end", "def full_name\n name\n end", "def first_name_men; 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" ]
[ "0.64742225", "0.6427333", "0.6344343", "0.63430834", "0.6299515", "0.6277544", "0.6233395", "0.62087435", "0.6203189", "0.61714435", "0.61332124", "0.61231005", "0.61062247", "0.609935", "0.60773283", "0.6067734", "0.6060615", "0.60569674", "0.6050722", "0.60484797", "0.60405266", "0.60366696", "0.60298055", "0.6019182", "0.6018084", "0.6007604", "0.59979755", "0.59909445", "0.5990692", "0.5977729" ]
0.6846041
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 grab_nearest_by_location(distance, loc)\n\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 select_within_radius km\n self.location_hash = location_hash.select {|h1| distance(h1) <= km }\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 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 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", "def assignClosest(parr)\n self.dims[0].times do |i|\n self.dims[1].times do |j|\n distances = Array.new\n parr.each do |point|\n distances << point.distance(i, j)\n end\n mins = distances.min(2)\n if mins[0] == mins[1]\n @grid[i][j] = -1\n else\n @grid[i][j] = distances.index(mins[0])\n end\n end\n end\n end", "def find_within_radius(distance, property=nil)\n locations = find_within_box(distance).delete_if { |l| self.distance_to(l) > distance }\n\t\tproperty ? locations.map(&property.to_sym) : locations\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 nearest_mine\n src = @pos\n shortest_dst = 63\n nearest = [0,0]\n unowned_mines = @game.mines_locs.reject { |pos, hero_id| hero_id == @hero_id }\n unowned_mines.each do |pos, hero_id|\n build_branching_paths(src, pos)\n path = find_path(pos)\n if path.length < shortest_dst\n shortest_dst = path.length\n nearest = pos\n end\n end\n nearest\n end", "def find_new_road\n return nil if finding_new_road?\n return nil if Params::NEW_ROOT_FIND_PERCENTAGE < rand(Params::PERCENT_DENOMINATOR)\n\n found_mini_map_ids = mini_map_roads.collect{|r| r.end_mini_map_id}\n found_mini_map_ids << id\n not_found_mini_map_ids = MiniMap.all.collect{|m| m.id} - found_mini_map_ids\n end_mini_map_id = not_found_mini_map_ids[rand(not_found_mini_map_ids.size)]\n \n return end_mini_map_id\n end", "def nearby\n\n #select * from ( select * from Location\n # WHERE Longitude > @lngA-(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Longitude < @lngA+(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Latitude > @latA-(@dist/68.703)\n # AND Latitude < @latA+(@dist/68.703) ) AS `tmp` WHERE GEODISTANCE(@latA,@lngA ,Latitude,Longitude) < @dist\n\n #Calculate a bounding box we can use to quickly find nearby trucks\n lat = params[:lat].to_f\n lng = params[:lng].to_f\n dist = params[:radius].to_f\n latDelta = dist/68.703\n\n value = lat+(latDelta);\n rad = value/180 * Math::PI #Geocoder::Calculations.to_radians(value) #value.to_ra radians(value);\n\n lngDelta = dist/(Math.cos( rad)*69.172)\n minLng = lng-lngDelta\n maxLng = lng+lngDelta\n minLat = lat-latDelta\n maxLat = lat+latDelta\n\n\n #IFNULL( SQRT(((difX)(difX))+((difY)(difY))), 99999)\n trucks = Truck.find_by_sql \"SELECT trucks.* WHERE SQRT(((trucks.lng-#{lng})(trucks.lng-#{lng}))+((trucks.lat-#{lat})(trucks.lat-#{lat}))) < #{dist}\"\n\n render :json => trucks\n end", "def update_closest(array, city, new_dist)\n if !array.include?([city, new_dist])\n insert_point = binary_insert(array, new_dist)\n array.insert(insert_point,[city, new_dist])\n end\nend", "def surrounding(position, radius)\n dlat = 0.0001\n dlng = 0.0001\n (1..radius).map do |r|\n (-r..r).map do |rlat|\n points = [sum(position, [dlat * rlat, dlng * (r - rlat.abs)])]\n if rlat.abs != r\n points += [sum(position, [dlat * rlat, dlng * (rlat.abs - r)])]\n end\n points\n end.flatten(1)\n end\nend", "def find_nearest_place_id max_dist\n\t#byebug\n\tphot=self.class.find(@id) #returns instance of photo\n\tphot_loc=phot.location #gets location from photo (point where photo was taken)\n\tphot_place=Place.near(phot_loc,max_dist).projection(:_id=>1).first #find closest place to point\n\tphot_place.nil? ? nil : phot_place[:_id] #return the id of the closest place to that point\nend", "def closest_to_center(list)\n list\n .sort_by { |point| dist(point, point(0,0)) }\n .first\nend", "def near max_meters=nil\n documents = self.class.near(@location, max_meters)\n self.class.to_places(documents)\n end", "def closest_planet\n finder = self.class.select(\"id, name, location, planets.location<->POINT('#{self.location}') as distance\")\n self.class.my_planets.each do |p|\n finder = finder.where(\"NOT location ~= POINT(?)\", p.location)\n end\n finder.order(\"distance ASC\").first\n end", "def reduce_root(tree_match=nil)\n if tree_match.nil?\n reduce_root_tree_var(self.name)\n else\n tree = find{|i| i === tree_match}.reduce_root\n update_height\n tree\n end\n end", "def distanceToSearchCenter(centerLat, centerLong)\n\n # kilometers\n earthRadius = 6371 \n\n buildingLat = self.gis_lat\n buildingLong = self.gis_long\n\n buildingLatRad = buildingLat/180 * Math::PI\n centerLongRad = centerLong/180 * Math::PI\n\n\n dLat = (centerLat-buildingLat)/180 * Math::PI;\n dLon = (centerLong-buildingLong)/180 * Math::PI;\n\n a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(buildingLatRad) * Math.cos(centerLongRad) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n distanceMeters = 6371*1000 * c; \n puts distanceMeters\n distanceMeters\n end", "def nearest_driver(map,user)\n driver_pos=[]\n\n for i in 0..map.length-1\n for j in 0..map.length-1\n if map[i][j] == \" D \"\n driver_pos << [i,j]\n end\n end\n end\n @driver_pos=driver_pos\n\n nearest_driver_position = driver_pos[0]\n distance = driver_pos[0].zip(user).map { |x| x.reduce(:-).abs }.sum\n\n for i in 1..driver_pos.length-1\n temp = driver_pos[i].zip(user).map { |x| x.reduce(:-).abs }.sum\n if temp < distance\n distance = temp\n nearest_driver_position = driver_pos[i]\n end\n end\n nearest_driver_position\n end", "def nearby_bike_parking(string, dist)\n area = process_coords(area)\n querry = \"$where=within_circle(geom, #{area[1]}, #{area[0]}, #{dist})\"\n bike_grabber(querry)\n end", "def search_radius\n exact_location ? 100 : 50_000\n end", "def climb(position, radius)\n max_rad, max_pos, max_ele, inc, my_ele = highest_neighbor(position, radius)\n if inc < 0 || max_rad < radius\n puts \"We have reached the peak (#{my_ele}) at #{position}\".green\n peak_id = store_peak(position, my_ele)\n [position, my_ele, peak_id]\n else\n puts \"Elevation #{max_ele}, position #{max_pos}\".yellow\n sleep 0.01\n if inc > 0\n puts \"Climbing more\".light_black\n climb(max_pos, 1)\n else\n new_radius = radius + 1\n puts \"On a flat, increasing radius to #{new_radius}\"\n climb(max_pos, new_radius)\n end\n end\nend", "def near(max_meters=nil)\n result = self.class.near(@location, max_meters)\n self.class.to_places(result)\n end", "def near(max_meters=nil)\n result = self.class.near(@location, max_meters)\n self.class.to_places(result)\n end", "def find_nearest_parent(target_class)\n columns = ['id', 'parent_id', 'construct_id', 'construct_type']\n columns_joined = columns.join(',')\n sql =\n <<-SQL\n WITH RECURSIVE control_constructs_tree (#{columns_joined}, level)\n AS (\n SELECT\n #{columns_joined},\n 0\n FROM control_constructs\n WHERE construct_id = #{id}\n AND construct_type = '#{self.class.name}'\n\n UNION ALL\n SELECT\n #{columns.map { |col| 'cat.' + col }.join(',')},\n ct.level + 1\n FROM control_constructs cat, control_constructs_tree ct\n WHERE cat.id = ct.parent_id\n )\n SELECT #{target_class.table_name}.*\n FROM control_constructs_tree\n INNER JOIN #{target_class.table_name} ON #{target_class.table_name}.id = control_constructs_tree.construct_id\n WHERE level > 0\n AND construct_type = '#{target_class.name}'\n ORDER BY level, control_constructs_tree.id, construct_id, construct_type\n LIMIT 1;\n SQL\n target_class.find_by_sql(sql.chomp).first\n end", "def closest_ant_view l, ai \n\tants = ai.my_ants \n\n\tcur_best = nil\n\tcur_dist = nil\n\n\tants.each do |ant|\n\t\td = Distance.get ant, l\n\t\tdist = d.dist\n\n\t\tif !cur_dist || dist < cur_dist\n\t\t\tcur_dist = dist\n\t\t\tcur_best = ant\n\t\tend\n\tend\n\n\tcur_best\nend", "def near(max_meters=nil)\n Place.to_places(self.class.near(@location, max_meters))\n end" ]
[ "0.7133173", "0.6104328", "0.58099306", "0.55982375", "0.54753995", "0.53915673", "0.5343848", "0.5337359", "0.5316703", "0.52875584", "0.5238724", "0.5238321", "0.521971", "0.51853186", "0.51826876", "0.5162653", "0.51573294", "0.5144329", "0.5136009", "0.51356137", "0.51223284", "0.5104776", "0.5093459", "0.50625134", "0.5052992", "0.5036365", "0.5036365", "0.50247425", "0.4992198", "0.49914512" ]
0.85513055
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 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 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 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 grab_nearest_by_location(distance, loc)\n\n end", "def chargeVoisins\n for x in 0..(self.lignes-1)\n for y in 0..(self.colonnes-1)\n if (self.get_child_at(x,y).status == 'i')\n\n # DROITE\n for x2 in (x+1).upto(self.lignes-1)\n if (self.get_child_at(x2, y).status == 'i')\n self.get_child_at(x, y).eastNode = self.get_child_at(x2,y)\n break\n end\n end\n\n #BAS\n for y2 in (y+1).upto(self.colonnes-1)\n if (self.get_child_at(x,y2).status == 'i')\n self.get_child_at(x,y).southNode = self.get_child_at(x,y2)\n break\n end\n end\n \n #HAUT\n for y2 in (y-1).downto(0)\n if (self.get_child_at(x,y2).status == 'i')\n self.get_child_at(x,y).northNode = self.get_child_at(x,y2)\n break\n end\n end\n\n # Gauche\n for x2 in (x-1).downto(0)\n if (self.get_child_at(x2,y).status == 'i')\n self.get_child_at(x,y).westNode = self.get_child_at(x2,y)\n break\n end\n end\n end\n end \n end\n\n return self\n end", "def parent_mass_error_distances\n mass_error_as_distance_array(self['search']['spectrum']['parent_mass_error'])[0,2]\n end", "def calculate_relatives!(root_id)\n @relatives = {root_id => 0}\n queue = Set[root_id]\n until queue.empty?\n new_queue = Set[]\n queue.each do |id|\n character = Character[id]\n [character.mother, character.father].compact.each do |c|\n next if @relatives[c.id]\n @relatives[c.id] = @relatives[id] + 1\n new_queue << c.id\n end\n end\n queue = new_queue\n end\n queue = Set[*@relatives.keys]\n until queue.empty?\n new_queue = Set[]\n queue.each do |id|\n character = Character[id]\n character.children.each do |c|\n next if @relatives[c.id]\n @relatives[c.id] = @relatives[id] + 1\n new_queue << c.id\n end\n end\n queue = new_queue\n end\n end", "def waypoints_must_be_at_most_n_km_apart\n self.waypoints_minus_removed.each do |waypoint|\n next if waypoint.parent_index.nil? || waypoint.parent_index < 0 || waypoint.parent_index == waypoint.local_index\n parent = waypoints_minus_removed[waypoint.parent_index]\n if !parent.nil? && type == 'Road' && waypoint.dist(parent.latitude, parent.longitude) > 50\n\tputs \"cannot be more than 50km apart.\"\n errors.add(:waypoints, \"cannot be more than 50km apart.\")\n elsif !parent.nil? && type != 'Road' && waypoint.dist(parent.latitude, parent.longitude) > 20\n\tputs \"cannot be more than 20km apart.\"\n errors.add(:waypoints, \"cannot be more than 20km apart.\")\n end\n end\n end", "def change_distance\n @before_dist = session[:distance];\n @distance = params[:distance];\n @holes = Pothole.near([session[:lat], session[:lng]], @distance, :order => session[:sorting]);\n build_markers\nend", "def initialize(longitude, latitude, location_id, parent)\n @longitude = longitude\n @latitude = latitude\n @location_id = location_id\n @parent = parent\n @children = [nil,nil,nil,nil]\n @total_leaves = if location_id.nil? then 0 else 1 end\n end", "def shortest_route_by_distance_to!(place_or_object_place_was_built_from)\n routes_for!(place_or_object_place_was_built_from).min_by(&:distance_in_meters)\n end", "def min_distance\n @min_distance ||= (_fence.southwest & _fence.northeast) * @min_distance_ratio\n end", "def push_new_associate\n # We short-circuit any nodes whose global value would be less than the cutoff\n new_child unless child_attenuation < @sn_cutoff\n end", "def find_solution\n open = [{:cell => @start_cell, :parent => nil, :distance => 0}]\n closed = []\n\n while !open.empty?\n # Find the lowest movement cost\n current_node = open.min{ |a,b| a[:distance] <=> b[:distance]}\n\n # Check if we reached the end cell\n if is_end?(current_node[:cell])\n return current_node[:distance]\n end\n\n # Find immediate neighbors\n current_neighbors = find_neighbors(current_node[:cell])\n current_neighbors.each { | neighbor |\n if closed.find { | node | node[:cell].eql?(neighbor[:cell])}.nil?\n # Find if the cell is already in the open list\n existing_open = open.find { |node | node[:cell].eql?(neighbor[:cell])}\n if existing_open\n # Find the shorter distance to the cell\n current_distance = existing_open[:distance]\n new_distance = current_node[:distance] + neighbor[:distance]\n existing_opened[:distance] = new_distance if current_distance > new_distance\n else\n # Add the new visited cell to the open list\n neighbor[:distance] = neighbor[:distance] + current_node[:distance]\n open << neighbor\n end\n end\n }\n closed << current_node\n open.delete(current_node)\n end\n 0\n end", "def select_within_radius km\n self.location_hash = location_hash.select {|h1| distance(h1) <= km }\n end", "def find_within_radius(distance, property=nil)\n locations = find_within_box(distance).delete_if { |l| self.distance_to(l) > distance }\n\t\tproperty ? locations.map(&property.to_sym) : locations\n end", "def distanceToSearchCenter(centerLat, centerLong)\n\n # kilometers\n earthRadius = 6371 \n\n buildingLat = self.gis_lat\n buildingLong = self.gis_long\n\n buildingLatRad = buildingLat/180 * Math::PI\n centerLongRad = centerLong/180 * Math::PI\n\n\n dLat = (centerLat-buildingLat)/180 * Math::PI;\n dLon = (centerLong-buildingLong)/180 * Math::PI;\n\n a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(buildingLatRad) * Math.cos(centerLongRad) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n distanceMeters = 6371*1000 * c; \n puts distanceMeters\n distanceMeters\n end", "def distance_to(other)\n # using Spherical Law of Cosines formula to calculate 'great circle' distance\n # http://www.movable-type.co.uk/scripts/latlong.html\n # assumes a spherical moon\n # result in is metres\n lat1_r = to_rad(self.lat)\n lat2_r = to_rad(other.lat)\n delta = to_rad(other.long - self.long)\n Math.acos(\n Math.sin(lat1_r) * Math.sin(lat2_r) +\n Math.cos(lat1_r) * Math.cos(lat2_r) * Math.cos(delta)\n ) * RADIUS\n end", "def drive(distanceInMiles)\n\t\t\n\t\tgasToRemove = self.fuelEfficiency * distanceInMiles\n\n\t\tself.fuelLevel -= gasToRemove\n\n\t\t#\tEnsure we don't go below zero gas\n\t\tself.fuelLevel = [self.fuelLevel, 0].max\n\tend", "def guide(from, to, unit_type=nil, max_depth=400)\n return nil if @map.blocked?(from, unit_type) || @map.blocked?(to, unit_type)\n from_element = PathElement.new(from)\n from_element.dist_from = @map.distance(from,to)\n open = PriorityQueue.new { |x, y| (x <=> y) == -1 }\n open.push from_element, from_element.rating\n closed = SplayTreeMap.new\n step = 0\n \n until open.empty? || step > max_depth\n step += 1\n \n current_element = open.pop\n @nodes_considered += 1\n \n loc = current_element.location\n if @map.cost(loc,to) == 0\n path = []\n until current_element.parent.nil?\n path.unshift current_element\n current_element = current_element.parent\n end\n\n return path\n else\n closed.push loc, current_element\n @map.neighbors(loc).each do |next_door|\n next if closed.has_key? next_door\n\n el = PathElement.new(next_door,current_element)\n\n if @map.blocked? next_door, unit_type\n closed.push el.location, el\n else\n current_rating = current_element.cost_to + @map.cost(loc, next_door)\n\n # add to open\n el.cost_to = current_rating\n el.dist_from = @map.distance(next_door,to)\n \n open.push el, el.rating\n end\n end\n end\n end\n nil\n end", "def guide(from, to, unit_type=nil, max_depth=400)\n return nil if @map.blocked?(from, unit_type) || @map.blocked?(to, unit_type)\n from_element = PathElement.new(from)\n from_element.dist_from = @map.distance(from,to)\n open = PrioritySet.new\n open.push from_element, from_element.rating\n closed = SplayTreeMap.new\n step = 0\n\n until open.empty? || step > max_depth\n step += 1\n\n current_element = open.pop\n @nodes_considered += 1\n\n loc = current_element.location\n if @map.cost(loc,to) == 0\n path = []\n until current_element.parent.nil?\n path.unshift current_element\n current_element = current_element.parent\n end\n\n return path\n else\n closed.push loc, current_element\n @map.neighbors(loc).each do |next_door|\n if closed.has_key? next_door\n next\n end\n \n el = PathElement.new(next_door,current_element)\n\n if @map.blocked? next_door, unit_type\n closed.push el.location, el\n else\n current_rating = current_element.cost_to + @map.cost(loc, next_door)\n\n # add to open\n el.cost_to = current_rating\n el.dist_from = @map.distance(next_door,to)\n el.reset_rating\n\n open.push el, el.rating\n end\n end\n end\n end\n nil\n end", "def parent_location_full_child_tree\n parent_location = self\n\n self.class.full_tree_location_ids = self.class.full_tree_location_ids + \"#{self.id}, \"\n \n parent_location.locations.each do |location|\n\n self.class.full_tree_location_ids = self.class.full_tree_location_ids + \"#{location.id}, \"\n logger.debug(\"XXXXXXXXXXXXXx #{self.class.full_tree_location_ids}\")\n \n unless location.locations.empty?\n location.parent_location_full_child_tree\n end\n end\n self.class.full_tree_location_ids[0..-3]\n end", "def parent\n raise NoParentRationalNumberIsRootError if root?\n numerator = @nv\n denominator = @dv\n _parent = RationalNumber.new\n compare_key = RationalNumber.new\n # make sure we break if we get root values! (numerator == 0 + denominator == 0)\n while ((compare_key.nv < @nv) && (compare_key.dv < @dv)) && ((numerator > 0) && (denominator > 0))\n div = numerator / denominator\n mod = numerator % denominator\n # set return values to previous values, as they are the parent values\n _parent.set_from_other(compare_key)\n\n # temporary calculations (needed)\n parent_nv = _parent.nv + (div * _parent.snv)\n parent_dv = _parent.dv + (div * _parent.sdv)\n\n compare_key.set_values( parent_nv , #nv\n parent_dv , #dv\n parent_nv + _parent.snv, #snv\n parent_dv + _parent.sdv) #sdv\n numerator = mod\n if (numerator != 0)\n denominator = denominator % mod\n denominator = 1 if denominator == 0\n end\n end\n _parent\n end", "def parent_share\n fetch(:parent_share) do\n if value && (slot_demand = rgt_output.external_value)\n slot_demand.zero? ? 0.0 : value / slot_demand\n end\n end\n end", "def find_new_road\n return nil if finding_new_road?\n return nil if Params::NEW_ROOT_FIND_PERCENTAGE < rand(Params::PERCENT_DENOMINATOR)\n\n found_mini_map_ids = mini_map_roads.collect{|r| r.end_mini_map_id}\n found_mini_map_ids << id\n not_found_mini_map_ids = MiniMap.all.collect{|m| m.id} - found_mini_map_ids\n end_mini_map_id = not_found_mini_map_ids[rand(not_found_mini_map_ids.size)]\n \n return end_mini_map_id\n end", "def calculate_up_child\n # Guard condition for movement not possible\n return nil if blank_y + 1 == size\n\n # Make the movement\n new_state = swap_up\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y + 1)\n end", "def parent_for_new(tree_node, value)\n return tree_node if !tree_node.left && value < tree_node.value\n return tree_node if !tree_node.right && value > tree_node.value\n\n if value > tree_node.value\n return parent_for_new(tree_node.right, value)\n else\n return parent_for_new(tree_node.left, value)\n end\n end", "def find_parent\n if params.key?(:reservation_id)\n @parent = @car.reservations.find(params[:reservation_id])\n elsif params.key?(:ride_id)\n @parent = @car.rides.find(params[:ride_id])\n else\n @parent = @car\n end\n end" ]
[ "0.8235895", "0.5898242", "0.5318209", "0.5277388", "0.5045914", "0.49961343", "0.49835724", "0.49419254", "0.49409592", "0.49079368", "0.4890193", "0.48785388", "0.48690915", "0.486506", "0.4854083", "0.4815669", "0.48073077", "0.47885486", "0.478069", "0.47805166", "0.47803655", "0.4726553", "0.47214514", "0.47132725", "0.4710969", "0.47084302", "0.47076446", "0.46990705", "0.4661242", "0.46412343" ]
0.71061254
1
Returns an array of Licensee::License instances
def licenses(options = {}) Licensee::License.all(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 end", "def licenses\n data[:licenses]\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 licenses *names\n names.to_strings.each do |name| \n begin\n module_name = \"#{name.camelize}License\"\n clazz = module_name.constantize\n clazz.new(self).enforce!\n rescue\n raise \"License #{module_name} not found\"\n end\n end\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 complete_licenses\n License.selectable\n .sort_by(&:identifier)\n .map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end", "def licenses *names\n names.to_strings.each do |name| \n begin\n module_name = \"#{name.camelize}License\"\n clazz = module_name.constantize\n rescue\n raise \"License #{module_name} is not defined\"\n end\n\n begin\n clazz.new(self).enforce!\n rescue\n raise \"License #{clazz} could not be enforced using #{self.inspect}\"\n end\n end\n end", "def customized_licenses\n @research_output.plan.template.licenses.map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\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 licenses=(licenses)\n @licenses = Array licenses\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 index\n @licenses = License.all\n end", "def index\n @licenses = License.all\n end", "def licenses=(licenses)\n @licenses = [licenses].flatten\n end", "def license_files\n @license_files ||= []\n end", "def license=(o)\n self.licenses = [o]\n end", "def index\n @diriving_licenses = DirivingLicense.all\n end", "def licenses_list(opts = {})\n data, _status_code, _headers = licenses_list_with_http_info(opts)\n return data\n end", "def get_licenses(opts = {})\n data, _status_code, _headers = get_licenses_with_http_info(opts)\n data\n end", "def license name\n self.licenses << name.to_s\n end", "def project_files\n return [] if @url.nil?\n\n license_data = self.class.retrieve_license(@url)\n Array(Licensee::ProjectFiles::LicenseFile.new(license_data, { uri: @url }))\n end", "def index\n @licenses = License.page(params[:page]).per(10)\n end", "def licenses=(new_licenses)\n @licenses = new_licenses\n end", "def index\n @license_results = LicenseResult.all\n end", "def get_license_listing(opts = {})\n data, _status_code, _headers = get_license_listing_with_http_info(opts)\n data\n end", "def license_info\n self.dig_for_array(\"licenseInfo\")\n end", "def license\n @licenses.first\n end", "def licenses_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.licenses_list ...\"\n end\n # resource path\n local_var_path = \"/licenses\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<License>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#licenses_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.79116863", "0.7615163", "0.7191282", "0.7116111", "0.7056881", "0.70310897", "0.6982774", "0.6905566", "0.6766984", "0.66965204", "0.6654633", "0.6613263", "0.66106236", "0.65628034", "0.65628034", "0.65494007", "0.65008265", "0.64991575", "0.6475362", "0.6403956", "0.6308821", "0.6307728", "0.6266871", "0.6212319", "0.62112916", "0.6188958", "0.61710745", "0.6126139", "0.61023027", "0.61002445" ]
0.8071391
0
Returns the license for a given path
def license(path) Licensee.project(path).license end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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\n last_commit = @ref.target\n license = @repo.blob_at(last_commit.oid, 'LICENSE') || @repo.blob_at(last_commit.oid, 'LICENSE.txt')\n\n if license.nil?\n 'N/A'\n else\n license_text = license.text\n\n case license_text\n when /Apache License/\n 'Apache'\n when /GNU GENERAL PUBLIC LICENSE/\n 'GPL'\n when /GNU LESSER GENERAL PUBLIC LICENSE/\n 'LGPL'\n when /Permission is hereby granted, free of charge,/\n 'MIT'\n when /Redistribution and use in source and binary forms/\n 'BSD'\n else\n 'N/A'\n end\n end\n end", "def license_url\n get_url(:license)\n end", "def license\n licenses.first\n end", "def license\n @licenses.first\n end", "def license\n return self.licenses.first\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(name=nil)\n if name\n self.license = name\n else\n if copryrights.first\n copyrights.first.license\n end\n end\n end", "def license(*args)\n arguments(args, required: [:user, :repo])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/license\", arguments.params)\n end", "def license\n return @license\n end", "def retrieve_license(url)\n (@licenses ||= {})[url] ||= Net::HTTP.get(URI(url))\n end", "def license\n @header.license\n end", "def license(arg = nil)\n set_or_return(:license, arg, kind_of: [String])\n end", "def project_license_content\n project.license_file.nil? ? \"\" : IO.read(File.join(Config.project_root,project.license_file))\n end", "def license(value)\n _license(value) or fail ArgumentError, \"Unknown value for license: #{value}\"\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 license\n conf['license'] || proj.license\n end", "def license(arg = nil)\n set_or_return(\n :license,\n arg,\n kind_of: [ String ]\n )\n end", "def lic_path\n @lic_path ||= Pathname.new(configured_lic_path.path).expand_path(root)\n end", "def license\n if ladnn?\n [\"https://creativecommons.org/licenses/by/4.0/\"]\n else\n # If it's populated, DLCS uses MARC IDs, not labels, so we don't need to map like w/ resource_type\n map_field(:license)\n end\n end", "def license name\n self.licenses << name.to_s\n end", "def license_as_uri\n # no mapping for `license_text` as this gets checked and ingested as a `rights` field in Fedora Item\n return nil if license == 'license_text'\n\n code = LICENSE_TO_URI_CODE.fetch(license.to_sym)\n CONTROLLED_VOCABULARIES[:license].send(code)\n end", "def license\n @flickr.photos.licenses[self.license_id]\n end", "def render_license\n return '' unless @document\n return '' unless @document[:license_tesim]\n license = @document[:license_tesim].first\n if license.match?(/creativecommons.org/)\n data = license_markup\n data.html_safe\n else\n license\n end\n end", "def license\n FFI::GDAL.GDALVersionInfo('LICENSE')\n end", "def detect_license(repo, files)\n file = JavaProject.new(repo, files).matched_file\n return nil unless file\n LicenseeFile.new(file)\n end", "def license_info\n self.dig_for_array(\"licenseInfo\")\n end", "def show_license(license)\n # Checks if lang is nil and we want to show the license\n if license && SHOW_LICENSE\n %Q(\n <section class=\"gh-card-license\">\n <p class=\"text-grey\">#{license}</p>\n <svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 14 16\" width=\"14\"><path fill-rule=\"evenodd\" d=\"M7 4c-.83 0-1.5-.67-1.5-1.5S6.17 1 7 1s1.5.67 1.5 1.5S7.83 4 7 4zm7 6c0 1.11-.89 2-2 2h-1c-1.11 0-2-.89-2-2l2-4h-1c-.55 0-1-.45-1-1H8v8c.42 0 1 .45 1 1h1c.42 0 1 .45 1 1H3c0-.55.58-1 1-1h1c0-.55.58-1 1-1h.03L6 5H5c0 .55-.45 1-1 1H3l2 4c0 1.11-.89 2-2 2H2c-1.11 0-2-.89-2-2l2-4H1V5h3c0-.55.45-1 1-1h4c.55 0 1 .45 1 1h3v1h-1l2 4zM2.5 7L1 10h3L2.5 7zM13 10l-1.5-3-1.5 3h3z\"></path></svg>\n </section>)\n end\n end" ]
[ "0.7683035", "0.74824435", "0.7099152", "0.70910287", "0.6921656", "0.6828952", "0.68228656", "0.6766218", "0.67525727", "0.6741766", "0.66850466", "0.6644496", "0.6614537", "0.6590169", "0.6530255", "0.65026665", "0.64850676", "0.647243", "0.6460033", "0.6417067", "0.6340329", "0.6335096", "0.6243446", "0.6226491", "0.61940336", "0.6188417", "0.6186812", "0.6151815", "0.61416304", "0.6091132" ]
0.86217886
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_brightness\n @base.brightness > 0.5 ? -1 : 1\n end", "def threshold(x)\n\t\tx > 0 ? 1.0 : 0.0\n\tend", "def confidence_lowered\n @positions.transform_values! {|value| value - 1}\n @positions.delete_if {|key, value| value == 0 }\n end", "def inverse()\n map_hash{|k,v|[k,1/v] if v > 0}.to_p\n end", "def cdf_inverse(confidence)\n a = [0, -3.969683028665376e+01, 2.209460984245205e+02, -2.759285104469687e+02, 1.383577518672690e+02, -3.066479806614716e+01, 2.506628277459239e+00]\n b = [0, -5.447609879822406e+01, 1.615858368580409e+02, -1.556989798598866e+02, 6.680131188771972e+01, -1.328068155288572e+01]\n c = [0, -7.784894002430293e-03, -3.223964580411365e-01, -2.400758277161838e+00, -2.549732539343734e+00, 4.374664141464968e+00, 2.938163982698783e+00]\n d = [0, 7.784695709041462e-03, 3.224671290700398e-01, 2.445134137142996e+00, 3.754408661907416e+00]\n p_low = 0.02425\n p_high = 1.0 - p_low\n\n x = 0.0\n q = 0.0\n if 0.0 < confidence && confidence < p_low\n q = Math.sqrt(-2.0 * Math.log(confidence))\n x = (((((c[1] * q + c[2]) * q + c[3]) * q + c[4]) * q + c[5]) * q + c[6]) / ((((d[1] * q + d[2]) * q + d[3]) * q + d[4]) * q + 1.0)\n elsif p_low <= confidence && confidence <= p_high\n q = confidence - 0.5\n r = q * q\n x = (((((a[1] * r + a[2]) * r + a[3]) * r + a[4]) * r + a[5]) * r + a[6]) * q / (((((b[1] * r + b[2]) * r + b[3]) * r + b[4]) * r + b[5]) * r + 1.0)\n elsif p_high < confidence && confidence < 1.0\n q = Math.sqrt(-2.0 * Math.log(1.0 - confidence))\n x = -(((((c[1] * q + c[2]) * q + c[3]) * q + c[4]) * q + c[5]) * q + c[6]) / ((((d[1] * q + d[2]) * q + d[3]) * q + d[4]) * q + 1.0)\n end\n pi = Math::PI\n if 0 < confidence && confidence < 1\n e = 0.5 * Math.erfc(-x / Math.sqrt(2.0)) - confidence\n u = e * Math.sqrt(2.0 * pi) * Math.exp((x**2.0) / 2.0)\n x = x - u / (1.0 + x * u / 2.0)\n end\n x\n end", "def slightly_increase_confidence\r\n @confidence += LOW unless impossible\r\n end", "def threshold\n @threshold || 95\n end", "def confidenceLo\n end", "def inverse!\r\n conjugate!\r\n scale!(1.0/norm)\r\n end", "def desaturate(value=0)\n return self.saturate(-value)\n end", "def threshold_spy\n puts \"Ergebnis:\"\n puts (@spy_level_defender - @spy_level_attacker)*0.05+0.5 \n return (@spy_level_defender - @spy_level_attacker)*0.05+0.5 \n end", "def ir_azucares \n\t\t@ir_azucares = (@azucares/90.to_f)*100\n\t\t@ir_azucares.round(1)\n\tend", "def ci_plusminus(confidence = 0.95)\n require 'statistics2'\n n = votes.size\n if n == 0\n return 0\n end\n z = Statistics2.pnormaldist(1 - (1 - confidence) / 2)\n phat = 1.0 * votes_for / n\n (phat + z * z / (2 * n) - z * Math.sqrt((phat * (1 - phat) + z * z / (4 * n)) / n)) / (1 + z * z / n)\n end", "def non_negative_float(value, epsilon: nil)\n result = to_float(value) or return\n result unless epsilon ? (result < -epsilon) : result.negative?\n end", "def variance_percent\n if [300, 700, 1200].include? upper_threshold\n 0.01\n elsif [2000, 2800].include? upper_threshold\n 0.015\n else\n 0\n end\n end", "def normalize(value)\n return 0.0 if near_zero_or_less? value\n return 1.0 if near_one_or_more? value\n value\n end", "def horizontal_brighting_correction_factor\n adjusted_global_horizontal_irradiance = @global_horizontal_irradiance < SMALL_VALUE_FOR_SKY_DIFFUSE_IRRADIANCE ? SMALL_VALUE_FOR_SKY_DIFFUSE_IRRADIANCE : @global_horizontal_irradiance\n # In PVLIB_MatLab as well as PVLIB_Python, there is a following adjustment. \n # However, all the negative numbers are already converted to SMALL_VALUE_FOR_SKY_DIFFUSE_IRRADIANCE in the above statement, \n # the following statement doesn't do anything. \n # I'm just writing it to remind that it is there in PVLIB_MatLab and PVLIB_Python. \n # adjusted_global_horizontal_irradiance = @global_horizontal_irradiance < BigDecimal('0') ? BigDecimal('0') : @global_horizontal_irradiance\n bigdecimal_sqrt(horizontal_beam_irradiance / adjusted_global_horizontal_irradiance)\n end", "def cut_factor\r\n return 0.0\r\n end", "def threshold_y\n @zac\n end", "def inverse_brightness\n h, s, l, a = self.to_hsl\n l = 100 - l\n return self.from_hsl([h, s, l, a])\n end", "def invert; end", "def confidenceHi\n end", "def inverse_f\n return 0 if f_x.zero?\n temp_value = i = 0\n while temp_value <= f_x && i < n\n temp_value = gsl_cdf.binomial_P(i, p, n)\n next if temp_value >= f_x\n i += 1\n end\n i.zero? ? 0 : i - 1\n end", "def inverse; end", "def inverse; end", "def invert\n end", "def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend", "def inverse\r\n quaternion.inverse!\r\n end", "def expectation\n -1.0 / (@weights.n - 1)\n end", "def inverse\n Negation.new(self)\n end" ]
[ "0.6771814", "0.6225526", "0.6224604", "0.598087", "0.5944674", "0.57596177", "0.5613212", "0.56006366", "0.55319154", "0.54572326", "0.5448475", "0.5445973", "0.5438047", "0.5371062", "0.53431785", "0.5311402", "0.53051555", "0.5297779", "0.5294272", "0.5287737", "0.5282349", "0.52771205", "0.5273291", "0.52591246", "0.52591246", "0.5255907", "0.52445364", "0.5240003", "0.5236872", "0.5229977" ]
0.8523854
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 linked_account_names\n # user.user explained: first user is local user, second user ir padma_user\n @linked_account_names ||= @user.user.padma_accounts.map(&:name)\n end", "def linked_to\n @linked_to ||= []\n end", "def index\n wl = current_user.watchlists.select(:name).distinct\n @watchlists = wl.map {|wlname| Watchlist.find_by(name: wlname.name) }\n end", "def ministry_list\n root_ministry.descendants.pluck(:id)\n end", "def items_list\n return self.donor_items.map{|it| \" #{it.item.andand.item_code} (#{it.number_donated}) \"}.join(\"/\")\n end", "def list_items\r\n list = \"\"\r\n items.each{ |item| list = list + item.name + \"\\n\"}\r\n list\r\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 lister node\n path = File.join(*node.user_object_path)\n populate path\n end", "def roles_list(role = nil)\n self.role_symbols\n end", "def open_lists\n List.open(id)\n end", "def links\n linked_to.map{|to|[self,to]}\n end", "def account_list(user)\n (user.account_lists & account_lists).first\n end", "def items_list\n return self.pickedup_items.ordered_by_item_category.map{|it| \n \" #{it.andand.item.andand.item_code} [#{it.number_donated}] \" << (it.comments.blank? ? \"\" : \"(#{it.comments}) \")\n }.join(\"/\")\n end", "def run_list\n self.roles.collect { |role| \"role[#{role}]\" } +\n self.recipes.collect { |recipe| \"recipe[#{recipe}]\" }\n end", "def get_relations_of_workspace_and_user(wid)\n get \"/workspaces/#{wid}/workspace_users\"\n end", "def list_related\n uid = unsafe_params[:uid]\n item = item_from_uid(uid)\n\n if item.accessible_by?(@context)\n unsafe_params[:opts] = unsafe_params[:opts].is_a?(Hash) ? unsafe_params[:opts] : {}\n\n scopes = unsafe_params[:opts][:scopes]\n unless scopes.nil?\n fail \"Option 'scopes' can only be an Array of Strings that are one of public, private or a space-xxxx id.\" unless scopes.is_a?(Array) && scopes.all? { |s| s == 'public' || s == 'private' || s =~ /^space-(\\d+)$/ }\n end\n\n classes = unsafe_params[:opts][:classes]\n unless classes.nil?\n fail \"Option 'classes' can be undefined or an array of strings\" unless classes.is_a?(Array) && classes.all? { |k| k.is_a?(String) }\n end\n\n scoped_items = lambda do |scoped_item, scopes_override = false|\n unless scopes.nil?\n scope_query = scopes_override ? scopes_override : { scope: scopes }\n scoped_item = scoped_item.where(scope_query)\n end\n scoped_item = if unsafe_params[:opts][:editable]\n scoped_item.editable_by(@context)\n else\n scoped_item.accessible_by(@context)\n end\n\n return scoped_item.to_a\n end\n\n allow_klass = lambda do |klass|\n return classes.nil? || classes.include?(klass)\n end\n\n related = []\n case item.klass\n when \"file\"\n related.push(*scoped_items.call(item.notes.real_notes)) if allow_klass.call(\"note\")\n related.push(*scoped_items.call(item.comparisons)) if allow_klass.call(\"comparison\")\n if item.parent_type == \"Job\"\n related.push(*scoped_items.call(Job.where(id: item.parent_id))) if allow_klass.call(\"job\")\n end\n when \"note\", \"answer\", \"discussion\"\n if item.klass == \"discussion\"\n scopes_override = !scopes.nil? ? { notes: { scope: scopes } } : false\n related.push(*scoped_items.call(item.answers.joins(:note), scopes_override)) if allow_klass.call(\"answer\")\n end\n note = if item.klass != \"note\"\n item.note\n else\n item\n end\n related.push(*scoped_items.call(note.comparisons)) if allow_klass.call(\"comparison\")\n related.push(*scoped_items.call(note.real_files)) if allow_klass.call(\"file\")\n related.push(*scoped_items.call(note.apps)) if allow_klass.call(\"app\")\n related.push(*scoped_items.call(note.jobs)) if allow_klass.call(\"job\")\n related.push(*scoped_items.call(note.assets)) if allow_klass.call(\"asset\")\n when \"app\"\n related.push(*scoped_items.call(item.notes.real_notes)) if allow_klass.call(\"note\")\n related.push(*scoped_items.call(item.jobs)) if allow_klass.call(\"job\")\n related.push(*scoped_items.call(item.assets)) if allow_klass.call(\"asset\")\n when \"job\"\n related.push(*scoped_items.call(App.where(id: item.app_id))) if allow_klass.call(\"app\")\n related.push(*scoped_items.call(item.notes.real_notes)) if allow_klass.call(\"note\")\n related.push(*scoped_items.call(item.input_files)) if allow_klass.call(\"file\")\n related.push(*scoped_items.call(item.output_files)) if allow_klass.call(\"file\")\n when \"asset\"\n when \"comparison\"\n related.push(*scoped_items.call(item.notes.real_notes)) if allow_klass.call(\"file\")\n related.push(*scoped_items.call(item.user_files)) if allow_klass.call(\"file\")\n when \"license\"\n when \"space\"\n when \"workflow\"\n related.push(*scoped_items.call(item.apps)) if allow_klass.call(\"app\")\n related.push(*scoped_items.call(item.jobs)) if allow_klass.call(\"job\")\n else\n fail \"Unknown class #{item.klass}\"\n end\n\n related = related.uniq.map { |o| describe_for_api(o, unsafe_params[:opts][:describe]) }\n\n render json: related\n else\n fail \"You do not have permission to access #{id}\"\n end\n end", "def linked_transactions\n wizard_list_step(nil, setup_step: :setup_linked_transactions_step,\n next_step: :calculate_next_step, cache_index: LbttController,\n list_required: :linked_ind, list_attribute: :link_transactions,\n new_list_item_instance: :new_list_item_link_transactions)\n end", "def linked\n ret = []\n self.links.inject(ret){|arr , link| arr << link.target}\n self.incomming_links.inject(ret){|arr , link| arr << link.source}\n ret\n end", "def connections_here(whom = nil)\n list = []\n if whom\n whom = whom.map(&:downcase)\n end\n @connection.server.connections.each { |key, connection|\n if whom\n if whom.include?(connection.agent.name.downcase) and connection.agent.item == item\n list.push(connection)\n end\n else\n if connection.agent.item == item\n list.push(connection)\n end\n end\n }\n return list\n end", "def my_memberships_list\n list = []\n self.ul(:class=>\"mygroup_items_list\").spans(:class=>\"mygroups_ellipsis_text\").each do |span|\n list << span.text\n end\n return list\n end", "def list_worksets (username, token, include_public)\n Rails.logger.debug \"list_public_worksets #{username}\"\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets?public=#{include_public}\")\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::Get.new(url.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n request.add_field(\"Accept\", \"application/vnd.htrc-workset+xml\")\n response = http.request(request)\n Rails.logger.debug \"Response Code: #{response.code}\"\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\n response_xml = response.body\n #Rails.logger.debug response_xml\n\n worksets = Array.new\n\n doc = REXML::Document.new(response_xml)\n\n doc.elements.each('worksets/workset/metadata') { |metadata|\n hash = Hash.new\n hash['name'] = metadata.elements['name'].text\n hash['description'] = metadata.elements['description'].text\n hash['author'] = metadata.elements['author'].text\n\n if (hash['author'] == username)\n worksets.unshift(hash)\n else\n worksets.push(hash)\n end\n }\n\n id = 1\n worksets.each { |w|\n w['id'] = id;\n id = id+1\n\n }\n\n return worksets\n end", "def associates_list()\n\t\tassocs = Contract.associates_for(current_user()).all.inject([]) \\\n\t\t\t{ |ret, assoc| ret << ([assoc.username, assoc.id] unless assoc.id == 2) }.compact\n\tend", "def accounts\n @browser.lis(data_semantic: 'account-item')\n end", "def row_items\n object.manifest_items.scope.active\n end", "def list_users(workspace)\n puts \"\\nUser List\\n\\n\"\n tp workspace.users, \"id\", \"name\", \"real_name\", \"status_text\", \"status_emoji\"\nend", "def wait_list(course)\n \twl = course.registrations.where(:wl => true)\n \treturn wl\n end", "def add_link(lh)\n lnk_wid = lh[:wid]\n\tlnk_role = lh[:role]\n\t\n\t# find or create the attach node\n if @doc.xpath('//field[@id=\"linkedWorkItems\"]/list').last.nil?\n Nokogiri::XML::Builder.with(@doc.xpath('//work-item').last) do\n field(:id => 'linkedWorkItems') {\n\t list {}\n\t }\n end\n end\n\t\n\t# build and attach the link struct\n\tNokogiri::XML::Builder.with(@doc.xpath('//field[@id=\"linkedWorkItems\"]/list').last) do\n\t struct {\n\t item(:id => 'revision')\n\t\titem(:id => 'workItem') {\n\t\t text lnk_wid\n\t\t}\n\t\titem(:id => 'role') {\n\t\t text lnk_role\n\t\t}\n\t }\n\tend\n end", "def workflow_ids\n approval_access = RBAC::Access.new('workflows', 'approve').process\n approval_access.send(:generate_ids)\n\n Rails.logger.info(\"Accessible workflows: #{approval_access.id_list}\")\n\n approval_access.id_list\n end" ]
[ "0.588742", "0.5639725", "0.5494293", "0.5393605", "0.5306446", "0.5221445", "0.51779103", "0.51683897", "0.51538044", "0.5148698", "0.5145366", "0.51173925", "0.51153964", "0.51047075", "0.50885755", "0.5083474", "0.5060652", "0.5057517", "0.50118136", "0.5007342", "0.5004423", "0.5000948", "0.49995136", "0.49925563", "0.49902287", "0.4987344", "0.49848145", "0.49615645", "0.49488533", "0.4948039" ]
0.7573507
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_role_url(url, role_index=0)\n implementation[\"roles\"][role_index][\"role_url\"]=url\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 main_nav_link_helper(role,link_id,link_text,link_title,link_details)\n if has_role?(role)\n (\"<li id='#{link_id}'#{\" class='active'\" if main_nav_guess_current == link_id}>\" +\n link_to(link_text, link_details, :title => link_title) +\n \"</li>\").html_safe\n else\n \"\"\n end\n end", "def update_user_role(params)\n self.link.update_attributes(role: params[:rolname], active: params[:active_link])\n end", "def link_to_add_role(name, f, association, **args)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize, f: builder)\n end\n link_to(name, \"#\", class: \"add_fields \" + args[:class], data: { id: id, fields: fields.gsub(\"\\n\", \"\") })\n end", "def click_add_salesperson_link\n add_salesperson_link.click\n end", "def create_and_link(title, itype, ltype, o={})\n item = Item.find_or_create(title, itype, o)\n Link.find_or_create(item.id, id, ltype, o)\n end", "def linkItem _obj, _args\n \"_obj linkItem _args;\" \n end", "def add_role(role)\n roles << role\n end", "def addrole(event, role)\n if @assignable_roles.include? role then\n if event.message.author.roles.find {|r| r.name == role}\n event.send_message(\"but you already have that role sweetie\")\n else\n event.message.author.add_role get_role(event, role)\n event.send_message(\"mhm! role added, you're now #{role}\")\n end\n else\n event.send_message(\"i'm sorry honey, but i can't give you that role\")\n end\n end", "def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end", "def termref(name, role_name = nil)\n role_name ||= name\n element(role_name, {:href=>'#'+name, :class=>:object_type}, 'a')\n end", "def termref(name, role_name = nil)\n role_name ||= name\n element(role_name, {:href=>'#'+name, :class=>:object_type}, 'a')\n end", "def write_link(org_one, org_two)\n org_one = Organisation.find(org_one)\n org_two = Organisation.find(org_two)\n\n if org_one != org_two\n org_one.linked_to = org_one.linked_to + [org_two.uri] # write org:linkedTo\n org_two.linked_to = org_two.linked_to + [org_one.uri] # write org:linkedTo\n\n begin\n org_one.save!\n org_two.save!\n rescue\n false\n end\n end\n end", "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 test_link\n authenticated_client.link test_link_full_name\nend", "def bot_addrole(event, role=nil)\n if role.nil?\n event.send_message <<-MESSAGE\n the roles i'll let you play with are #{@assignable_roles.to_a.join \", \"}\n MESSAGE\n else\n addrole(event, role)\n end\n end", "def add_href\n return if attributes.key?(\"href\")\n return unless attributes.key?(\"id\")\n attributes[\"href\"] = client.connection.api_path(\"#{collection.name}/#{attributes['id']}\")\n end", "def hyperlink()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Hyperlink::HyperlinkRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def admin_user_with_role(user)\n send user.role, user\n end", "def become_user_link_element(user)\n link_element(id: \"become-#{user.uid}\")\n end", "def menu_item_link(m)\n options = {}\n if m.new_page\n options = {:target => \"_blank\"}\n end\n link_to m.title, m.url, options\n end", "def link(relation, href, options={})\n @resource.add_link relation, href, options\n end", "def addrole\n\t\tself.add_role :Guest\n\tend", "def create_link(item_nr)\n \"<a href=\\'/item/#{item_nr}\\'>#{self}</a>\"\n end", "def add_me_link\n link_to_function(_(\"add me\")) do |page|\n page.insert_html(:bottom, \"task_notify\",\n :partial => \"tasks/notification\",\n :locals => { :notification => current_user })\n end\n end", "def add_another_asset_link\n expect(focused_element).to eq(find_button('Add another link').native)\n\n focused_element.send_keys(:enter,\n [:shift, :tab],\n [:shift, :tab],\n [:shift, :tab],\n [:shift, :tab])\n end", "def project_link(project)\n context.link_to project.name, context.backlog_path(:user => project.user.username, :key => project.key)\n end", "def add_link(link)\n links << link\n end", "def <<(actor)\n @links[actor.mailbox.address] = actor\n end" ]
[ "0.5651713", "0.5580572", "0.5452056", "0.5435948", "0.5411164", "0.5391962", "0.5356014", "0.531838", "0.5298207", "0.5297529", "0.52965766", "0.5295887", "0.5295887", "0.5289582", "0.52657247", "0.52458954", "0.52362657", "0.52158487", "0.52028644", "0.51917166", "0.5188409", "0.51273715", "0.51148856", "0.51025105", "0.5096165", "0.5091032", "0.5086032", "0.50761896", "0.5074224", "0.50517005" ]
0.61871344
0
Delete an organization's routing settings
def delete_routing_settings(opts = {}) delete_routing_settings_with_http_info(opts) return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @org_setting.destroy\n\n head :no_content\n end", "def delete_routing_settings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.delete_routing_settings ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/routing/settings\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#delete_routing_settings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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_omniauth\n organization = Maestrano::Connector::Rails::Organization.find_by_id(params[:organization_id])\n if organization && is_admin?(current_user, organization)\n organization.oauth_uid = nil\n organization.oauth_token = nil\n organization.refresh_token = nil\n organization.sync_enabled = false\n organization.save\n end\n\n redirect_to root_url\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 destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n \n redirect_to admin_organizations_url, notice: t('organization.messages.delete.success')\n end", "def destroy\n @global_config = AppConfig.find(params[:id])\n @global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to global_configs_url }\n format.json { head :no_content }\n end\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 @org = Organisation.find_by( id: params[\"id\"]).delete\n redirect_to root_url\n end", "def DeleteOrganization id\n \n APICall(path: \"organizations/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n standard_destroy(OrganizationType, params[:id])\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 @organization.destroy\n end", "def destroy\n authorize! @organization\n @organization.destroy\n\n redirect_to root_path\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", "def destroy\n @site_config = SiteConfig.find(params[:id])\n @site_config.destroy\n\n respond_to do |format|\n format.html { redirect_to site_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n debug('Removing location')\n crm('configure', 'delete', @resource[:name])\n @property_hash.clear\n end", "def destroy\n system_node_id = @setting.system_node_id\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to edit_system_node_path(system_node_id), notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @organization_theme.destroy\n end", "def destroy\n @organization.destroy\n end", "def destroy\n @portal_config.destroy\n respond_to do |format|\n format.html { redirect_to portal_configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_route(route={})\n request :delete, '/routes', route\n end", "def destroy\n @kf_global_config = Kf::GlobalConfig.find(params[:id])\n @kf_global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_global_configs_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end", "def delete(config, org_guid)\n token = @client.token\n\n user_setup_obj = UsersSetup.new(config)\n admin_token = user_setup_obj.get_admin_token\n\n # elevate user just to delete organization\n @client.token = admin_token\n org = @client.organization(org_guid)\n deleted = org.delete(:recursive => true)\n\n # then put token back to the initial one\n @client.token = token\n deleted\n end", "def destroy\n @website_setting = WebsiteSetting.find(params[:id])\n @website_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to website_settings_url }\n format.json { head :ok }\n end\n end", "def destroy\n org = Org.includes(:users, :templates, :guidance_groups).find(params[:id])\n authorize org\n\n # Only allow the delete if the org has no dependencies\n return if !org.users.empty? || !org.templates.empty?\n\n org.guidance_groups.delete_all\n\n if org.destroy!\n msg = success_message(org, _('removed'))\n redirect_to super_admin_orgs_path, notice: msg\n else\n failure = failure_message(org, _('remove'))\n redirect_to super_admin_orgs_path, alert: failure\n end\n end", "def destroy\n @doc_type_am_configuration = DocTypeAmConfiguration.find(params[:id])\n @doc_type_am_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to doc_type_am_configurations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to(organizations_url) }\n end\n end" ]
[ "0.730187", "0.65662843", "0.6402383", "0.6378157", "0.6342843", "0.63057655", "0.62673783", "0.62329805", "0.6202773", "0.6193246", "0.617383", "0.61692655", "0.6145706", "0.61408544", "0.61327016", "0.61080647", "0.6107035", "0.60616076", "0.6054164", "0.6053777", "0.6050099", "0.603824", "0.59991866", "0.5950887", "0.5938601", "0.59319836", "0.5928705", "0.59281904", "0.5919351", "0.5918877" ]
0.6706296
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_routing_queue_wrapupcodes_with_http_info(queue_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_queue_wrapupcodes ...\"\n end\n \n \n # verify the required parameter 'queue_id' is set\n fail ArgumentError, \"Missing the required parameter 'queue_id' when calling RoutingApi.get_routing_queue_wrapupcodes\" if queue_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/queues/{queueId}/wrapupcodes\".sub('{format}','json').sub('{' + 'queueId' + '}', queue_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'WrapupCodeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_queue_wrapupcodes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_routing_queue_wrapupcodes_with_http_info(queue_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_queue_wrapupcodes ...\"\n end\n \n \n # verify the required parameter 'queue_id' is set\n fail ArgumentError, \"Missing the required parameter 'queue_id' when calling RoutingApi.get_routing_queue_wrapupcodes\" if queue_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/queues/{queueId}/wrapupcodes\".sub('{format}','json').sub('{' + 'queueId' + '}', queue_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'WrapupCodeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_queue_wrapupcodes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end", "def b_f_s(queue)\n queue.shift\n end", "def blocking_queue_handler queues, meth, timeout=Stella::Worker.queuetimeout\n queues << timeout # We do it this way to support Ruby 1.8\n queue, jobid = *(Stella::SmartQueue.redis.send(meth, *queues) || [])\n return nil if jobid.nil?\n #Stella.ld \"FOUND #{jobid} in #{queue}\"\n jobid\n end", "def _get_queued_instruction\n\n begin\n\n # pull from the priority queue first\n queue_uri = \"#{@control_queue_uri}_priority_100\"\n response = @sqs.receive_message(queue_url: queue_uri, max_number_of_messages: 1)\n\n\n # otherwise go to the normal queue\n unless response.messages.count > 0\n queue_uri = @control_queue_uri\n response = @sqs.receive_message(queue_url: queue_uri, max_number_of_messages: 1)\n end\n\n control_message = {}\n response.messages.each do |m|\n\n if (m && m.body)\n\n @sqs.delete_message({\n queue_url: queue_uri,\n receipt_handle: m.receipt_handle\n })\n\n # return the first one\n message = JSON.parse(m.body)\n _log \"Got instruction for #{message[\"id\"]}\"\n _log \"#{message}\"\n\n return message\n\n else\n _log_error \"No instructions received!!!\"\n return nil\n end\n end\n rescue JSON::ParserError => e\n _log_error \"Can't parse response\"\n rescue Aws::SQS::Errors::NonExistentQueue\n _log_error \"A queue named '#{queue_name}' does not exist.\"\n end\n\n false\n end", "def post_routing_queue_wrapupcodes(queue_id, body, opts = {})\n data, _status_code, _headers = post_routing_queue_wrapupcodes_with_http_info(queue_id, body, opts)\n return data\n end", "def post_routing_queue_wrapupcodes(queue_id, body, opts = {})\n data, _status_code, _headers = post_routing_queue_wrapupcodes_with_http_info(queue_id, body, opts)\n return data\n end", "def nonblocking_queue_handler queues, meth\n jobid, queue = nil, nil\n queues.each do |q|\n queue, jobid = q, Stella::SmartQueue.redis.send(meth, q)\n break if ! jobid.nil?\n end\n return nil if jobid.nil?\n #Stella.ld \"FOUND #{jobid} in #{queue}\"\n jobid\n end", "def key_queue_status\n key(\"queue\", \"status\")\n end", "def queues_cmd\n return @unique_queues.dup << TIMEOUT if @strictly_ordered_queues\n queues = @queues.sample(@unique_queues.size).uniq\n queues.concat(@unique_queues - queues)\n queues << TIMEOUT\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 inspect\n \"#<#{self.class}:0x#{self.__id__.to_s(16)} NT=#{@run_queue.length}>\"\n end", "def inspect\n \"#<#{self.class}:0x#{self.__id__.to_s(16)} NT=#{@run_queue.length}>\"\n end", "def queue_key\n Digest::SHA256.hexdigest(queues.sort.join(\";\"))\n end", "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_key_for(val)\n if val.is_a?(Integer)\n QUEUE_PRIORITY.invert[val]\n else\n val.try(:queue_key) || val.try(:to_sym)\n end\n end", "def restriction_queue(tracking_key, queue)\n restriction_queue_raw(tracking_key, queue).collect {|s| decode(s) }\n end", "def get_queues\n @gem_name_queue = get_queue 'gem_name'\n @gem_queue = get_queue 'gem'\n end", "def post_routing_queue_wrapupcodes_with_http_info(queue_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.post_routing_queue_wrapupcodes ...\"\n end\n \n \n # verify the required parameter 'queue_id' is set\n fail ArgumentError, \"Missing the required parameter 'queue_id' when calling RoutingApi.post_routing_queue_wrapupcodes\" if queue_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.post_routing_queue_wrapupcodes\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/queues/{queueId}/wrapupcodes\".sub('{format}','json').sub('{' + 'queueId' + '}', queue_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<WrapupCode>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#post_routing_queue_wrapupcodes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def queue_stats\n broker_stats[\"queues\"]\n end", "def backlog\n @queues.map{|k,v| [k,v.size]} \n end", "def restriction_queue_raw(tracking_key, queue)\n Array(Resque.redis.lrange(restriction_queue_key(tracking_key, queue), 0, -1))\n end", "def post_routing_queue_wrapupcodes_with_http_info(queue_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.post_routing_queue_wrapupcodes ...\"\n end\n \n \n # verify the required parameter 'queue_id' is set\n fail ArgumentError, \"Missing the required parameter 'queue_id' when calling RoutingApi.post_routing_queue_wrapupcodes\" if queue_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.post_routing_queue_wrapupcodes\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/queues/{queueId}/wrapupcodes\".sub('{format}','json').sub('{' + 'queueId' + '}', queue_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<WrapupCode>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#post_routing_queue_wrapupcodes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def queued_method_queued_key(method)\n queued_method_key method, 'queued'\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 get_general_queue\n reply = @client.call(:get_general_queue)\n data = reply.body.dig(:get_general_queue_response,\n :get_general_queue_result,\n :array_of_string)\n data = check_if_data_exists(data)\n\n data.map do |attrs|\n {\n service_id: attrs[:string][0],\n service_name: attrs[:string][1],\n channel_id: attrs[:string][2],\n channel_name: attrs[:string][3],\n contact_type: attrs[:string][4],\n directive: attrs[:string][5],\n queue_length: attrs[:string][6],\n time_in_queue: attrs[:string][7]\n }\n end\n rescue Savon::HTTPError => error\n Rails.logger.debug error.http.code\n return []\n end", "def process_queue(doctype)\n verify_doctype(doctype)\n ret = []\n keys = []\n lock_queue_doc(doctype) do |s|\n ret, keys = Store.get_store(0).get_zdata(s.queue_docname(doctype))\n Store.get_store(0).flush_zdata(s.queue_docname(doctype))\n end\n [ret, keys]\n end", "def queues\n @queues[0] == \"*\" ? RockQueue.queues : @queues\n end", "def rt_queue\n return(self.lang == 'en_US' ? queue : self.lang)\n end" ]
[ "0.593082", "0.5857839", "0.5729366", "0.57112134", "0.56663644", "0.56494474", "0.5646263", "0.5646263", "0.5624186", "0.55112594", "0.5492475", "0.5487969", "0.5431073", "0.5431073", "0.54277134", "0.539099", "0.53842854", "0.5314806", "0.5296389", "0.5292231", "0.5276259", "0.52742624", "0.52704346", "0.525028", "0.5238902", "0.52161825", "0.5202835", "0.5187783", "0.5169203", "0.51289856" ]
0.6597079
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_routing_settings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_settings ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/routing/settings\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RoutingSettings')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_settings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n 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 get_settings\n request :get, \"_settings\"\n end", "def get_settings\n request :get, \"_settings\"\n end", "def profile_route\n \"/organization/#{self.id}\"\n end", "def get_settings\n @bridge.get_settings\n end", "def search_routing\n space.team_id\n end", "def get_settings\n settings.get\n end", "def organization\n self[:O]\n end", "def routes_normal\n return @routes[:inside_region]\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 @settings ||= get('/settings')['settings']\n end", "def general\n config['general']\n end", "def routing_key\n model.is_a?(Cocina::Models::AdminPolicyWithMetadata) ? 'SDR' : AdministrativeTags.project(identifier: model.externalIdentifier).first\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 routing_key\n model.is_a?(Cocina::Models::AdminPolicy) ? 'SDR' : AdministrativeTags.project(identifier: model.externalIdentifier).first\n end", "def organization\n capital_project.organization\n end", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def requestor_settings\n return @requestor_settings\n end", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def routes_out_of_region\n return @routes[:outside_region]\n end", "def route\n return @children['route'][:value]\n end", "def index\n get_settings\n end", "def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end", "def routes\n context[:routes]\n end", "def settings\n @scope.settings\n end", "def routing_key; opt('routing_key'); end", "def index\n @org_settings = OrgSetting.all\n\n render json: @org_settings\n end" ]
[ "0.61976194", "0.6116203", "0.6043768", "0.6023132", "0.6023132", "0.59173304", "0.5763514", "0.57590765", "0.5696754", "0.5636265", "0.56117845", "0.5528207", "0.5515749", "0.5483957", "0.54781586", "0.5463524", "0.54619485", "0.5427907", "0.53998363", "0.53828526", "0.53819966", "0.5379395", "0.5371385", "0.5334326", "0.53164274", "0.5307907", "0.5303791", "0.5289186", "0.52495044", "0.5243189" ]
0.62819916
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_settings\n settings.get\n end", "def get_routing_settings_contactcenter_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_settings_contactcenter ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/routing/settings/contactcenter\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContactCenterSettings')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_settings_contactcenter\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_settings\n request :get, \"_settings\"\n end", "def get_settings\n request :get, \"_settings\"\n end", "def get_settings\n @bridge.get_settings\n end", "def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def settings\n @settings ||= get('/settings')['settings']\n end", "def settings\n {\n name: @client.self.name,\n team: @client.team.name,\n domain: @client.team.domain\n }\n end", "def settings\n CircleCi.request(conf, \"#{base_path}/settings\").get\n end", "def settings\n get('/account/settings.json')\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 get_settings(options = {}, request_options = {})\n options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion']\n client.get(Protocol.settings_uri(name, options).to_s, :read, request_options)\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 CircleCi.request(@conf, \"/project/#{username}/#{project}/settings\").get\n end", "def settings\n return @settings\n end", "def settings\n return @settings\n end", "def mcl\n build_settings_array RubyRedtail::Query.run(\"settings/mcl\", @api_hash, \"GET\")\n end", "def settings\n @settings\n end", "def query_settings(options={})\n path = \"/api/v2/settings\"\n get(path, options)\n end", "def get_settings(params = {})\n response = client.get \"/_cluster/settings\", params.merge(action: \"cluster.get_settings\", rest_api: \"cluster.get_settings\")\n response.body\n end", "def settings\r\n @@settings\r\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 appl_settings\n @appl_settings\n end", "def settings\n @settings ||= {}\n end", "def settings\n @settings ||= {}\n end", "def settings\n # TODO\n {}\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" ]
[ "0.6859486", "0.67521214", "0.6604221", "0.6604221", "0.65050334", "0.65021676", "0.6328418", "0.63258797", "0.6324125", "0.6308632", "0.6276304", "0.6253201", "0.622507", "0.61976767", "0.6146485", "0.6141268", "0.61061513", "0.609263", "0.609263", "0.6048011", "0.6032028", "0.59607613", "0.59119695", "0.59115857", "0.5882663", "0.58663213", "0.5858546", "0.5858546", "0.5852088", "0.5840001" ]
0.71615505
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skills\n\t\t[]\n\tend", "def index\n @desired_skills = DesiredSkill.all\n end", "def index\n\t@skills = Skill.all\n end", "def skills_view(skills)\n skills.map { |skill| skill_view(skill) }\n end", "def list_skills\n\t\trender json: Skill.where(language_id: params[:language_id]).to_json\n\tend", "def index\n @skills = current_user.skills.all\n end", "def skillsNeeded\n\t\t[]\n\tend", "def index\n @skills = Skill.all\n end", "def index\n @skills = Skill.all\n end", "def index\n @skill_levels = SkillLevel.all\n end", "def index\n @skill_lists = SkillList.all\n end", "def get_routing_skills_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_skills ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/skills\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SkillEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_skills\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_routing_skills_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_skills ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/skills\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SkillEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_skills\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n\t\tauthorize! :read, Skill\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @skills }\n end\n end", "def skills(id={}, options={})\n options = parse_id(id, options)\n path = \"#{profile_path(options, false)}/skills\"\n get(path, options)\n end", "def index\n @s_skills = SSkill.all\n end", "def index\n @current_skills = CurrentSkill.all\n end", "def index\n @areas_skills = AreasSkill.all\n end", "def index\n @skills = Skill.by_orderno\n end", "def index\n @opening_skills = OpeningSkill.all\n end", "def index\n @skill_slots = SkillSlot.all\n end", "def all_skills\n self.skills.map(&:name).join(', ')\n end", "def all_skills\n self.skills.map(&:name).join(\", \")\n end", "def index\n @special_skills = SpecialSkill.all\n end", "def skill_schools\r\n\t\t[\r\n\t\t\t'Tailoring', \r\n\t\t\t'Jewelcrafting', \r\n\t\t\t'Enchanting',\r\n\t\t\t'Blacksmithing',\r\n\t\t\t'Summoning',\r\n\t\t\t'Shadow',\r\n\t\t\t'Fire',\r\n\t\t\t'Holy',\r\n\t\t\t'Frost',\r\n\t\t\t'Melee',\r\n\t\t\t'Ranged'\r\n\t\t]\r\n\tend", "def index\n @myskills = Myskill.all\n end", "def index\n @skills = Skill.all\n\n render json: @skills\n end", "def index\n @buildskills = Buildskill.all\n end", "def index\n @computer_skills = current_user.computer_skills.all\n @computerSkillList = ComputerSkillList.all\n @skillLevel = SkillLevel.all\n end", "def get_skills(locator, freelancer)\n find_all(locator, freelancer).map {|skill| skill.text}\n end" ]
[ "0.7204195", "0.6707567", "0.6667485", "0.665472", "0.66317236", "0.6582452", "0.6541576", "0.65037006", "0.65037006", "0.64443225", "0.6414369", "0.64018404", "0.6391023", "0.6369318", "0.63278127", "0.62645847", "0.6242867", "0.6210142", "0.6133432", "0.6127569", "0.611758", "0.60974705", "0.60916877", "0.60772383", "0.60754997", "0.60719085", "0.60626936", "0.60510147", "0.60251784", "0.5999682" ]
0.7397265
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 index\n @languages = Language.all.order(:name)\n @path_langu = request.path.starts_with? '/langu'\n end", "def add_languages(lang_hash)\r\n JobSeekerLanguage.delete_all(\"job_seeker_id = '#{self.id}'\")\r\n lang_hash.each{|k,v|\r\n begin\r\n lang = Language.find(k)\r\n self.job_seeker_languages << JobSeekerLanguage.new({:language_id => k,:proficiency_val => v})\r\n rescue ActiveRecord::RecordNotFound\r\n end\r\n }\r\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 add_languages_new(lang_hash)\r\n JobSeekerLanguage.delete_all(\"job_seeker_id = '#{self.id}'\")\r\n if !lang_hash.blank?\r\n lang_arr = lang_hash.split(\",\")\r\n lang_arr.each{|lang|\r\n lang_each = lang.split(\"__\")\r\n lang_id = Language.find_by_name(lang_each[0]).id\r\n begin\r\n self.job_seeker_languages << JobSeekerLanguage.new({:language_id => lang_id, :proficiency_val => lang_each[1]})\r\n rescue ActiveRecord::RecordNotFound\r\n end\r\n }\r\n end\r\n end", "def patch_user_routinglanguages_bulk_with_http_info(user_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.patch_user_routinglanguages_bulk ...\"\n end\n \n \n # verify the required parameter 'user_id' is set\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling RoutingApi.patch_user_routinglanguages_bulk\" if user_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.patch_user_routinglanguages_bulk\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/users/{userId}/routinglanguages/bulk\".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UserLanguageEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#patch_user_routinglanguages_bulk\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @user = current_user\n @project = Project.find(params[:project_id])\n @preferedlang = Language.find_by_id(@project.source_lang_id)\n @slanguages = Language.where(\"id != ?\", @preferedlang.id).order('iso_code asc') \n @slanguages.unshift(@preferedlang)\n #from railsrecipes recipe 22 - refactor\n # @user = current_user\n\n\n @mostpopulartarlang = Language.find_by_id(@project.translations.maximum(\"source_lang_id\"))\n if @mostpopulartarlang\n @tlanguages = Language.where(\"id != ?\", @mostpopulartarlang.id).order('iso_code asc')\n @tlanguages.unshift(@mostpopulartarlang)\n else\n @tlanguages = Language.order('iso_code desc')\n end\n\n\n @translation = @project.translations.build(params[:translation])\n @translation.owner_id = @user.id\n\n# @project = Project.find(params[:id])\n\n# @translation = Translation.new(params[:translation])\n# @translation.owner_id = current_user.id\n# @translation.project_id = Project.find_by_id(params[:project_id]).id\n # @user = User.find(params[:user_id])\n # @project = Project.find(params[:project_id])\n # @translation = Translation.new(params[:translation])\n # @project = current_user.projects.build\n # @translation = @project.translations.build\n # @user = current_user\n # @project = Project.find_by_user_id(@user)\n # @translation = @project.translations.build(params[:translation])\n @languages = Language.all(:order => 'iso_code')\n # #process information from checkbox\n\n if @translation.save\n flash[:notice] = \"Translation was successfully created\"\n # redirect_to user_project_translations_path(@user, @project)\n redirect_to user_project_path(current_user, @project)\n else\n render 'new'\n end\nend", "def create_default_language_entries\n self.all.each {|entry| entry.save_default_translation}\n end", "def index\n @learning_resources = @language.learning_resources\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 set_language\n params[:lang] ||= 'en'\n Localization.use params[:lang]\n end", "def index\n @user_languages = UserLanguage.all.to_a\n end", "def languages\n @selects = YAML.load_file(\"#{ExpressTranslate.root}/config/languages.yml\")\n @origin = Language.get_origin(params[:packages])\n @origin_keys = @origin.present? ? LanguageDetail.info(@origin).all.collect{|x| x['code']} : []\n @languages = Package.find(params[:packages])['language']\n @max = @origin.nil? ? 1 : LanguageDetail.info(@origin).all.count\n @LanguageDetail = LanguageDetail\n @Package = Package\n render :action => :languages, layout: 'express_translate/translate'\n end", "def scope_langs\n if params[:language_id].present?\n langs_scope = []\n langs_scope << \"langs.language_id = #{params[:language_id]}\"\n langs_condition = \"SELECT user_id FROM langs WHERE #{langs_scope.join('AND')}\"\n @users = @users.where(\"users.id IN (#{langs_condition})\")\n end\n end", "def after_create\n GetText::Db::Language.find(:all).each do |lang|\n self.completions.create(:language => lang)\n end\n end", "def sync_languages\n projects.find_each do |tracker|\n tracker.languages.find_each do |language|\n language_relations.find_or_create_by(language: language)\n end\n end\n end", "def index\n @languages = Language.all\n end", "def language_server; end", "def index\n @languagenames = Languagename.all\n end", "def index\n @langues = Langue.all\n end", "def on_load_language; load_language('lang/login'); end", "def get_language_list\n call :get_language_list\n end", "def sync_languages(languages, save_to = \"#{__dir__}\")\n validate\n languages.each { |language|\n self.sync_language(language, save_to)\n }\n end", "def index\n @r_languages = RLanguage.all\n end", "def get_routing_languages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_languages ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_order'] && !['ascending', 'descending'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of ascending, descending'\n end\n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/languages\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LanguageEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_languages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_port_translations()\n @rports.each do |rport|\n log \"try to add port #{rport}\"\n\n if not self.assignable?\n log \"reached the maximum number of ports allowed by machine (#{@max_assign})\"\n break\n end\n if not @ports.get_local_port(@remote_id, rport).nil?\n log \"translation for remote port #{rport} already exists (skip)\"\n next\n end\n\n begin\n lport = @ports.assign_local_port(@remote_id, rport)\n @firewall.insert(:pat, {:local_if => @local_if, :local_ip => @local_ip,\n :local_port => lport, :remote_ip => @remote_ip,\n :remote_port => rport})\n log \"added port translation #{lport} => #{rport}\"\n rescue FirewallError\n @ports.delete_port_translations(@remote_id, rport, lport)\n log \"couldn't add translation for remote port #{rport}\"\n end\n end\n end", "def index\n\t\t@languages = Language.all\n\t\t@title = t(\"translate.title\")\n\t\trespond_with @languages\n\tend", "def index\n authorize! :index, LanguageCode\n @admin_language_codes = Admin::LanguageCode.accessible_by(current_ability, :read)\n @admin_language_codes = @admin_language_codes.search(params[:search]) unless params[:search].blank?\n @admin_language_codes = @admin_language_codes.order(\"#{sort_column} #{sort_direction}\") unless sort_column.blank?\n @admin_language_codes = @admin_language_codes.paginate(page: params[:page], per_page: params[:per_page] || 100)\n end" ]
[ "0.64350766", "0.6042314", "0.59030354", "0.5797003", "0.5696586", "0.5687204", "0.566597", "0.5517404", "0.5451561", "0.54204214", "0.5397678", "0.5396581", "0.53672826", "0.52999985", "0.52969587", "0.5285753", "0.52821153", "0.5263881", "0.525577", "0.52556974", "0.52361894", "0.5212282", "0.52039266", "0.5196942", "0.51960707", "0.5190607", "0.5181006", "0.51386076", "0.51380795", "0.5115906" ]
0.60516745
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_model(record, reflection, id, attributes, seen, model_cache)\n klass = if reflection.polymorphic?\n record.send(reflection.foreign_type).constantize\n else\n reflection.klass\n end\n\n model = model_cache[klass][id] ||= klass.instantiate(attributes)\n other = record.association(reflection.name)\n\n if reflection.collection?\n other.target.push(model)\n else\n other.target = model\n end\n\n other.set_inverse_instance(model)\n model\n end", "def build(attrs = {})\n attrs[:type] ? attrs[:type].constantize.new(attrs) : new(attrs)\n end", "def construct_association(parent, reflection, attributes, seen, model_cache)\n return if attributes.nil?\n\n klass = if reflection.polymorphic?\n parent.send(reflection.foreign_type).constantize.base_class\n else\n reflection.klass\n end\n id = attributes[klass.primary_key]\n model = seen[parent.class.base_class][parent.id][klass][id]\n\n if model\n construct(model, attributes.select{|k,v| !klass.column_names.include?(k.to_s) }, seen, model_cache)\n\n other = parent.association(reflection.name)\n\n if reflection.collection?\n other.target.push(model)\n else\n other.target = model\n end\n\n other.set_inverse_instance(model)\n else\n model = construct_model(parent, reflection, id, attributes.select{|k,v| klass.column_names.include?(k.to_s) }, seen, model_cache)\n seen[parent.class.base_class][parent.id][model.class.base_class][id] = model\n construct(model, attributes.select{|k,v| !klass.column_names.include?(k.to_s) }, seen, model_cache)\n end\n end", "def nested_attributes_create(meta, attributes)\n reflection = meta[:reflection]\n obj = reflection.associated_class.new\n nested_attributes_set_attributes(meta, obj, attributes)\n delay_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\n # Because we are modifying the associations cache manually before the\n # setter is called, we still want to run the setter code even though\n # the cached value will be the same as the given value.\n @set_associated_object_if_same = true\n\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 if reflection[:type] == :many_to_one \n before_save_hook{send(reflection.setter_method, obj.save(:validate=>false))}\n else\n after_save_hook{send(reflection.setter_method, obj)}\n end\n end\n add_reciprocal_object(reflection, obj)\n obj\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 new_model(defaults = {})\n if parent_model\n # is it a has_many\n if parent_model.respond_to?(plural_model_name)\n new_model = parent_model.send(plural_model_name).build(defaults)\n # is is a has_one\n elsif parent_model.respond_to?(model_name)\n new_model = parent_model.send(\"build_#{model_name}\", defaults)\n else\n raise \"can't find association #{model_name} or #{plural_model_name} for #{parent_model.class.name}\"\n end\n else\n new_model = model_name.camelize.constantize.new(defaults)\n end\n return new_model\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 initialize(attrs = {})\n run_callbacks :initialize do\n @new_record = true\n @attributes ||= {}\n @associations ||= {}\n @attributes_before_type_cast ||= {}\n\n attrs_with_defaults = self.class.attributes.each_with_object({}) do |(attribute, options), res|\n if attrs.key?(attribute)\n res[attribute] = attrs[attribute]\n elsif options.key?(:default)\n res[attribute] = evaluate_default_value(options[:default])\n end\n end\n\n attrs_virtual = attrs.slice(*(attrs.keys - self.class.attributes.keys))\n\n load(attrs_with_defaults.merge(attrs_virtual))\n end\n end", "def build(attributes)\n self.model_instance ||= (base.kind_of?(Class) ? base.new(attributes) : base.build(attributes))\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 initialize(model_class)\n @model_class = model_class\n @models_to_embed = []\n end", "def initialize(attrs = {})\n # we need this hack for Rails 4.0 only\n # because `run_callbacks` calls `attributes` getter while it is still nil\n @attributes = {}\n\n run_callbacks :initialize do\n @new_record = true\n @attributes ||= {}\n @associations ||= {}\n\n self.class.attributes.each do |_, options|\n if options[:type].is_a?(Class) && options[:default]\n raise 'Dynamoid class-type fields do not support default values'\n end\n end\n\n attrs_with_defaults = {}\n self.class.attributes.each do |attribute, options|\n attrs_with_defaults[attribute] = if attrs.key?(attribute)\n attrs[attribute]\n elsif options.key?(:default)\n evaluate_default_value(options[:default])\n end\n end\n\n attrs_virtual = attrs.slice(*(attrs.keys - self.class.attributes.keys))\n\n load(attrs_with_defaults.merge(attrs_virtual))\n end\n end", "def build(attrs = {})\n choose_right_class(attrs).new(attrs)\n end", "def instantiate(record)\n object = record_with_type?(record) ? compute_type(record[inheritance_column]).allocate : allocate\n object.instance_variable_set(\"@attributes\", record)\n return object\n end", "def new_record(model, *args)\n attributes = valid_attributes_for(model, *args)\n record = model.new(attributes)\n attributes.each {|attr, value| record.send(\"#{attr}=\", value) if model.accessible_attributes && !model.accessible_attributes.include?(attr) || model.protected_attributes && model.protected_attributes.include?(attr)}\n record\n end", "def create!(attributes)\n new_attributes = map_to_keys(attributes)\n\n new_attributes = new_attributes.merge(\n RecordTypeManager::FIELD_NAME => klass.record_type_id\n ) if klass.record_type_id\n\n client.create!(klass.object_name, new_attributes)\n end", "def instantiate(record)\n associated_record = sti_config[:type_class_name].constantize.find_by_id(record[sti_config[:foreign_key].to_s])\n type_name = associated_record.try(sti_config[:type_column])\n record[inheritance_column] = type_name\n\n super\n end", "def construct(parent, relations, seen, model_cache)\n relations.each do |key, attributes|\n reflection = parent.class.reflect_on_association(key)\n next unless reflection\n\n if reflection.collection?\n other = parent.association(reflection.name)\n other.loaded!\n else\n if parent.association_cached?(reflection.name)\n model = parent.association(reflection.name).target\n construct(model, attributes.select{|k,v| !reflection.klass.column_names.include?(k.to_s) }, seen, model_cache)\n end\n end\n\n if !reflection.collection?\n construct_association(parent, reflection, attributes, seen, model_cache)\n else\n attributes.each do |row|\n construct_association(parent, reflection, row, seen, model_cache)\n end\n end\n\n end\n end", "def new_with_associations\n raise \"Method not implemented, please define \\\"self.new_with_associations\\\" in #{model_name.to_s}\"\n end", "def new_record(model, *args)\n attributes = valid_attributes_for(model, *args)\n record = model.new(attributes)\n attributes.each {|attr, value| record.send(\"#{attr}=\", value) }\n record\n end", "def build_embedded_models(data)\n return false unless relations.include? :embed_one\n\n relations[:embed_one].each do |name, relation|\n value = if data.key? relation[:alias] then data[relation[:alias]]\n elsif data.key? name then data[name]\n else nil\n end\n\n @embedded_models[name] = ::Mandrake::EmbeddedModel.new(relation[:model], value)\n end\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 do_new\n @record = new_model\n apply_constraints_to_record(@record)\n create_association_with_parent(@record) if nested?\n @record\n end", "def create!(attrs = {})\n if attrs.is_a?(Array)\n attrs.map { |attr| create!(attr) }\n else\n build(attrs).tap(&:save!)\n end\n end", "def new(attributes = {}, &block)\n assert_valid\n\n model = if discriminator = properties(repository_name).discriminator\n attributes[discriminator.name]\n end\n\n model ||= self\n\n resource = model.allocate\n resource.send(:initialize, attributes, &block)\n resource\n end", "def initialize(model = nil, ignore_doc_type: false, **attributes)\n @__metadata__ = Metadata.new\n\n # Assign default values\n @__attributes__ = ::ActiveSupport::HashWithIndifferentAccess.new({type: self.class.design_document})\n self.class.attributes.each do |key, options|\n default = options[:default]\n if default.respond_to?(:call)\n write_attribute key, default.call\n else\n write_attribute key, default\n end\n end\n\n if model\n case model\n when ::Libcouchbase::Response\n doc = model.value || raise('empty response provided')\n type = doc.delete(:type)\n doc.delete(:id)\n\n if type && !ignore_doc_type && type.to_s != self.class.design_document\n raise \"document type mismatch, #{type} != #{self.class.design_document}\"\n end\n\n @__metadata__.key = model.key\n @__metadata__.cas = model.cas\n\n # This ensures that defaults are applied\n @__attributes__.merge! doc\n clear_changes_information\n when CouchbaseOrm::Base\n clear_changes_information\n attributes = model.attributes\n attributes.delete(:id)\n super(attributes)\n else\n clear_changes_information\n super(attributes.merge(Hash(model)))\n end\n else\n clear_changes_information\n super(attributes)\n end\n\n yield self if block_given?\n\n run_callbacks :initialize\n end", "def build(attributes = {})\n attrs = self.schema\n self.new(attrs)\n end", "def new(attrs = {})\n obj = self.model.new\n attrs.each do |k,v|\n obj.send(\"#{k}=\", v)\n end\n obj\n end", "def instantiate_without_type(execute_callbacks)\n klass.instantiate_document(attributes, selected_fields, execute_callbacks: execute_callbacks).tap do |obj|\n if criteria&.association && criteria&.parent_document\n obj.set_relation(criteria.association.inverse, criteria.parent_document)\n end\n end\n end", "def create(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.id = self.class.rpc_execute('create', vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end" ]
[ "0.6377699", "0.62251276", "0.6024569", "0.5934028", "0.57572323", "0.5727669", "0.5664753", "0.5664248", "0.5582147", "0.55699843", "0.55603516", "0.5559794", "0.55230045", "0.55061775", "0.55044043", "0.54982626", "0.54449993", "0.5444811", "0.5436498", "0.540047", "0.53890634", "0.5376067", "0.5359875", "0.5358545", "0.53281516", "0.52990055", "0.5236645", "0.5229065", "0.51806796", "0.51688796" ]
0.6256274
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose(array)\n result = []\n number = array.count\n if array.empty?\n single_array = array\n else\n single_array = [array[0]]\n end\n single_array.each do |val|\n val.each do |v|\n new_array = []\n number.times do\n new_array << v\n end\n result << new_array\n end\n end\n result\nend", "def transpose(array)\n return [] if array.empty?\n result = []\n array.first.length.times do |i|\n array.each_with_index do |inner, inner_index|\n result[i] ||= []\n result[i] << array[inner_index][i]\n end\n end\n result\nend", "def transpose(arr)\n col_size = arr.size # the number of rows in the original array\n row_size = arr[0].size # the number of cols in the original array\n new_arr = Array.new(row_size) { Array.new(col_size) } # create a nil-filled row_size-by-col_size array\n arr.each_with_index do |sub_arr, row|\n sub_arr.each_with_index { |elem, col| new_arr[col][row] = elem }\n end\n new_arr\nend", "def my_transpose(trans_arr)\n i, j = 0, 1\n array_copy = trans_arr.dup\n (i...trans_arr.length-1).each do |index_one|\n (j...trans_arr.length).each do |index_two|\n array_copy[index_one][index_two], array_copy[index_two][index_one] =\n array_copy[index_two][index_one], array_copy[index_one][index_two]\n end\n end\n array_copy\n end", "def my_transpose(arr) \n new_arr = []\n (0...arr.length).each do |outer_el| # the second dimension of a matrix\n outer_arr = []\n (0...arr.length).each do |inner_el| \n outer_arr << arr[inner_el][outer_el] # flip everything inside the array and place in the outer_arr\n end\n new_arr << outer_arr # nest that outer_arr inside the new_arr\n end\n new_arr\nend", "def transpose(array)\n\ttransposed = []\n\n\tfor item in array\n\t\tif item.kind_of?(Array)\n\t\t\tfor i in (0... item.count)\n\t\t\t\tif i < transposed.count\n\t\t\t\t\ttransposed[i].push(item[i]) \n\t\t\t\telse \n\t\t\t\t\ttransposed.push([item[i]])\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\ttransposed.push([item])\n\t\tend\n\tend\n\n\treturn transposed\nend", "def transpose(arr)\n columns = arr.max.length-1\n\n (0..columns).map do |column|\n (0..arr.length-1).map do |row|\n arr[row][column]\n end\n\n end\nend", "def rotate_array(array)\n results = []\n results << array\n results = results.flatten\n last = results.shift \n results << last\nend", "def transpose(arr)\n transposed = Array.new([[], [], []])\n arr.each_index do |outer_i|\n arr.each_index do |inner_i|\n transposed[inner_i][outer_i] = arr[outer_i][inner_i]\n end\n end\n transposed\nend", "def my_transpose\n transposed = []\n\n i = 0\n until transposed.length == length\n current = []\n self.each do |arr|\n current << arr[i]\n end\n i += 1\n transposed << current\n end\n\n transposed\n end", "def rotate_array(numbers)\n new_numbers = []\n new_numbers << numbers[1,numbers.size] << numbers[0]\n new_numbers.flatten\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 rotate_array(arr)\n results = arr.map { |n| n }\n results << results.shift\nend", "def transpose(a)\n # get the number of rows and columns\n # create empty matrix where # of rows = # of columns, and vice versa\n rows = a.length\n cols = a[0].length\n newA = Array.new(cols) {Array.new(rows)}\n\n i = j = 0\n while i < rows\n while j < cols\n # swap them\n newA[j][i] = a[i][j]\n j += 1\n end\n i += 1\n # don't forget to reset j after every column\n j = 0\n end\n\n newA\nend", "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 transpose(matrix)\n new_matrix = []\n matrix[0].size.times { |_| new_matrix.push(Array.new) }\n matrix.each do |array|\n # while iterating through array,\n # the next spot in each item in new_matrix gets successive items from array.\n array.size.times do |i|\n new_matrix[i] << array[i]\n end\n end\n new_matrix\nend", "def array_align (arr, *data)\n arr.zip(*data)\nend", "def transpose(mtrx)\n new_mtrx = Array.new(3) { Array.new(3) }\n new_mtrx.each_with_index do |sub_arr, idx|\n sub_arr.each_with_index do |element, inner_idx|\n new_mtrx[idx][inner_idx] = mtrx[inner_idx][idx]\n end\n end\n new_mtrx\nend", "def my_transpose\n row_length = length\n col_length = first.length\n transposed = Array.new(col_length) { Array.new(row_length) }\n\n (0...row_length).each do |row|\n (0...col_length).each do |col|\n transposed[col][row] = self[row][col]\n end\n end\n transposed\n end", "def zany_zip(*arr)\n max_length = 0\n arr.each do |x|\n if x.length > max_length\n max_length = x.length\n end\n end\n result = []\n i = 0\n while i < max_length\n temp = []\n arr.each do |subarray|\n temp << subarray[i]\n end\n result << temp\n i += 1\n end\n result\nend", "def rotate_array(array)\n array.drop(1) + array.take(1)\nend", "def rotate_array(arr)\narr.drop(1) + arr[0...1]\nend", "def rotate_array(array)\n copy = array.dup\n popped = copy.shift\n copy << popped\nend", "def vstack(arrays)\n arys = arrays.map do |a|\n _atleast_2d(cast(a))\n end\n concatenate(arys,axis:0)\n end", "def my_transpose\n ret = []\n i=0\n while i < self.length\n j=0\n ret2 = []\n while j < self[i].length\n ret2 << self[j][i]\n j += 1\n end\n ret << ret2\n i += 1\n end\n ret\n end", "def rotate_array(array)\n array[1, array.size] << array[0]\nend", "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 transpose\n gather { [] }.\n map(element_type: :array) { |a| a.transpose }.\n scatter(element_type: :array)\n end", "def transpose\n gather { [] }.\n map(element_type: :array) { |a| a.transpose }.\n scatter(element_type: :array)\n end", "def array_transform(array)\n\tb = []\n\tarray.each_index do |i|\n\t\tb.push(array[i]+array[i-1])\tif i > 0\n\tend\n\treturn b.unshift(1).push(1)\nend" ]
[ "0.67185825", "0.65414304", "0.64826894", "0.6358183", "0.6284582", "0.62558293", "0.6179306", "0.6164385", "0.6154813", "0.60738105", "0.59777343", "0.5919717", "0.5879765", "0.5865317", "0.58263654", "0.5804391", "0.58035696", "0.57423973", "0.5734635", "0.57249856", "0.57163054", "0.57087696", "0.5703896", "0.56951475", "0.5680153", "0.5675731", "0.56716716", "0.5666005", "0.5666005", "0.5661358" ]
0.71513534
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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_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 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 show\n @stock = Stock.find(params[:id])\n default_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock }\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 index\n session[:product] = params[:product] if params[:product]\n @stocks = Stock.product session[:product]\n default_data\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 @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 index\n @stockists = Stockist.all.paginate :page => params[:page], :per_page => 30\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @stockists }\n end\n end", "def show\r\n @stock_transfer = StockTransfer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @stock_transfer }\r\n end\r\n end", "def show\n @stock_item = StockItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_item }\n end\n end", "def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end", "def cyberstock\n @classifieds = Cyberstock.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end", "def index\n @quants = Quant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quants }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n 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 show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def getgpx\n trek = Trek.find_by_id(params[:id])\n send_file trek.get_gpx(), :type => \"text/xml\", :disposition => \"inline\"\n end", "def show\n @quant = Quant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quant }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def index\n @savings = @advance.savings\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @savings }\n end\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def show\n @stock_cargo = StockCargo.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_cargo }\n end\n end", "def index\n @product = Product.find(params[:product_id])\n @product_stocks = @product.product_stocks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_stocks }\n end\n end", "def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end", "def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n end\n end" ]
[ "0.67526084", "0.6715799", "0.6571327", "0.65441597", "0.6493681", "0.6479716", "0.63526934", "0.6342628", "0.633463", "0.62446284", "0.61916393", "0.6180023", "0.6170798", "0.6159341", "0.6104314", "0.60863477", "0.606803", "0.6045858", "0.60283875", "0.60276", "0.60222316", "0.60222316", "0.60222316", "0.60222316", "0.6019329", "0.5998202", "0.5986392", "0.5950343", "0.5944165", "0.5931948" ]
0.73484886
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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\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 @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_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 = 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 @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 @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 @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 @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 @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 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 @savings = Savings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @savings }\n end\n end", "def new\n @quant = Quant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quant }\n end\n end", "def new\n @sp500_stock = Sp500Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sp500_stock }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @openingstockentrymaster = Openingstockentrymaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @openingstockentrymaster }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n @stock_transfer = StockTransfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transfer }\n end\n end", "def new\n @total_stock = TotalStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @total_stock }\n end\n end", "def new\n @feedstock = Feedstock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedstock }\n end\n end", "def new\n @sprint = Sprint.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n @stock_transaction = StockTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transaction }\n end\n end", "def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def show\n @stock_gabarra = StockGabarra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_gabarra }\n end\n end", "def new\n @seance = Seance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seance }\n end\n end" ]
[ "0.75774455", "0.713519", "0.71218437", "0.71024317", "0.7076562", "0.69889104", "0.6884069", "0.6884069", "0.6884069", "0.6884069", "0.6884069", "0.6884069", "0.67877734", "0.6784752", "0.6774144", "0.6696844", "0.6692977", "0.66864675", "0.66664976", "0.6634966", "0.66226554", "0.66226554", "0.66144395", "0.6595851", "0.65880877", "0.65880513", "0.65837127", "0.65516526", "0.6550821", "0.65368557" ]
0.77319825
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 \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 @repuesto_servicio = RepuestoServicio.new(repuesto_servicio_params)\n @repuesto_servicio.stock=params[:repuesto_servicio][:stock] = 0.0\n respond_to do |format|\n if @repuesto_servicio.save\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue creado con éxito.' }\n format.json { render :show, status: :created, location: @repuesto_servicio }\n else\n format.html { render :new }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(params[:stock])\n @stock.product_id = session[:product]\n\n respond_to do |format|\n if @stock.save\n flash[:notice] = 'Movimentação criada.'\n format.html { redirect_to(@stock) }\n format.xml { render :xml => @stock, :status => :created, :location => @stock }\n else\n default_data\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 @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 @stock = Stock.new(stock_params)\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 :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\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 :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\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 :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\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 :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\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 :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\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 :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\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 :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def stock_params\n params.require(:stock).permit(\n :id,\n :product_id,\n :store_id,\n :g1,\n :g1h,\n :g2,\n :g2h,\n :g3,\n :g3h,\n :g4,\n :g4h,\n :g5,\n :g5h,\n :g6,\n :g6h,\n :g7,\n :g7h,\n :g8,\n :g8h,\n :g9,\n :g9h,\n :g10,\n :g10h,\n :g11,\n :g11h,\n :g12,\n :g12h,\n :g13,\n :g13h,\n :g14,\n :g14h,\n :g15,\n :g16,\n :g17,\n :g18,\n :g19\n )\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 @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 @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 @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 respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\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 action: 'show', 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 @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", "def create\n @stock_medica = StockMedica.new(stock_medica_params)\n \n respond_to do |format|\n if @stock_medica.save\n format.html { redirect_to @stock_medica, notice: 'Fue Crado stock' }\n format.json { render :show, status: :created, location: @stock_medica }\n else\n format.html { render :new }\n format.json { render json: @stock_medica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product_stock = ProductStock.new(params[:product_stock])\n\n respond_to do |format|\n if @product_stock.save\n format.html { redirect_to @product_stock, notice: 'Estoque de Produto atualizado' }\n format.json { render json: @product_stock, status: :created, location: @product_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @purchased_stock = PurchasedStock.new(params[:purchased_stock])\n\n respond_to do |format|\n if @purchased_stock.save\n format.html { redirect_to @purchased_stock, notice: 'Purchased stock was successfully created.' }\n format.json { render json: @purchased_stock, status: :created, location: @purchased_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchased_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @purchased_stock = PurchasedStock.new(params[:purchased_stock])\n\n respond_to do |format|\n if @purchased_stock.save\n format.html { redirect_to @purchased_stock, notice: 'Purchased stock was successfully created.' }\n format.json { render json: @purchased_stock, status: :created, location: @purchased_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchased_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @galletum = Galletum.new(galletum_params)\n\n respond_to do |format|\n if @galletum.save\n format.html { redirect_to @galletum, notice: 'Galletum was successfully created.' }\n format.json { render :show, status: :created, location: @galletum }\n else\n format.html { render :new }\n format.json { render json: @galletum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @feedstock = Feedstock.new(params[:feedstock])\n\n respond_to do |format|\n if @feedstock.save\n format.html { redirect_to @feedstock, notice: 'Estoque criado.' }\n format.json { render json: @feedstock, status: :created, location: @feedstock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedstock.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6194585", "0.6093889", "0.60368073", "0.6017775", "0.6014114", "0.59872866", "0.588416", "0.5862459", "0.5862459", "0.5862459", "0.5862459", "0.5862459", "0.5862459", "0.58326036", "0.5828713", "0.5828713", "0.5828713", "0.5828713", "0.5815972", "0.57984734", "0.5779719", "0.57421803", "0.57419467", "0.5735342", "0.5730549", "0.5725065", "0.56879795", "0.56879795", "0.56801116", "0.56614244" ]
0.70952505
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 flash[:notice] = 'Movimentação atualizada.'\n format.html { redirect_to(@stock) }\n format.xml { head :ok }\n else\n default_data\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_stock\n \tproduct = FileOperations.search_by_name(self)\n \tproduct = product[0].split(';')\n \tself.id = product[0]\n \tself.name = product[1]\n \tself.price = product[2]\n \tself.company = product[3]\n \tself.stock = product[4].to_i - 1\n \tFileOperations.update(self)\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update 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 = 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\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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}/volumes\")\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.request_uri)\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\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @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 @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 @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 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 @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 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, 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 @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 @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n if @product_stock.update_attributes(params[:product_stock])\n format.html { redirect_to @product_stock, notice: 'Estoque atualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_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 @stock.update(stock_params)\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" ]
[ "0.6187903", "0.61674374", "0.6154142", "0.6084725", "0.6019372", "0.5988001", "0.59314835", "0.5902975", "0.58936757", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5881712", "0.5876238", "0.5876238", "0.5876238", "0.5871846", "0.5871374", "0.58169115", "0.58059186", "0.58057386", "0.5781799", "0.57658875" ]
0.6751812
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @stock = Stock.find( params[:id] )\n @stock.delete_status = 1\n @stock.save\n #@stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_edit_all_path }\n format.json { head :no_content }\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 @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 delete()\n sql = \"DELETE FROM stock_items WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stock_cargo = StockCargo.find(params[:id])\n @stock_cargo.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_cargos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @stock_cargo = StockCargo.find(params[:id])\r\n @stock_cargo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(stock_cargos_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @bixo = Bixo.find(params[:id])\n @bixo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bixos_url) }\n format.xml { head :ok }\n end\n end", "def deleteStock\n p params[:ticker]\n Stock.where(:ticker => params[:ticker]).destroy_all \n end", "def destroy\n @openingstockentrymaster = Openingstockentrymaster.find(params[:id])\n @openingstockentrymaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(openingstockentrymasters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sp500_stock = Sp500Stock.find(params[:id])\n @sp500_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to sp500_stocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rig = Rig.find(params[:id])\n @rig.destroy\n\n respond_to do |format|\n format.html { redirect_to(rigs_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bom = Bom.find(params[:id])\n @bom.destroy\n\n respond_to do |format|\n format.html { redirect_to(boms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @importacion = Importacion.find(params[:id])\n @importacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(importaciones_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.json { head :no_content }\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.json { head :no_content }\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.json { head :no_content }\n end\n end" ]
[ "0.67664903", "0.67664903", "0.6697583", "0.6637852", "0.65870255", "0.6581397", "0.65796584", "0.6570577", "0.6497727", "0.64919853", "0.64591134", "0.6368759", "0.6343575", "0.6312497", "0.62912893", "0.62897813", "0.6233325", "0.62260705", "0.6219344", "0.6213168", "0.62097734", "0.620708", "0.6195725", "0.6190277", "0.61798596", "0.61773425", "0.61770874", "0.6169493", "0.6169493", "0.6169493" ]
0.7252481
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary\n #render unless @output\n @summary\n end", "def summary *args\n @summary = args.first if args.size > 0\n end", "def workout\n WorkoutPlan.new(plan)\n end", "def total_workouts\n set_sport_by_user.count || 0\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 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 my\n if self.current_user == nil\n redirect_to \"/account/login\"\n end\n condition = ['user_profile_id = :user_profile_id', { :user_profile_id => self.current_user.id }]\n id = params[:id] != nil ? params[:id] : Workout.find(:first, :select => 'max(id) as last_id', :conditions => condition).last_id\n @workout = Workout.find_by_id(id, condition)\n\n totals = Workout.find(:first, :select => 'sum(workout_length) as total_mins, count(*) as total_count', :conditions => condition)\n @total_mins = totals.total_mins\n @total_count = totals.total_count\n\n @workouts = Workout.find(:all, :conditions => condition, :limit => 50, :order => 'workout_date desc, created_at desc') \n end", "def render_summary\n summary = nil\n\n end", "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 set_workout\n\t\t@workout = Workout.friendly.find(params[:id])\n\tend", "def dummy\n @workouts = Workout.find(1)\n end", "def summary\n {}\n end", "def default_summaries\n Summaries.new(summarizers)\n end", "def summaryX\n render :layout => \"general\"\n end", "def set_workout\n @workout = Workout.find(params[:id])\n @xp = 30\n @xptogo = 60\n @remain = 10\n end", "def record_totals\n workout_hash = Hash.new\n current_user.workouts.each do |w|\n # Today, This Week, This Month, This Year, Total [x2 for time & distance]\n inner_array = [\n w.sum_field_by_time_range(:duration, method(:this_day)),\n w.sum_field_by_time_range(:duration, method(:this_week)),\n w.sum_field_by_time_range(:duration, method(:this_month)),\n w.sum_field_by_time_range(:duration, method(:this_year)),\n w.sum_field_by_time_range(:duration, method(:total)),\n w.sum_field_by_time_range(:distance, method(:this_day)),\n w.sum_field_by_time_range(:distance, method(:this_week)),\n w.sum_field_by_time_range(:distance, method(:this_month)),\n w.sum_field_by_time_range(:distance, method(:this_year)),\n w.sum_field_by_time_range(:distance, method(:total))\n ]\n workout_hash[w] = inner_array\n end\n return workout_hash\n end", "def default\r\n @opts[:default]\r\n end", "def set_workout\n @workout = Workout.find(params[:id])\n end", "def summary\n # do extra setup for new returns to clear wizard cache _before_ setup_step is called\n # so we don't populate @ variables with old data!\n if params[:new]\n Rails.logger.debug('Starting new SLfT return')\n wizard_end\n end\n\n setup_step\n\n # Need to save on the summary to make sure that we have a new return if one was created\n wizard_save(@slft_return)\n\n # manage the buttons AFTER wizard_save so we don't save the validation errors\n return if manage_draft(@slft_return) || manage_calculate(@slft_return)\n end", "def workout_params\n params.require(:workout).permit(:title, :description, :intensity, :duration, :category, :id, :users, :sets)\n end", "def summary\n if @private\n nil\n elsif @namespace.id == \"default\"\n \"#{@id} - #{@description}\"\n else\n \"#{@namespace.id}#{@id} - #{@description}\"\n end\n end", "def index\n @workout_plans = @workout_block.nil? ? nil : @workout_block.workout_plans\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @workout_plans }\n end\n end", "def summary\n # TODO\n end", "def todays_plan_workout(date) \n # find workout by plan_day (for example, plan_day:103), eager-loading workout_type for output\n plan_workout = current_user.training_cycles.last.plan.workouts.includes(:workout_type).find_by(plan_day:plan_day(date))\n\n # if a plan workout exists for this plan_day, format it and save for output\n if !plan_workout.nil? \n\t\t\t@workout_scheduled = format_workout(plan_workout.workout_type.name,plan_workout.mileage,plan_workout.description)\n\t\t\t@workout_type_id = plan_workout.workout_type.id\n\t\t\t@workout_name = plan_workout.workout_type.name\n\t\t\t@workout_description = plan_workout.description\n\t\t\t@workout_type_description = plan_workout.workout_type.description\n\t\t\t@workout_total_mileage = plan_workout.total_mileage\n\t @workout_date = date\n\t\telse \n\t\t\t@workout_scheduled = \"\"\n\t\tend \n\tend", "def workout_params\n params.require(:workout).permit(:title, :description, :duration_mins, :is_private, :influencer_id)\n end", "def summary\n end" ]
[ "0.5523957", "0.530634", "0.52549636", "0.5158978", "0.5071245", "0.4990898", "0.49788228", "0.49595895", "0.49449766", "0.4916034", "0.48936713", "0.4891835", "0.48880687", "0.48851243", "0.48846623", "0.48550475", "0.48405808", "0.48034096", "0.47995967", "0.47987047", "0.4768593", "0.4763757", "0.4758213", "0.47510073", "0.4742696", "0.47392607", "0.47282943", "0.47041222", "0.4697973", "0.468876" ]
0.60265905
0
>> 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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_quiz(questions)\r\n answer = \"\"\r\n score = 0\r\n for question in questions #a for loop for every question in the above array\r\n puts question.prompt\r\n answer = gets.chomp()\r\n if answer == question.answer\r\n score += 1\r\n end\r\nend\r\n puts \"you got\" + score.to_s + \"/\" + questions.length.to_s \r\nend", "def run_test(questions)\n answer = \"\"\n score = 0\n for question in questions\n puts question.prompt\n answer = gets.chomp().to_s\n if answer == question.answer\n score += 1\n end #end if\n end #end loop\n puts (\"You got \" + score.to_s + \"/\" + questions.length().to_s)\nend", "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 run_test(questions)\n answer = \"\"\n score = 0\n\n for question in questions\n puts question.prompt\n answer = gets.chomp().to_s\n if(answer == question.answer)\n score += 1\n end\n end\n\n puts \"You got #{score} questions correct out of #{questions.length()}\"\nend", "def num_answered_questions\n return Answer.where(id: answers.map(&:id)).includes({ question: :question_format }, :question_options).reduce(0) do |m, a|\n if a.is_valid?\n m+=1\n end\n m\n end\n end", "def run_quiz(questions)\n answer = \"\"\n score = 0\n questions.each do |question| \n puts question.prompt \n answer = gets.chomp()\n if answer == question.answer\n score+=1\n end\n end\n puts \" You got a score of #{score}/#{questions.length} congratulations!\"\nend", "def run_test(questions)\n answer = \"\" # create a variable called answer empty string\n score = 0 # keeping track of the questions they get right\n\n # looping through the questions\n for question in questions\n puts question.prompt\n \n # get answer from the user\n answer = gets.chomp()\n\n if answer == question.answer\n score += 1\n end\n end\n\n puts (\"You got \" + score.to_s + \" / \" + questions.length().to_s)\n\nend", "def answered_questions_count\n return 0 if survey.nil?\n survey.answered_count\n end", "def run_test(questions)\n answer = \"\"\n score = 0\n for question in questions \n puts question.prompt\n answer = gets.chomp() #it will store whatever the user respond into the answer \n if answer == question.answer #another attribute of question class\n score += 1 \n end\n end \n puts (\"You got\" + score.to_s + \"/\" + questions.length().to_s)\nend", "def take_quiz(title)\n score = 0\n\n puts title.upcase\n puts \"-----------\"\n\n @quizzes[title].each do |question, answer|\n puts question\n user_ans = gets.chomp.downcase\n\n if user_answer == \"y\" || user_ans == \"n\"\n if user_ans == answer\n score += 1\n end\n else\n puts \"Try again: Y or N\"\n redo\n end\n end\n\n puts \"You got a score of #{score} out of #{@quizzes[title].length}\"\n\nend", "def num_answered_questions(plan)\n return 0 if plan.nil?\n return sections.reduce(0) do |m, s|\n m + s.num_answered_questions(plan) \n end\n end", "def alsquiz_count\n self.alsquiznr.nil? ? 0 : 1\n end", "def marks(my_answers, correct_answers)\n marks = 0\n wrong = []\n my_answers.each_with_index do |x,i|\n if x == correct_answers[i]\n marks += 1\n else\n wrong << i + 1\n end\n end\n puts \"I scored #{marks} out of 20\"\n puts \"I got these questions wrong:\"\n puts wrong.empty? ? \"None!!\" : wrong.join(\",\") \nend", "def question_count \n @by_question.count\n end", "def answer_count\n return @answers.length if @answers\n \n Factory.count_answers_at_machine(@location)\n end", "def bad_results\n answer_choice_count = {}\n answer_choices = self.answer_choices\n answer_choices.each do |answer_choice|\n answer_choice_count[answer_choice.answer_choice_body] = answer_choice.responses.length\n end\n\n answer_choice_count\n end", "def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end", "def num_votes \n @scores.reject { |a| a[:option] == 'absent' }.count\n end", "def score_factor_count\n com_count = self.complaints.finished.count\n dep_review_count = count_scorable_department_reviews\n city_review_count = count_scorable_city_reviews\n petition_count = self.petitions.finished.count\n return score_count = com_count + dep_review_count + city_review_count + petition_count\n end", "def total_quizzes_stats\n Float(self.quizzes.length)\n end", "def answer_count\n if is_standard?\n respond_to?(:copy_answer_count_col) ? copy_answer_count_col : copies.inject(0){|sum,c| sum += c.answer_count}\n else\n respond_to?(:answer_count_col) ? answer_count_col : answers.count\n end\n end", "def number_correct\n turns.count do |each_turn|\n each_turn.correct?\n end\n end", "def number_correct\n @turns.count do |turn|\n turn.correct?\n end\n end", "def number_of_completed_responses\n if statistics && !statistics.empty? && (completed_data = statistics.find {|a| a[0] == 'Complete'})\n completed_data[1]\n else\n 0\n end\n end", "def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\n end", "def agreed_with_community\n responses = self.responses\n count = 0\n responses.each do |response|\n #count += 1 if response.verdict == response.question.get_community_verdict\n count += 1 if response.question.get_community_verdict(response.verdict)\n end\n return count\n end", "def num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end", "def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end", "def num_answered_questions(plan)\n plan&.num_answered_questions.to_i\n end", "def num_answered_calls\n answered_contacts.count\n end" ]
[ "0.7076016", "0.6728585", "0.6710225", "0.6652424", "0.6644462", "0.663831", "0.6636416", "0.6606279", "0.6586398", "0.64089113", "0.6376458", "0.6270606", "0.6246921", "0.6238103", "0.6178607", "0.6170431", "0.61440253", "0.61341083", "0.61295664", "0.611574", "0.61090994", "0.6107974", "0.609538", "0.60824305", "0.6077778", "0.60603595", "0.60223264", "0.60007644", "0.5995147", "0.5991227" ]
0.8939018
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable\n {\n method: \"Page.enable\"\n }\n end", "def set_lifecycle_events_enabled(enabled:)\n {\n method: \"Page.setLifecycleEventsEnabled\",\n params: { enabled: enabled }.compact\n }\n end", "def disable\n {\n method: \"Page.disable\"\n }\n end", "def is_site_pages_creation_enabled=(value)\n @is_site_pages_creation_enabled = value\n end", "def disable_section\n layout_id = params[:layout_id]\n layout = PageLayout.find(layout_id)\n se = PageEvent::SectionEvent.new(\"disable_section\", layout )\n se.notify\n \n end", "def enable\n end", "def enable\n end", "def enable\n @enabled = true\n end", "def enable\n {\n method: \"DOM.enable\"\n }\n end", "def set_pages_flag\n @pages_flag = true\n end", "def set_event_values\n self.domain ||= self.class.event_domain\n end", "def enable!\n self.enabled = true\n end", "def create_before\n return unless Spree::Config[:cms_page_status_default]\n @page.is_active = Spree::Config[:cms_page_status_default]\n end", "def conditionally_disable_page\n if page.present? && respond_to?(:live) && !live?\n page.update(live: false)\n end\n end", "def after_save\r\n self.blockable.touch if self.blockable_type == 'Page'\r\n end", "def send_events; end", "def enable!; end", "def test_pages\n oldpage = @current_page\n @current_page = nil\n for i in 0...pages.size\n if test_page_conditions(i)\n @current_page = i\n if oldpage != @current_page\n # Run only if the page actually changed\n @direction = current_page.graphic[:direction] || 2\n # Delete any interpreters there may be left trying to run the old page\n if oldpage\n if oldpage.has_trigger?(:parallel_process)\n $game.map.parallel_interpreters.delete_if { |i| i.event == self }\n else\n $game.map.event_interpreters.delete_if { |i| i.event == self }\n end\n end\n # Execute event if new page is Parallel Process or Autorun\n if current_page.has_trigger?(:parallel_process) || current_page.has_trigger?(:autorun)\n trigger\n end\n if current_page.automoveroute[:commands].size > 0\n # Wait 1 frame to start the new autonomous move route so the visuals have time to adjust to the new page.\n @automove_wait = 1\n end\n end\n break\n end\n end\n end", "def is_commenting_on_site_pages_enabled=(value)\n @is_commenting_on_site_pages_enabled = value\n end", "def set_enabled\n\t\t\tself.enabled = true\n\t\tend", "def download_events?\n event_planner? || super_admin?\n end", "def enable\n @service.disabled = false\n end", "def enable\n exclusively do\n @enabled = true\n @manual_toggle = true\n end\n\n save_state\n\n sync_control do\n start_upkeep unless upkeep_running?\n end\n end", "def disable\n @disabled = true\n end", "def create_events\n end", "def enable\n\t\t\t@last_request = nil\n\t\t\tBase.instance.add_observer(self)\n\t\tend", "def enabled!\n self\n end", "def enabled!\n self\n end", "def disable_section\n layout_id = params[:layout_id]\n layout = PageLayout.find(layout_id)\n se = PageEvent::SectionEvent.new(\"disable_section\", layout )\n se.notify\n end", "def disable_section\n layout_id = params[:layout_id]\n layout = PageLayout.find(layout_id)\n se = PageEvent::SectionEvent.new(\"disable_section\", layout )\n se.notify\n end" ]
[ "0.67002696", "0.6632279", "0.5825981", "0.5763034", "0.55463254", "0.5482061", "0.545053", "0.5421582", "0.5420663", "0.53439677", "0.5221659", "0.52019787", "0.5195125", "0.5152388", "0.5122626", "0.51105136", "0.5058344", "0.5049732", "0.5035277", "0.50184125", "0.4998353", "0.4997377", "0.49619076", "0.49342802", "0.4934118", "0.4932466", "0.49237895", "0.4916017", "0.48863322", "0.48863322" ]
0.7110019
0
Returns string containing respondent's first and last name
def respondent_full_name [respondent_first_name, respondent_last_name].compact.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [@first_name, @last_name].join(' ')\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def name\n if first_name && last_name\n return \"#{first_name} #{last_name}\"\n else\n return email\n end\n end", "def full_name\n\t\treturn self.salutation.to_s + \" \" + self.last_name.to_s + \" \" + self.first_name.to_s\n end", "def fullname\n [firstname, middlename, lastname].compact.join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name()\n name + ' ' + last_name\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def whole_name\n [given_name, family_name].compact.join(' ')\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def full_name\n @first_name + ' ' + @last_name\n end", "def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end", "def full_name \n [first_name, last_name].join(' ')\n end", "def full_name\n \t[self.first_name, self.last_name].join(\" \")\n end", "def fullname\n return first_name + \" \" + last_name\n end", "def full_name_first_last\n return self.first_name unless (self.last_name.length > 0)\n return (self.first_name + \" \" + self.last_name)\n end", "def fullName\n return first_name + \" \" + last_name\n end", "def full_name\n return \"#{@first_name} #{@last_name}\"\n end" ]
[ "0.7651924", "0.7569874", "0.7541533", "0.75231886", "0.75231886", "0.7517006", "0.7505338", "0.74688125", "0.74542254", "0.74542254", "0.74542254", "0.74542254", "0.74542254", "0.74542254", "0.7438604", "0.74363995", "0.74363995", "0.74363995", "0.74363995", "0.74363995", "0.7422431", "0.74120647", "0.7403855", "0.7401664", "0.7392273", "0.73802376", "0.7377513", "0.73727137", "0.7372151", "0.736977" ]
0.8590738
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def celebrate_birthday\n\t\t@age += 1\n\t\tabout(true)\n\tend", "def celebrate_birthday(age)\n\t\t\tage = @age\n\t\t\tage + 1\n\t\tend", "def celebrate_birthday\n\t\t@age += 1\n\tend", "def celebrate_birthday\n\t\t@age += 1\n\tend", "def celebrate_birthday\r\n\t\t@age += 1\r\n\tend", "def celebrate_birthday(age)\n @age = age\n age = age + 1\n end", "def celebrate_birthday(age)\n\t\t@age = age + 1\n\tend", "def celebrate_birthday\r\n\t\t@age +=1\r\n\tend", "def celebrate_birthday(given_age)\n @age = given_age + 1\n end", "def celebrate_birthday \r\n\t@age += 1\r\n\tend", "def celebrate_birthday\r\n @age += 1\r\n end", "def celebrate_birthday\r\n @age += 1\r\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday(age)\n @age += 1\n end", "def celebrate_birthday(age)\n age = @age += 1\n end", "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 convert_birthday\r\n\tbirthdate_str = get_birthday\r\n\tyour_number = birthdate_str[0].to_i + birthdate_str[1].to_i + birthdate_str[2].to_i \r\n\tyour_number = your_number + birthdate_str[3].to_i + birthdate_str[4].to_i + birthdate_str[5].to_i \r\n\tyour_number = your_number + birthdate_str[6].to_i + birthdate_str[7].to_i\r\n\r\n\t#SECOND ROUND OF ADDING NUMBERS TOGETHER\r\n\tyour_number = your_number.to_s\r\n\tyour_number = your_number[0].to_i + your_number[1].to_i\r\n\r\n\t#LAST ROUND OF ADDING IF NEEDED\r\n\tif (your_number > 9)\r\n\t\tyour_number = your_number.to_s\r\n\t\tyour_number = your_number[0].to_i + your_number[1].to_i\r\n\tend\r\n\r\n\treturn your_number\r\nend", "def celebrate_birthday\n @age = @age + 1\n end", "def celebrate_birthday\n @age = @age + 1\n end", "def celebrate_birthday\n @age = @age + 1\n end", "def celebrate_birthday\n age = age+1\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday\n @age += 1\n end", "def celebrate_birthday\n b_day_age = @age + 1\n end", "def fix_phone_number\n number = phone_number.to_s.gsub(/\\D/, '')\n number = number[1..-1] if number.starts_with?('1')\n self.phone_number = number\n end" ]
[ "0.61577225", "0.6135849", "0.60823715", "0.60823715", "0.60721546", "0.60409033", "0.60383934", "0.6026922", "0.6012647", "0.5918162", "0.59168875", "0.59168875", "0.5915824", "0.5908193", "0.5894481", "0.58818865", "0.585106", "0.5849952", "0.5849952", "0.5849952", "0.58261967", "0.57957464", "0.57957464", "0.57957464", "0.57957464", "0.57957464", "0.57957464", "0.57957464", "0.5789512", "0.57850075" ]
0.6877508
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uic(birth_number)\n service = prepare_service(birth_number)\n @@logger.debug \"Trying service for student with bn #{birth_number}\"\n @@logger.debug service\n begin\n service_response = query_service(service)\n rescue Exception => e\n @@logger.error 'Something gone wrong with service ' + e\n end\n begin\n uic = extract_uic(service_response)\n @@logger.debug \"Service and parsing successful. Updating student\"\n return uic\n rescue Exception => e\n @@logger.error \"Error parsing response: \" + e\n end\n end", "def set_studentinfo\n @studentinfo = Studentinfo.find(params[:id])\n end", "def set_studen\n @studen = Studen.find(params[:id])\n 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 update\n @student = Student.find(params[:student][:id])\n\n \t# check that the issuer of the request has both the username and ID, prevent attack\n if params[:student][:login].gsub(/ /,'') != @student.login.gsub(/ /,'')\n \tlog_attack \"Student update \" + params[:student][:id] + \" : \" + params[:student][:login] + \" - student.login = \" + @student.login \t\n respond_to do |format|\n format.xml { render :xml => errorRsp( \"ATTACK: Error student update \" + params[:student][:id] + \" : \" + params[:student][:login]) }\n end\n \treturn\n end\n \n \n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.xml { render :xml => successRsp }\n else\n log_DB_errors( \"student\", @student.errors ) \n format.xml { render :xml => errorRsp( @student.errors.to_s ) }\n end\n end\n end", "def set_student\n @student = current_school.students.find(params[:id])\n end", "def student_id\r\n\t\t\treturn 51875531\r\n\t\tend", "def set_student\n @student = User.students.find_by_id(params[:id])\n end", "def set_student\n @student = Student.find_by_login(params[:login])\n end", "def set_student\n @student = Student.find(session[:student_id])\n end", "def set_studnet\n @studnet = Studnet.find(params[:id])\n end", "def set_student\n @student = Student.includes(:scores, :nutritions).find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id] || params[:student_id])\n end", "def set_student_id\n @student_id = StudentId.find(params[:id])\n end", "def set_student\n @student = Student.find_by(id: params[:id])\n end", "def show\n \n\n begin\n @students = Student.find(params[:id]) \n \n \t# check that the issuer of the request has both the username and ID, prevent attack\n \tif params[:login].gsub(/ /,'') != @students.login.gsub(/ /,'')\n \t\tlog_attack \"Student show \" + params[:id] + \" : \" + params[:login] + \" - students.login = \" + @students.login \t\n \t\trespond_to do |format|\n \t\tformat.xml { render :xml => errorRsp( \"Security error, contact support\" ) }\n \t\t end\n \t\treturn\n \tend \n rescue Exception => e \n respond_to do |format|\n format.xml { render :xml => errorRsp( e.message) }\n end\n return\n end\n \n respond_to do |format|\n format.xml { render :xml => @students }\n end\n end", "def set_student\n student = Student.find(params[:id])\n end", "def set_student_interest\n @student_interest = StudentInterest.find(params[:id])\n end", "def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n end" ]
[ "0.6116094", "0.6046837", "0.6037891", "0.5998901", "0.59817576", "0.59674853", "0.59195304", "0.5898165", "0.5895579", "0.5892546", "0.58843505", "0.58116835", "0.58065975", "0.5803452", "0.5801357", "0.58009857", "0.5794507", "0.57696253", "0.5760095", "0.57466507", "0.57451147", "0.57451147", "0.57451147", "0.57451147", "0.57451147", "0.57451147", "0.57451147", "0.57451147", "0.57451147", "0.57451147" ]
0.64471924
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_to(other); end", "def assign_canned_subject\n self.subject = canned_subject\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 controller_copy(pass_obj=nil)\n from_name = @params[\"from_name\"]\n from_id = @params[\"from_id\"]\n from_rel = @params[\"from_rel\"]\n activity = @params[\"activity\"]\n to_name = @params[\"to_name\"]\n to_rel = @params[\"to_rel\"]\n to_ids = params[\"subjects\"].present? ? params[\"subjects\"].keys.to_a : []\n to_ids += [pass_obj.id.to_s] if (pass_obj.present? and !to_ids.include?(pass_obj.id.to_s))\n from_obj = from_name.singularize==\"user\" ? current_user : current_user.send(from_name.pluralize).find(from_id)\n for to_id in to_ids\n\tto_obj = current_user.send(to_name.pluralize).find(to_id)\n\tobj = to_obj.dup\n\tobj.update(makena(obj, :sender).split(\"_\").first.to_sym => obj.send(makena(obj, :sender).split(\"_\").first)+\"*\")\n\tobj.save\n\tfrom_id = obj.id\n\tif from_name==to_name\n\t sender, hsh = controller_sender_generate(from_name, to_id, from_rel, to_name, from_id, to_rel)\n\telse\n\t sender, hsh = controller_sender_generate(from_name, from_id, from_rel, to_name, to_id, to_rel)\n\tend\n\tcurrent_user.send(sender).find_or_create_by(hsh) if sender\n end\n notice = \"#{activity.upcase} #{from_name.humanize} #{(to_rel||to_name).humanize} processed.\"\n return [obj, notice]\n end", "def copy(from, to)\n \n end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); 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 contact_to!(subject)\n contact_to(subject) ||\n sent_contacts.create!(:receiver => Actor.normalize(subject))\n end", "def set_subject(subject)\n\t\tend", "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 subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end" ]
[ "0.62365746", "0.590587", "0.5584064", "0.55696654", "0.54849213", "0.5470133", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53887695", "0.53752095", "0.5329787", "0.529699", "0.52954537", "0.5282319", "0.5282319", "0.5282319", "0.5282319", "0.5282319", "0.5282319", "0.5282319", "0.5282319", "0.5282319", "0.5282319", "0.5282319" ]
0.77002716
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject_ids=(*ids)\n ids.flatten!\n subjects = subscribables_subscriptions.find(:all, :conditions => { :subscribable_type => 'Subject' })\n subscribables_subscriptions.delete(subjects)\n subscribables.reload\n unless ids == [0]\n ids.delete('0')\n subscribables << Subject.find_all_by_id(ids)\n end\n end", "def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end", "def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n if ind2 == '7'\n sfs << ['2', subject['source']]\n end\n\n # add authority ID as subject 6xx $0\n authority_id = subject['authority_id']\n subfield_0 = authority_id ? [0, authority_id] : nil\n sfs.push(subfield_0) unless subfield_0.nil?\n\n ind1 = code == '630' ? \"0\" : \" \"\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end", "def for_subjects(subjects)\n result = Hash[subjects.map {|node| [node, false]}]\n subjects_by_id = Hash[subjects.map {|subject| [subject.id, subject]}]\n subject_rlshp_sources = Hash.new { |h, k| h[k] = [] }\n [:subject, :subject_agent_subrecord, :subject_agent_subrecord_place].each do |t|\n Subject.relationship_dependencies[t].each { |d| subject_rlshp_sources[d] << t }\n end\n\n subject_rlshp_sources.each do |model, sources|\n sources.each do |source|\n # i.e. one or more: subject_rlshp, subject_agent_subrecord_rlshp, subject_agent_subrecord_place_rlshp\n link_relationship = model.find_relationship(source)\n link_table = link_relationship.table_name\n\n link_relationship.reference_columns_for(model).each do |model_link_column|\n link_relationship.reference_columns_for(Subject).each do |subject_link_column|\n # Join subject_rlshp to (e.g.) accession\n linked_records = model\n .join(link_table,\n Sequel.qualify(link_table, model_link_column) => Sequel.qualify(model.table_name, :id))\n .filter(Sequel.qualify(link_table, subject_link_column) => subjects_by_id.keys)\n .select(Sequel.qualify(model.table_name, :id),\n Sequel.qualify(model.table_name, :publish),\n Sequel.qualify(model.table_name, :suppressed),\n Sequel.as(Sequel.qualify(link_table, subject_link_column),\n :subject_id))\n\n if model.columns.include?(:repo_id)\n linked_records = linked_records\n .select_append(Sequel.as(Sequel.qualify(model.table_name, :repo_id),\n :repository_id))\n end\n\n published_status = if model.included_modules.include?(TreeNodes)\n for_tree_nodes(linked_records\n .select_append(Sequel.qualify(model.table_name, :parent_id),\n Sequel.qualify(model.table_name, :root_record_id))\n .all)\n elsif model.to_s =~ /^Agent/\n for_agents_linked_to_subject(linked_records.all)\n else\n for_top_level_records(linked_records.all)\n end\n\n published_status.each do |linked_record, published|\n if published\n result[subjects_by_id.fetch(linked_record[:subject_id])] = true\n end\n end\n end\n end\n end\n end\n\n result\n end", "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 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 handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n ind1 = ' '\n code, *ind2 = case term['term_type']\n when 'uniform_title'\n value = term['term'].split(\" \")[0]\n first_indicator = '0'\n if value\n hsh = {}\n hsh['A'] = '2'\n hsh['An'] = '3'\n hsh['The'] = '4'\n articles = []\n articles = hsh.keys\n first_indicator = hsh[value] if articles.include?(value)\n end\n ['630', first_indicator, source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n # code borrowed from Yale to export subject authority id\n unless subject['authority_id'].nil?\n sfs << ['0', subject['authority_id']]\n end\n\n \n # N.B. ind2 is an array at this point.\n if ind2[0] == '7'\n sfs << ['2', subject['source']]\n end\n\n # adding this code snippet because I'm making ind2 an array\n # for code 630 if the title begins with an article\n if (ind2.is_a?(Array) && code == '630')\n ind1, ind2 = ind2\n else\n ind2 = ind2[0]\n end\n\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end", "def subject=(subject)\n self.subjects = [subject]\n end", "def set_subject_type\n @subject_type = SubjectType.find(params[:id])\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 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 cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n 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", "def add_seen_for(user_id, *subject_ids)\n [subject_ids].flatten.compact.each do |subject_id|\n user(user_id).seen.add subject_id\n end\n end", "def assign_subject!\n return if subject_code.present?\n update(slice_subject_id: nil)\n end", "def all_subjects\n observations + profile_users + glossary_terms\n end", "def initialize(subjects)\n sub_data = [{\"id\"=>1,\"name\"=>\"ABS35H1F\", \"credit_hrs\"=>2}, {\"id\"=>2,\"name\"=>\"ACT20H1F\", \"credit_hrs\"=>3}, {\"id\"=>3,\"name\"=>\"ACT240H1\", \"credit_hrs\"=>6}, {\"id\"=>4,\"name\"=>\"ACT38H1F\", \"credit_hrs\"=>7}, {\"id\"=>5,\"name\"=>\"ACT3491F\", \"credit_hrs\"=>7},\n {\"id\"=>6,\"name\"=>\"ACT4601F\", \"credit_hrs\"=>10}, {\"id\"=>7,\"name\"=>\"ACT60H1F\", \"credit_hrs\"=>4}, {\"id\"=>8,\"name\"=>\"ANA300Y1\", \"credit_hrs\"=>8}, {\"id\"=>9,\"name\"=>\"ANT24H1F\", \"credit_hrs\"=>3}, {\"id\"=>10,\"name\"=>\"ANT3Y1Y\", \"credit_hrs\"=>5}]\n subjects = sub_data\n @subjects = subjects\n end", "def subjects\n bib_subjects || get_item_data_by_name('Subject')\n end", "def add_all_to\n if params[:contact_type] && [1, 2, 3].include?(params[:contact_type].to_i)\n contacts = Contact.find_all_by_contact_type_id(params[:contact_type])\n for contact in contacts\n Subscriber.find_or_create_by_subscriber_list_id_and_contact_id(@subscriber_list.id, contact.id)\n end\n\n flash[:notice] = \"Todos los #{Contact::SUBSCRIBER_TYPES.select{|x| x.idx == params[:contact_type].to_i}.first.name} han sido añadidos.\"\n end\n\n redirect_to :back\n end", "def index\n @curriculum_subjects = Subject.all.where(is_core: false, is_pivats: false, is_lunch: false, is_tutorial: false, is_ppa: false)\n @core_subjects = Subject.all.where(is_core: true, is_pivats: false)\n authorize @curriculum_subjects\n\n @subject = Subject.new\n @subject.sub_subjects.build\n # authorize @curriculum_subjects\n\n end", "def enroll(subject)\n\t\tsubjects[subject] = []\n\t\tsubjects\n\tend", "def order_subjects\n subjects = super\n other_subjects = []\n templates = {}\n\n log_debug \"order_subjects: #{subjects.inspect}\"\n\n # Order subjects by finding those with templates, and then by the template priority order and name\n\n # Get template priorities for each subject\n subjects.each do |s|\n if (t = find_template(s)) && !t[:skip]\n t[:priority] ||= 99\n templates[s] = t\n else\n other_subjects << s\n end\n end\n\n # Order subjects by priority or identifier\n ordered_subjects = templates.keys.sort do |s1, s2|\n if templates[s1][:priority] == templates[s2][:priority]\n templates[s1][:identifier] <=> templates[s2][:identifier]\n else\n templates[s1][:priority] <=> templates[s2][:priority]\n end\n end\n\n log_debug \"ordered_subjects: #{ordered_subjects.inspect}\\n\" + \n \"other_subjects: #{other_subjects.inspect}\"\n\n ordered_subjects + other_subjects\n end", "def order_subjects\n subjects = super\n \n add_debug \"order_subjects: #{subjects.inspect}\"\n\n # Order subjects by finding those with templates, and then by the template priority order\n prioritized_subjects = []\n other_subjects = []\n subjects.each do |s|\n template = find_template(s)\n next unless template\n \n priority = template[:priority] || 99\n add_debug \" priority(#{s}) = #{priority}\"\n prioritized_subjects[priority] ||= []\n prioritized_subjects[priority] << s\n end\n\n ordered_subjects = prioritized_subjects.flatten.compact\n \n other_subjects = subjects - ordered_subjects\n \n add_debug \"ordered_subjects: #{ordered_subjects.inspect}\\n\" + \n \"other_subjects: #{other_subjects.inspect}\"\n\n ordered_subjects + other_subjects\n end", "def subjects\r\n subjects = []\r\n range =\"#{group[:first_message]}-\"\r\n connection.query(:xhdr, \"Subject\", range) do |status, data|\r\n if status[:code] == 221\r\n data.each do |line|\r\n message = Message.new\r\n message.num, message.subject = line.split(' ', 2)\r\n subjects << message\r\n end\r\n end\r\n end\r\n subjects\r\n end", "def set_additional_subject\n @additional_subject = AdditionalSubject.find(params[:id])\n end", "def set_subject_courses_relation\n @subject_courses_relation = SubjectCoursesRelation.find(params[:id])\n end", "def create_subjects\n Subject.create!([{\n name: \"History\",\n teacher_id:1 \n },\n {\n name: \"Math\",\n teacher_id: 2\n },\n {\n name: \"Economics\",\n teacher_id: 3\n }])\nend", "def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n # LOCAL: hack to export buildings as 610s, part 1\n when 'topical'\n if subject['source'] == 'built'\n ['610', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n # LOCAL: occupation == 'x'\n when 'topical', 'cultural_context', 'occupation'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n # LOCAL: hack to export buildings as 610s, part 2\n if ind2 == '7'\n if subject['source'] == 'built'\n sfs << ['2', 'local']\n else\n sfs << ['2', subject['source']]\n end\n end\n\n ind1 = code == '630' ? \"0\" : \" \"\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end", "def extract_subjects(mods_subject_nodes, template_subject_nodes)\n subjects = {}\n mods_subject_name_nodes, template_subject_name_nodes = get_subject_name_nodes(mods_subject_nodes, template_subject_nodes)\n mods_subject_other_nodes, template_subject_other_nodes = get_subject_other_nodes(mods_subject_nodes, template_subject_nodes, mods_subject_name_nodes)\n mods_subject_name_nodes.each_with_index do |sn, i|\n subjects.merge!(extract_subject_values_and_attributes(sn, template_subject_name_nodes[i]))\n end\n mods_subject_other_nodes.each_with_index do |su, i|\n subjects.merge!(extract_subject_values_and_attributes(su, template_subject_other_nodes[i]))\n end\n subjects.merge!(extract_other_geo_subjects(mods_subject_nodes, template_subject_nodes))\n end" ]
[ "0.5937251", "0.58760554", "0.5841737", "0.57777596", "0.57418853", "0.5698272", "0.564167", "0.5517109", "0.55109835", "0.54901993", "0.545795", "0.5440346", "0.5438689", "0.5360564", "0.5348204", "0.5291302", "0.5288366", "0.5284829", "0.52696025", "0.5267824", "0.5262338", "0.5231689", "0.52199674", "0.5218278", "0.52050716", "0.51990104", "0.5160359", "0.51527476", "0.5118048", "0.5117312" ]
0.8289575
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 read_hash(gmail, my_hash)\n\n @my_hash = my_hash\n @gmail = gmail\n\n @my_hash.each do |key, value|\n unless value == \"\" && EmailAddress.valid?(value)\n content = body_content(key)\n send_email(@gmail, content, value)\n end\n end\nend", "def hash\n [actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\n end", "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 hash_addresses(address_field)\n return nil unless address_field\n\n address_field.formatted.map do |address|\n address_obj = Mail::Address.new(address)\n {\n email: address_obj.address,\n name: address_obj.display_name,\n type: address_field.name.downcase\n }\n end\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 constructShippingAddress(tmp_email_order_hash, email_order_hash)\n\t\temail_order_hash[:ship_to_first_name] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_first_name\"].to_s\n\t\temail_order_hash[:ship_to_last_name] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_last_name\"].to_s\n\t\temail_order_hash[:ship_to_company] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_company\"].to_s\n\t\temail_order_hash[:ship_to_addr1] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_addr1\"].to_s\n\t\temail_order_hash[:ship_to_addr2] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_addr2\"].to_s\n\t\temail_order_hash[:ship_to_city] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_city\"].to_s\n\t\temail_order_hash[:ship_to_state] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_state\"].to_s\n\t\temail_order_hash[:ship_to_zip] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_zip\"].to_s\n\t\temail_order_hash[:ship_to_phone] = formatPhoneNumber(tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_phone\"].to_s)\n\t\temail_order_hash[:ship_to_phone] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_phone\"].to_s\n\t\temail_order_hash[:shipping_address] = \"#{email_order_hash[:ship_to_first_name]} #{email_order_hash[:ship_to_last_name]}<br />\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_company]}<br />\" if email_order_hash[:ship_to_company] !=\"\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_addr1]}<br />\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_addr2]}<br />\" if email_order_hash[:ship_to_addr2] !=\"\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_city]}, #{email_order_hash[:ship_to_state]} #{email_order_hash[:ship_to_zip]}<br />\"\t\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_phone]}<br />\" if email_order_hash[:ship_to_phone] !=\"\"\n\t\t\n\tend", "def hash\n [additional_contact_billing_id, additional_contact_billing_is_primary, additional_contact_billing_name, additional_contact_executive_sponsor_id, additional_contact_executive_sponsor_is_primary, additional_contact_executive_sponsor_name, additional_contact_hiring_manager_id, additional_contact_hiring_manager_is_primary, additional_contact_hiring_manager_name, additional_contact_internal_recruiter_id, additional_contact_internal_recruiter_is_primary, additional_contact_internal_recruiter_name, additional_contact_other_id, additional_contact_other_is_primary, additional_contact_other_name, attachments, created_by_id, created_by_name, created_on, expected_value, external_email_address, id, job_code, last_activity_date, last_engagement_date, modified_by_id, modified_by_name, modified_on, owners, status_id, status_name, time_to_close, actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\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_creation(hash_to_manipulate,msg)\n retirement_site=[]\n others_site=[]\n sorted_hash = hash_to_manipulate.sort_by{ |instance, details| details[:not_before] }\n sorted_hash.each do |instance, details|\n if details[:code] == \"instance-retirement\"\n retirement_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n else\n unless details[:description] =~ /\\[Completed\\]|\\[Canceled\\]/\n others_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n end\n end\n end\n # This is so people know the system is working, but that nothing happened today\n if retirement_site.empty? and others_site.empty?\n msg << \"<html>\"\n msg << \"<body>\"\n msg << \"<h3>No events today! Have a nice day! :)</h3>\"\n msg << \"</body>\"\n msg << \"</html>\"\n end\n unless retirement_site.empty? and others_site.empty? \n msg << \"<html>\"\n msg << \"<body>\"\n unless retirement_site.empty?\n msg << \"<h3>Instances that are being terminated!</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{retirement_site.join(\"\\n\")}\"\n msg << \"</table>\"\n msg << \"<p><p>\"\n end\n unless others_site.empty?\n msg << \"<h3>Instances with non-terminal events.</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{others_site.join(\"\\n\")}\"\n msg << \"</table>\"\n end\n msg << \"</body>\"\n msg << \"</html>\"\n end\nend", "def build_hash(emails, first_names, last_names)\n deputies_array = []\n\n emails.each_with_index do |email, index|\n deputy_hash = {}\n deputy_hash['first_name'] = first_names[index]\n deputy_hash['last_name'] = last_names[index]\n deputy_hash['email'] = email\n deputies_array << deputy_hash\n end\n\n deputies_array\nend", "def get_townhall_email(townhalls_urls_and_cities)\n\n return nil if townhalls_urls_and_cities.nil? || townhalls_urls_and_cities.empty?\n # return nil if list_townhall_urls.nil? || list_townhall_urls.empty? || list_cities.empty? || list_cities.nil?\n\n # Pour une meilleur compréhension\n list_townhall_urls = townhalls_urls_and_cities[0]\n list_cities = townhalls_urls_and_cities[1]\n\n\n #2/Liste des emails--------------------je fais une recherche sur tout... qui contient du text et @ (email ;o)! ) \n list_townhall_email=Array.new\n\n list_townhall_email = list_townhall_urls.each{ |url_hall|\n\n # Lecture d'une page html url_hall (de la ville) pour chaque mairie\n Nokogiri::HTML(URI.open(url_hall)).xpath('//*[contains(text(), \"@\")]').text\n }\n \n # -=-=-=- Init d'un Array (tableau de hash, conformément au format demandé) -=-=-=-\n # -=-=-=- MISE EN FORME -=-=-=-\n townhall_and_email_tab = Array.new\n\n # for i in 0..cities.length-1 do \n (0..list_cities.length-1).each do | i |\n townhall_and_email_tab[i] = Hash.new\n townhall_and_email_tab[i][list_cities[i]] = list_townhall_email[i]\n end\n \n return townhall_and_email_tab\nend", "def custom_contact_hash(current_user_id, import_hash)\n puts \"custom_contact_hash \"\n\n {\n first_name: import_hash[\"First Name\"],\n last_name: import_hash[\"Last Name\"],\n email: import_hash[\"email\"],\n primary_phone: import_hash[\"home_phone\"] || import_hash[\"mobile_phone\"],\n mobile_phone: import_hash[\"mobile_phone\"],\n home_phone: import_hash[\"home_phone\"],\n url: import_hash[\"url\"],\n importer_user_id: current_user_id,\n editor_user_id: current_user_id,\n status: \"approved\"\n }\n end", "def update_from_auth_hash(auth_hash)\n if e_account_no && auth_hash.uid != e_account_no\n raise \"eAccount #'s don't match! Expected #{e_account_no} but \" +\n \"got #{auth_hash.uid}\"\n end\n EACCOUNT_MAP.each do |k,v|\n val = auth_hash.extra[k]\n if val && v == :email\n # Email fields come in as multiple <mail> xml nodes :/\n val = [] << val unless val.respond_to?(:each)\n self.email = val[0] if val[0]\n self.email_cc = val[1] if val[1]\n next\n elsif val && val.respond_to?(:blank?)\n self.send(\"#{v}=\", val) unless val.blank?\n else\n self.send(\"#{v}=\", val)\n end\n end\n self.e_account_no = auth_hash.uid\n self.save\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 get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end", "def email_map(emails)\n emails.each do |e|\n result = self.map[e]\n unless result.nil? || result.empty?\n return result\n end\n end\n nil\n end", "def build_meteor_mail_hash(email, verified_state)\n {address: email, verified: verified_state}\n end", "def import_hash(hash)\n clean_char_encoding!(hash)\n\n ref = {}\n {\"@referent\" => \"rft\", \"@referrer\" => \"rfr\", \"@referringEntity\" => \"rfe\",\n \"@requestor\" => \"req\"}.each do |ent, abbr|\n next unless hash[\"#{abbr}_val_fmt\"]\n val = hash[\"#{abbr}_val_fmt\"]\n val = val[0] if val.is_a?(Array)\n instance_variable_set(ent.to_sym, ContextObjectEntityFactory.format(val))\n end\n\n {\"@serviceType\" => \"svc\", \"@resolver\" => \"res\"}.each do |ent, abbr|\n next unless hash[\"#{abbr}_val_fmt\"]\n val = hash[\"#{abbr}_val_fmt\"]\n val = val[0] if val.is_a?(Array)\n instance_variable_set(ent.to_sym, [ContextObjectEntityFactory.format(val)])\n end\n\n openurl_keys = [\"url_ver\", \"url_tim\", \"url_ctx_fmt\"]\n hash.each do |key, value|\n val = value\n val = value[0] if value.is_a?(Array)\n\n next if value.nil? || value.empty?\n\n if openurl_keys.include?(key)\n next # None of these matter much for our purposes\n elsif @admin.has_key?(key)\n set_administration_key(key, val)\n elsif /^[a-z]{3}_val_fmt/.match?(key)\n next\n elsif /^[a-z]{3}_ref/.match?(key)\n # determines if we have a by-reference context object\n (entity, v, fmt) = key.split(\"_\")\n ent = get_entity_obj(entity)\n unless ent\n foreign_keys[key] = val\n next\n end\n # by-reference requires two fields, format and location, if this is\n # the first field we've run across, set a place holder until we get\n # the other value\n if ref[entity]\n if ref[entity][0] == \"format\"\n instance_variable_get(\"@#{ent}\").set_reference(val, ref[entity][1])\n else\n instance_variable_get(\"@#{ent}\").set_reference(ref[entity][1], val)\n end\n else\n ref_key = if fmt\n \"format\"\n else\n \"location\"\n end\n ref[entity] = [ref_key, val]\n end\n elsif /^[a-z]{3}_id$/.match?(key)\n # Get the entity identifier\n (entity, v) = key.split(\"_\")\n ent = get_entity_obj(entity)\n unless ent\n foreign_keys[key] = val\n next\n end\n # May or may not be an array, turn it into one.\n [value].flatten.each do |id|\n ent.add_identifier(id)\n end\n\n elsif /^[a-z]{3}_dat$/.match?(key)\n # Get any private data\n (entity, v) = key.split(\"_\")\n ent = get_entity_obj(entity)\n unless ent\n foreign_keys[key] = val\n next\n end\n ent.set_private_data(val)\n else\n # collect the entity metadata\n keyparts = key.split(\".\")\n if keyparts.length > 1\n # This is 1.0 OpenURL\n ent = get_entity_obj(keyparts[0])\n unless ent\n foreign_keys[key] = val\n next\n end\n ent.set_metadata(keyparts[1], val)\n elsif key == \"id\"\n # This is a 0.1 OpenURL. Your mileage may vary on how accurately\n # this maps.\n if value.is_a?(Array)\n value.each do |id|\n @referent.add_identifier(id)\n end\n else\n @referent.add_identifier(val)\n end\n elsif key == \"sid\"\n @referrer.set_identifier(\"info:sid/\" + val.to_s)\n elsif key == \"pid\"\n @referent.set_private_data(val.to_s)\n elsif key == \"doi\"\n @referent.set_identifier(\"info:doi/\" + val.to_s)\n elsif key == \"pmid\"\n @referent.set_identifier(\"info:pmid/\" + val.to_s)\n else\n @referent.set_metadata(key, val)\n end\n end\n end\n\n # Initialize a new ContextObject object from an existing key/value hash\n def self.new_from_hash(hash)\n co = new\n co.import_hash(hash)\n co\n end\n\n # if we don't have a referent format (most likely because we have a 0.1\n # OpenURL), try to determine something from the genre. If that doesn't\n # exist, just call it a journal since most 0.1 OpenURLs would be one,\n # anyway. Case insensitive match, because some providers play fast and\n # loose. (BorrowDirect sends 'Book', which can confuse us otherwise)\n unless @referent.format\n fmt = case @referent.metadata[\"genre\"]\n when /article|journal|issue|proceeding|conference|preprint/i then \"journal\"\n when /book|bookitem|report|document/i then \"book\"\n # 'dissertation' is not a real 'genre', but some use it anyway, and should\n # map to format 'dissertation' which is real.\n when /dissertation/i then \"dissertation\"\n else \"journal\"\n end\n @referent.set_format(fmt)\n end\n end", "def get_test_email_recipients(campaign_mailout)\n\t\n \tproject_team_emails = Hash.new\n\t\n\tmarketing_campaign = campaign_mailout.marketing_campaign\n\tproject = marketing_campaign.project\n\t\n\tproject_team_members = project.project_team_members.map{|pm| pm.person}.uniq\n\t\t\n\tproject_team_members.each do |person|\n\t user_contactinfos = person.roles.collect{ |r| r.role_contactinfos.collect{|rc| rc.contactinfo }}.flatten.compact\n\t \n\t user_contactinfos.each do |c|\n\t\t project_team_emails.store(c.email_1, c.email_1) unless c.email_1.blank?\n\t\t project_team_emails.store(c.email_2, c.email_2) unless c.email_2.blank?\n\t\t project_team_emails.store(c.email_3, c.email_3) unless c.email_3.blank?\n\t end\n\tend\n\tproject_team_emails = project_team_emails \t\n \t\n\treturn project_team_emails\n end", "def e_email_for(key = 'email_order_paid')\n (e_settings[key]) || case key.to_s\n when 'email_order_received'\n '<h1>ORDER SUMMARY {number}</h1> Dear {name}, please review and retain the following order information for your records.<br>{order_table}'\n when 'email_order_confirmed'\n '<h1>ORDER CONFIRMED {number}</h1> Dear {name}, your order has been confirmed. Please retain the following order information for your records<br>{order_table}'\n when 'email_order_shipped'\n '<h1>SHIPMENT SUMMARY</h1> Dear {name}, your order {number} has been shipped. Shipped method: {shipping_name} <br>{order_table}<br>{tracking_url}'\n when 'email_order_cancelled'\n '<h1>ORDER {number} CANCELLED</h1> Dear {name}, your order has been cancelled. Please retain this cancellation information for your records. <br>{order_table}'\n when 'email_order_invoice'\n '<table style=\"width: 100%;\"><tr><td><h1>INVOICE #{invoice_number}</h1> <h4>Order #{number}</h4><div>{current_date}</div></td><td style=\"text-align: center;\"><img src=\"http://camaleon.tuzitio.com/media/132/logo2.png\"></td></tr></table> <table style=\"width: 100%;\"><tr><td><strong>Billing Address</strong><br>{billing_info}</td><td><strong>Shipping Address</strong><br>{shipping_info}</td></tr><tr><td colspan=\"2\">{order_table}</td></tr></table>'\n end\n end", "def vcard_emails(data, uri)\n # TODO: consider using regex: /.+@.+\\..+/i\n # The 'email' field might contain multiple entries, separated by\n # various kinds of delimiter and each item is not necessarily\n # validated, so this is an attempt to clean up some things, but\n # it's not fool proof. For more on this topic, see\n # http://davidcel.is/posts/stop-validating-email-addresses-with-regex/\n emails = []\n collect = data['email'].split rescue []\n collect.each_with_index do |email, i|\n email = email.gsub(/,\\z/,'').gsub(/>.*/,'').gsub(/\\A</,'')\n emails << {\n '@id' => uri + \"/email/#{i}\",\n 'a' => ['vcard:Email'], # must be array to allow addition of types\n 'vcard:email' => email\n }\n end\n emails\n end", "def parse_email_address(emails,check_for_shared_netids=nil)\n emails = check_for_shared_netid(emails,1) if check_for_shared_netids\n emails = emails.split(\"|\") if emails =~ /|/\n if emails.class.to_s == \"String\"\n parsed_emails = emails + \"@\" + @configuration[:domain] if emails !~ /@/\n elsif emails.class.to_s == \"Array\"\n # this is ugly\n emails_string = \"\"\n emails.each do |address|\n address = address + \"@\" + @configuration[:domain] if address !~ /@/\n emails_string += \"#{address}, \"\n end\n emails_string.chomp(\", \")\n end\n end", "def convert_email\n %w[[email protected] [email protected] [email protected] [email protected] [email protected]]\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def process\n parsed = {}\n parsed[:contents] = \"#{@email.subject} ::: #{@email.body}\"\n parsed[:from] = \"#{@email.from[:email]}\"\n #[:to] is an array of hashes, since possible multiple to's\n parsed[:to] = \"#{@email.to[0][:email]}\"\n\n email_of_interest = parsed[:to]\n if !(/@/.match(parsed[:to]))\n Rails.logger.warn \"Poorly formatted email! parsed: #{parsed}\"\n end\n\n object = Person.react_to_email(email_of_interest)\n if object.class.to_s == \"Person\"\n Communication.create(person_id: object.id,\n contents: parsed[:contents],\n medium: \"email\",\n when: Date.today)\n end\n end", "def e_email_keys\n '{root_url} => site url, {date} => order date, {number} => order number, {name} => client first name, {full_name}, {order_table} => table of products of the order, {shipping_name} => shipping method name, {tracking_url} => the url of tracking, {shipping_info} => Shipping info, {billing_info} => Billing info, {invoice_number} => Sequential Invoice Number, {url} => Order Url'\n end", "def email_kyc_report_issue(data_to_format)\n {}\n end", "def email_cleaned\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :campaign_id => data['campaign_id'],\n :email => data['email'],\n :reason => data['reason'],\n :human => \"#{data['email']} was cleaned from Mailchimp list with ID #{data['list_id']}. Reason: '#{data['reason']}'\"\n }\n end" ]
[ "0.5980221", "0.5902993", "0.5503901", "0.54622376", "0.5426123", "0.5385771", "0.53739285", "0.53543955", "0.53529567", "0.534108", "0.5340184", "0.5290035", "0.5247238", "0.5213672", "0.5188327", "0.51502", "0.50781226", "0.5064934", "0.50607044", "0.5059193", "0.5049328", "0.50463206", "0.5046127", "0.5028304", "0.50140893", "0.5009616", "0.5009093", "0.4996173", "0.49827847", "0.49783605" ]
0.7308328
0
1. For a given person, return their favourite tv show
def tv_show(person) return person[:favourites][:tv_show] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tv_show(person)\n tv_show = person[:favourites][:tv_show]\n return tv_show\nend", "def fav_tv_show(person)\n return person[:favourites][:tv_show]\nend", "def get_favourite_tv_show(person)\n return person[:favourites][:tv_show]\nend", "def get_tv_show(person)\n return person[:favourites][:tv_show]\nend", "def test_favourite_tv_show\n result = favourite_tv_show(@person5)\n assert_equal(\"Scrubs\", result)\n end", "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 test_favourite_tv_show\n result = person_favourite_tv_show(@person5)\n assert_equal(\"Scrubs\",result)\n end", "def tv_show(hash)\n return hash[:favourites][:tv_show]\nend", "def favorite(category, user)\n shows_by_category = user.shows.group_by({|show| show.send(category.downcase + \"_id\")})\n category_count = shows_by_category.each { |k,v| shows_by_category[k] = v.count}\n if category_count.empty?\n \"None.\"\n else\n Object.const_get(category).find(category_count.max_by{|k,v| v}[0]).name\n end\nend", "def find_show_buddies(people)\n\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n p tv_shows\n end\n p tv_shows\n\n same_show = []\n count = 0\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n p same_show\n p count\n end\n count += 1\n end\n p same_show\n\n show_buddies = []\n for index in same_show\n show_buddies.push(people[index][:name])\n p show_buddies\n end\n p show_buddies\n\n return show_buddies\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 favorite_players(fan)\n Fan.find_by(name: fan).players\nend", "def favourite_for(user)\n favourites.find_by_user_id user\n end", "def person_cheers_song(pl, favourite_song)\n \n for tune in pl\n if tune == favourite_song\n return \"yaaay!\"\n else \n return \"didn't find my favourite\" \n end \n end \n end", "def 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 favorite_for(user)\n favs.find_by(user_id: user)\n end", "def viewers #returns people\n people = Rating.all.map do |rating|\n if rating.title == self.title\n rating.viewer\n end\n end\n people.map do |peo|\n peo.full_name\n end.uniq\n end", "def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend", "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 favorite(client)\n\tensemble = client.search(\"#bonjour_monde\", result_type: \"recent\").take(25)\n#\tensemble.each do |tweet|\n\t\tclient.favorite(ensemble)\n#\tend\nend", "def show_favorite_players(fan) #this method is backend finding the players of a specifc fan\n players_array = favorite_players(fan)\n players_array.each do |player|\n puts player.name \n end\nend", "def favourite_drink name\r\n\tif name == \"Jean-Luc\"\r\n\t\t\"tea, Earl Grey, hot\"\r\n\telsif name == \"Kathryn\"\r\n\t\t\"coffee, black\"\r\n\telse\r\n\t\t\"perhaps...horchata?\"\r\n\tend\r\nend", "def favorite_food name\n\tif name == \"Lister\"\n\t\treturn \"vindaloo\"\n\tend\n\n\tif name == \"Rimmer\"\n\t\treturn \"mashed potatoes\"\n\tend\n\n\t\"hard to say...maybe fried plantain?\"\nend", "def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend", "def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\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 get_favorite_for user\n\t user.favorites.find_by_page_id(self)\n end", "def underdog\n\t if home_team != favorite\n\t home_team\n\t else\n\t visitor_team\n\t end\n\tend", "def favorite\n puts FAVE\n end" ]
[ "0.7669126", "0.74630356", "0.7420349", "0.7370223", "0.7161871", "0.71301794", "0.71096283", "0.69950676", "0.68426484", "0.6778154", "0.676397", "0.6762284", "0.6553473", "0.65082234", "0.6430549", "0.6378693", "0.63551176", "0.6304187", "0.6287841", "0.6226974", "0.62209123", "0.6213701", "0.6128745", "0.609228", "0.60845596", "0.60845596", "0.60492617", "0.60107905", "0.6010013", "0.5999395" ]
0.7502839
1
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_gen\n rand100 = rand(1..100)\n if (0..50).cover?(rand100)\n output_val = 1\n elsif (51..75).cover?(rand100)\n output_val = 2\n elsif (76..90).cover?(rand100)\n output_val = 3\n elsif (91..95).cover?(rand100)\n output_val = 4\n elsif (96..100).cover?(rand100)\n output_val = 5\n end\n handle_output(output_val)\n end", "def gen_rand b\n p = rand(2**b)+2**b-1\n while ! rand_test p\n# puts p\n p += 1\n end\n p\nend", "def gen\n (x=rand)>0.5 ? x : (x < rand/2.0) ? 1.0 - x : x\nend", "def should_invent?\n rand(100) < @probability * 100\n end", "def rand\n num = SecureRandom.random_number(@n)\n @bins.each do |k, freq|\n num -= freq\n return k if num < 0\n end\n end", "def pbRockSmashRandomEncounter\n if rand(100)<25\n pbEncounter(EncounterTypes::RockSmash)\n end\nend", "def probability\n rand(1..100)\n end", "def chance(c)\n return rand < c\nend", "def random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend", "def random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend", "def random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend", "def random_fibonacci\r\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\r\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 random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend", "def gen_num\n rand(1..100)\nend", "def bi_rand(v)\n rand(2) > 1 ? v : nil\n end", "def sample(value)\n (@bins[value] || 0).to_f / @n.to_f\n end", "def biased_random_number(prob_arr)\n # http://stackoverflow.com/questions/479236/how-do-i-simulate-biased-die-in-python\n rand_roll = rand()\n sum = 0 \n result = 0\n prob_arr.each do |i|\n sum += i\n if rand_roll < sum\n return result\n end\n result += 1\n end\n # puts \"prob_arry:\" + prob_arr.to_s\n # puts \"rand_roll: \" + rand_roll.to_s\n # puts prob_arr.join(\" \")\n return result - 1\n end", "def getBin\n case @binDataType\n when 'B'\n bin = Bin.new('information', BytesValue.new(randString(@binDataSize)))\n when 'S'\n bin = Bin.new('information', StringValue.new(randString(@binDataSize)))\n else\n bin = Bin.new('information', IntegerValue.new(2**63))\n end\n\n bin\nend", "def create_random_bignum(bits, range = nil)\n if range.nil?\n middle = (1..bits-3).map{rand()>0.5 ? '1':'0'}.join\n else\n middle = (range).map { rand()>0.5 ? '1':'0' }.join\n end\n str = \"11\" + middle + \"1\"\n str.to_i(2)\nend", "def with_prob probability, action = \"\"\n if rand < probability\n if block_given?\n yield\n else\n act action\n end\n true\n else\n false\n end\n end", "def fake_bin(s)\n nums = s.split('')\n outcome = nums.map do |num|\n if num.to_i >= 5\n num = 1\n else\n num = 0\n end\n end\n outcome.join()\nend", "def random_num_generator\n return rand(1..100)\nend", "def random_num_generator\n return rand(1..100)\nend", "def compute_damage\n \treturn rand(1..6)\n end", "def compute_damage\n return rand(1..6)\n end", "def compute_damage\n return rand(1..6)\n end", "def pick\n float = BigDecimal.new(@rnd.uniform.to_s)\n from = to = BigDecimal.new(\"0.0\")\n value = nil\n @distribution.each do |value, probabillity|\n to += probabillity\n if float >= from && float < to\n return value\n end\n from = to\n end\n\n throw \"probabillity sum not 1.0, was #{to} for #{@distribution}\" if to < 0.999\n return value\n end" ]
[ "0.6501454", "0.64549047", "0.64001167", "0.63501245", "0.63500243", "0.6141074", "0.6114508", "0.60487866", "0.59814036", "0.59814036", "0.59814036", "0.5966036", "0.59596086", "0.5950158", "0.59330815", "0.5932772", "0.5895907", "0.5883795", "0.583623", "0.5817098", "0.5809222", "0.57662135", "0.5732972", "0.57228893", "0.5713189", "0.5713189", "0.56945103", "0.5689689", "0.5689689", "0.5689075" ]
0.79586697
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_fork(wins, forker, forkee)\n position_counts = count_positions(wins, forker, forkee)\n forking_moves = []\n position_counts.each do |position, count|\n forking_moves.push(position) if count > 1\n end\n forking_moves = (forking_moves - (forking_moves & forker))\n forking_moves.empty? ? [] : forking_moves\n 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 > 1 # if opponent can create multiple forks, force block\n move = get_adj(wins, player, opponent)\n elsif block_fork.size == 1 # otherwise if opponent can create fork, block it\n move = block_fork[0]\n else\n get_cen(player, opponent) # otherwise see if center is available\n end\n end", "def find_forks(player)\n forks = []\n open_spaces = {}\n count_squares_and_moves(player) do |squares, moves|\n if squares == 1 && moves.length == 2\n moves.each do |move|\n forks << move if open_spaces[move]\n open_spaces[move] = true\n end\n end\n end\n forks\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 block_fork(board)\n if board.cells[0] == opponent_token && board.cells[8] == opponent_token\n return 2\n end\n if board.cells[2] == opponent_token && board.cells[6] == opponent_token\n return 2\n end\n if board.cells[5] == opponent_token && board.cells[7] == opponent_token\n return 3\n end\n end", "def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend", "def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend", "def fork_count\n ENV['OPAL_PREFORK_THREADS']&.to_i || (Etc.nprocessors * 3 / 4.0).ceil\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 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 discover_fork(ctoken, spaces, board)\n open_spaces = compile_open_spaces(spaces)\n\n # Cycle through open_spaces; temporarily add a token to spaces;\n # then determine if there are two instances of two computer tokens\n # in a row.\n avail = [] # array of fork-creating spaces, to maximize randomness of play\n open_spaces.each do |space|\n # assigns computer token to this empty space\n spaces[space] = ctoken\n # check if spaces now contains a fork!\n afork, length = are_there_two_computer_tokens_in_a_row(ctoken, spaces, board)\n spaces[space] = \" \"\n avail << space if length && length > 1 # add this space to array of fork-creating spaces\n end\n if ! avail.empty? # do this if there ARE available fork-creating spaces\n corners = avail.select {|x| [0, 2, 6, 8].include?(x)}\n return corners.sample if ! corners.empty? # gimme any corner blocker first\n return avail.sample # then other kinds of blockers\n end\n return false # if no forks were found\nend", "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 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 getStepCount(input1,input2,input3,input4)\n\tways = possible_moves(input1,input2,input3,input4)\n\tfound = true\n\tcount = 1\n\n\twhile found do\n\t temp = []\n\t\tways.each do |way|\n\t\t\tmoves = possible_moves(way.first,way.last,input3,input4)\n\t\t\tif moves.include?([input3,input4])\n\t\t\t\tfound = false\n\t\t\tend\n\t\t\tmoves.each {|arr| temp.push(arr) }\n\t\tend\n\t\tcount += 1\n\t\tways = temp\n\tend\n\tcount\nend", "def fork\n find_forks(@computer_mark).first\n end", "def parent(i); (i-1)/2; end", "def number_of_parent_work(login=nil)\n count_by_frbr(login, :is_part_of, :how_many_works?) \n end", "def num_steps(n)\n return 1 if n <= 1\n num_steps(n-1) + num_steps(n-2)\nend", "def coast_guard_rank; 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 move count\n dir = count <0 ? 'in' : 'out' \n r= db.execute { \"select from ( traverse #{dir}(\\\"tg_grid_of\\\") from #{rrid} while $depth <= #{count.abs}) where $depth = #{count.abs} \" } \n if r.size == 1\n r.first\n else\n nil\n end\n end", "def next_pid(tid)\n if(tid == THREAD_CNT)\n return 1\n else\n return tid+1\n end\nend", "def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend", "def process(n)\n foundpart = 0\n parts = []\n for i in 0..n-1 do # init participants ary\n parts.push 1\n end\n infolog {\"Starting, num-parts=#{n}\"}\n round = 0\n finished = false\n while !finished and round < @maxrounds\n round += 1\n numparts = parts.select{|it| it>0}.size\n infolog {\"ROUND ##{round}: num-parts=#{numparts}\"}\n deblog {\" parts=#{parts}\"}\n for i in 0..n-1 do\n if parts[i] > 0 and !finished\n for j in i+1..i+n do\n k = j % n\n #tracelog {\"k=#{k}\"}\n if parts[k] > 0\n parts[i] += parts[k]\n deblog {\"part##{i} steals from part#{k}: #{parts[k]} => #{parts[i]}\"}\n parts[k] = 0\n if parts[i] == n\n infolog {\"FINISHED at round##{round}, participant=#{i+1}\"}\n foundpart = i+1\n finished = true\n end\n break\n end\n end\n else\n tracelog {\"part##{i} has nothing, is skipped.\"} unless finished\n end\n end\n end\n foundpart\nend", "def solve( n = 100 )\n n.partition_sieve[-1] - 1\n end", "def determine_possible_num_moves(gm, rd, md)\n # puts \"Determining possible total moves...\" #NICE TO HAVE\n min = [ md[:max_val], rd[:num_regions] * 2 - 1 ].max\n max = gm[:x] * gm[:y]\n poss_ms = []\n for i in min..max do\n if i % rd[:num_regions] == 0 or (i + 1) % rd[:num_regions] == 0\n poss_ms.push(i)\n end\n end\n # puts \"poss_ms = \" + poss_ms.to_s #NICE TO HAVE\n return poss_ms\nend", "def procession_position\n procession.index(self).to_i + 1\n end" ]
[ "0.7214283", "0.67108524", "0.6621591", "0.65560275", "0.6528573", "0.635649", "0.6356065", "0.6356065", "0.6188072", "0.60513544", "0.6030303", "0.5945687", "0.5834187", "0.5826054", "0.57539535", "0.572253", "0.5696886", "0.56904507", "0.5681871", "0.562731", "0.55833095", "0.55613", "0.55566055", "0.5534004", "0.55265725", "0.5520624", "0.55021405", "0.5492689", "0.5492284", "0.54842216" ]
0.72230446
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_regions(name, start_row = nil, end_row = nil)\n raise NotImplementedError, \"Getting the table regions is not supported yet\"\n end", "def getPrimaryDistribution(tableName)\n c = HBaseConfiguration.new()\n tableNameObj = TableName.valueOf(tableName)\n t = HTable.new(c, tableNameObj)\n regions = t.getRegionsInRange(t.getStartKeys[0],\n t.getEndKeys[t.getEndKeys.size-1])\n\n count = Hash.new(0)\n regions.each do |r|\n #puts r.getRegionInfo().getRegionNameAsString()+\" id \"+r.getRegionInfo().getReplicaId().to_s()+\" enc name \"+r.getRegionInfo().getEncodedName()+\" server name \"+r.getServerName().getHostname()\n z = count[r.getServerName().getHostname()]\n count[r.getServerName().getHostname()]=z+1\n end\n count.each do |r,c|\n puts r.to_s()+\" \"+c.to_s()\n end\nend", "def regions(for_select = true)\n fetch_array_for $regions, for_select\n end", "def all\n # return an array of all the regions\n return NAMES\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 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 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 tables\n []\n end", "def regions\n AWS.regions.map(&:name)\n end", "def parsed_region_ids\n\t region_id = self.area.split(\":\").last.to_i if self.area\n\t return [nil,nil,nil] if region_id == 0 || new_record?\n\t region = Ecstore::Region.find_by_region_id(region_id)\n\t region.region_path.split(',').select{ |x| x.present? }\n \tend", "def tables\n [\n ]\n end", "def partitioned_tables\n PartitionedTables.new(connection).all\n end", "def listRegions\n\t\t\treturn MU::Config.listRegions\n\t\tend", "def region_opts\n res = $store.select(RegionTable, \n \"reg_affiliate=? order by reg_name\",\n @data_object.aff_id)\n\n regions = { Affiliate::NONE => \"unassigned\" } \n\n res.each {|r| regions[r.reg_id] = r.reg_name}\n \n regions\n end", "def get_all_replicas(id, options = GetAllReplicasOptions.new) end", "def fetch_curr_table\n Array.new\n end", "def table_array\r\n @table_array\r\n end", "def set_regions\n return (\n [\n 'Horizontal Region',\n 'Vertical Region',\n 'Horizontal Region',\n 'Vertical Region',\n 'Horizontal Region'\n ]\n )\n end", "def primary_index_segments\n table.get_index(primary_index[:name]).segments.inject({}) do |h, s|\n v = read_attribute(s.field_name)\n h[s.field_name] = v unless v.nil?\n h\n end\n end", "def primary_key(_table_name)\n []\n end", "def regions\n @attributes[:regions]\n end", "def parsed_region_ids(area_name = \"ship_area\")\n\t\t area_val = self.send(area_name)\n\t\t region_id =area_val.split(\":\").last if area_val\n\t\t return [nil,nil,nil] if region_id.blank? || self.new_record?\n\t\t region = Ecstore::Region.find_by_region_id(region_id)\n\t\t region.region_path.split(',').select{ |x| x.present? }\n\t \tend", "def select_region\n\n origin_labs = Strain.find_by_sql(\"select origin_lab from strains group by origin_lab\")\n @lab_menu = []\n origin_labs.each do |lab|\n @lab_menu << lab.origin_lab if (lab.origin_lab != nil && lab.origin_lab != '')\n end\n\n origin_country = Strain.find_by_sql(\"select origin from strains group by origin\")\n @country_menu = []\n origin_country.each do |country|\n @country_menu << country.origin if (country.origin != nil && country.origin != '')\n end\n\n chromosomes = MapPosition.find_by_sql(\"select chromosome_label from map_positions where map_id = 1 group by chromosome_label order by chromosome_number asc\")\n @chromosome_menu = []\n chromosomes.each do |chr|\n @chromosome_menu << chr.chromosome_label\n end\n\n @strains = Strain.find(:all, :conditions => ['taxon_id = ?',10116], :order => \"symbol ASC\")\n\n end", "def current_region(default: [])\n return default unless params[:region]\n icao_starts = params[:region].split(/[\\-,]/)\n icao_starts.compact!\n icao_starts.uniq!\n icao_starts.map!{|s| s.upcase.tr(\"^A-Z\",\"\")}\n return icao_starts\n end", "def primary_keys(table)\n pks = query(<<-end_sql, 'SCHEMA')\n SELECT DISTINCT attr.attname\n FROM pg_attribute attr\n INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey)\n WHERE cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n pks.present? ? pks[0] : pks\n end", "def as_array\n row_names = []\n rows = [] \n if @db == @@sdb\n @@sdb.select('select * from `' + @table_name + '`')[:items].each do |row| \n row.each do |row_name, row_data| \n row_names << row_name\n rows << reassemble_sdb_items(row_data)\n end\n end\n elsif @db == @@google_storage\n row_names = as_name_array\n rows = get_rows_from_names(row_names)\n end\n return row_names, rows\n end" ]
[ "0.6588477", "0.6113635", "0.5896268", "0.58489084", "0.5829196", "0.58112407", "0.57174903", "0.5666384", "0.5639907", "0.56119996", "0.55950606", "0.55498254", "0.5516848", "0.5445279", "0.543753", "0.5359669", "0.5347066", "0.5328389", "0.5319675", "0.53120387", "0.53077644", "0.52764684", "0.52634174", "0.52622503", "0.5255783", "0.52243024", "0.52033854", "0.51916355", "0.5175772", "0.5157105" ]
0.7482731
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 elements_in_same_block(region_size = 3)\n row_del = @row_idx % region_size\n col_del = @column_idx % region_size\n\n region_shift = region_size -1\n\n start_row_idx = @row_idx - row_del\n start_col_idx = @column_idx - col_del\n\n block_elements = []\n (start_row_idx..start_row_idx+region_shift).each do |row_idx|\n (start_col_idx..start_col_idx+region_shift).each do |col_idx|\n block_elements << @map.element_at(row_idx, col_idx)\n end\n end\n block_elements\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 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 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 squares_by_region(region_id)\n @region_mapper[region_id] || []\n end", "def normalize_regions(regions)\n regions = regions.sort_by { |r| r.start_time }\n filtered_regions = Array.new\n last_region = regions.shift\n regions.each do |r|\n if r.start_time < last_region.end_time\n last_region.end_time = [last_region.end_time, r.end_time].max\n else\n filtered_regions << last_region\n last_region = r\n end\n end\n if last_region\n filtered_regions << last_region\n end\n filtered_regions\n end", "def build_distribution\n dist = Array.new(NUM_DICE * SIDES + 1, 0)\n (1..SIDES).each do |i|\n (1..SIDES).each do |j|\n dist[i+j] += 1\n end\n end\n\n # normalize to a probability\n (NUM_DICE..NUM_DICE * SIDES).each do |k|\n dist[k] = dist[k].to_f / 36.to_f\n end\n dist\nend", "def unloadRegions(options, hostname, port)\n # Clean up any old files.\n filename = getFilename(options, hostname, port)\n deleteFile(filename)\n # Get configuration\n config = getConfiguration()\n # Get an admin instance\n admin = HBaseAdmin.new(config)\n servers = getServers(admin)\n # Remove the server we are unloading from from list of servers.\n # Side-effect is the servername that matches this hostname \n servername = stripServer(servers, hostname, port)\n\n # Remove the servers in our exclude list from list of servers.\n servers = stripExcludes(servers, options[:excludesFile])\n puts \"Valid region move targets: \", servers\n if servers.length == 0\n puts \"No regions were moved - there was no server available\"\n exit 4\n end\n movedRegions = java.util.Collections.synchronizedList(java.util.ArrayList.new())\n while true\n rs = getRegions(config, servername)\n # Remove those already tried to move\n rs.removeAll(movedRegions)\n break if rs.length == 0\n $LOG.info(\"Moving \" + rs.length.to_s + \" region(s) from \" + servername +\n \" on \" + servers.length.to_s + \" servers using \" + options[:maxthreads].to_s + \" threads.\")\n counter = 0\n pool = ThreadPool.new(options[:maxthreads])\n server_index = 0\n while counter < rs.length do\n pool.launch(rs,counter,server_index) do |_rs,_counter,_server_index|\n $LOG.info(\"Moving region \" + _rs[_counter].getEncodedName() + \" (\" + (_counter + 1).to_s +\n \" of \" + _rs.length.to_s + \") to server=\" + servers[_server_index] + \" for \" + servername)\n # Assert we can scan region in its current location\n isSuccessfulScan(admin, _rs[_counter])\n # Now move it.\n move(admin, _rs[_counter], servers[_server_index], servername)\n movedRegions.add(_rs[_counter])\n end \n counter += 1\n server_index = (server_index + 1) % servers.length\n end\n $LOG.info(\"Waiting for the pool to complete\")\n pool.stop\n $LOG.info(\"Pool completed\")\n end\n if movedRegions.size() > 0 \n # Write out file of regions moved\n writeFile(filename, movedRegions)\n $LOG.info(\"Wrote list of moved regions to \" + filename)\n end\nend", "def random_square(region_id)\n reg = @region_mapper[region_id] || []\n reg.sample\n end", "def adjust_security_groups\n\n all_regions.each do |region|\n c = connection(region)\n g = c.security_groups.get(primary_group)\n \n g.authorize_port_range(1024..65535, :cidr_ip => \"#{master.public_ip_address}/32\")\n nodes.each do |node|\n g.authorize_port_range(1024..65535, :cidr_ip => \"#{node.public_ip_address}/32\")\n end\n end\n end", "def new_groups(array)\n new_group = []\n array.shuffle.each_slice(4){|acc| new_group << acc}\n if new_group.length > 1 && new_group.last.length <= 2\n (new_group.last.length).times do |i|\n new_group[i].push(new_group.last.pop)\n new_group.pop\n end\n end\n new_group\nend", "def create_obstacles(array, semester)\n array.map { |hash| create_obstacle(hash, semester) }\n end", "def scan_regions(regions=[])\n regions_to_scan = regions || REGIONS\n regions_to_scan.each do |region|\n @@path = \"#{BASE_DIR}/#{region}\"\n these_locations = process_directory(@@path)\n out = \"#{@@path}/out/#{Time.now.strftime(\"%Y|%m|%d|%H|%M|%S_\")}#{region}.txt\"\n begin \n File.open(out, 'w+') { |f| \n f.write(these_locations.to_json)\n }\n rescue Exception => e\n puts \"scan_regions ex #{e.message}\"\n rescue => e\n puts \"scan_regions #{e.message}\"\n end\n end\n end", "def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend", "def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend", "def create_group(array)\nunit1=array.shuffle!.each_slice(4).to_a\nunit2=array.shuffle!.each_slice(4).to_a\nunit3=array.shuffle!.each_slice(4).to_a\nputs \"Unit1: #{unit1.to_s} Unit2: #{unit2.to_s} Unit3: #{unit3.to_s}\"\nend", "def calc_root_partition(r, m)\n total_per_r = ((m * (m + 1)) / 2) / r\n root_partition = Array.new(m, -1)\n region_totals = Array.new(r, 0)\n i = m\n while i > 0 do\n for j in 0..r-1 do\n if (region_totals[j] + i <= total_per_r)\n region_totals[j] += i\n root_partition[i-1] = j\n break\n end\n end\n i = (i - 1)\n end\n return root_partition\nend", "def weighted_random_index(array)\n\nend", "def cross_individuals(selected_indexes, select_method: :roulette)\n if select_method == :roulette\n m = selected_indexes.size\n (0...m).each do\n x = selected_indexes.sample\n y = selected_indexes.sample\n new_chrom_x, new_chrom_y =\n crossover @chromosomes[x].clone, @chromosomes[y].clone\n evaluate_chromosome new_chrom_x\n evaluate_chromosome new_chrom_y\n @chromosomes << new_chrom_x << new_chrom_y\n end\n elsif select_method == :tournament\n m = selected_indexes.size - 1\n (0...m).each do\n x = selected_indexes.sample\n y = selected_indexes.sample\n new_chrom_x, new_chrom_y =\n crossover @chromosomes[x].clone, @chromosomes[y].clone\n evaluate_chromosome new_chrom_x\n evaluate_chromosome new_chrom_y\n end\n end\n end", "def extend mult\n self.length = @len*mult\n dist.branches.times do |i|\n hits = self[i].hits\n self[i].clear_hits\n mult.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/mult)\n new_hits + (j.to_f / mult)\n self[i] << new_hits\n end\n end\n end", "def mutate_matingpool\n (0...@mating_pool.size).each do |i|\n j = rand 0...@num_genes\n chromosome = @mating_pool[i].clone\n gene = chromosome[j]\n gene = gene.zero? ? 1 : 0\n chromosome[j] = gene\n @new_generation << chromosome\n end\n end", "def construct_ms_per_r(gm, rd, md)\n ms_per_r = Array.new(rd[:num_regions]) {|e| e = Array.new}\n for y in 0...gm[:y] do\n for x in 0...gm[:x] do\n if md[:moves][y][x] != 0\n r = rd[:regions][y][x]\n ms_per_r[r].push(md[:moves][y][x])\n end\n end\n end\n puts \"ms_per_r = \" + ms_per_r.to_s\n return ms_per_r\nend", "def loadRegions(options, hostname, port)\n # Get configuration\n config = getConfiguration()\n # Get an admin instance\n admin = HBaseAdmin.new(config) \n filename = getFilename(options, hostname, port)\n regions = readFile(filename)\n return if regions.isEmpty()\n servername = nil\n # Wait till server is up\n maxWaitInSeconds = admin.getConfiguration.getInt(\"hbase.serverstart.wait.max\", 180)\n maxWait = Time.now + maxWaitInSeconds\n while Time.now < maxWait\n servers = getServers(admin)\n begin\n servername = getServerName(servers, hostname, port)\n rescue ArgumentError => e\n $LOG.info(\"hostname=\" + hostname.to_s + \":\" + port.to_s + \" is not up yet, waiting\");\n end\n break if servername\n sleep 0.5\n end\n $LOG.info(\"Moving \" + regions.size().to_s + \" regions to \" + servername)\n # sleep 20s to make sure the rs finished initialization.\n sleep 20\n counter = 0\n pool = ThreadPool.new(options[:maxthreads])\n while counter < regions.length do\n r = regions[counter]\n exists = false\n begin\n isSuccessfulScan(admin, r)\n exists = true\n rescue org.apache.hadoop.hbase.NotServingRegionException => e\n $LOG.info(\"Failed scan of \" + e.message)\n end\n next unless exists\n currentServer = getServerNameForRegion(admin, r)\n if currentServer and currentServer == servername\n $LOG.info(\"Region \" + r.getRegionNameAsString() + \" (\" + counter.to_s +\n \" of \" + regions.length.to_s + \") already on target server=\" + servername)\n counter = counter + 1\n next\n end\n pool.launch(r,currentServer,counter) do |_r,_currentServer,_counter|\n $LOG.info(\"Moving region \" + _r.getRegionNameAsString() + \" (\" + (_counter + 1).to_s +\n \" of \" + regions.length.to_s + \") from \" + _currentServer.to_s + \" to server=\" +\n servername); \n move(admin, _r, servername, _currentServer)\n end\n counter = counter + 1\n end\n pool.stop\nend", "def generate_blocks(blocks_array)\r\n size=rand(1..3)\r\n index=0\r\n while blocks_array.length<size\r\n case rand(4)\r\n when 0\r\n blocks_array[index]=Obstacle.new(\"media/man.png\", :man)\r\n when 1\r\n blocks_array[index]=Obstacle.new(\"media/tree.png\", :tree)\r\n when 2\r\n blocks_array[index]=Obstacle.new(\"media/bird.png\", :bird)\r\n when 3\r\n blocks_array[index]=Obstacle.new(\"media/bird2.png\", :bird2)\r\n end\r\n\r\n index+=1\r\n end\r\n end", "def test_example_part_two\n input = ['1, 1', '1, 6', '8, 3', '3, 4', '5, 5', '8, 9'].join(\"\\n\")\n grid = Grid.new(input, true, 32)\n\n assert_equal 16, grid.region_size\n end", "def distribute(m, n)\n arr=[]\n return arr if n<=0\n \n if m <=0\n \ta = 0\n \tb = 0\n else \n \ta = m/n\n \tb = m%n\n\tend \n\n n.times {|i| arr[i] = a}\n b.times {|i| arr[i] += 1}\n \n return arr\nend", "def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend", "def expand(*regions)\n regions = normalize_territories(regions.flatten)\n expanded_set(regions).to_a\n end" ]
[ "0.5648439", "0.5311164", "0.5304631", "0.51253974", "0.50617677", "0.5017626", "0.49934906", "0.48969123", "0.48899093", "0.4840798", "0.4821756", "0.47919583", "0.47817144", "0.47581056", "0.47357437", "0.47319466", "0.47319466", "0.4725475", "0.47095367", "0.47092828", "0.4691971", "0.46814752", "0.46765864", "0.4666943", "0.46669284", "0.46552077", "0.46548057", "0.46525735", "0.46428254", "0.46373773" ]
0.62527525
0
Initializes a new Ban object
def initialize(raw_ban) @raw_ban = raw_ban end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\r\n @owner = msg.sender\r\n @counter = 0\r\n @bets = Mapping.of( Integer => Bet ) ## type mapping( uint => Bet )\r\n end", "def initialize(name, bulbs)\n\t\t@name = name\n\t\t@bulbs = bulbs\n\tend", "def initialize (banco, numero_cuenta, saldo_cuenta = 0)\n @banco = banco\n @numero_cuenta = numero_cuenta\n @saldo_cuenta = saldo_cuenta\n end", "def ban\n ban = Ban.new\n ban.steamid = params[:id]\n ban.ts = params[:ts]\n ban.sign = params[:sign]\n ban.expiry = DateTime.now.ago(-(params[:len].to_i*60))\n ban.addr = params[:addr]\n ban.reason = params[:reason]\n ban.ban_type = Ban::TYPE_SERVER\n ban.save!\n\n render :text => \"Ok\"\n end", "def initialize(fighter, bomber)\n create(fighter, bomber)\n end", "def initialize(bid)\n @bid = bid.to_s.upcase\n raise ArgumentError, \"invalid bid: #{bid}\" unless Bridge.bid?(@bid)\n end", "def new\n @bet = Bet.new\n end", "def initialize(user_id, balance)\n # Setting the user_id instance variable to the first value passed in when a bank account is created\n @user_id = user_id\n # Setting the balance instance variable to the second value passed in when a bank account is created\n @balance = balance\n @username = \"\"\n\n # Pushes the newly created instance of bank account into the class variable all\n @@all << self\n end", "def new\n @bond = Bond.new\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(an, bn, tn, data=nil)\n @bn = bn\n super(an, tn, data)\n end", "def initialize(balance)\n @balance = balance\n end", "def initialize(initial_name)\n puts \"I was created\"\n @name = initial_name\n @bag = Array.new\n @balance = 100\n @dollars = []\n end", "def initialize(commodity, bid)\n @commodity = commodity\n @bid = bid\n end", "def initialize(balance = 0)\n if balance < 0\n raise ArgumentError.new(\"You cannot open an account with a negative amount.\")\n end\n @balance = balance\n @id = Faker::Company.swedish_organisation_number\n # Make sure there are no duplicate ID #s?\n @owner = Bank::Owner.new(account_id: @id, first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, street_address: Faker::Address.street_address, city: Faker::Address.city, state: Faker::Address.state, zip: Faker::Address.zip)\n end", "def initialize(balance:)\n @balance = balance\n @change = nil\n @product = nil\n end", "def initialize(name)\n\t\t#when I initialize the bank account I need to do so with my name\n\t\t#always initialize with a balance of 1000\n\t\t@name = name\n\t\t@balance = 1000 \n\t\t@status = \"open\"\n\tend", "def initialize(b, n, baths)\n @unit = b\n @num_beds = n\n @num_baths = baths\n @tenants = []\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def initialize(exisiting_savings) #This gets called when a new instance of a bank account gets created\n # @balance = 0\n @balance = exisiting_savings\n end", "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 initialize\n\t\t@wallets = Set[ \"0\" ]\n\t\t@uuid = UUID.new\n\n\t\tsuper\n\tend", "def initialize(apt_no, rent, br, baths)\n\t\t@is_occupied = false\n\t\t@apt_no = apt_no\n\t\t# Note that this then redefines what rent is -- it was actually in place from above, and set to nil\n\t\t@rent = rent\n\n\t\t# Let's set these read-only properties\n\t\t@bedrooms = br\n\t\t@baths = baths\n\tend", "def initialize(title,author,isbn)\n @title = title\n @author = author\n @isbn = isbn.to_i\n# @borrow = false\n end", "def initialize\n super\n @bet_amount = 0\n end", "def initialize(initial_name=nil)\n # what's important to your object\n # upon its creation?\n puts \"I was created!\"\n @name = initial_name\n @bag = Array.new\n @balance = 100\n @dollars = []\n end", "def initialize(holder_name , balance , type)\n @holder_name =holder_name\n @balance = balance\n @type = type\n end", "def initialize id, balance, open_date, owner = nil\n # error handling for initial negative balance\n if balance >= 0\n @balance = balance\n else\n raise ArgumentError.new \"Inital balance cannot be a negetive value\"\n end\n\n @id = id\n @open_date = DateTime.parse(open_date)\n\n # Assumes that required csv file is accesible\n CSV.read(\"support/account_owners.csv\").each do |line|\n if line[0].to_i == @id\n @owner = Bank::Owner.find(line[1].to_i)\n end\n end\n\n if owner.class == Bank::Owner\n @owner = owner\n else\n # Default instance of the Owner class initialized with empty hash\n @owner = Bank::Owner.new({})\n end\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" ]
[ "0.68401676", "0.656826", "0.65381145", "0.64578813", "0.6371757", "0.6274962", "0.62144697", "0.62128013", "0.6204669", "0.62019575", "0.61475253", "0.6133302", "0.6085256", "0.6084247", "0.60379523", "0.60094404", "0.6001493", "0.59995127", "0.59748083", "0.5948451", "0.59313494", "0.5924283", "0.5902989", "0.5895878", "0.58781725", "0.5877789", "0.58711714", "0.58586776", "0.58580846", "0.58562094" ]
0.77015656
0
The player's Steam 64 bit ID
def steam_id raw_ban['SteamId'].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def steam_id\n raw_friend['steamid'].to_i\n end", "def uid\n id && Base58GMP.encode(id)\n end", "def tuid\n self.player_id.to_s + self.team_id.to_s\n end", "def secret_ID(id = nil)\r\n return id ? id >> 16 : @id >> 16\r\n end", "def identifier\n SecureRandom.hex(16)\n end", "def unique_id\n object_id.abs.to_s(16)\n end", "def id(raw = false)\n id = Spotify.image_image_id(@pointer).read_string(20)\n raw ? id : to_hex(id)\n end", "def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end", "def get_player_id\n\t\t@player_id\n\tend", "def hex\n @id.unpack('H*').first\n end", "def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end", "def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend", "def uid\n \"#{user_id}-#{team_id}\"\n end", "def short_id\n Digest::SHA1.hexdigest(hex)[0, 6]\n end", "def unique_identifier\n Digest::SHA1.hexdigest (\"#{self.screen_name}:#{self.password}\")\n end", "def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end", "def code\n id ? id.to_s(36) : nil\n end", "def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end", "def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end", "def unique_id\n '%8x%s@%s' % [\n Time.now.to_i,\n Digest::SHA1.hexdigest(\n '%.8f%8x' % [ Time.now.to_f, rand(1 << 32) ]\n )[0, 32],\n Socket.gethostname\n ]\n end", "def gen_id\n SecureRandom.hex(32)\n end", "def uid\n @uid ||= (@in['uid_hi'] << 16) | @in['uid_lo']\n end", "def getPlayerUID _args\n \"getPlayerUID _args;\" \n end", "def short_id\n @short_id ||= Digest::SHA1.hexdigest(hex)[0, 6]\n end", "def numId\n id.to_s.slice(-9,9).hex.to_i\n end", "def encoded_id\n (((id * PRIME) & MAXID) ^ RNDXOR).to_s(16)\n end", "def short_id(txid)\n hash = SipHash.digest(siphash_key, txid.htb.reverse).to_even_length_hex\n [hash].pack('H*')[2...8].bth.to_i(16)\n end", "def public_ID(id = nil)\r\n return id ? id & 0xFFFF : @id & 0xFFFF\r\n end", "def lab_user_id\n plaintext_id = \"#{@view_options[:channel]}:#{user_or_session_id}\"\n Digest::SHA1.base64digest(storage_encrypt(plaintext_id)).tr('=', '')\n end", "def session_guid\n UUIDTools::UUID.random_create.to_s\n end" ]
[ "0.73491544", "0.67257905", "0.66229326", "0.6490911", "0.6408611", "0.6287923", "0.6262609", "0.6262545", "0.6260919", "0.6202612", "0.62016654", "0.6170822", "0.616833", "0.6164912", "0.61478496", "0.6097115", "0.60859674", "0.6085555", "0.6085555", "0.6082716", "0.6076983", "0.6068358", "0.6044216", "0.604209", "0.6030692", "0.60143083", "0.6009946", "0.59986603", "0.5993718", "0.5990692" ]
0.7306445
1
String containing the player's ban status in the economy.
def economy_banned_status raw_ban['EconomyBan'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n output = \"\"\n player = @game.player\n output << \"You won!! you have scaped with life from the castle!!! \"\n output << \"WELL DONE!!\"\n end", "def status()\r\n\t\treturn to_s() + \", #{total_guess_count()} guesses (#{bad_guess_count()} bad), won? #{won?}, lost? #{lost?}\"\r\n\tend", "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 to_s\n @name + \" Level: \" + @level.to_s + \" Combat Level: \" + getCombatLevel.to_s +\n \"\\nMal rollo pendiente: \" + \n ((@pendingBadConsequence==nil||@pendingBadConsequence.isEmpty)?(\"OK\"):(\"\\n\"[email protected]_s))\n end", "def status\n result = \"online\"\n if Current.room.ready? && Current.room.poker_records.find_by(user_id: object.id).present?\n result += \" played\"\n end\n result\n end", "def status\n puts \"Player #{@playerNo}\".center(60)\n puts \"Name: #{@name}\".center(60)\n puts \"Class: #{@fightClass[:name]}\".center(60)\n puts \"Race: #{@race[:name]}\".center(60)\n puts \"HP: #{@hp}\".center(60)\n puts \"Level: #{@level}\".center(60)\n puts \"Actions: #{@actions.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Attacks: #{@attacks.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Inventory: #{@inventory.join(', ')}\".center(60)\n puts \"\"\n end", "def get_loss_confirmation()\n return \"#{@player.get_name()} loses with #{@player.get_weapon()}!\"\n end", "def status_string\n case status\n when APPROVED_STATUS\n \"approved\"\n when REJECTED_STATUS\n \"rejected\"\n when REMOVED_STATUS\n \"removed\"\n when PENDING_STATUS\n \"pending\"\n else\n \"error\"\n end\n end", "def status_string\n if waiting_confirmation?\n return \"À confirmer\"\n elsif confirmed?\n return \"Confirmé\"\n elsif forgiven?\n return \"Pardonné\"\n else\n return \"Rejeté\"\n end\n end", "def betting_status\n super || ''\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 to_s\n return 'inactive' if inactive?\n\n # try to mimics stat behaviour to minimize readings\n result = status_string\n result += ', got TERM' if got_term?\n result += ', want down' if want_down?\n result += ', want up' if want_up?\n result\n end", "def player_status(player)\n return \"Draw\" if draw?\n player.id == winner_id ? \"Won\" : \"Lost\"\n end", "def game_status\n puts\n game_status_str = @game_status.join(' ')\n puts game_status_str\n end", "def get_other_loss_confirmation()\n return \"#{@player.get_other_name()} loses with #{@player.get_other_weapon()}!\"\n end", "def status_name\n STATUSES[status]\n end", "def status(player)\n puts player\n linebreak\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end", "def get_status\n return @player_status\n end", "def status\n \"#{@name}: #{@lives}/3 \"\n end", "def cheat_status\n if @revealed\n \" \"\n else\n @bombed ? \"X\" : \"*\"\n end\n end", "def check_bet\r\n (padding,pronoun) = self.is_a?(User) ? [29,\"You\"] : [32,\"Player ##{player_id+1}\"]\r\n puts \"\\n%#{padding}s\\n\" % \"#{pronoun} checked.\"\r\n end", "def backup_status_desc\n status = if !confirmed?\n 'Authentication Required'\n elsif active?\n if lb = latest_backup\n lb.successful? ? 'OK' : 'Failed'\n else\n 'OK'\n end\n else\n 'Inactive'\n end\n if (status == 'Failed') && backup_broken?\n status = EternosBackup::BackupSourceError.new(self).short_error\n end\n status\n end", "def status_text\n case @state\n when 0\n H87Enchant::ST1\n when 1\n H87Enchant::ST2\n when 2\n H87Enchant::STQ\n when 3\n H87Enchant::ST3\n when 4\n H87Enchant::ST4\n when 5\n H87Enchant::ST5\n else\n ; 'ERRORE 01'\n end\n end", "def status\n status = \"\"\n if points < 4000\n status = \"Baby Seeder\"\n elsif points < 8000\n status = \"Aspiring Gardener\"\n elsif points < 15000\n status = \"Garden Hero\"\n else\n status = \"Plant Wizard\"\n end\n end", "def battle_outcome()\n if get_battle() == 1\n set_games_won()\n return get_victory_confirmation() + \" \" + get_other_loss_confirmation()\n\n elsif get_battle() == 2\n set_other_games_won()\n return get_loss_confirmation() + \" \" + get_other_victory_confirmation()\n\n else get_battle() == 0\n set_games_tied()\n return get_tie_confirmation()\n end\n end", "def status\n output = StringIO.new\n output << @game.player.to_s\n output << \"\\n\"\n\n output << \"#{@game.current_room_model.description}\\n\"\n\n treasure = @game.current_room_model.treasure\n output << \"\\nThere is treasure here worth $#{treasure}.\\n\" if treasure && treasure > 0\n\n monster = @game.current_room_model.monster\n if monster\n output << \"\\nDANGER... THERE IS A MONSTER HERE....\\n\\n\"\n output << \"#{@game.current_room_model.monster}\\n\\n\"\n end\n\n if @game.current_room_model.name != \"Exit\"\n output << \"\\nWhat do you want to do? \"\n end\n \n output.string\n end", "def all_player_status\n linebreak\n @players.each{ |p| puts p; linebreak; }\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end", "def to_s\n result = @name\n if self.has_a_hand and not self.is_dealer\n result += \" [\\$#{@bet.to_s}]\"\n end\n result += \" [\\$#{@bankroll.to_s}]\"\n return result\n end" ]
[ "0.6465956", "0.64026785", "0.6379537", "0.63592315", "0.6345788", "0.6337388", "0.63297904", "0.62974423", "0.619753", "0.6189802", "0.61089504", "0.6094221", "0.60374403", "0.60345924", "0.6032034", "0.60320145", "0.6027504", "0.6008943", "0.60056204", "0.59927166", "0.59750557", "0.59722733", "0.59716076", "0.5915861", "0.59154165", "0.5903601", "0.5899541", "0.5885949", "0.5856931", "0.5841807" ]
0.8089339
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 run_hook(_resources)\n setup_code_deploy_s3_buckets\n end", "def generate_matchfile_content(template: nil)\n return \"s3_bucket(\\\"#{self.s3_bucket}\\\")\"\n end", "def prod_s3_credentials\n {:bucket => \"alphadelta-pro\", :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET_KEY'] }\n end", "def copy_initializer\n template 'k8s/tests_job.yaml', \"k8s/#{app_name}_tests_job.yaml\"\n template 'k8s/deployment.yaml', \"k8s/#{app_name}_deployment.yaml\"\n template 'k8s/service.yaml', \"k8s/#{app_name}_service.yaml\"\n template 'k8s/setup_job.yaml', \"k8s/#{app_name}_setup_job.yaml\"\n template 'Jenkinsfile', \"Jenkinsfile\"\n template \"Dockerfile.#{docker_base}\", \"Dockerfile\"\n template \"Dockerfile.test.#{docker_base}\", \"Dockerfile.test\"\n template 'database.yml.prod', \"database.yml.prod\"\n template 'database.yml.test', \"database.yml.test\"\n end", "def transform_code_uri(lambda_fn_params, code_uri)\n if s3_uri? code_uri\n lambda_fn_params[:code_bucket] = bucket_from_uri code_uri\n lambda_fn_params[:code_key] = object_key_from_uri code_uri\n elsif code_uri.is_a? Hash\n lambda_fn_params[:code_bucket] = code_uri['Bucket']\n lambda_fn_params[:code_key] = code_uri['Key']\n end\n lambda_fn_params\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n kms_master_key_id = '9041e78c-7a20-4db3-929e-828abEXAMPLE'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if default_bucket_encryption_sse_cmk_set?(\r\n s3_client,\r\n bucket_name,\r\n kms_master_key_id\r\n )\r\n puts 'Default encryption state set.'\r\n else\r\n puts 'Default encryption state not set.'\r\n end\r\nend", "def secret\n 's3cr37'\n end", "def copy_initializer\n template \"bucket_maker.rb\", \"config/initializers/bucket_maker.rb\"\n end", "def prime_cache_with_default_image\n s3init\n \n logger.info(\"Priming cache with default image\")\n Rails.cache.fetch(\"bar_image_-1\") { AWS::S3::S3Object.value 'barview.jpg', @bucketname }\n end", "def execute!\n name_required!\n name = name_args.first\n\n stack_info = \"#{ui.color(\"Name:\", :bold)} #{name}\"\n begin\n stack = provider.stacks.get(name)\n rescue Miasma::Error::ApiError::RequestError\n stack = nil\n end\n\n config[:compile_parameters] ||= Smash.new\n\n if config[:file]\n s_name = [name]\n\n c_setter = lambda do |c_stack|\n if c_stack.outputs\n compile_params = c_stack.outputs.detect do |output|\n output.key == \"CompileState\"\n end\n end\n if compile_params\n compile_params = MultiJson.load(compile_params.value)\n c_current = config[:compile_parameters].fetch(s_name.join(\"__\"), Smash.new)\n config[:compile_parameters][s_name.join(\"__\")] = compile_params.merge(c_current)\n end\n c_stack.nested_stacks(false).each do |n_stack|\n s_name.push(n_stack.data.fetch(:logical_id, n_stack.name))\n c_setter.call(n_stack)\n s_name.pop\n end\n end\n\n if stack\n c_setter.call(stack)\n end\n\n ui.debug \"Compile parameters - #{config[:compile_parameters]}\"\n file = load_template_file(:stack => stack)\n stack_info << \" #{ui.color(\"Path:\", :bold)} #{config[:file]}\"\n else\n file = stack.template.dup if config[:plan]\n end\n\n unless stack\n ui.fatal \"Failed to locate requested stack: #{ui.color(name, :red, :bold)}\"\n raise \"Failed to locate stack: #{name}\"\n end\n\n unless config[:print_only]\n ui.info \"#{ui.color(\"SparkleFormation:\", :bold)} #{ui.color(\"update\", :green)}\"\n end\n\n unless file\n if config[:template]\n file = config[:template]\n stack_info << \" #{ui.color(\"(template provided)\", :green)}\"\n else\n stack_info << \" #{ui.color(\"(no template update)\", :yellow)}\"\n end\n end\n unless config[:print_only]\n ui.info \" -> #{stack_info}\"\n end\n if file\n if config[:print_only]\n ui.puts format_json(parameter_scrub!(template_content(file)))\n return\n end\n\n original_template = stack.template\n original_parameters = stack.parameters\n\n apply_stacks!(stack)\n\n populate_parameters!(file, :current_parameters => stack.root_parameters)\n update_template = stack.template\n\n if config[:plan]\n begin\n stack.template = original_template\n stack.parameters = original_parameters\n plan = build_planner(stack)\n if plan\n result = plan.generate_plan(\n file.respond_to?(:dump) ? file.dump : file,\n config_root_parameters\n )\n display_plan_information(result)\n end\n rescue => e\n unless e.message.include?(\"Confirmation declined\")\n ui.error \"Unexpected error when generating plan information: #{e.class} - #{e}\"\n ui.debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n ui.confirm \"Continue with stack update?\" unless config[:plan_only]\n else\n raise\n end\n end\n if config[:plan_only]\n ui.info \"Plan only mode requested. Exiting.\"\n return\n end\n end\n stack.parameters = config_root_parameters\n\n if config[:upload_root_template]\n upload_result = store_template(name, file, Smash.new)\n stack.template_url = upload_result[:url]\n else\n stack.template = parameter_scrub!(template_content(file, :scrub))\n end\n else\n apply_stacks!(stack)\n original_parameters = stack.parameters\n populate_parameters!(stack.template, :current_parameters => stack.root_parameters)\n stack.parameters = config_root_parameters\n end\n\n # Set options defined within config into stack instance for update request\n if config[:merge_api_options]\n config.fetch(:options, Smash.new).each_pair do |key, value|\n if stack.respond_to?(\"#{key}=\")\n stack.send(\"#{key}=\", value)\n end\n end\n end\n\n begin\n api_action!(:api_stack => stack) do\n stack.save\n if config[:poll]\n poll_stack(stack.name)\n if stack.reload.state == :update_complete\n ui.info \"Stack update complete: #{ui.color(\"SUCCESS\", :green)}\"\n namespace.const_get(:Describe).new({:outputs => true}, [name]).execute!\n else\n ui.fatal \"Update of stack #{ui.color(name, :bold)}: #{ui.color(\"FAILED\", :red, :bold)}\"\n raise \"Stack did not reach a successful update completion state.\"\n end\n else\n ui.warn \"Stack state polling has been disabled.\"\n ui.info \"Stack update initialized for #{ui.color(name, :green)}\"\n end\n end\n rescue Miasma::Error::ApiError::RequestError => e\n if e.message.downcase.include?(\"no updates\")\n ui.warn \"No updates detected for stack (#{stack.name})\"\n else\n raise\n end\n end\n end", "def s3_gen_bucket\n s3_gen.bucket(App.aws_bucket,true)\n end", "def setup_code_deploy_s3_buckets\n @regions.uniq.each do |region|\n client = s3_client(region:)\n name = bucket_name(region)\n bucket = Aws::S3::Bucket.new(\n name,\n client:\n )\n bucket.create unless bucket.exists?\n end\n end", "def update_from_s3\n begin\n ensure_updated_package\n rescue Aws::S3::Errors::NoSuchKey\n @logger.info 'Package does not exist on S3. If you have made local changes to code-studio, you need to set build_code_studio and use_my_code_studio to true in locals.yml'\n return false\n rescue Exception => e\n @logger.info \"update_from_s3 failed: #{e.message}\"\n return false\n end\n return true\n end", "def writeVersionCode(file, versionCode)\n s3 = Aws::S3::Client.new(region: 'us-east-1')\n obj = s3.put_object({\n body: versionCode.to_s,\n bucket: \"sportarchive-prod-creds\",\n key: \"android-versioncode/#{file}\"\n })\nend", "def cloudCode(code, placeholder = \"CLOUDCODEPLACEHOLDER\")\n var_name = code.gsub(/[^a-z0-9]/i, \"_\")\n placeholder = code if placeholder.nil?\n getTail(var_name, value: placeholder, runtimecode: code)\n \"MU::Config.getTail PLACEHOLDER #{var_name} REDLOHECALP\"\n end", "def bootstrap!\n root_file = Gem::TUF::File.new 'metadata/root.txt',\n Gem::TUF::Serialize.canonical(signed_root)\n\n targets = Gem::TUF::Role::Targets.empty\n targets_file = build_role 'targets', targets\n\n release = Gem::TUF::Role::Release.empty\n release.replace(targets_file)\n release.replace(root_file)\n release_file = build_role 'release', release\n\n timestamp = Gem::TUF::Role::Timestamp.empty\n timestamp.replace(release_file)\n timestamp_file = build_role 'timestamp', timestamp\n\n [root_file, targets_file, release_file].each do |file|\n bucket.create file.path_with_hash, file.body\n end\n bucket.create timestamp_file.path, timestamp_file.body\n end", "def default_s3_bucket\n \"hydra_uploads\"\n end", "def url_for(software)\n \"http://#{Config.s3_bucket}.s3.amazonaws.com/#{S3Cache.key_for(software)}\"\n end", "def add_to(s3)\n s3_template = s3.template\n @instance_name = s3.name\n cloud_front_template = template\n s3.template.deep_merge(cloud_front_template)\n end", "def tf_vars_aws\n {\n aws_region: provider.region,\n route53_zone_main_name: infra.dns.domain,\n route53_zone_this_name: infra.dns.subdomain,\n ec2_instance_type: provider.instance.type,\n ec2_key_pair: provider.instance.key_pair,\n ec2_tags: provider.instance.tags,\n ec2_ami_distro: provider.instance.ami_distro\n # lambda_filename: infra.lambda_filename\n }\n end", "def s3_url\n \"https://s3.amazonaws.com/#{ENV['S3_BUCKET']}\"\n end", "def fle_aws_temp_key\n ENV['CSFLE_AWS_TEMP_ACCESS_KEY_ID']\n end", "def secret_key_base=(_arg0); end", "def secret_key_base=(_arg0); end", "def string_or_url(template)\n # Upload the template to S3 if it's too large to be passed directly.\n if template.length < 51200\n {template_body: template}\n elsif template.length < 460800\n CDO.log.debug 'Uploading template to S3...'\n key = AWS::S3.upload_to_bucket(TEMP_BUCKET, \"#{stack_name}-#{Digest::MD5.hexdigest(template)}-cfn.json\", template, no_random: true)\n {template_url: \"https://s3.amazonaws.com/#{TEMP_BUCKET}/#{key}\"}\n else\n raise 'Template is too large'\n end\n end", "def aws_instance_S3_files_create\n bucket = aws_call('aws_S3_bucket_get', name: Rails.configuration.x.aws['s3_bucket_name'])\n if not aws_call('aws_obj_exists?', obj: bucket)\n log \"AWS: creating S3 Bucket '#{Rails.configuration.x.aws['s3_bucket_name']}'\"\n bucekt = aws_call('aws_S3_bucket_create', name: Rails.configuration.x.aws['s3_bucket_name'])\n end\n\n aws_instance_S3_object_create(bucket, 'exit_status', :exit_status_page, :write)\n aws_instance_S3_object_create(bucket, 'script_log', :script_log_page, :write)\n aws_instance_S3_object_create(bucket, 'bash_history', :bash_history_page, :write)\n\n obj = aws_instance_S3_object_create(bucket, 'com', :com_page, :write)\n log \"AWS: writing to S3Object '#{obj.key}'\"\n aws_call('aws_S3_object_write', obj: obj, data: 'waiting')\n\n obj = aws_instance_S3_object_create(bucket, 'cookbook', :cookbook_url, :read)\n log \"AWS: writing to S3Object '#{obj.key}'\"\n aws_call('aws_S3_object_write', obj: obj, data: self.generate_cookbook)\n end", "def get_box(dist, version)\n dist ||= \"trusty\"\n version ||= '20160323'\n \n name = \"govuk_dev_#{dist}64_#{version}\"\n bucket = 'govuk-dev-boxes-test'\n url = \"https://#{bucket}.s3.amazonaws.com/#{name}.box\"\n\n return name, url\nend", "def s3_start\n\t\t@s3 = AWS::S3.new\n\tend" ]
[ "0.5726733", "0.5661511", "0.5531613", "0.55142844", "0.5394334", "0.5278653", "0.52558106", "0.52528733", "0.51931196", "0.51488304", "0.5136274", "0.51173973", "0.51095766", "0.5100951", "0.5076209", "0.504742", "0.5042179", "0.50356054", "0.5010599", "0.5001653", "0.49781448", "0.49711", "0.4965534", "0.4950725", "0.49398112", "0.49398112", "0.49346033", "0.49321407", "0.49311075", "0.4928101" ]
0.7231689
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(message)\n return unless debugging?\n\n logger.debug(message.to_s)\n nil\n end", "def output(message)\n return if disabled\n if Device.simulator?\n puts(message)\n else\n NSLog(message)\n end\n message\n end", "def debugonce(message)\n logger.debugonce(message)\n nil\n end", "def log_capture_device\n @log_capture_device ||= STDOUT\n end", "def warn(message)\n logger.warn(message.to_s)\n nil\n end", "def <<(msg)\n @logdev.write(msg) if @logdev\n end", "def log(message, level)\n if SEVERITY[@log_level] <= SEVERITY[level]\n message = \"#{level}: #{message}\"\n if @output==:file\n File.open('debug.log', 'ab') {|f| f.puts message }\n elsif @output==:stdout\n puts message\n end\n return message \n end\n return nil\n end", "def log_debug(message)\n return message\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 log_debug(message) # :nodoc:\n @logger.debug(message) if @logger\n end", "def debug_message(message)\n logger.debug \"**** - #{message}\"\n end", "def debug(message)\n log(0, message)\n end", "def log(msg)\n return if logger.nil?\n logger.debug(msg)\n end", "def log_output(color: false)\n return unless defined? @log_device\n if color\n @log_device.string\n else\n ANSI.unansi(@log_device.string)\n end\n end", "def log(message)\n SystemdMon::Logger.puts \"#{me}: #{message}\"\n end", "def format_log_entry(message, dump = nil)\n if Rails.application.config.colorize_logging\n if @@row_even\n @@row_even = false\n message_color, dump_color = \"4;36;1\", \"0;1\"\n else\n @@row_even = true\n message_color, dump_color = \"4;35;1\", \"0\"\n end\n\n log_entry = \" \\e[#{message_color}m#{message}\\e[0m \"\n log_entry << \"\\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\\e[0m\" % dump if dump\n log_entry\n else\n \"%s %s\" % [message, dump]\n end\n end", "def debug_message message\n if @quiet\n # noop\n \":\"\n else\n \">&2 echo #{DEBUG_HEADER} #{message}\"\n end\n end", "def log_this(message)\n Vedeu::Log.logger.debug(message)\n end", "def debug(message = nil)\n log(:debug, message) unless message.nil?\n end", "def log_message(message)\n @log.info(message) if @options[:logging_enabled]\n end", "def log_message(message)\n @log.info(message) if @options[:logging_enabled]\n end", "def log_message(message)\n @log.info(message) if @options[:logging_enabled]\n end", "def log(message)\n if Typescript::Monkey.configuration.logger\n Typescript::Monkey.configuration.logger.debug(message)\n end\n end", "def debug(message)\n logger.debug(PROG_NAME) { message }\n end", "def message(message)\n log.info(message.to_s)\n end", "def debug message; write DEBUG, message, caller[0] unless level > @level end", "def write(message)\n logger.info message unless message == \"\\n\"\n end", "def log(message)\n @collector.sending_stream.puts pack(:log, message)\n end", "def debug(message)\n ostream.puts message if $DEBUG\n end" ]
[ "0.60039926", "0.58382386", "0.56024206", "0.55666196", "0.55440235", "0.55388784", "0.55302936", "0.5462529", "0.54331875", "0.53947324", "0.5375474", "0.53453916", "0.5311871", "0.5254254", "0.5251005", "0.5231307", "0.5220675", "0.52088624", "0.5199539", "0.5190324", "0.51876825", "0.51876825", "0.51876825", "0.5164762", "0.51606387", "0.5154101", "0.51480156", "0.5143733", "0.5135533", "0.51239175" ]
0.5844435
1
Close the logging device.
def close @logdev.close if @logdev end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 flush\n @log.close if @log.respond_to?(:close) && [email protected]?\n @log = nil\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_log\n if @logging_io && @logging_io != $stdout\n @logging_io.close\n @logging_io = nil\n end\n end", "def end_logging\n finalize_log_file()\n @logger.close()\n end", "def close\n checkpoint\n @logfile.close\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 DeregisterEventSource(@eventlog_handle)\n ensure\n @eventlog_handle = nil\n end", "def close\n\t\trequest = Packet.create_request('stdapi_sys_eventlog_close')\n\n\t\trequest.add_tlv(TLV_TYPE_EVENT_HANDLE, self.handle);\n\n\t\tresponse = client.send_request(request)\n\t\treturn nil\n\tend", "def do_close\n @logger.debug(\"closing\", :plugin => self.class.name)\n close\n end", "def close\n if threaded?\n @dump_queue.push nil\n @dump_thread.join\n end\n ensure\n logfile.close\n end", "def close\n @closed = true\n @on_close and @on_close.call\n end", "def close\n send_termination_event\n end", "def close\n SLPClose(@handle)\n end", "def close\n\n # nothing to do here.\n end", "def close\n return if @ptr.nil?\n\n ObjectSpace.undefine_finalizer(self) if @finalize\n Native.sd_journal_close(@ptr)\n\n @ptr = nil\n end", "def game_close\n @console_delegate.close\n end", "def close!\n close(true)\n end", "def close\n _do_if_open { _handle_closed! ; Dnet.fw_close(@handle) }\n end", "def close\n close!\n end", "def close\n # Force full flush call to ensure that all accumulated messages are flushed.\n buffer_flush(:final => true)\n end", "def close\n return if @fileformat == nil\n\n @device.close unless @device == nil || @device.closed?\n end", "def close\n @fh.close\n end", "def close\n @ios.each(&:close)\n end", "def close\n\t remove_common_event_handlers\n\t remove_specific_event_handlers\n\t sleep 0.2\n Phidgets::FFI::Common.close(@handle) \n\t delete\n true\n end", "def close\n self.disconnect\n end" ]
[ "0.81122386", "0.7884688", "0.7607325", "0.75072706", "0.74091536", "0.7402672", "0.73840773", "0.7304757", "0.71073735", "0.6899726", "0.68814754", "0.68182427", "0.6670712", "0.6466136", "0.6224144", "0.6173834", "0.61599284", "0.6155557", "0.61449194", "0.6142942", "0.60996485", "0.60906464", "0.6073539", "0.60625476", "0.6061303", "0.6059026", "0.60541487", "0.6050338", "0.6047511", "0.6045375" ]
0.81379324
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 @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 show\n @ios_topbar = @user.ios_topbar\n\n if @ios_topbar == nil\n @ios_topbar = @user.build_ios_topbar\n render action: \"new\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ios_topbar }\n end\n end\n end", "def new\n @tuoshui = Tuoshui.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tuoshui }\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 @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", "def new\n @foobar = Foobar.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foobar }\n end\n end", "def new\n redirect_to_home\n \n #@bar_event = BarEvent.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render :json => @bar_event }\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 @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @bar = Bar.new\n @button_text = \"Sign up!\"\n @show_tos = true\n @show_password_explanation = false\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 @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end", "def new\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb 'New hub', new_hub_path\n append_title 'New hub'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hub }\n end\n end", "def new\n @highfive = Highfive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @highfive }\n end\n end", "def new\n @sticky = Sticky.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sticky }\n end\n end", "def new\n @bucket = current_user.buckets.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bucket }\n format.iphone { render :layout => false}\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 @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @rackitem = Rackitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rackitem }\n end\n end", "def new\n current_admin_user\n @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end", "def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end", "def create\n @top5 = Top5.new(top5_params)\n \n respond_to do |format|\n if @top5.save\n @status = 'success' \n @action = 'create' \n format.js { render :index} \n else\n @status = 'danger'\n format.js { render :new } \n end\n end\n end", "def new\n @weibo = Weibo.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end", "def new\n @sidebar = Sidebar.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sidebar }\n end\n end" ]
[ "0.67649686", "0.6763822", "0.6451191", "0.6434442", "0.63553584", "0.63374573", "0.62913173", "0.6272199", "0.6260369", "0.62488884", "0.6220289", "0.61899066", "0.6173362", "0.6168536", "0.6167665", "0.6144411", "0.61321086", "0.6129298", "0.61153615", "0.6110055", "0.61036426", "0.6072442", "0.60722286", "0.6033401", "0.6023389", "0.6020306", "0.59938425", "0.59937024", "0.59548366", "0.59511817" ]
0.70895004
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 show\n @ios_topbar = @user.ios_topbar\n\n if @ios_topbar == nil\n @ios_topbar = @user.build_ios_topbar\n render action: \"new\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ios_topbar }\n end\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 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 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 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\n @slider_top = SliderTop.new(slider_top_params)\n\n respond_to do |format|\n if @slider_top.save\n format.html { redirect_to @slider_top, notice: 'Slider top was successfully created.' }\n format.json { render :show, status: :created, location: @slider_top }\n else\n format.html { render :new }\n format.json { render json: @slider_top.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @non_smoking_bar = NonSmokingBar.new(params[:non_smoking_bar])\n\n respond_to do |format|\n if @non_smoking_bar.save\n format.html { redirect_to root_url, notice: 'Successfully created.' }\n format.json { render json: @non_smoking_bar, status: :created, location: @non_smoking_bar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @non_smoking_bar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bar80 = Bar80.new(bar80_params)\n\n respond_to do |format|\n if @bar80.save\n format.html { redirect_to @bar80, notice: \"Bar80 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar80 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar80.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @topi = Topi.new(topi_params)\n\n respond_to do |format|\n if @topi.save\n format.html { redirect_to @topi, notice: 'Topi was successfully created.' }\n format.json { render :show, status: :created, location: @topi }\n else\n format.html { render :new }\n format.json { render json: @topi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @top5 = Top5.new(top5_params)\n \n respond_to do |format|\n if @top5.save\n @status = 'success' \n @action = 'create' \n format.js { render :index} \n else\n @status = 'danger'\n format.js { render :new } \n end\n end\n end", "def index\n @topups = Topup.all\n end", "def index\n @user=current_user\n\t @bars = @user.bars\n\t bar_num = @user.bars.count\n\t logger.error \"Bar Num: #{bar_num}\"\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bars }\n\tend\n end", "def index\n #if(params[:stack_count].nil?)\n #@stacks = Stack.all\n #else\n @stacks = Stack.all.order(id: :desc).limit(5)\n\n render json: @stacks\n end", "def create\n @set_top_box = SetTopBox.new(set_top_box_params)\n if @set_top_box.save\n flash[:success] = \"Create success!\"\n redirect_to @set_top_box\n else\n render 'new'\n end\n end", "def create\n @top_category = TopCategory.new(top_category_params)\n\n respond_to do |format|\n if @top_category.save\n format.json { render :show, status: :created, location: @top_category }\n else\n format.json { render json: @top_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def createTitlebar\n height = NSHeight(self.window.frame) - NSHeight(self.window.contentView.frame)\n @spinner = NSProgressIndicator.alloc\n .initWithFrame([[0, 2], [height - 4, height - 4]])\n .tap do |obj|\n obj.usesThreadedAnimation = true\n obj.indeterminate = true\n obj.style = NSProgressIndicatorSpinningStyle\n obj.displayedWhenStopped = false\n end\n titlebarView = NSView.alloc.initWithFrame([[0, 0], [40, height]])\n titlebarView.addSubview(@spinner)\n NSTitlebarAccessoryViewController.alloc.init.tap do |obj|\n obj.view = titlebarView\n obj.layoutAttribute = NSLayoutAttributeRight\n end\n end", "def create\n @bar8 = Bar8.new(bar8_params)\n\n respond_to do |format|\n if @bar8.save\n format.html { redirect_to @bar8, notice: \"Bar8 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar8 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar8.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @non_smoking_bars = NonSmokingBar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @non_smoking_bars }\n end\n end", "def create\n @barrack = Barrack.new(params[:barrack])\n\n respond_to do |format|\n if @barrack.save\n format.html { redirect_to @barrack, notice: 'Barrack was successfully created.' }\n format.json { render json: @barrack, status: :created, location: @barrack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end", "def bar_item_params\n params.require(:bar_item).permit(:ticket_id, :bar_menu_item_id, :bar_closeout)\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 top\n render :action => 'top'\n end", "def create\n @bar = Bar.new(params[:bar])\n\[email protected] = @bar.street_address + \", \" + @bar.city + \", \" + @bar.state + \", \" + @bar.zip_code\n\t@user = User.find(params[:os])\n\[email protected] = @user\n\[email protected]_id= @user.id\n respond_to do |format|\n if @bar.save\n format.html { redirect_to user_bar_path(@bar.user,@bar), notice: 'Bar was successfully created.' }\n format.json { render json: @bar, status: :created, location: @bar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bar_item = BarItem.new(bar_item_params)\n\n respond_to do |format|\n if @bar_item.save\n format.html { redirect_to @bar_item, notice: 'Bar item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bar_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @bar_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bar68 = Bar68.new(bar68_params)\n\n respond_to do |format|\n if @bar68.save\n format.html { redirect_to @bar68, notice: \"Bar68 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar68 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar68.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bar52 = Bar52.new(bar52_params)\n\n respond_to do |format|\n if @bar52.save\n format.html { redirect_to @bar52, notice: \"Bar52 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar52 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar52.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.63054585", "0.58808243", "0.5842777", "0.5764179", "0.5598212", "0.5550156", "0.55280316", "0.54193044", "0.5368331", "0.53079444", "0.5147426", "0.5113014", "0.50867176", "0.5082762", "0.5045289", "0.5043123", "0.503894", "0.5021577", "0.49959806", "0.49874905", "0.4963999", "0.4960496", "0.4948922", "0.49304748", "0.49276984", "0.4902482", "0.4867722", "0.4852622", "0.48470291", "0.48218673" ]
0.6848883
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 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 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 show\n @ios_topbar = @user.ios_topbar\n\n if @ios_topbar == nil\n @ios_topbar = @user.build_ios_topbar\n render action: \"new\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ios_topbar }\n end\n end\n end", "def set_bar80\n @bar80 = Bar80.find(params[:id])\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 set_bar_item\n @bar_item = BarItem.find(params[:id])\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", "def update_info_bars\n @info_bars.each_value do |info_bars|\n info_bars.each(&:update)\n end\n end", "def update\n respond_to do |format|\n if @top_category.update(top_category_params)\n format.json { render :show, status: :ok, location: @top_category }\n else\n format.json { render json: @top_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_bar74\n @bar74 = Bar74.find(params[:id])\n end", "def set_top\n @top = Top.find(params[:id])\n end", "def set_topup\n @topup = Topup.find(params[:id])\n end", "def set_bar8\n @bar8 = Bar8.find(params[:id])\n end", "def update\n respond_to do |format|\n if @bar8.update(bar8_params)\n format.html { redirect_to @bar8, notice: \"Bar8 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar8 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar8.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_baristum\n @baristum = Baristum.find(params[:id])\n end", "def set_bar\n @bar = Bar.find(params[:id])\n end", "def set_bar\n @bar = Bar.find(params[:id])\n end", "def set_bar22\n @bar22 = Bar22.find(params[:id])\n end", "def update\n respond_to do |format|\n if @topi.update(topi_params)\n format.html { redirect_to @topi, notice: 'Topi was successfully updated.' }\n format.json { render :show, status: :ok, location: @topi }\n else\n format.html { render :edit }\n format.json { render json: @topi.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_bar68\n @bar68 = Bar68.find(params[:id])\n end", "def update\n respond_to do |format|\n if @bar52.update(bar52_params)\n format.html { redirect_to @bar52, notice: \"Bar52 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar52 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar52.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_bar76\n @bar76 = Bar76.find(params[:id])\n end", "def update\n respond_to do |format|\n if @bar74.update(bar74_params)\n format.html { redirect_to @bar74, notice: \"Bar74 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar74 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar74.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6147237", "0.58415157", "0.5777632", "0.5756605", "0.56879574", "0.56521755", "0.56232065", "0.5592485", "0.55634034", "0.5460779", "0.5442371", "0.54187995", "0.54149514", "0.53758353", "0.53338075", "0.53068495", "0.5272955", "0.5256504", "0.52412534", "0.5218861", "0.5205574", "0.51939166", "0.519283", "0.519283", "0.5165787", "0.51594996", "0.5157816", "0.5125528", "0.5124059", "0.51232475" ]
0.69610995
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 @bar71.destroy\n respond_to do |format|\n format.html { redirect_to bar71s_url, notice: \"Bar71 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @bar74.destroy\n respond_to do |format|\n format.html { redirect_to bar74s_url, notice: \"Bar74 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar68.destroy\n respond_to do |format|\n format.html { redirect_to bar68s_url, notice: \"Bar68 was successfully destroyed.\" }\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 @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_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 @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 @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", "def destroy\n @bar76.destroy\n respond_to do |format|\n format.html { redirect_to bar76s_url, notice: \"Bar76 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar64.destroy\n respond_to do |format|\n format.html { redirect_to bar64s_url, notice: \"Bar64 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar50.destroy\n respond_to do |format|\n format.html { redirect_to bar50s_url, notice: \"Bar50 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar81.destroy\n respond_to do |format|\n format.html { redirect_to bar81s_url, notice: \"Bar81 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar.destroy\n respond_to do |format|\n format.html { redirect_to bars_url, notice: 'Bar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar.destroy\n respond_to do |format|\n format.html { redirect_to bars_url, notice: 'Bar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar18.destroy\n respond_to do |format|\n format.html { redirect_to bar18s_url, notice: \"Bar18 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @top.destroy\n respond_to do |format|\n format.html { redirect_to tops_url, notice: 'Top was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar77.destroy\n respond_to do |format|\n format.html { redirect_to bar77s_url, notice: \"Bar77 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar84.destroy\n respond_to do |format|\n format.html { redirect_to bar84s_url, notice: \"Bar84 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @foobar = Foobar.find(params[:id])\n @foobar.destroy\n\n respond_to do |format|\n format.html { redirect_to foobars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar42.destroy\n respond_to do |format|\n format.html { redirect_to bar42s_url, notice: \"Bar42 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar90.destroy\n respond_to do |format|\n format.html { redirect_to bar90s_url, notice: \"Bar90 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar34.destroy\n respond_to do |format|\n format.html { redirect_to bar34s_url, notice: \"Bar34 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz72.destroy\n respond_to do |format|\n format.html { redirect_to baz72s_url, notice: \"Baz72 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar22.destroy\n respond_to do |format|\n format.html { redirect_to bar22s_url, notice: \"Bar22 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar82.destroy\n respond_to do |format|\n format.html { redirect_to bar82s_url, notice: \"Bar82 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end" ]
[ "0.67203504", "0.6693712", "0.66052395", "0.6596948", "0.65449905", "0.6540875", "0.65384316", "0.65342724", "0.65323496", "0.65127444", "0.6466629", "0.64347625", "0.64247054", "0.63976705", "0.6392009", "0.63696116", "0.63678545", "0.6366376", "0.6366376", "0.63474625", "0.6340433", "0.63356996", "0.6329676", "0.63067615", "0.6300478", "0.6290482", "0.6289858", "0.62735504", "0.6267643", "0.62642884" ]
0.7557382
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 && [email protected]? \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 check_for_modern_browser\n if browser.ie6? || browser.ie7?\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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 # 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\n end", "def test_on_legacy_browsers\n for legacy_browser in LEGACY_BROWSERS\n @request.user_agent = legacy_browser\n get :index\n assert_response :success\n assert_select 'div[style*=filter:progid:DXImageTransform.Microsoft.AlphaImageLoader]'\n assert_select 'div[style*=height:175px]'\n assert_select 'div[style*=width:120px]'\n end\n end", "def verify_user_owns_video\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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_user_can_access_channel\n unless user_can_access_channel\n if (params[:controller] == \"channels\" && params[:action] == \"show\")\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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 # 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 else\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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\n end\n end", "def verify_user_owns_page\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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_user_owns_channel\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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 verify_current_user_is_not_blocked\n unless current_user.blank? || current_user?(@user)\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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\n end", "def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end", "def decide_interested_video_type\n \n end", "def show\n @seo_video = true # let app header know this is an seo page\n # Consider errors and render seovideo page\n @auth_failure = params[:auth_failure] == '1'\n @auth_strategy = params[:auth_strategy]\n @access_error = params[:access] == \"nos\"\n @invite_error = params[:invite] == \"invalid\"\n\n @from_similar_video = params[:s]\n\n # route guarantees provider_name and provider_id will exist\n @video_provider_name = params.delete(:provider_name)\n @video_provider_id = params.delete(:provider_id)\n @is_mobile = is_mobile?\n @user_signed_in = user_signed_in?\n\n # set all other @video_ variables relevant to primary video\n getVideo(@video_provider_name, @video_provider_id)\n # if the primary video isn't available, means we can't really show a great page, rescue_from catches error\n\n # we'll return a page regardless of how successful the rest of these are\n getRecommendedVideos()\n getConversations()\n splitConversationMessagesByNetwork()\n setMetaDescription()\n\n # A/B tests\n #@seo_show_play_on_related = ab_test :seo_show_play_on_related\n #@seo_messaging_v2 = ab_test :seo_messaging_v2\n=begin\n # if the referrer is google search, parse the search query out of its url\n http_referer = request.env[\"HTTP_REFERER\"]\n if http_referer && http_referer.length > 0\n # the parser doesn't know it's an http url without the protocol, so ensure\n # that it starts with http://\n unless http_referer.start_with? 'http://'\n if http_referer.start_with? 'https://'\n http_referer.slice! 4\n else\n http_referer = 'http://' + http_referer\n end\n end\n\n begin\n referer_uri = Addressable::URI.parse(http_referer)\n rescue Exception => e\n #don't want to blow up on uri parsing errors, but log them so we have some way of tracking them\n Rails.logger.info \"SEO Page Parse Referer URI Failed (ignoring): #{e}\"\n return\n end\n\n if referer_host = referer_uri.host\n if referer_host.start_with?('http://google.') || referer_host.start_with?('google.') || referer_host.include?('.google.')\n if query_values = referer_uri.query_values\n # its a google url so grab the search query\n if @search_query = query_values[\"q\"]\n # check if the google url specified an encoding for the search query and if so decode it accordingly\n if search_query_encoding = query_values[\"ie\"]\n if encoding_obj = Encoding.list.find {|enc| enc.name.casecmp(search_query_encoding) == 0 }\n # re-encode the search query as UTF-8, respecting the input encoding that was passed to google\n @search_query.encode!('utf-8', encoding_obj, :invalid => :replace, :undef => :replace, :replace => '?')\n end\n end\n end\n end\n end\n end\n end\n=end\n\n respond_to do |format|\n format.html { render }\n format.any { head :not_found }\n end\n\n end", "def w3c_tests # :nologin:\n render(layout: false)\n end", "def get_info()\n video_array=[]\n max_info_length = 0\n max_video_info_num = \"\"\n max_video_info = \"\"\n j=0\n\n def displayed?(locator)\n puts \"looking for #{locator}\"\n @driver.find_element(locator)\n puts \"#{locator} found\"\n true\n rescue Selenium::WebDriver::Error::NoSuchElementError\n puts \"#{locator} not found\"\n false\n end\n\n grid = @wait.until{@driver.find_element(:id,\"presentation_grid\")}\n # presentation_list = @driver.find_elements(:css, \".isotope > li\")\n presentation_list = @driver.find_elements(:css, \".presentation_wrap\")\n\n presentation_list_length = presentation_list.length\n\n presentation_list.each do |presentation|\n presentation_classes = presentation.attribute(\"class\")\n sep_presentation_classes = presentation_classes.gsub(\" \",\",\")\n video_array.push(sep_presentation_classes)\n end\n\n while j<video_array.length\n i=2\n cleaned_video_info=[]\n video_info = video_array[j].split(\",\") #video_info = [\"presentation_wrap\", \"p_1022\", \"k_139\", \"k_145\", \"g_70\", \"i_1176\", \"s_ok\", \"c_none\", \"l_grades_k_6\", \"l_grades_6_8\", \"l_grades_9_12\", \"a_researchers\", \"a_informal_educators\", \"p_imls\", \"isotope-item\"]\n cleaned_video_info[0]=video_info[1].gsub(\"p_\",\"\").to_i #[1022]\n while i<video_info.length\n if (video_info[i].include? \"l_\") || (video_info[i].include? \"s_\") || (video_info[i].include? \"a_\")\n cleaned_video_info.push((video_info[i][2..-1]))\n end\n i +=1\n end\n video_info_length = cleaned_video_info.length\n if video_info_length > max_info_length\n max_info_length = video_info_length\n max_video_info_num = cleaned_video_info[0]\n max_video_info = cleaned_video_info\n end\n write_to_file(cleaned_video_info)\n j +=1\n end\n puts \"Longest info video # #{max_video_info_num}. length of info #{max_info_length} info is #{max_video_info}\"\nend", "def test_browser_mode!\r\n @browser_mode = BrowserMode::Test\r\n end", "def test_006\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #A task type is changed into \"individual analysis\"\n # with a \"general control\" tab.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析 (Individual Analysis)\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n #An option setup of \"master: A qac\" subwindow is displayed.\n click $xpath[\"task\"][\"option_setup_link\"]\n # click \"link=設定する\"\n sleep 3\n # #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n sleep 2\n\n # logout\n logout\n\n end", "def test_home_bk_app\n @driver.navigate.to(@rootURL)\n verify_visible_image_in_css(:css, '.bkDelivers')\n just_verify {assert @driver.find_element(:css, 'section.bkDelivers h3.title').text.include?'APP'}\n just_verify {assert_not_nil @driver.find_element(:css, 'section.bkDelivers h4.subtitle').text}\n end", "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 set_video_based_on_user\n video_id = params[:video_id] || params[:id]\n\n begin\n if current_user?(@user)\n @video ||= @user.videos.where(:id => video_id).joins(:video_graph).where(:video_graphs => { :status => Video.statuses_to_show_to_current_user }).first\n else\n @video ||= @user.videos.where(:id => video_id).joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).first\n end\n rescue ActiveRecord::StatementInvalid\n @video = nil\n end\n \n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \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 w3c_tests\n render(layout: false)\n end", "def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.find_element(@@список_смартфонов) }\n rescue => e\n error('Eti mobilkies not nahodyatsya, smeni prices epta')\n end\n $driver.manage.timeouts.implicit_wait = 10\n end", "def test_playlist\n end", "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 TelevisionPage()\n \n \n begin\n \n #Chromedriver location\n Selenium::WebDriver::Chrome.driver_path = File.expand_path('C:\\\\TestProject\\\\ChromeDriver\\\\chromedriver.exe')\n \n #Open a Chrome browser\n driver = Watir::Browser.new :chrome\n \n #Navigate to the url\n driver.goto \"https://www.which.co.uk/reviews/televisions\"\n sleep 4\n #Maximize the Chrome window\n driver.window.maximize \n sleep 1\n #get page title\n oPageTitle=driver.title\n UtilsTestScript.TakeScreenshot(driver)\n #Check that the page title is Television reviews - Which?\n if(oPageTitle != \"Television reviews - Which?\") \n puts\"Title of the webpage is not 'Television reviews - Which?'. \" \n #Utility to take screenshot \n UtilsTestScript.TakeScreenshot(driver)\n return false\n end\n \n #Scenario 1\n #Check if the top level menu items are displayed as expected\n ############################################################\n \n #Expected Toplevel menu items \n array_toplevelmenu=[\"Technology\",\"Home & garden\",\"Money\",\"Baby & child\",\"Cars & travel\",\"Campaigns\",\"Services\",\"More from Which?\"]\n \n for i in 0 ... array_toplevelmenu.length\n #Xpath_ToplevelMenu returns all the elements in the top level menu.\n xpath_menuitems=TelevisionPageObjects.ReplaceString(TelevisionPageObjects::Xpath_ToplevelMenu,\"#{i+1}\")\n #Waits(for 5 seconds) until the object is returned\n isMenuItemPresent = Watir::Wait.until(5){driver.element(:xpath => xpath_menuitems)}\n if(isMenuItemPresent.present?)\n #Get the text of the menuitem\n menuItem=isMenuItemPresent.text\n puts \"#{menuItem}\"\n #compare the text retrived to the array\n if(array_toplevelmenu[i] != menuItem)\n puts\"Top level menu item '#{array_toplevelmenu[i]}' is not displayed in the web page.\"\n UtilsTestScript.TakeScreenshot(driver) \n end\n else\n puts\"Not able to get the reference of top level menu item #{array_toplevelmenu[i]}.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n end\n \n #Scenario 2\n #Check if 'TV & home entertainment' link is displayed in the page\n ############################################################ \n isLinkPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_TVHomeELink)}\n if !(isLinkPresent.present?) \n puts\"'TV & home entertainment' link is not displayed in the page\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n #Scenario 3\n #For the first product displayed in the page,make sure that Compare button is displayed.\n #Click on it and verify that the Compare popup shows up with the same product name.\n ############################################################ \n \n #Check if Compare button is present inside the first product description \n isButtonPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_CompareBtn)}\n if (isButtonPresent.present?) \n #Click on Compare button\n isButtonPresent.click\n UtilsTestScript.TakeScreenshot(driver)\n #Check if Compare popup is displayed\n isPopupPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_ComparePopup)}\n if(isPopupPresent)\n #Get the model name from the product tile\n isModel = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_model)} \n if(isModel)\n puts\"#{isModel.text}\"\n else\n puts\"Not able to get the reference of the first product model name in the product list.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n #Check the manufacturer name in the Compare popup \n checkPopupMf = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_modelMf)} \n if(checkPopupMf)\n getPopupMf=checkPopupMf.text\n puts\"#{getPopupMf}\"\n else\n puts\"Not able to get the reference of the product manufacturer name in the popup.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n #Check the model number in the Compare popup \n checkPopupModel = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_modelno)} \n if(checkPopupModel)\n getPopupModel=checkPopupModel.text\n puts\"#{getPopupModel}\"\n else\n puts\"Not able to get the reference of the product model name in the popup.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n #Check that product name matches in the Compare popup and the first product tile\n if(isModel.text != getPopupMf+\" \"+ getPopupModel)\n puts\"Product name in the first tile doesn't match with the one displyed in Compare popup .\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n end\n \n end\n \n #rescue block to display any Exception that may happen \n rescue Exception => e\n puts e\n ensure\n #Close the driver\n driver.quit\n end \n \nend", "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 test_lesson_access_rights\n $ie.text_field(:id, \"login\").set((users :watir_premium).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.text_field(:id, \"login\").set((users :registered).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"upgrade\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n end", "def iframes; end", "def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\n end", "def add_visibility_verifier; end" ]
[ "0.5891938", "0.5838972", "0.58306587", "0.5765835", "0.5723487", "0.5677557", "0.5674475", "0.56693363", "0.5656986", "0.5590565", "0.55620307", "0.5522716", "0.54958296", "0.54794925", "0.5467298", "0.5377037", "0.53142023", "0.53003246", "0.52932036", "0.52903837", "0.52758443", "0.5270961", "0.52659136", "0.52628744", "0.5248143", "0.52219766", "0.5211097", "0.5185081", "0.5169806", "0.5157864" ]
0.66605896
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.find_element(@@список_смартфонов) }\n rescue => e\n error('Eti mobilkies not nahodyatsya, smeni prices epta')\n end\n $driver.manage.timeouts.implicit_wait = 10\n end", "def videos_test\n end", "def test_on_legacy_browsers\n for legacy_browser in LEGACY_BROWSERS\n @request.user_agent = legacy_browser\n get :index\n assert_response :success\n assert_select 'div[style*=filter:progid:DXImageTransform.Microsoft.AlphaImageLoader]'\n assert_select 'div[style*=height:175px]'\n assert_select 'div[style*=width:120px]'\n end\n end", "def test_playlist\n end", "def w3c_tests # :nologin:\n render(layout: false)\n end", "def check_accessibility\n end", "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 test_006\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #A task type is changed into \"individual analysis\"\n # with a \"general control\" tab.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析 (Individual Analysis)\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n #An option setup of \"master: A qac\" subwindow is displayed.\n click $xpath[\"task\"][\"option_setup_link\"]\n # click \"link=設定する\"\n sleep 3\n # #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n sleep 2\n\n # logout\n logout\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 w3c_tests\n render(layout: false)\n end", "def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend", "def test_home_bk_app\n @driver.navigate.to(@rootURL)\n verify_visible_image_in_css(:css, '.bkDelivers')\n just_verify {assert @driver.find_element(:css, 'section.bkDelivers h3.title').text.include?'APP'}\n just_verify {assert_not_nil @driver.find_element(:css, 'section.bkDelivers h4.subtitle').text}\n end", "def test_browser_mode!\r\n @browser_mode = BrowserMode::Test\r\n end", "def test_lesson_access_rights\n $ie.text_field(:id, \"login\").set((users :watir_premium).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.text_field(:id, \"login\").set((users :registered).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"upgrade\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n end", "def test_10_filter_html\n\t\tprintTestHeader \"filter_html 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_html )\n\t\t}\n\t\tassert_instance_of BlueCloth, bc\n\n\t\t# Accessors\n\t\tassert_nothing_raised { rval = bc.filter_html }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_styles }\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 DangerousHtmlOutput, rval\n\n\t\t# Test setting it in a sub-array\n\t\tassert_nothing_raised {\n\t\t\tbc = BlueCloth::new( DangerousHtml, [:filter_html] )\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_html }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_styles }\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 DangerousHtmlOutput, rval\n\tend", "def test_0_before\n\t\t$report = Report.new()\n \t\t$testReport = $report.createReport($REPORT)\n\n\t\t$browser = Watir::Browser.new\n\t\t$current=\"\"\n\tend", "def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end", "def test_filters\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"pt-pt,pt;q=0.5\"\n good_ajax_request(:test)\n assert_nil(@controller.instance_variable_get(\"@user\"))\n assert_nil(User.current)\n assert_equal(:pt, I18n.locale)\n assert_equal(0, cookies.count)\n assert_equal({ \"locale\" => \"pt\" }, session.to_hash)\n session.delete(\"locale\")\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"pt-pt,xx-xx;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete(\"locale\")\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"pt-pt,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete(\"locale\")\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"en-xx,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"zh-*\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n end", "def test_018\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #Click a sub directory link\n click $xpath[\"task\"][\"master_option_file1\"]\n sleep 2\n #uncheck a file\n\n click $xpath[\"task\"][\"master_option_chk5\"]\n sleep 2\n\n #The state of other check boxes is not influenced.\n assert is_checked($xpath[\"task\"][\"master_option_chk6\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def test_filters\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"pt-pt,pt;q=0.5\"\n good_ajax_request(:test)\n assert_nil(@controller.instance_variable_get('@user'))\n assert_nil(User.current)\n assert_equal(:pt, I18n.locale)\n assert_equal(0, cookies.count)\n assert_equal({'locale'=>'pt'}, session)\n session.delete('locale')\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"pt-pt,xx-xx;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete('locale')\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"pt-pt,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete('locale')\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"en-xx,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"zh-*\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n end", "def test_allApplication_load\n @driver.get(@baseURL)\n #begin\n @Nexa_Util.loginAsNormalUser(@driver)\n # @wait.until { @driver.find_element(:id, 'leftNavigationContent') }\n\n # rescue Timeout::Error\n waitForPageFullyLoaded(40);\n @start = Time.now\n @driver.find_element(:link_text, 'All Applications').click\n # @wait.until { @driver.find_element(:class, 'resultTable') }\n waitForPageFullyLoaded(20);\n @stop = Time.now\n @sitePerformance.puts \"Page load time 'All Applications': #{@Nexa_Util.time_diff_milli(@start, @stop)}\"\n assert_operator 60000.00, :>, @Nexa_Util.time_diff_milli(@start, @stop)\n # end\n end", "def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\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 test_017\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #All file of directory is checked.\n\n assert is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\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 pbPlayDecisionSE()\n if $data_system && $data_system.respond_to?(\"decision_se\") &&\n $data_system.decision_se && $data_system.decision_se.name!=\"\"\n pbSEPlay($data_system.decision_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[1] && $data_system.sounds[1].name!=\"\"\n pbSEPlay($data_system.sounds[1])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel decision\")\n pbSEPlay(\"GUI sel decision\",80)\n end\nend", "def one_player_mode\nend", "def test_015\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n #uncheck an option setup\n click $xpath[\"task\"][\"master_option_chk1\"]\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Close window\n click window_id + \"_close\"\n\n sleep 3\n #Open popup set again\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #the information set remains\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end" ]
[ "0.56154615", "0.5464052", "0.54391384", "0.53845745", "0.5375689", "0.5348216", "0.5299415", "0.52725124", "0.5262615", "0.5251521", "0.5251047", "0.52241135", "0.51914674", "0.51686305", "0.51580733", "0.51398253", "0.5126495", "0.51260114", "0.51169014", "0.51077414", "0.50990385", "0.508858", "0.5075253", "0.5049441", "0.5035435", "0.5000893", "0.49992085", "0.49910367", "0.49904972", "0.4990161" ]
0.6196123
0